This commit is contained in:
Bjarne Koll 2024-09-29 16:33:11 +02:00
parent ae614202ba
commit 3badd78e42
No known key found for this signature in database
GPG key ID: 27F6CCCF55D2EE62
2 changed files with 8 additions and 20 deletions

View file

@ -26,10 +26,10 @@ index 4482e8f2c617c2f51b2b53762e775d118002363a..684c546479f0103c538b7af5d612fe53
public @NotNull String translationKey() { public @NotNull String translationKey() {
return "gamerule." + this.name; return "gamerule." + this.name;
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
index 05ecf3cb38ff42c8b52405d900197e6bf47dd1e6..a19adcde803b6ae8da223ac8451b3d0a8c21cc5e 100644 index 05ecf3cb38ff42c8b52405d900197e6bf47dd1e6..76b0d7e14708a1b04f63eb817b658549027c717d 100644
--- a/src/main/java/org/bukkit/RegionAccessor.java --- a/src/main/java/org/bukkit/RegionAccessor.java
+++ b/src/main/java/org/bukkit/RegionAccessor.java +++ b/src/main/java/org/bukkit/RegionAccessor.java
@@ -539,4 +539,27 @@ public interface RegionAccessor extends Keyed, io.papermc.paper.world.flag.Featu @@ -539,4 +539,25 @@ public interface RegionAccessor extends Keyed, io.papermc.paper.world.flag.Featu
*/ */
boolean hasCollisionsIn(@NotNull org.bukkit.util.BoundingBox boundingBox); boolean hasCollisionsIn(@NotNull org.bukkit.util.BoundingBox boundingBox);
// Paper end // Paper end
@ -41,7 +41,6 @@ index 05ecf3cb38ff42c8b52405d900197e6bf47dd1e6..a19adcde803b6ae8da223ac8451b3d0a
+ * @param rule the GameRule to check + * @param rule the GameRule to check
+ * @param <T> the GameRule's type + * @param <T> the GameRule's type
+ * @return the current value + * @return the current value
+ * @see GameRule#getValue(World)
+ */ + */
+ <T> @NotNull T getGameRuleValue(@NotNull GameRule<T> rule); + <T> @NotNull T getGameRuleValue(@NotNull GameRule<T> rule);
+ +
@ -52,7 +51,6 @@ index 05ecf3cb38ff42c8b52405d900197e6bf47dd1e6..a19adcde803b6ae8da223ac8451b3d0a
+ * @param newValue the new value + * @param newValue the new value
+ * @param <T> the value type of the GameRule + * @param <T> the value type of the GameRule
+ * @return true if the value was successfully set + * @return true if the value was successfully set
+ * @see GameRule#setValue(World, Object)
+ */ + */
+ <T> boolean setGameRule(@NotNull GameRule<T> rule, @NotNull T newValue); + <T> boolean setGameRule(@NotNull GameRule<T> rule, @NotNull T newValue);
+ // Paper end - add gamerule methods here + // Paper end - add gamerule methods here
@ -69,21 +67,19 @@ index 10c87b7c19ed3eab28fdce5f225df3767292ee0a..961174b4a87b797b8dceffbe9cb91d8c
+ <T> @NotNull T getGameRuleDefault(@NotNull GameRule<T> rule); // Paper - get default game rule value + <T> @NotNull T getGameRuleDefault(@NotNull GameRule<T> rule); // Paper - get default game rule value
} }
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index d8a23aa0d898ca3360757721e38ddb97387f7d21..4ffcba883ae71ce7b4079130a3d7c07da1a7cd60 100644 index adcd8161846b06fd1a7895750f98b629204a8406..5a5957b3200734c1c6a65035727f9ad63a1301c4 100644
--- a/src/main/java/org/bukkit/World.java --- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java
@@ -3509,8 +3509,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @@ -3526,7 +3526,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @param rule the GameRule to check
* @param <T> the GameRule's type * @param <T> the GameRule's type
* @return the current value * @return the current value
+ * @see GameRule#getValue(World)
*/ */
- @Nullable - @Nullable
+ @NotNull // Paper - make not null + @NotNull // Paper - make not null
public <T> T getGameRuleValue(@NotNull GameRule<T> rule); public <T> T getGameRuleValue(@NotNull GameRule<T> rule);
/** /**
@@ -3520,7 +3521,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @@ -3536,7 +3536,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @param rule the rule to return a default value for * @param rule the rule to return a default value for
* @param <T> the type of GameRule * @param <T> the type of GameRule
* @return the default value * @return the default value
@ -93,11 +89,3 @@ index d8a23aa0d898ca3360757721e38ddb97387f7d21..4ffcba883ae71ce7b4079130a3d7c07d
@Nullable @Nullable
public <T> T getGameRuleDefault(@NotNull GameRule<T> rule); public <T> T getGameRuleDefault(@NotNull GameRule<T> rule);
@@ -3531,6 +3534,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @param newValue the new value
* @param <T> the value type of the GameRule
* @return true if the value was successfully set
+ * @see GameRule#setValue(World, Object)
*/
public <T> boolean setGameRule(@NotNull GameRule<T> rule, @NotNull T newValue);

View file

@ -37,10 +37,10 @@ index c9ecec5da937bc5458f69736b68ff6ae50aa5ebc..b852ead129951eaeddd47c1e90b10f2a
+ // Paper end - move gamerule methods here + // Paper end - move gamerule methods here
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index cd3381d8225e0322b3e285b3c4aa0a1265a91cc0..c1bdaaec30cdca995580c3d7efde60f56f526d71 100644 index 38b046da5acac8633db8618a2957187d291f5e73..3df2a62c7adcb7f336d51c92203caf67575ab0d3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2046,11 +2046,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2048,11 +2048,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return CraftWorld.getGameRulesNMS().containsKey(rule); return CraftWorld.getGameRulesNMS().containsKey(rule);
} }
@ -53,7 +53,7 @@ index cd3381d8225e0322b3e285b3c4aa0a1265a91cc0..c1bdaaec30cdca995580c3d7efde60f5
@Override @Override
public <T> T getGameRuleDefault(GameRule<T> rule) { public <T> T getGameRuleDefault(GameRule<T> rule) {
@@ -2058,24 +2054,9 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2060,24 +2056,9 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return this.convert(rule, CraftWorld.getGameRuleDefinitions().get(rule.getName()).createRule()); return this.convert(rule, CraftWorld.getGameRuleDefinitions().get(rule.getName()).createRule());
} }