Updated Upstream (Bukkit/CraftBukkit) (#7776)

This commit is contained in:
Shane Freeder 2022-04-30 17:27:41 +01:00 committed by GitHub
parent 608482d512
commit 4166632333
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 144 additions and 132 deletions

View file

@ -5,23 +5,15 @@ Subject: [PATCH] Allow setting the vex's summoner
diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit/entity/Vex.java
index 6b61c4ab773c731fe5ae9577fd13e44707be9787..c34a3ea7b4d16817b4bee25d5c69787e22ec44d8 100644
index dc21f3ba648ab02a2b75ec429501143398c356f6..627e3c1a96ae3331f5aa2dd7803dd2a31c7204be 100644
--- a/src/main/java/org/bukkit/entity/Vex.java
+++ b/src/main/java/org/bukkit/entity/Vex.java
@@ -1,5 +1,7 @@
package org.bukkit.entity;
+import org.jetbrains.annotations.Nullable;
+
/**
* Represents a Vex.
*/
@@ -22,4 +24,21 @@ public interface Vex extends Monster {
* @param charging new state
@@ -73,4 +73,21 @@ public interface Vex extends Monster {
* @return true if the entity has limited life
*/
void setCharging(boolean charging);
+
boolean hasLimitedLife();
+ // Paper start
+
+ /**
+ * Get the Mob that summoned this vex
+ *

View file

@ -562,10 +562,41 @@ index 28cdb3b544572ba7aeb9061e3163e3895ac7d4e6..c8015ff610e3c1222cb368ea1d8a0c2f
+}
+// Paper end
diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit/entity/Vex.java
index c34a3ea7b4d16817b4bee25d5c69787e22ec44d8..6a39042f1ea18b4849c4b6d2343938e0f430aefb 100644
index 627e3c1a96ae3331f5aa2dd7803dd2a31c7204be..3c447d2300c866ae605eeca97bd869f400d6be6f 100644
--- a/src/main/java/org/bukkit/entity/Vex.java
+++ b/src/main/java/org/bukkit/entity/Vex.java
@@ -40,5 +40,37 @@ public interface Vex extends Monster {
@@ -57,21 +57,30 @@ public interface Vex extends Monster {
* Gets the remaining lifespan of this entity.
*
* @return life in ticks
+ * @deprecated This API duplicates existing API which uses the more
+ * preferable name due to mirroring internals better
*/
+ @Deprecated
int getLifeTicks();
/**
* Sets the remaining lifespan of this entity.
*
* @param lifeTicks life in ticks, or negative for unlimited lifepan
+ * @deprecated This API duplicates existing API which uses the more
+ * preferable name due to mirroring internals better
*/
+ @Deprecated
void setLifeTicks(int lifeTicks);
/**
* Gets if the entity has a limited life.
*
* @return true if the entity has limited life
+ * @deprecated This API duplicates existing API which uses the more
+ * preferable name due to mirroring internals better
*/
+ @Deprecated
boolean hasLimitedLife();
// Paper start
@@ -89,5 +98,37 @@ public interface Vex extends Monster {
* @param summoner New summoner
*/
void setSummoner(@Nullable Mob summoner);

View file

@ -22,30 +22,3 @@ index c71f8a7b96fc5abc499802a79fcb3b0771de021c..121dbbf163588690d0678ae73a6ab8ed
protected FileConfigurationOptions(@NotNull MemoryConfiguration configuration) {
super(configuration);
diff --git a/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java b/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java
index 20e968764725ddb324be28d81c50be57abd00e05..1514d3ec63a6c43fbdb4933ef75f9617ce1a1a4d 100644
--- a/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java
+++ b/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java
@@ -11,11 +11,22 @@ import org.yaml.snakeyaml.representer.Representer;
public class YamlRepresenter extends Representer {
public YamlRepresenter() {
+ this.multiRepresenters.put(org.bukkit.configuration.ConfigurationSection.class, new RepresentConfigurationSection()); // Paper - restore old yaml config section representer
this.multiRepresenters.put(ConfigurationSerializable.class, new RepresentConfigurationSerializable());
// SPIGOT-6234: We could just switch YamlConstructor to extend Constructor rather than SafeConstructor, however there is a very small risk of issues with plugins treating config as untrusted input
// So instead we will just allow future plugins to have their enums extend ConfigurationSerializable
this.multiRepresenters.remove(Enum.class);
}
+ // Paper start - restore old yaml config section representer
+ private class RepresentConfigurationSection extends RepresentMap {
+
+ @NotNull
+ @Override
+ public Node representData(@NotNull Object data) {
+ return super.representData(((org.bukkit.configuration.ConfigurationSection) data).getValues(false));
+ }
+ }
+ // Paper end
private class RepresentConfigurationSerializable extends RepresentMap {

View file

@ -19,10 +19,10 @@ index f9abe6991dadc7c652dcf6682bdb1b43240af438..9ba2e956be80952c146bac9a03bdb837
@NotNull
diff --git a/src/test/java/org/bukkit/configuration/file/YamlConfigurationTest.java b/src/test/java/org/bukkit/configuration/file/YamlConfigurationTest.java
index 3522baa0a234999114db69dea5743de2c8f059a0..cbdf7aa91e8399d3b936690b34a29bd6d0f2d518 100644
index 194949d74a3f1c69f7869a826ee3a011a6c26786..9f83d16341b4efd5c7150d2ab9abd579f373fa95 100644
--- a/src/test/java/org/bukkit/configuration/file/YamlConfigurationTest.java
+++ b/src/test/java/org/bukkit/configuration/file/YamlConfigurationTest.java
@@ -146,6 +146,7 @@ public class YamlConfigurationTest extends FileConfigurationTest {
@@ -152,6 +152,7 @@ public class YamlConfigurationTest extends FileConfigurationTest {
}
@Test