Fix setting game rules via the API

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-06-21 20:35:22 +10:00
parent a8155d2399
commit 3a28cb13b9
2 changed files with 70 additions and 2 deletions

View File

@@ -1904,7 +1904,9 @@ public class CraftWorld implements World {
if (!isGameRule(rule)) return false;
getHandle().getGameRules().get(getGameRulesNMS().get(rule)).b(null, value);
GameRules.GameRuleValue<?> handle = getHandle().getGameRules().get(getGameRulesNMS().get(rule));
handle.setValue(value);
handle.a(getHandle().getMinecraftServer());
return true;
}
@@ -1938,7 +1940,9 @@ public class CraftWorld implements World {
if (!isGameRule(rule.getName())) return false;
getHandle().getGameRules().get(getGameRulesNMS().get(rule.getName())).b(null, newValue.toString());
GameRules.GameRuleValue<?> handle = getHandle().getGameRules().get(getGameRulesNMS().get(rule.getName()));
handle.setValue(newValue.toString());
handle.a(getHandle().getMinecraftServer());
return true;
}