mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
fix(Room): pets CME
This commit is contained in:
parent
c83f7cd364
commit
31c7ff7b6d
@ -1992,11 +1992,24 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
* @param excludeUserId Habbo id to keep pets
|
* @param excludeUserId Habbo id to keep pets
|
||||||
*/
|
*/
|
||||||
public void removeAllPets(int excludeUserId) {
|
public void removeAllPets(int excludeUserId) {
|
||||||
|
ArrayList<Pet> toRemovePets = new ArrayList<>();
|
||||||
ArrayList<Pet> removedPets = new ArrayList<>();
|
ArrayList<Pet> removedPets = new ArrayList<>();
|
||||||
synchronized (this.currentPets) {
|
synchronized (this.currentPets) {
|
||||||
for (Pet pet : this.currentPets.valueCollection()) {
|
for (Pet pet : this.currentPets.valueCollection()) {
|
||||||
try {
|
try {
|
||||||
if (pet.getUserId() != excludeUserId) {
|
if (pet.getUserId() != excludeUserId) {
|
||||||
|
toRemovePets.add(pet);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (NoSuchElementException e) {
|
||||||
|
Emulator.getLogging().logErrorLine(e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Pet pet : toRemovePets) {
|
||||||
|
removedPets.add(pet);
|
||||||
|
|
||||||
pet.removeFromRoom();
|
pet.removeFromRoom();
|
||||||
|
|
||||||
@ -2005,15 +2018,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
habbo.getInventory().getPetsComponent().addPet(pet);
|
habbo.getInventory().getPetsComponent().addPet(pet);
|
||||||
habbo.getClient().sendResponse(new AddPetComposer(pet));
|
habbo.getClient().sendResponse(new AddPetComposer(pet));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pet.needsUpdate = true;
|
pet.needsUpdate = true;
|
||||||
pet.run();
|
pet.run();
|
||||||
} catch (NoSuchElementException e) {
|
|
||||||
Emulator.getLogging().logErrorLine(e);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Pet pet : removedPets) {
|
for (Pet pet : removedPets) {
|
||||||
|
Loading…
Reference in New Issue
Block a user