Java 类org.bukkit.entity.AbstractHorse 实例源码

项目:StableMaster    文件:Give.java   
public void handleInteract(Stable stable, Player player, Tameable animal) {
    OfflinePlayer newOwner = giveQueue.get(player);
    removeFromQueue(player);

    if (animal instanceof AbstractHorse) {
        AbstractHorse horse = (AbstractHorse) animal;
        Stable newStable = StableMaster.getStable(newOwner);
        stable.removeHorse(horse);
        newStable.addHorse(horse);
    }

    animal.setOwner(newOwner);
    new LangString("command.give.given", getAnimal(((Animals) animal).getType()), newOwner.getName()).send(player);
}
项目:StableMaster    文件:AddRider.java   
public void handleInteract(Stable stable, Player player, Tameable animal) {
    final AbstractHorse horse = (AbstractHorse) animal;
    StabledHorse stabledHorse = stable.getHorse(horse);
    OfflinePlayer rider = addRiderQueue.get(player);
    removeFromQueue(player);

    if (stabledHorse.isRider(rider)) {
        new LangString("command.addrider.is-rider", rider.getName()).send(player);
    }
    else {
        stabledHorse.addRider(rider);
        new LangString("command.addrider.added", rider.getName(), getAnimal(horse.getType())).send(player);
    }
}
项目:StableMaster    文件:DelRider.java   
public void handleInteract(Stable stable, Player player, Tameable animal) {
    final AbstractHorse horse = (AbstractHorse) animal;
    StabledHorse stabledHorse = stable.getHorse(horse);
    OfflinePlayer rider = delRiderQueue.get(player);
    removeFromQueue(player);

    if (!stabledHorse.isRider(rider)) {
        new LangString("command.delrider.not-rider", rider.getName()).send(player);
    }
    else {
        stabledHorse.delRider(rider);
        new LangString("command.delrider.removed", rider.getName(), getAnimal(horse.getType())).send(player);
    }
}
项目:SonarPet    文件:NMSEntityHorseImpl.java   
@Override
public AbstractHorse getBukkitEntity() {
    return (AbstractHorse) super.getBukkitEntity();
}
项目:SonarPet    文件:NMSEntityHorseImpl.java   
@Override
public AbstractHorse getBukkitEntity() {
    return (AbstractHorse) super.getBukkitEntity();
}
项目:SimpleEgg    文件:LorePacker.java   
/**
 * Assembles an ArrayList of the properties for the specified Entity that
 * is to be used for a spawn egg. All instanceof checks are done internally
 * by the LorePackager, so no type checking is required prior to calling
 * this method. Null Entities will throw an IllegalArgumentException. <b>The
 * actual ArrayList is returned by {@link #getLore() LorePacker.getLore()}.
 * </b>
 * @param livingEntity - The Entity to assemble a lore for.
 * @return An ArrayList of Strings
 * @throws IllegalArgumentException If entity parameter is null
 */
public LorePacker(LivingEntity livingEntity) throws IllegalArgumentException {
    if (livingEntity == null) {
        throw new IllegalArgumentException("Can't assemble lore for a null entity!");
    }

    lore = new ArrayList<String>();
    // This needs to always be on top of an egg's lore
    lore.add("Identifier: SimpleEgg." + livingEntity.getType().getEntityClass().getSimpleName() + "." + Main.getSelf().getDescription().getVersion());
    lore.addAll(livingEntity(livingEntity));

    if (livingEntity instanceof Ageable) {
        lore.addAll(ageable((Ageable) livingEntity));

        if (livingEntity instanceof Sheep) {
            lore.addAll(sheep((Sheep) livingEntity));
        } else if (livingEntity instanceof Pig) {
            lore.addAll(pig((Pig) livingEntity));
        } else if (livingEntity instanceof Rabbit) {
            lore.addAll(rabbit((Rabbit) livingEntity));
        } else if (livingEntity instanceof Villager) {
            lore.addAll(villager((Villager) livingEntity));
        } else if (livingEntity instanceof Tameable) {
            lore.addAll(tameable((Tameable) livingEntity));

            if (livingEntity instanceof AbstractHorse) {
                lore.addAll(abstractHorse((AbstractHorse) livingEntity));

                if (livingEntity instanceof Horse) {
                    lore.addAll(horse((Horse) livingEntity));
                } else if (livingEntity instanceof ChestedHorse) {
                    lore.addAll(chestedHorse((ChestedHorse) livingEntity));

                    if (livingEntity instanceof Llama) {
                        lore.addAll(llama((Llama) livingEntity));
                    }
                }
            } else if (livingEntity instanceof Sittable) {
                lore.addAll(sittable((Sittable) livingEntity));

                if (livingEntity instanceof Wolf) {
                    lore.addAll(wolf((Wolf) livingEntity));
                } else if (livingEntity instanceof Ocelot) {
                    lore.addAll(ocelot((Ocelot) livingEntity));
                } else if (livingEntity instanceof Parrot) {
                    lore.addAll(parrot((Parrot) livingEntity));
                }
            }
        }
    } else if (livingEntity instanceof Slime) {
        lore.addAll(slime((Slime) livingEntity));
    } else if (livingEntity instanceof Creeper) {
        lore.addAll(creeper((Creeper) livingEntity));
    } else if (livingEntity instanceof Zombie) {
        lore.addAll(zombie((Zombie) livingEntity));

        if (livingEntity instanceof PigZombie) {
            lore.addAll(pigZombie((PigZombie) livingEntity));
        } else if (livingEntity instanceof ZombieVillager) {
            lore.addAll(zombieVillager((ZombieVillager) livingEntity));
        }
    } else if (livingEntity instanceof Spellcaster) {
        lore.addAll(spellCaster((Spellcaster) livingEntity));
    } else if (livingEntity instanceof IronGolem) {
        lore.addAll(ironGolem((IronGolem) livingEntity));
    } else if (livingEntity instanceof Snowman) {
        lore.addAll(snowman((Snowman) livingEntity));
    }
}
项目:StableMaster    文件:StabledHorse.java   
public StabledHorse(AbstractHorse h) {
    uniqueID = h.getUniqueId().toString();
    riders = new ArrayList<>();
}
项目:StableMaster    文件:Stable.java   
public void addHorse(AbstractHorse horse) {
    horses.put(horse.getUniqueId().toString(), new StabledHorse(horse));
}
项目:StableMaster    文件:Stable.java   
public void removeHorse(AbstractHorse horse) {
    horses.remove(horse.getUniqueId().toString());
}
项目:StableMaster    文件:Stable.java   
public boolean hasHorse(AbstractHorse horse) {
    return horses.containsKey(horse.getUniqueId().toString());
}
项目:StableMaster    文件:Stable.java   
public StabledHorse getHorse(AbstractHorse horse) {
    return horses.get(horse.getUniqueId().toString());
}