diff options
author | feildmaster <admin@feildmaster.com> | 2012-10-30 21:24:48 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-10-31 03:40:43 -0400 |
commit | 9e4e2c62af6b6d12cc6a15cbf117d0a7586372c6 (patch) | |
tree | 568f95e09fd51a84bcc314962209d58e2682c163 /src/main/java/org/bukkit | |
parent | 59dc403a61e4aec5f127fbbc7e1a5a66970f97f1 (diff) | |
download | craftbukkit-9e4e2c62af6b6d12cc6a15cbf117d0a7586372c6.tar craftbukkit-9e4e2c62af6b6d12cc6a15cbf117d0a7586372c6.tar.gz craftbukkit-9e4e2c62af6b6d12cc6a15cbf117d0a7586372c6.tar.lz craftbukkit-9e4e2c62af6b6d12cc6a15cbf117d0a7586372c6.tar.xz craftbukkit-9e4e2c62af6b6d12cc6a15cbf117d0a7586372c6.zip |
Expose API for managing and using GameRules. Adds BUKKIT-2757
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 2ca3078d..5855b549 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1197,4 +1197,26 @@ public class CraftWorld implements World { getHandle().makeSound(x, y, z, CraftSound.getSound(sound), volume, pitch); } + + public String getGameRuleValue(String rule) { + return getHandle().getGameRules().get(rule); + } + + public boolean setGameRuleValue(String rule, String value) { + // No null values allowed + if (rule == null || value == null) return false; + + if (!isGameRule(rule)) return false; + + getHandle().getGameRules().set(rule, value); + return true; + } + + public String[] getGameRules() { + return getHandle().getGameRules().b(); + } + + public boolean isGameRule(String rule) { + return getHandle().getGameRules().e(rule); + } } |