mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-01 00:10:40 +01:00
Added null checking for world when changing worlds
https://github.com/BentoBoxWorld/BentoBox/issues/1336
This commit is contained in:
parent
304867c1f8
commit
4a3c9ad8ae
@ -130,8 +130,11 @@ public class JoinLeaveListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerSwitchWorld(final PlayerChangedWorldEvent event) {
|
||||
World world = Util.getWorld(event.getPlayer().getWorld());
|
||||
// Clear inventory if required
|
||||
clearPlayersInventory(Util.getWorld(event.getPlayer().getWorld()), User.getInstance(event.getPlayer()));
|
||||
if (world != null) {
|
||||
clearPlayersInventory(world, User.getInstance(event.getPlayer()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user