Fix more issues.

This commit is contained in:
Mike 2020-05-10 00:02:46 +02:00
parent 4c140d9402
commit 463fb82654
5 changed files with 62 additions and 35 deletions

View File

@ -35,6 +35,9 @@ public class EventCommand extends Command {
ServerMessage msg = new BubbleAlertComposer("hotel.event", codes).compose(); ServerMessage msg = new BubbleAlertComposer("hotel.event", codes).compose();
msg.retain();
try {
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
Habbo habbo = set.getValue(); Habbo habbo = set.getValue();
if (habbo.getHabboStats().blockStaffAlerts) if (habbo.getHabboStats().blockStaffAlerts)
@ -42,6 +45,9 @@ public class EventCommand extends Command {
habbo.getClient().sendResponse(msg); habbo.getClient().sendResponse(msg);
} }
} finally {
msg.release();
}
return true; return true;
} }

View File

@ -32,7 +32,8 @@ public class MassBadgeCommand extends Command {
keys.put("image", "${image.library.url}album1584/" + badge + ".gif"); keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received")); keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
ServerMessage message = new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose(); ServerMessage message = new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose();
message.retain();
try {
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
Habbo habbo = set.getValue(); Habbo habbo = set.getValue();
@ -48,6 +49,9 @@ public class MassBadgeCommand extends Command {
} }
} }
} }
} finally {
message.release();
}
} }
return true; return true;
} }

View File

@ -60,6 +60,9 @@ public class MassGiftCommand extends Command {
ServerMessage giftNotificiationMessage = new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose(); ServerMessage giftNotificiationMessage = new BubbleAlertComposer(BubbleAlertKeys.RECEIVED_BADGE.key, keys).compose();
Emulator.getThreading().run(() -> { Emulator.getThreading().run(() -> {
giftNotificiationMessage.retain();
try {
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
Habbo habbo = set.getValue(); Habbo habbo = set.getValue();
@ -75,6 +78,9 @@ public class MassGiftCommand extends Command {
habbo.getClient().sendResponse(new InventoryRefreshComposer()); habbo.getClient().sendResponse(new InventoryRefreshComposer());
habbo.getClient().sendResponse(giftNotificiationMessage); habbo.getClient().sendResponse(giftNotificiationMessage);
} }
} finally {
giftNotificiationMessage.release();
}
}); });

View File

@ -43,6 +43,8 @@ public class ImageHotelAlert extends RCONMessage<ImageHotelAlert.JSON> {
} }
ServerMessage message = new BubbleAlertComposer(json.bubble_key, keys).compose(); ServerMessage message = new BubbleAlertComposer(json.bubble_key, keys).compose();
message.retain();
try {
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) { for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
Habbo habbo = set.getValue(); Habbo habbo = set.getValue();
if (habbo.getHabboStats().blockStaffAlerts) if (habbo.getHabboStats().blockStaffAlerts)
@ -50,6 +52,9 @@ public class ImageHotelAlert extends RCONMessage<ImageHotelAlert.JSON> {
habbo.getClient().sendResponse(message); habbo.getClient().sendResponse(message);
} }
} finally {
message.release();
}
} }
static class JSON { static class JSON {

View File

@ -33,11 +33,14 @@ public class CannonKickAction implements Runnable {
dater.put("title", "${notification.room.kick.cannonball.title}"); dater.put("title", "${notification.room.kick.cannonball.title}");
dater.put("message", "${notification.room.kick.cannonball.message}"); dater.put("message", "${notification.room.kick.cannonball.message}");
ServerMessage message = new BubbleAlertComposer("cannon.png", dater).compose();
int rotation = this.cannon.getRotation(); int rotation = this.cannon.getRotation();
List<RoomTile> tiles = this.room.getLayout().getTilesInFront(this.room.getLayout().getTile(this.cannon.getX(), this.cannon.getY()), rotation + 6, 3); List<RoomTile> tiles = this.room.getLayout().getTilesInFront(this.room.getLayout().getTile(this.cannon.getX(), this.cannon.getY()), rotation + 6, 3);
ServerMessage message = new BubbleAlertComposer("cannon.png", dater).compose();
message.retain();
try {
for (RoomTile t : tiles) { for (RoomTile t : tiles) {
for (Habbo habbo : this.room.getHabbosAt(t.x, t.y)) { for (Habbo habbo : this.room.getHabbosAt(t.x, t.y)) {
if (!habbo.hasPermission(Permission.ACC_UNKICKABLE) && !this.room.isOwner(habbo)) { if (!habbo.hasPermission(Permission.ACC_UNKICKABLE) && !this.room.isOwner(habbo)) {
@ -46,5 +49,8 @@ public class CannonKickAction implements Runnable {
} }
} }
} }
} finally {
message.release();
}
} }
} }