Make VehicleEnterEvent check horse-type agnostic

This commit is contained in:
fullwall 2016-11-17 17:18:51 +08:00
parent ef0bc3d4e7
commit fc43e6aa12

View File

@ -12,6 +12,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -503,7 +504,7 @@ public class EventListen implements Listener {
if (!npcRegistry.isNPC(event.getEntered()))
return;
NPC npc = npcRegistry.getNPC(event.getEntered());
if ((npc.getEntity().getType() == EntityType.HORSE || npc.getEntity().getType() == EntityType.BOAT
if ((npc.getEntity() instanceof Horse || npc.getEntity().getType() == EntityType.BOAT
|| npc.getEntity() instanceof Minecart) && !npc.getTrait(Controllable.class).isEnabled()) {
event.setCancelled(true);
}