mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-27 04:55:25 +01:00
Prevent mounted players from unmounting.
This commit is contained in:
parent
021b43179f
commit
2d4b6f20f2
@ -1,7 +1,7 @@
|
||||
name: MobArena
|
||||
author: garbagemule
|
||||
main: com.garbagemule.MobArena.MobArena
|
||||
version: 0.96.4.4
|
||||
version: 0.96.4.5
|
||||
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
|
||||
commands:
|
||||
ma:
|
||||
|
@ -51,6 +51,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
@ -1176,4 +1177,19 @@ public class ArenaListener
|
||||
|
||||
arena.playerLeave(p);
|
||||
}
|
||||
|
||||
public void onVehicleExit(VehicleExitEvent event) {
|
||||
LivingEntity entity = event.getExited();
|
||||
if (!(entity instanceof Player)) return;
|
||||
|
||||
Player p = (Player) entity;
|
||||
if (!arena.inArena(p)) return;
|
||||
|
||||
Vehicle vehicle = event.getVehicle();
|
||||
if (!(vehicle instanceof Horse)) return;
|
||||
|
||||
if (monsters.hasMount(vehicle)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
|
||||
@ -310,6 +311,13 @@ public class MAGlobalListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void vehicleExit(VehicleExitEvent event) {
|
||||
for (Arena arena : am.getArenas()) {
|
||||
arena.getEventListener().onVehicleExit(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user