Fix NPE for invalid world argument in gamerule cmd

Stumbled upon an NPE when using /mv gamerule. I realised it was because I had specified a nonexistent world. This will fix it.
This commit is contained in:
A248 2020-04-16 18:31:23 -04:00 committed by GitHub
parent b4b0940918
commit 9d42a05759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -62,6 +62,11 @@ public class GameruleCommand extends MultiverseCommand {
world = p.getWorld();
} else {
world = Bukkit.getWorld(args.get(2));
if (world == null) {
sender.sendMessage(ChatColor.RED + "Failure!" + ChatColor.WHITE + " World " + ChatColor.AQUA + args.get(2)
+ ChatColor.WHITE + " does not exist.");
return;
}
}
if (world.setGameRuleValue(gameRule, value)) {