Revert "Added null checking for world when changing worlds"

This reverts commit 054934fded.
This commit is contained in:
tastybento 2020-05-02 18:55:59 -07:00
parent 054934fded
commit 1dc566922b

View File

@ -55,7 +55,7 @@ public class JoinLeaveListener implements Listener {
if (!players.isKnown(playerUUID)) { if (!players.isKnown(playerUUID)) {
firstTime(user); firstTime(user);
} }
// Make sure the player is loaded into the cache or create the player if they don't exist // Make sure the player is loaded into the cache or create the player if they don't exist
players.addPlayer(playerUUID); players.addPlayer(playerUUID);
@ -121,7 +121,7 @@ public class JoinLeaveListener implements Listener {
} }
} }
}); });
} }
/** /**
@ -130,11 +130,8 @@ public class JoinLeaveListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerSwitchWorld(final PlayerChangedWorldEvent event) { public void onPlayerSwitchWorld(final PlayerChangedWorldEvent event) {
World world = Util.getWorld(event.getPlayer().getWorld());
// Clear inventory if required // Clear inventory if required
if (world != null) { clearPlayersInventory(Util.getWorld(event.getPlayer().getWorld()), User.getInstance(event.getPlayer()));
clearPlayersInventory(world, User.getInstance(event.getPlayer()));
}
} }
@ -217,13 +214,13 @@ public class JoinLeaveListener implements Listener {
// Call Protection Range Change event. Does not support cancelling. // Call Protection Range Change event. Does not support cancelling.
IslandEvent.builder() IslandEvent.builder()
.island(island) .island(island)
.location(island.getCenter()) .location(island.getCenter())
.reason(IslandEvent.Reason.RANGE_CHANGE) .reason(IslandEvent.Reason.RANGE_CHANGE)
.involvedPlayer(user.getUniqueId()) .involvedPlayer(user.getUniqueId())
.admin(true) .admin(true)
.protectionRange(range, oldRange) .protectionRange(range, oldRange)
.build(); .build();
} }
} }
}); });