mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 01:39:52 +03:00
31 lines
1.4 KiB
Diff
31 lines
1.4 KiB
Diff
--- ../src-base/minecraft/net/minecraft/item/ItemLead.java
|
|
+++ ../src-work/minecraft/net/minecraft/item/ItemLead.java
|
|
@@ -12,6 +12,7 @@
|
|
import net.minecraft.util.math.AxisAlignedBB;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
+import org.bukkit.event.hanging.HangingPlaceEvent;
|
|
|
|
public class ItemLead extends Item
|
|
{
|
|
@@ -55,8 +56,19 @@
|
|
if (entityleashknot == null)
|
|
{
|
|
entityleashknot = EntityLeashKnot.createKnot(worldIn, fence);
|
|
+ HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityleashknot.getBukkitEntity(), player != null ? (org.bukkit.entity.Player) player.getBukkitEntity() : null, worldIn.getWorld().getBlockAt(i, j, k), org.bukkit.block.BlockFace.SELF);
|
|
+ worldIn.getServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ entityleashknot.setDead();
|
|
+ return false;
|
|
+ }
|
|
}
|
|
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerLeashEntityEvent(entityliving, entityleashknot, player).isCancelled()) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
entityliving.setLeashHolder(entityleashknot, true);
|
|
flag = true;
|
|
}
|