protected void updateLeashedState() { if (this.field_110170_bx != null) { this.recreateLeash(); } if (this.isLeashed) { if (this.leashedToEntity == null || this.leashedToEntity.isDead) { this.worldObj.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit this.clearLeashed(true, true); } } }
protected void cP() { if (this.bF != null) { this.cU(); } if (this.bD) { if (!this.isAlive()) { this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.PLAYER_UNLEASH)); // CraftBukkit this.unleash(true, true); } if (this.leashHolder == null || this.leashHolder.dead) { this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit this.unleash(true, true); } } }
protected void bL() { if (this.bx != null) { this.bP(); } if (this.bv) { if (this.bw == null || this.bw.dead) { this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit this.unleash(true, true); } } }
private void bP() { if (this.bv && this.bx != null) { if (this.bx.hasKeyOfType("UUIDMost", 4) && this.bx.hasKeyOfType("UUIDLeast", 4)) { UUID uuid = new UUID(this.bx.getLong("UUIDMost"), this.bx.getLong("UUIDLeast")); List list = this.world.a(EntityLiving.class, this.boundingBox.grow(10.0D, 10.0D, 10.0D)); Iterator iterator = list.iterator(); while (iterator.hasNext()) { EntityLiving entityliving = (EntityLiving) iterator.next(); if (entityliving.getUniqueID().equals(uuid)) { this.bw = entityliving; break; } } } else if (this.bx.hasKeyOfType("X", 99) && this.bx.hasKeyOfType("Y", 99) && this.bx.hasKeyOfType("Z", 99)) { int i = this.bx.getInt("X"); int j = this.bx.getInt("Y"); int k = this.bx.getInt("Z"); EntityLeash entityleash = EntityLeash.b(this.world, i, j, k); if (entityleash == null) { entityleash = EntityLeash.a(this.world, i, j, k); } this.bw = entityleash; } else { this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit this.unleash(false, true); } } this.bx = null; }
protected void bF() { if (this.bx != null) { this.bJ(); } if (this.bv) { if (this.bw == null || this.bw.dead) { this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit this.unleash(true, true); } } }
private void bJ() { if (this.bv && this.bx != null) { if (this.bx.hasKey("UUIDMost") && this.bx.hasKey("UUIDLeast")) { UUID uuid = new UUID(this.bx.getLong("UUIDMost"), this.bx.getLong("UUIDLeast")); List list = this.world.a(EntityLiving.class, this.boundingBox.grow(10.0D, 10.0D, 10.0D)); Iterator iterator = list.iterator(); while (iterator.hasNext()) { EntityLiving entityliving = (EntityLiving) iterator.next(); if (entityliving.getUniqueID().equals(uuid)) { this.bw = entityliving; break; } } } else if (this.bx.hasKey("X") && this.bx.hasKey("Y") && this.bx.hasKey("Z")) { int i = this.bx.getInt("X"); int j = this.bx.getInt("Y"); int k = this.bx.getInt("Z"); EntityLeash entityleash = EntityLeash.b(this.world, i, j, k); if (entityleash == null) { entityleash = EntityLeash.a(this.world, i, j, k); } this.bw = entityleash; } else { this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit this.unleash(false, true); } } this.bx = null; }
private void cU() { if (this.bD && this.bF != null) { if (this.bF.b("UUID")) { UUID uuid = this.bF.a("UUID"); List list = this.world.a(EntityLiving.class, this.getBoundingBox().g(10.0D)); Iterator iterator = list.iterator(); while (iterator.hasNext()) { EntityLiving entityliving = (EntityLiving) iterator.next(); if (entityliving.getUniqueID().equals(uuid)) { this.leashHolder = entityliving; break; } } } else if (this.bF.hasKeyOfType("X", 99) && this.bF.hasKeyOfType("Y", 99) && this.bF.hasKeyOfType("Z", 99)) { BlockPosition blockposition = new BlockPosition(this.bF.getInt("X"), this.bF.getInt("Y"), this.bF.getInt("Z")); EntityLeash entityleash = EntityLeash.b(this.world, blockposition); if (entityleash == null) { entityleash = EntityLeash.a(this.world, blockposition); } this.leashHolder = entityleash; } else { this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit this.unleash(false, true); } } this.bF = null; }
private void recreateLeash() { if (this.isLeashed && this.field_110170_bx != null) { if (this.field_110170_bx.hasKey("UUIDMost", 4) && this.field_110170_bx.hasKey("UUIDLeast", 4)) { UUID uuid = new UUID(this.field_110170_bx.getLong("UUIDMost"), this.field_110170_bx.getLong("UUIDLeast")); List list = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(10.0D, 10.0D, 10.0D)); Iterator iterator = list.iterator(); while (iterator.hasNext()) { EntityLivingBase entitylivingbase = (EntityLivingBase)iterator.next(); if (entitylivingbase.getUniqueID().equals(uuid)) { this.leashedToEntity = entitylivingbase; break; } } } else if (this.field_110170_bx.hasKey("X", 99) && this.field_110170_bx.hasKey("Y", 99) && this.field_110170_bx.hasKey("Z", 99)) { int i = this.field_110170_bx.getInteger("X"); int j = this.field_110170_bx.getInteger("Y"); int k = this.field_110170_bx.getInteger("Z"); EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForBlock(this.worldObj, i, j, k); if (entityleashknot == null) { entityleashknot = EntityLeashKnot.func_110129_a(this.worldObj, i, j, k); } this.leashedToEntity = entityleashknot; } else { this.worldObj.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit this.clearLeashed(false, true); } } this.field_110170_bx = null; }
public EntityUnleashEvent(Entity entity, EntityUnleashEvent.UnleashReason reason) { }
public EntityUnleashEvent.UnleashReason getReason() { return null; }
public PlayerUnleashEntityEvent(Entity entity, Player player) { super(entity, UnleashReason.PLAYER_UNLEASH); }