mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
Expose API for managing and using GameRules. Adds BUKKIT-2757
By: feildmaster <admin@feildmaster.com>
This commit is contained in:
parent
6ea108ec2e
commit
ef3acaeea9
1 changed files with 22 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue