Fix kickAllPlayers() NPE

This commit is contained in:
Daniel Saukel 2020-06-24 00:31:51 +02:00
parent fbb08ac232
commit 74f3829282

View File

@ -170,8 +170,10 @@ public abstract class DInstanceWorld implements InstanceWorld {
public void kickAllPlayers() { public void kickAllPlayers() {
getPlayers().forEach(p -> p.leave()); getPlayers().forEach(p -> p.leave());
// Players who shouldn't be in the dungeon but still are for some reason // Players who shouldn't be in the dungeon but still are for some reason
if (world != null) {
getWorld().getPlayers().forEach(p -> PlayerUtil.secureTeleport(p, Bukkit.getWorlds().get(0).getSpawnLocation())); getWorld().getPlayers().forEach(p -> PlayerUtil.secureTeleport(p, Bukkit.getWorlds().get(0).getSpawnLocation()));
} }
}
/** /**
* @param rules sets up the time and weather to match the rules * @param rules sets up the time and weather to match the rules