本文整理汇总了Java中org.bukkit.event.entity.EntityUnleashEvent类的典型用法代码示例。如果您正苦于以下问题:Java EntityUnleashEvent类的具体用法?Java EntityUnleashEvent怎么用?Java EntityUnleashEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityUnleashEvent类属于org.bukkit.event.entity包,在下文中一共展示了EntityUnleashEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateLeashedState
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
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);
}
}
}
示例2: cP
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
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);
}
}
}
示例3: init
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
if (!ScriptLoader.isCurrentEvent(EntityUnleashEvent.class)) {
Skript.error("You can not use UnleashHitch expression in any event but on entity unleash!");
return false;
}
setTime(1);
return true;
}
示例4: get
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
@Nullable
protected Entity[] get(Event e) {
try {
return new Entity[]{((LivingEntity) ((EntityUnleashEvent)e).getEntity()).getLeashHolder()};
} catch (IllegalStateException error) {}
return null;
}
示例5: init
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
if (!ScriptLoader.isCurrentEvent(EntityUnleashEvent.class)) {
Skript.error("You can not use UnleashReason expression in any event but on entity unleash!");
return false;
}
return true;
}
示例6: bL
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
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);
}
}
}
示例7: bP
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
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;
}
示例8: bF
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
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);
}
}
}
示例9: bJ
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
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;
}
示例10: cU
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
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;
}
示例11: getReturnType
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
public Class<? extends EntityUnleashEvent.UnleashReason> getReturnType() {
return EntityUnleashEvent.UnleashReason.class;
}
示例12: get
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
@Nullable
protected EntityUnleashEvent.UnleashReason[] get(Event e) {
return new EntityUnleashEvent.UnleashReason[]{((EntityUnleashEvent)e).getReason()};
}
示例13: bL
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
protected void bL() {
super.bL();
if (this.bN() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world) {
Entity entity = this.getLeashHolder();
this.a((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5);
float f = this.e(entity);
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
return;
}
if (!this.bt) {
this.goalSelector.a(2, this.bs);
this.getNavigation().a(false);
this.bt = true;
}
this.o(f);
if (f > 4.0F) {
this.getNavigation().a(entity, 1.0D);
}
if (f > 6.0F) {
double d0 = (entity.locX - this.locX) / (double) f;
double d1 = (entity.locY - this.locY) / (double) f;
double d2 = (entity.locZ - this.locZ) / (double) f;
this.motX += d0 * Math.abs(d0) * 0.4D;
this.motY += d1 * Math.abs(d1) * 0.4D;
this.motZ += d2 * Math.abs(d2) * 0.4D;
}
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
} else if (!this.bN() && this.bt) {
this.bt = false;
this.goalSelector.a(this.bs);
this.getNavigation().a(true);
this.bX();
}
}
示例14: bF
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
protected void bF() {
super.bF();
if (this.bH() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world) {
Entity entity = this.getLeashHolder();
this.b((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5);
float f = this.d(entity);
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
return;
}
if (!this.bt) {
this.goalSelector.a(2, this.bs);
this.getNavigation().a(false);
this.bt = true;
}
this.o(f);
if (f > 4.0F) {
this.getNavigation().a(entity, 1.0D);
}
if (f > 6.0F) {
double d0 = (entity.locX - this.locX) / (double) f;
double d1 = (entity.locY - this.locY) / (double) f;
double d2 = (entity.locZ - this.locZ) / (double) f;
this.motX += d0 * Math.abs(d0) * 0.4D;
this.motY += d1 * Math.abs(d1) * 0.4D;
this.motZ += d2 * Math.abs(d2) * 0.4D;
}
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
} else if (!this.bH() && this.bt) {
this.bt = false;
this.goalSelector.a(this.bs);
this.getNavigation().a(true);
this.bR();
}
}
示例15: recreateLeash
import org.bukkit.event.entity.EntityUnleashEvent; //导入依赖的package包/类
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;
}