Skip to content

Commit

Permalink
Make VehicleEnterEvent check horse-type agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Nov 17, 2016
1 parent ef0bc3d commit fc43e6a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main/src/main/java/net/citizensnpcs/EventListen.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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;
Expand Down Expand Up @@ -503,7 +504,7 @@ public void onVehicleEnter(VehicleEnterEvent event) {
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);
}
Expand Down

0 comments on commit fc43e6a

Please sign in to comment.