mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 02:55:45 +01:00
Fix vehicle enter prevention not working properly
This commit is contained in:
parent
1f540d2ad2
commit
30ef5de8e0
@ -501,12 +501,13 @@ public class EventListen implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onVehicleEnter(VehicleEnterEvent event) {
|
||||
if (!npcRegistry.isNPC(event.getEntered()))
|
||||
public void onVehicleEnter(final VehicleEnterEvent event) {
|
||||
if (!npcRegistry.isNPC(event.getVehicle()))
|
||||
return;
|
||||
NPC npc = npcRegistry.getNPC(event.getEntered());
|
||||
NPC npc = npcRegistry.getNPC(event.getVehicle());
|
||||
if ((npc.getEntity() instanceof AbstractHorse || npc.getEntity().getType() == EntityType.BOAT
|
||||
|| npc.getEntity() instanceof Minecart) && !npc.getTrait(Controllable.class).isEnabled()) {
|
||||
|| npc.getEntity().getType() == EntityType.PIG || npc.getEntity() instanceof Minecart)
|
||||
&& (!npc.hasTrait(Controllable.class) || !npc.getTrait(Controllable.class).isEnabled())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user