示例#1
0
 /**
  * Removes a {@link com.dsh105.echopet.api.pet.Pet} if the {@link org.bukkit.entity.Player} has
  * one active
  *
  * @param player the {@link org.bukkit.entity.Player} to remove their {@link
  *     com.dsh105.echopet.api.pet.Pet} from
  * @param sendMessage defines if the plugin sends a message to the target {@link
  *     org.bukkit.entity.Player}
  */
 public void removePet(Player player, boolean sendMessage, boolean save) {
   EchoPet.getManager().removePets(player, true);
   if (save) {
     if (hasPet(player)) {
       EchoPet.getManager().saveFileData("autosave", EchoPet.getManager().getPet(player));
       EchoPet.getSqlManager().saveToDatabase(EchoPet.getManager().getPet(player), false);
     }
   }
   if (sendMessage) {
     Lang.sendTo(player, Lang.REMOVE_PET.toString());
   }
 }
示例#2
0
 /**
  * Gives a {@link com.dsh105.echopet.api.pet.Pet} to the specified {@link Player}
  *
  * <p>Pets will be spawned immediately next to the target player, linked until it is removed.
  *
  * @param player the {@link org.bukkit.entity.Player} that will be provided with a {@link
  *     com.dsh105.echopet.api.pet.Pet}
  * @param petType the {@link com.dsh105.echopet.compat.api.entity.PetType} (type of {@link
  *     com.dsh105.echopet.api.pet.Pet}) that will be given to the player
  * @param sendMessage defines if the plugin sends a message to the target {@link Player}
  * @return the {@link com.dsh105.echopet.api.pet.Pet} created
  */
 public IPet givePet(Player player, PetType petType, boolean sendMessage) {
   if (player != null && petType != null) {
     IPet pet = EchoPet.getManager().createPet(player, petType, sendMessage);
     if (pet == null) {
       EchoPet.LOG.severe(
           "Failed to give "
               + petType.toString()
               + " to "
               + player.getName()
               + " through the EchoPetAPI. Maybe this PetType is disabled in the Config.yml?");
       return null;
     }
     if (sendMessage) {
       Lang.sendTo(
           player,
           Lang.CREATE_PET
               .toString()
               .replace("%type%", StringUtil.capitalise(petType.toString())));
     }
     return pet;
   }
   return null;
 }
示例#3
0
 /**
  * Opens the Pet Selector GUI Menu
  *
  * @param player {@link org.bukkit.entity.Player} to view the Menu
  * @param sendMessage defines if the plugin sends a message to the target {@link
  *     org.bukkit.entity.Player}
  */
 public void openPetSelector(Player player, boolean sendMessage) {
   SelectorLayout.getSelectorMenu().showTo(player);
   if (false) {
     Lang.sendTo(player, Lang.OPEN_SELECTOR.toString());
   }
 }