mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 13:36:16 +01:00
Fixed EntityTame event.
This commit is contained in:
parent
e2c9e92d98
commit
6f1d6a4ca8
@ -307,15 +307,12 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
if (this.random.nextInt(3) == 0) {
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
|
if (this.random.nextInt(3) == 0) {
|
||||||
EntityTameEvent event = CraftEventFactory.callEntityTameEvent(this, entityhuman);
|
EntityTameEvent event = CraftEventFactory.callEntityTameEvent(this, entityhuman);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.d(true);
|
this.d(true);
|
||||||
this.a((PathEntity) null);
|
this.a((PathEntity) null);
|
||||||
this.setSitting(true);
|
this.setSitting(true);
|
||||||
@ -328,6 +325,7 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
this.world.a(this, (byte) 6);
|
this.world.a(this, (byte) 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -421,6 +419,11 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void d(boolean flag) {
|
public void d(boolean flag) {
|
||||||
|
// CraftBukkit start
|
||||||
|
EntityTameEvent event = CraftEventFactory.callEntityTameEvent(this, null);
|
||||||
|
|
||||||
|
if (!event.isCancelled()) {
|
||||||
|
// CraftBukkit end
|
||||||
byte b0 = this.datawatcher.a(16);
|
byte b0 = this.datawatcher.a(16);
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@ -429,4 +432,5 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 & -5)));
|
this.datawatcher.b(16, Byte.valueOf((byte) (b0 & -5)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ public class CraftEventFactory {
|
|||||||
*/
|
*/
|
||||||
public static EntityTameEvent callEntityTameEvent(EntityLiving entity, EntityHuman tamer) {
|
public static EntityTameEvent callEntityTameEvent(EntityLiving entity, EntityHuman tamer) {
|
||||||
org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||||
org.bukkit.entity.AnimalTamer bukkitTamer = (AnimalTamer) tamer.getBukkitEntity();
|
org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? (AnimalTamer) tamer.getBukkitEntity() : null);
|
||||||
CraftServer craftServer = (CraftServer) bukkitEntity.getServer();
|
CraftServer craftServer = (CraftServer) bukkitEntity.getServer();
|
||||||
|
|
||||||
EntityTameEvent event = new EntityTameEvent(bukkitEntity, bukkitTamer);
|
EntityTameEvent event = new EntityTameEvent(bukkitEntity, bukkitTamer);
|
||||||
|
Loading…
Reference in New Issue
Block a user