public static InactiveMyPet setMyPetInactive(Player owner) { if (mActivePets.containsKey(MyPetPlayer.getMyPetPlayer(owner))) { MyPet activeMyPet = getMyPet(owner); MyPetSelectSetInactiveEvent event = new MyPetSelectSetInactiveEvent(activeMyPet); getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return null; } activeMyPet.removePet(); InactiveMyPet inactiveMyPet = getInactiveMyPet(activeMyPet); removeMyPet(activeMyPet); addInactiveMyPet(inactiveMyPet); MyPetUtil.getDebugLogger().info(" I: " + inactiveMyPet); MyPetUtil.getDebugLogger().info(" A: " + activeMyPet); return inactiveMyPet; } return null; }
public static MyPet setMyPetActive(InactiveMyPet inactiveMyPet) { if (hasMyPet(inactiveMyPet.getPetName())) { MyPet activeMyPet = getMyPet(inactiveMyPet.getPetOwner().getPlayer()); MyPetSelectSetInactiveEvent event = new MyPetSelectSetInactiveEvent(activeMyPet); getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return null; } setMyPetInactive(inactiveMyPet.getPetOwner().getPlayer()); } MyPetSelectSetActiveEvent event = new MyPetSelectSetActiveEvent(inactiveMyPet); getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return null; } MyPet activeMyPet = getMyPet(inactiveMyPet); addMyPet(activeMyPet); removeInactiveMyPet(inactiveMyPet); MyPetUtil.getDebugLogger().info(" A: " + activeMyPet); MyPetUtil.getDebugLogger().info(" I: " + inactiveMyPet); return activeMyPet; }