Merge branch '600-cme' into 'dev'

fix(Room): pets CME

See merge request morningstar/Arcturus-Community!142
This commit is contained in:
Harmonic 2020-05-08 05:22:00 -04:00
commit 7f987c7446

View File

@ -1992,11 +1992,24 @@ 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) {
toRemovePets.add(pet);
}
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
break;
}
}
}
for (Pet pet : toRemovePets) {
removedPets.add(pet);
pet.removeFromRoom();
@ -2005,15 +2018,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
habbo.getInventory().getPetsComponent().addPet(pet);
habbo.getClient().sendResponse(new AddPetComposer(pet));
}
}
pet.needsUpdate = true;
pet.run();
} catch (NoSuchElementException e) {
Emulator.getLogging().logErrorLine(e);
break;
}
}
}
for (Pet pet : removedPets) {