@Override public boolean comparePlayerWithEntity(MyPetPlayer player, Object obj) { EntityHuman entityHuman = (EntityHuman) obj; if (MyPetApi.getPlugin().isInOnlineMode()) { return player.getPlayerUUID().equals(entityHuman.getUniqueID()); } else { return entityHuman.getName().equals(player.getName()); } }
@Override public boolean onCommandOption(CommandSender sender, String[] args) { if (sender instanceof Player && MyPetApi.getPlayerManager().isMyPetPlayer((Player) sender)) { MyPetPlayer myPetPlayer = MyPetApi.getPlayerManager().getMyPetPlayer((Player) sender); myPetPlayer.setHealthBarActive(!myPetPlayer.isHealthBarActive()); sender.sendMessage(Translation.getString("Message.Command.Success", sender)); return true; } sender.sendMessage(Translation.getString("Message.Command.Fail", sender)); return true; }
public static String getString(String key, MyPetPlayer player) { if (player == null) { return key; } return getString(key, player.getLanguage()); }