Search in sources :

Example 1 with HopperMinecart

use of org.bukkit.entity.minecart.HopperMinecart in project Minigames by AddstarMC.

the class RecorderData method cartkMoveItem.

@EventHandler(ignoreCancelled = true)
private void cartkMoveItem(InventoryMoveItemEvent event) {
    if (!hasRegenArea() || !minigame.hasPlayers())
        return;
    Location loc = null;
    if (event.getInitiator().getHolder() instanceof HopperMinecart) {
        loc = ((HopperMinecart) event.getInitiator().getHolder()).getLocation().clone();
        if (blockInRegenArea(loc))
            addEntity((Entity) event.getInitiator().getHolder(), null, false);
    }
    loc = null;
    if (event.getDestination().getHolder() instanceof HopperMinecart) {
        loc = ((HopperMinecart) event.getDestination().getHolder()).getLocation().clone();
        if (blockInRegenArea(loc))
            addEntity((Entity) event.getInitiator().getHolder(), null, false);
    }
}
Also used : Entity(org.bukkit.entity.Entity) HopperMinecart(org.bukkit.entity.minecart.HopperMinecart) Location(org.bukkit.Location) EventHandler(org.bukkit.event.EventHandler)

Aggregations

Location (org.bukkit.Location)1 Entity (org.bukkit.entity.Entity)1 HopperMinecart (org.bukkit.entity.minecart.HopperMinecart)1 EventHandler (org.bukkit.event.EventHandler)1