mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 10:46:05 +03:00
72 lines
3.0 KiB
Diff
72 lines
3.0 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/EntityLeashKnot.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/EntityLeashKnot.java
|
|
@@ -1,12 +1,17 @@
|
|
package net.minecraft.entity;
|
|
|
|
import javax.annotation.Nullable;
|
|
+
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+
|
|
import net.minecraft.block.BlockFence;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
+import net.minecraft.entity.player.EntityPlayerMP;
|
|
import net.minecraft.init.Items;
|
|
import net.minecraft.init.SoundEvents;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
+import net.minecraft.network.play.server.SPacketEntityAttach;
|
|
import net.minecraft.util.EnumFacing;
|
|
import net.minecraft.util.EnumHand;
|
|
import net.minecraft.util.math.AxisAlignedBB;
|
|
@@ -106,6 +111,12 @@
|
|
{
|
|
if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == player)
|
|
{
|
|
+ // CraftBukkit start
|
|
+ if (CraftEventFactory.callPlayerLeashEntityEvent(entityliving, this, player).isCancelled()) {
|
|
+ ((EntityPlayerMP) player).connection.sendPacket(new SPacketEntityAttach(entityliving, entityliving.getLeashedToEntity()));
|
|
+ continue;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
entityliving.setLeashedToEntity(this, true);
|
|
flag = true;
|
|
}
|
|
@@ -114,9 +125,11 @@
|
|
|
|
if (!flag)
|
|
{
|
|
- this.setDead();
|
|
-
|
|
- if (player.capabilities.isCreativeMode)
|
|
+ // CraftBukkit start - Move below
|
|
+ //this.setDead();
|
|
+ boolean die = true;
|
|
+ // CraftBukkit end
|
|
+ if (true || player.capabilities.isCreativeMode) // CraftBukkit - Process for non-creative as well
|
|
{
|
|
double d1 = 7.0D;
|
|
|
|
@@ -124,9 +137,21 @@
|
|
{
|
|
if (entityliving1.getLeashed() && entityliving1.getLeashedToEntity() == this)
|
|
{
|
|
- entityliving1.clearLeashed(true, false);
|
|
+ // CraftBukkit start
|
|
+ //entityliving1.clearLeashed(true, false);
|
|
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityliving1, player).isCancelled()) {
|
|
+ die = false;
|
|
+ continue;
|
|
+ }
|
|
+ entityliving1.clearLeashed(true, !player.capabilities.isCreativeMode); // false -> survival mode boolean
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
+ // CraftBukkit start
|
|
+ if (die) {
|
|
+ this.setDead();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|