mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-17 21:11:26 +01:00
Catch random, unexplainable NPE in Inventory listeners when shutting
down
This commit is contained in:
parent
83789e27c0
commit
b10a02d424
@ -34,10 +34,14 @@ public class InventoryEventManager extends EventManagerImpl {
|
||||
@Override
|
||||
protected void handlePlayerTeleportEvent(final PlayerTeleportEvent event, final Priority priority) {
|
||||
|
||||
try {
|
||||
NoCheatPlayer player = plugin.getPlayer(event.getPlayer());
|
||||
if(InventoryCheck.getConfig(player.getConfigurationStore()).closebeforeteleports && event.getTo() != null && !(event.getTo().getWorld().equals(player.getPlayer().getWorld()))) {
|
||||
player.closeInventory();
|
||||
}
|
||||
} catch(NullPointerException e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,16 +65,18 @@ public class InventoryEventManager extends EventManagerImpl {
|
||||
}
|
||||
}
|
||||
|
||||
if(cancelled)
|
||||
if(cancelled) {
|
||||
event.setCancelled(true);
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getActiveChecks(ConfigurationCacheStore cc) {
|
||||
LinkedList<String> s = new LinkedList<String>();
|
||||
|
||||
/*CCInventory i = InventoryCheck.getConfig(cc);
|
||||
CCInventory i = InventoryCheck.getConfig(cc);
|
||||
if(i.check && i.dropCheck)
|
||||
s.add("inventory.dropCheck");*/
|
||||
s.add("inventory.dropCheck");
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user