Search in sources :

Example 1 with LeashFlag

use of de.Keyle.MyPet.api.entity.LeashFlag in project MyPet by xXKeyleXx.

the class CommandPetType method onCommand.

@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
    if (args.length < 1) {
        return false;
    }
    String lang = "en";
    if (commandSender instanceof Player) {
        lang = MyPetApi.getPlatformHelper().getPlayerLanguage((Player) commandSender);
    }
    try {
        MyPetType myPetType = MyPetType.byName(args[0]);
        String leashFlagString = "";
        for (LeashFlag leashFlag : MyPetApi.getMyPetInfo().getLeashFlags(myPetType)) {
            leashFlagString += leashFlag.name() + ", ";
        }
        leashFlagString = leashFlagString.substring(0, leashFlagString.lastIndexOf(","));
        commandSender.sendMessage(Translation.getString("Name.LeashFlag", lang) + ": " + leashFlagString);
        String foodString = "";
        for (ConfigItem material : MyPetApi.getMyPetInfo().getFood(myPetType)) {
            foodString += WordUtils.capitalizeFully(MyPetApi.getPlatformHelper().getMaterialName(material.getItem().getTypeId()).replace("_", " ")) + ", ";
        }
        foodString = foodString.substring(0, foodString.lastIndexOf(","));
        commandSender.sendMessage(Translation.getString("Name.Food", lang) + ": " + foodString);
        commandSender.sendMessage(Translation.getString("Name.HP", lang) + ": " + MyPetApi.getMyPetInfo().getStartHP(myPetType));
    } catch (MyPetTypeNotFoundException e) {
        commandSender.sendMessage(Translation.getString("Message.Command.PetType.Unknown", lang));
    }
    return true;
}
Also used : Player(org.bukkit.entity.Player) LeashFlag(de.Keyle.MyPet.api.entity.LeashFlag) MyPetType(de.Keyle.MyPet.api.entity.MyPetType) ConfigItem(de.Keyle.MyPet.api.util.ConfigItem) MyPetTypeNotFoundException(de.Keyle.MyPet.api.exceptions.MyPetTypeNotFoundException)

Aggregations

LeashFlag (de.Keyle.MyPet.api.entity.LeashFlag)1 MyPetType (de.Keyle.MyPet.api.entity.MyPetType)1 MyPetTypeNotFoundException (de.Keyle.MyPet.api.exceptions.MyPetTypeNotFoundException)1 ConfigItem (de.Keyle.MyPet.api.util.ConfigItem)1 Player (org.bukkit.entity.Player)1