Fix ArrayIndexOutOfBoundsException from null environment in BukkitPlayerCalculator

This commit is contained in:
Luck 2020-12-04 14:17:35 +00:00
parent 7d7d40b087
commit 5bfbf26e2f
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -82,7 +82,10 @@ public class BukkitPlayerCalculator implements ContextCalculator<Player>, Listen
World world = subject.getWorld();
if (world != null) {
consumer.accept(DefaultContextKeys.DIMENSION_TYPE_KEY, DIMENSION_TYPE_NAMER.name(world.getEnvironment()));
Environment environment = world.getEnvironment();
if (environment != null) {
consumer.accept(DefaultContextKeys.DIMENSION_TYPE_KEY, DIMENSION_TYPE_NAMER.name(environment));
}
this.plugin.getConfiguration().get(ConfigKeys.WORLD_REWRITES).rewriteAndSubmit(world.getName(), consumer);
}
}