mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 08:50:51 +01:00
Merge branch '600-cme' into 'dev'
fix(Room): pets CME See merge request morningstar/Arcturus-Community!142
This commit is contained in:
commit
7f987c7446
@ -1992,23 +1992,15 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
* @param excludeUserId Habbo id to keep pets
|
||||
*/
|
||||
public void removeAllPets(int excludeUserId) {
|
||||
ArrayList<Pet> toRemovePets = new ArrayList<>();
|
||||
ArrayList<Pet> removedPets = new ArrayList<>();
|
||||
synchronized (this.currentPets) {
|
||||
for (Pet pet : this.currentPets.valueCollection()) {
|
||||
try {
|
||||
if (pet.getUserId() != excludeUserId) {
|
||||
|
||||
pet.removeFromRoom();
|
||||
|
||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(pet.getUserId());
|
||||
if (habbo != null) {
|
||||
habbo.getInventory().getPetsComponent().addPet(pet);
|
||||
habbo.getClient().sendResponse(new AddPetComposer(pet));
|
||||
}
|
||||
toRemovePets.add(pet);
|
||||
}
|
||||
|
||||
pet.needsUpdate = true;
|
||||
pet.run();
|
||||
} catch (NoSuchElementException e) {
|
||||
Emulator.getLogging().logErrorLine(e);
|
||||
break;
|
||||
@ -2016,6 +2008,21 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
for (Pet pet : toRemovePets) {
|
||||
removedPets.add(pet);
|
||||
|
||||
pet.removeFromRoom();
|
||||
|
||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(pet.getUserId());
|
||||
if (habbo != null) {
|
||||
habbo.getInventory().getPetsComponent().addPet(pet);
|
||||
habbo.getClient().sendResponse(new AddPetComposer(pet));
|
||||
}
|
||||
|
||||
pet.needsUpdate = true;
|
||||
pet.run();
|
||||
}
|
||||
|
||||
for (Pet pet : removedPets) {
|
||||
this.currentPets.remove(pet.getId());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user