#1743 Stop mobs from targetting players when not authenticated
This commit is contained in:
@@ -56,7 +56,7 @@ public class EntityListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onEntityTarget(EntityTargetEvent event) {
|
||||
if (listenerService.shouldCancelEvent(event)) {
|
||||
if (listenerService.shouldCancelEvent(event.getTarget())) {
|
||||
event.setTarget(null);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@@ -52,11 +52,11 @@ class ListenerService implements SettingsDependent {
|
||||
* @return true if the associated event should be canceled, false otherwise
|
||||
*/
|
||||
public boolean shouldCancelEvent(Entity entity) {
|
||||
if (entity == null || !(entity instanceof Player)) {
|
||||
return false;
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
return shouldCancelEvent(player);
|
||||
}
|
||||
Player player = (Player) entity;
|
||||
return shouldCancelEvent(player);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user