类net.minecraft.util.org.apache.commons.lang3.StringUtils源码实例Demo

下面列出了怎么用net.minecraft.util.org.apache.commons.lang3.StringUtils的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: EntityAPI   文件: BehaviourGoalTarget.java
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) {
    if (entityliving == null) {
        return false;
    } else if (entityliving == this.getHandle()) {
        return false;
    } else if (!entityliving.isAlive()) {
        return false;
    } else if (!this.canAttackClass(entityliving.getClass())) {
        return false;
    } else {
        if (this.getHandle() instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.getHandle()).getOwnerName())) {
            if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.getHandle()).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) {
                return false;
            }

            if (entityliving == ((EntityOwnable) this.getHandle()).getOwner()) {
                return false;
            }
        } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
            return false;
        }

        if (!NMSEntityUtil.isInHomeArea(this.getHandle(), MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
            return false;
        } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.getHandle()).canSee(entityliving)) {
            return false;
        } else {
            if (this.useMelee) {
                if (--this.ticksAfterLastAttack <= 0) {
                    this.shouldAttack = 0;
                }

                if (this.shouldAttack == 0) {
                    this.shouldAttack = this.attack(entityliving) ? 1 : 2;
                }

                if (this.shouldAttack == 2) {
                    return false;
                }
            }

            // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET
            EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET;

            if (this instanceof BehaviourGoalDefendVillage) {
                reason = EntityTargetEvent.TargetReason.DEFEND_VILLAGE;
            } else if (this instanceof BehaviourGoalHurtByTarget) {
                reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY;
            } else if (this instanceof BehaviourGoalMoveTowardsNearestAttackableTarget) {
                if (entityliving instanceof EntityHuman) {
                    reason = EntityTargetEvent.TargetReason.CLOSEST_PLAYER;
                }
            } else if (this instanceof BehaviourGoalDefendTamer) {
                reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER;
            } else if (this instanceof BehaviourGoalHelpTamerTarget) {
                reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET;
            }

            org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callEntityTargetLivingEvent(this.getHandle(), entityliving, reason);
            if (event.isCancelled() || event.getTarget() == null) {
                this.getControllableEntity().setTarget(null);
                return false;
            } else if (entityliving.getBukkitEntity() != event.getTarget()) {
                this.getControllableEntity().setTarget(event.getTarget());
            }
            if (this.getHandle() instanceof EntityCreature) {
                ((EntityCreature) this.getHandle()).target = ((CraftEntity) event.getTarget()).getHandle();
            }
            // CraftBukkit end

            return true;
        }
    }
}
 
源代码2 项目: EntityAPI   文件: BehaviourGoalTarget.java
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) {
    if (entityliving == null) {
        return false;
    } else if (entityliving == this.getHandle()) {
        return false;
    } else if (!entityliving.isAlive()) {
        return false;
    } else if (!this.canAttackClass(entityliving.getClass())) {
        return false;
    } else {
        if (this.getHandle() instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.getHandle()).getOwnerName())) {
            if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.getHandle()).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) {
                return false;
            }

            if (entityliving == ((EntityOwnable) this.getHandle()).getOwner()) {
                return false;
            }
        } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
            return false;
        }

        if (!NMSEntityUtil.isInHomeArea(this.getHandle(), MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
            return false;
        } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.getHandle()).canSee(entityliving)) {
            return false;
        } else {
            if (this.useMelee) {
                if (--this.ticksAfterLastAttack <= 0) {
                    this.shouldAttack = 0;
                }

                if (this.shouldAttack == 0) {
                    this.shouldAttack = this.attack(entityliving) ? 1 : 2;
                }

                if (this.shouldAttack == 2) {
                    return false;
                }
            }

            // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET
            EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET;

            if (this instanceof BehaviourGoalDefendVillage) {
                reason = EntityTargetEvent.TargetReason.DEFEND_VILLAGE;
            } else if (this instanceof BehaviourGoalHurtByTarget) {
                reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY;
            } else if (this instanceof BehaviourGoalMoveTowardsNearestAttackableTarget) {
                if (entityliving instanceof EntityHuman) {
                    reason = EntityTargetEvent.TargetReason.CLOSEST_PLAYER;
                }
            } else if (this instanceof BehaviourGoalDefendTamer) {
                reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER;
            } else if (this instanceof BehaviourGoalHelpTamerTarget) {
                reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET;
            }

            org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callEntityTargetLivingEvent(this.getHandle(), entityliving, reason);
            if (event.isCancelled() || event.getTarget() == null) {
                this.getControllableEntity().setTarget(null);
                return false;
            } else if (entityliving.getBukkitEntity() != event.getTarget()) {
                this.getControllableEntity().setTarget(event.getTarget());
            }
            if (this.getHandle() instanceof EntityCreature) {
                ((EntityCreature) this.getHandle()).target = ((CraftEntity) event.getTarget()).getHandle();
            }
            // CraftBukkit end

            return true;
        }
    }
}
 
源代码3 项目: EntityAPI   文件: BehaviourGoalTarget.java
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) {
    if (entityliving == null) {
        return false;
    } else if (entityliving == this.getHandle()) {
        return false;
    } else if (!entityliving.isAlive()) {
        return false;
    } else if (!this.canAttackClass(entityliving.getClass())) {
        return false;
    } else {
        if (this.getHandle() instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.getHandle()).getOwnerName())) {
            if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.getHandle()).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) {
                return false;
            }

            if (entityliving == ((EntityOwnable) this.getHandle()).getOwner()) {
                return false;
            }
        } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
            return false;
        }

        if (!NMSEntityUtil.isInHomeArea(this.getHandle(), MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
            return false;
        } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.getHandle()).canSee(entityliving)) {
            return false;
        } else {
            if (this.useMelee) {
                if (--this.ticksAfterLastAttack <= 0) {
                    this.shouldAttack = 0;
                }

                if (this.shouldAttack == 0) {
                    this.shouldAttack = this.attack(entityliving) ? 1 : 2;
                }

                if (this.shouldAttack == 2) {
                    return false;
                }
            }

            // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET
            EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET;

            if (this instanceof BehaviourGoalDefendVillage) {
                reason = EntityTargetEvent.TargetReason.DEFEND_VILLAGE;
            } else if (this instanceof BehaviourGoalHurtByTarget) {
                reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY;
            } else if (this instanceof BehaviourGoalMoveTowardsNearestAttackableTarget) {
                if (entityliving instanceof EntityHuman) {
                    reason = EntityTargetEvent.TargetReason.CLOSEST_PLAYER;
                }
            } else if (this instanceof BehaviourGoalDefendTamer) {
                reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER;
            } else if (this instanceof BehaviourGoalHelpTamerTarget) {
                reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET;
            }

            org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callEntityTargetLivingEvent(this.getHandle(), entityliving, reason);
            if (event.isCancelled() || event.getTarget() == null) {
                this.getControllableEntity().setTarget(null);
                return false;
            } else if (entityliving.getBukkitEntity() != event.getTarget()) {
                this.getControllableEntity().setTarget(event.getTarget());
            }
            if (this.getHandle() instanceof EntityCreature) {
                ((EntityCreature) this.getHandle()).target = ((CraftEntity) event.getTarget()).getHandle();
            }
            // CraftBukkit end

            return true;
        }
    }
}
 
源代码4 项目: EntityAPI   文件: BehaviourGoalTarget.java
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) {
    if (entityliving == null) {
        return false;
    } else if (entityliving == this.getHandle()) {
        return false;
    } else if (!entityliving.isAlive()) {
        return false;
    } else if (!this.canAttackClass(entityliving.getClass())) {
        return false;
    } else {
        if (this.getHandle() instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.getHandle()).getOwnerName())) {
            if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.getHandle()).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) {
                return false;
            }

            if (entityliving == ((EntityOwnable) this.getHandle()).getOwner()) {
                return false;
            }
        } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
            return false;
        }

        if (!NMSEntityUtil.isInHomeArea(this.getHandle(), MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
            return false;
        } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.getHandle()).canSee(entityliving)) {
            return false;
        } else {
            if (this.useMelee) {
                if (--this.ticksAfterLastAttack <= 0) {
                    this.shouldAttack = 0;
                }

                if (this.shouldAttack == 0) {
                    this.shouldAttack = this.attack(entityliving) ? 1 : 2;
                }

                if (this.shouldAttack == 2) {
                    return false;
                }
            }

            // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET
            EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET;

            if (this instanceof BehaviourGoalDefendVillage) {
                reason = EntityTargetEvent.TargetReason.DEFEND_VILLAGE;
            } else if (this instanceof BehaviourGoalHurtByTarget) {
                reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY;
            } else if (this instanceof BehaviourGoalMoveTowardsNearestAttackableTarget) {
                if (entityliving instanceof EntityHuman) {
                    reason = EntityTargetEvent.TargetReason.CLOSEST_PLAYER;
                }
            } else if (this instanceof BehaviourGoalDefendTamer) {
                reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER;
            } else if (this instanceof BehaviourGoalHelpTamerTarget) {
                reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET;
            }

            org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callEntityTargetLivingEvent(this.getHandle(), entityliving, reason);
            if (event.isCancelled() || event.getTarget() == null) {
                this.getControllableEntity().setTarget(null);
                return false;
            } else if (entityliving.getBukkitEntity() != event.getTarget()) {
                this.getControllableEntity().setTarget(event.getTarget());
            }
            if (this.getHandle() instanceof EntityCreature) {
                ((EntityCreature) this.getHandle()).target = ((CraftEntity) event.getTarget()).getHandle();
            }
            // CraftBukkit end

            return true;
        }
    }
}
 
源代码5 项目: EchoPet   文件: PetGoalTarget.java
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) {
    if (entityliving == null) {
        return false;
    } else if (entityliving == this.handle) {
        return false;
    } else if (!entityliving.isAlive()) {
        return false;
    } else if (!this.canAttackClass(entityliving.getClass())) {
        return false;
    } else {
        if (this.handle instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.handle).getOwnerUUID())) {
            if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.handle).getOwnerUUID().equals(((EntityOwnable) entityliving).getOwnerUUID())) {
                return false;
            }

            if (entityliving == ((EntityOwnable) this.handle).getOwner()) {
                return false;
            }
        } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
            return false;
        }

        if (!NMSEntityUtil.isInGuardedAreaOf(this.handle, MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
            return false;
        } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.handle).canSee(entityliving)) {
            return false;
        } else {
            if (this.useMelee) {
                if (--this.ticksAfterLastAttack <= 0) {
                    this.shouldAttack = 0;
                }

                if (this.shouldAttack == 0) {
                    this.shouldAttack = this.attack(entityliving) ? 1 : 2;
                }

                if (this.shouldAttack == 2) {
                    return false;
                }
            }

            return true;
        }
    }
}
 
源代码6 项目: EchoPet   文件: PetGoalTarget.java
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) {
    if (entityliving == null) {
        return false;
    } else if (entityliving == this.handle) {
        return false;
    } else if (!entityliving.isAlive()) {
        return false;
    } else if (!this.canAttackClass(entityliving.getClass())) {
        return false;
    } else {
        if (this.handle instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.handle).getOwnerUUID())) {
            if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.handle).getOwnerUUID().equals(((EntityOwnable) entityliving).getOwnerUUID())) {
                return false;
            }

            if (entityliving == ((EntityOwnable) this.handle).getOwner()) {
                return false;
            }
        } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
            return false;
        }

        if (!NMSEntityUtil.isInGuardedAreaOf(this.handle, MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
            return false;
        } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.handle).canSee(entityliving)) {
            return false;
        } else {
            if (this.useMelee) {
                if (--this.ticksAfterLastAttack <= 0) {
                    this.shouldAttack = 0;
                }

                if (this.shouldAttack == 0) {
                    this.shouldAttack = this.attack(entityliving) ? 1 : 2;
                }

                if (this.shouldAttack == 2) {
                    return false;
                }
            }

            return true;
        }
    }
}
 
源代码7 项目: EchoPet   文件: PetGoalTarget.java
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) {
    if (entityliving == null) {
        return false;
    } else if (entityliving == this.handle) {
        return false;
    } else if (!entityliving.isAlive()) {
        return false;
    } else if (!this.canAttackClass(entityliving.getClass())) {
        return false;
    } else {
        if (this.handle instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.handle).getOwnerName())) {
            if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.handle).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) {
                return false;
            }

            if (entityliving == ((EntityOwnable) this.handle).getOwner()) {
                return false;
            }
        } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
            return false;
        }

        if (!NMSEntityUtil.isInGuardedAreaOf(this.handle, MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
            return false;
        } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.handle).canSee(entityliving)) {
            return false;
        } else {
            if (this.useMelee) {
                if (--this.ticksAfterLastAttack <= 0) {
                    this.shouldAttack = 0;
                }

                if (this.shouldAttack == 0) {
                    this.shouldAttack = this.attack(entityliving) ? 1 : 2;
                }

                if (this.shouldAttack == 2) {
                    return false;
                }
            }

            return true;
        }
    }
}
 
源代码8 项目: EchoPet   文件: PetGoalTarget.java
public boolean isSuitableTarget(EntityLiving entityliving, boolean flag) {
    if (entityliving == null) {
        return false;
    } else if (entityliving == this.handle) {
        return false;
    } else if (!entityliving.isAlive()) {
        return false;
    } else if (!this.canAttackClass(entityliving.getClass())) {
        return false;
    } else {
        if (this.handle instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.handle).getOwnerName())) {
            if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.handle).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) {
                return false;
            }

            if (entityliving == ((EntityOwnable) this.handle).getOwner()) {
                return false;
            }
        } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
            return false;
        }

        if (!NMSEntityUtil.isInGuardedAreaOf(this.handle, MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
            return false;
        } else if (this.checkSenses && !NMSEntityUtil.getEntitySenses(this.handle).canSee(entityliving)) {
            return false;
        } else {
            if (this.useMelee) {
                if (--this.ticksAfterLastAttack <= 0) {
                    this.shouldAttack = 0;
                }

                if (this.shouldAttack == 0) {
                    this.shouldAttack = this.attack(entityliving) ? 1 : 2;
                }

                if (this.shouldAttack == 2) {
                    return false;
                }
            }

            return true;
        }
    }
}
 
 类所在包
 类方法
 同包方法