mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Fix all last edge cases.
This commit is contained in:
parent
463fb82654
commit
46ff22f720
@ -24,15 +24,18 @@ public class HotelAlertCommand extends Command {
|
||||
}
|
||||
|
||||
ServerMessage msg = new StaffAlertWithLinkComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername(), "").compose();
|
||||
msg.retain();
|
||||
try {
|
||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
||||
Habbo habbo = set.getValue();
|
||||
if (habbo.getHabboStats().blockStaffAlerts)
|
||||
continue;
|
||||
|
||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
||||
Habbo habbo = set.getValue();
|
||||
if (habbo.getHabboStats().blockStaffAlerts)
|
||||
continue;
|
||||
|
||||
habbo.getClient().sendResponse(msg);
|
||||
habbo.getClient().sendResponse(msg);
|
||||
}
|
||||
} finally {
|
||||
msg.release();
|
||||
}
|
||||
|
||||
} else {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ha.forgot_message"), RoomChatMessageBubbles.ALERT);
|
||||
}
|
||||
|
@ -24,8 +24,13 @@ public class ReloadRoomCommand extends Command {
|
||||
Emulator.getGameEnvironment().getRoomManager().unloadRoom(room);
|
||||
room = Emulator.getGameEnvironment().getRoomManager().loadRoom(room.getId());
|
||||
ServerMessage message = new ForwardToRoomComposer(room.getId()).compose();
|
||||
for (Habbo habbo : habbos) {
|
||||
habbo.getClient().sendResponse(message);
|
||||
message.retain();
|
||||
try {
|
||||
for (Habbo habbo : habbos) {
|
||||
habbo.getClient().sendResponse(message);
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
|
@ -134,32 +134,47 @@ public class GameClientManager {
|
||||
|
||||
|
||||
public void sendBroadcastResponse(ServerMessage message) {
|
||||
for (GameClient client : this.clients.values()) {
|
||||
client.sendResponse(message);
|
||||
message.retain();
|
||||
try {
|
||||
for (GameClient client : this.clients.values()) {
|
||||
client.sendResponse(message);
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendBroadcastResponse(ServerMessage message, GameClient exclude) {
|
||||
for (GameClient client : this.clients.values()) {
|
||||
if (client.equals(exclude))
|
||||
continue;
|
||||
message.retain();
|
||||
try {
|
||||
for (GameClient client : this.clients.values()) {
|
||||
if (client.equals(exclude))
|
||||
continue;
|
||||
|
||||
client.sendResponse(message);
|
||||
client.sendResponse(message);
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void sendBroadcastResponse(ServerMessage message, String minPermission, GameClient exclude) {
|
||||
for (GameClient client : this.clients.values()) {
|
||||
if (client.equals(exclude))
|
||||
continue;
|
||||
message.retain();
|
||||
try {
|
||||
for (GameClient client : this.clients.values()) {
|
||||
if (client.equals(exclude))
|
||||
continue;
|
||||
|
||||
if (client.getHabbo() != null) {
|
||||
if (client.getHabbo().hasPermission(minPermission)) {
|
||||
client.sendResponse(message);
|
||||
if (client.getHabbo() != null) {
|
||||
if (client.getHabbo().hasPermission(minPermission)) {
|
||||
client.sendResponse(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
}
|
||||
}
|
||||
}
|
@ -3115,57 +3115,87 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
roomChatMessage.setMessage(trimmedMessage);
|
||||
|
||||
if (chatType == RoomChatType.WHISPER) {
|
||||
if (roomChatMessage.getTargetHabbo() == null) {
|
||||
return;
|
||||
}
|
||||
if (prefixMessage != null) {
|
||||
prefixMessage.retain();
|
||||
}
|
||||
|
||||
RoomChatMessage staffChatMessage = new RoomChatMessage(roomChatMessage);
|
||||
staffChatMessage.setMessage("To " + staffChatMessage.getTargetHabbo().getHabboInfo().getUsername() + ": " + staffChatMessage.getMessage());
|
||||
if (clearPrefixMessage != null) {
|
||||
clearPrefixMessage.retain();
|
||||
}
|
||||
|
||||
final ServerMessage message = new RoomUserWhisperComposer(roomChatMessage).compose();
|
||||
final ServerMessage staffMessage = new RoomUserWhisperComposer(staffChatMessage).compose();
|
||||
try {
|
||||
if (chatType == RoomChatType.WHISPER) {
|
||||
if (roomChatMessage.getTargetHabbo() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
message.retain();
|
||||
staffMessage.retain();
|
||||
RoomChatMessage staffChatMessage = new RoomChatMessage(roomChatMessage);
|
||||
staffChatMessage.setMessage("To " + staffChatMessage.getTargetHabbo().getHabboInfo().getUsername() + ": " + staffChatMessage.getMessage());
|
||||
|
||||
try {
|
||||
for (Habbo h : this.getHabbos()) {
|
||||
if (h == roomChatMessage.getTargetHabbo() || h == habbo) {
|
||||
if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) {
|
||||
if (prefixMessage != null) {
|
||||
h.getClient().sendResponse(prefixMessage);
|
||||
final ServerMessage message = new RoomUserWhisperComposer(roomChatMessage).compose();
|
||||
final ServerMessage staffMessage = new RoomUserWhisperComposer(staffChatMessage).compose();
|
||||
|
||||
message.retain();
|
||||
staffMessage.retain();
|
||||
|
||||
try {
|
||||
for (Habbo h : this.getHabbos()) {
|
||||
if (h == roomChatMessage.getTargetHabbo() || h == habbo) {
|
||||
if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) {
|
||||
if (prefixMessage != null) {
|
||||
h.getClient().sendResponse(prefixMessage);
|
||||
}
|
||||
h.getClient().sendResponse(message);
|
||||
|
||||
if (clearPrefixMessage != null) {
|
||||
h.getClient().sendResponse(clearPrefixMessage);
|
||||
}
|
||||
}
|
||||
h.getClient().sendResponse(message);
|
||||
|
||||
if (clearPrefixMessage != null) {
|
||||
h.getClient().sendResponse(clearPrefixMessage);
|
||||
continue;
|
||||
}
|
||||
if (h.hasPermission("acc_see_whispers")) {
|
||||
h.getClient().sendResponse(staffMessage);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
staffMessage.release();
|
||||
}
|
||||
} else if (chatType == RoomChatType.TALK) {
|
||||
ServerMessage message = new RoomUserTalkComposer(roomChatMessage).compose();
|
||||
boolean noChatLimit = habbo.hasPermission("acc_chat_no_limit");
|
||||
|
||||
message.retain();
|
||||
|
||||
try {
|
||||
for (Habbo h : this.getHabbos()) {
|
||||
if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance ||
|
||||
h.equals(habbo) ||
|
||||
this.hasRights(h) ||
|
||||
noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) {
|
||||
if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) {
|
||||
if (prefixMessage != null && !h.getHabboStats().preferOldChat) {
|
||||
h.getClient().sendResponse(prefixMessage);
|
||||
}
|
||||
h.getClient().sendResponse(message);
|
||||
if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) {
|
||||
h.getClient().sendResponse(clearPrefixMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
if (h.hasPermission("acc_see_whispers")) {
|
||||
h.getClient().sendResponse(staffMessage);
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
staffMessage.release();
|
||||
}
|
||||
} else if (chatType == RoomChatType.TALK) {
|
||||
ServerMessage message = new RoomUserTalkComposer(roomChatMessage).compose();
|
||||
boolean noChatLimit = habbo.hasPermission("acc_chat_no_limit");
|
||||
} else if (chatType == RoomChatType.SHOUT) {
|
||||
ServerMessage message = new RoomUserShoutComposer(roomChatMessage).compose();
|
||||
|
||||
message.retain();
|
||||
message.retain();
|
||||
|
||||
try {
|
||||
for (Habbo h : this.getHabbos()) {
|
||||
if ((h.getRoomUnit().getCurrentLocation().distance(habbo.getRoomUnit().getCurrentLocation()) <= this.chatDistance ||
|
||||
h.equals(habbo) ||
|
||||
this.hasRights(h) ||
|
||||
noChatLimit) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) {
|
||||
if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId())) {
|
||||
try {
|
||||
for (Habbo h : this.getHabbos()) {
|
||||
if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) {
|
||||
if (prefixMessage != null && !h.getHabboStats().preferOldChat) {
|
||||
h.getClient().sendResponse(prefixMessage);
|
||||
}
|
||||
@ -3175,29 +3205,17 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
}
|
||||
} else if (chatType == RoomChatType.SHOUT) {
|
||||
ServerMessage message = new RoomUserShoutComposer(roomChatMessage).compose();
|
||||
} finally {
|
||||
if (prefixMessage != null) {
|
||||
prefixMessage.release();
|
||||
}
|
||||
|
||||
message.retain();
|
||||
|
||||
try {
|
||||
for (Habbo h : this.getHabbos()) {
|
||||
if (!h.getHabboStats().userIgnored(habbo.getHabboInfo().getId()) && (show == null || RoomLayout.tileInSquare(show, h.getRoomUnit().getCurrentLocation()))) {
|
||||
if (prefixMessage != null && !h.getHabboStats().preferOldChat) {
|
||||
h.getClient().sendResponse(prefixMessage);
|
||||
}
|
||||
h.getClient().sendResponse(message);
|
||||
if (clearPrefixMessage != null && !h.getHabboStats().preferOldChat) {
|
||||
h.getClient().sendResponse(clearPrefixMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
if (clearPrefixMessage != null) {
|
||||
clearPrefixMessage.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,10 +179,15 @@ public class HabboManager {
|
||||
|
||||
public void sendPacketToHabbosWithPermission(ServerMessage message, String perm) {
|
||||
synchronized (this.onlineHabbos) {
|
||||
for (Habbo habbo : this.onlineHabbos.values()) {
|
||||
if (habbo.hasPermission(perm)) {
|
||||
habbo.getClient().sendResponse(message);
|
||||
message.retain();
|
||||
try {
|
||||
for (Habbo habbo : this.onlineHabbos.values()) {
|
||||
if (habbo.hasPermission(perm)) {
|
||||
habbo.getClient().sendResponse(message);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,8 +148,13 @@ public class FloorPlanEditorSaveEvent extends MessageHandler {
|
||||
Emulator.getGameEnvironment().getRoomManager().unloadRoom(room);
|
||||
room = Emulator.getGameEnvironment().getRoomManager().loadRoom(room.getId());
|
||||
ServerMessage message = new ForwardToRoomComposer(room.getId()).compose();
|
||||
for (Habbo habbo : habbos) {
|
||||
habbo.getClient().sendResponse(message);
|
||||
message.retain();
|
||||
try {
|
||||
for (Habbo habbo : habbos) {
|
||||
habbo.getClient().sendResponse(message);
|
||||
}
|
||||
} finally {
|
||||
message.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,17 @@ public class HotelAlert extends RCONMessage<HotelAlert.JSONHotelAlert> {
|
||||
}
|
||||
|
||||
if (serverMessage != null) {
|
||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
||||
Habbo habbo = set.getValue();
|
||||
if (habbo.getHabboStats().blockStaffAlerts)
|
||||
continue;
|
||||
serverMessage.retain();
|
||||
try {
|
||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
||||
Habbo habbo = set.getValue();
|
||||
if (habbo.getHabboStats().blockStaffAlerts)
|
||||
continue;
|
||||
|
||||
habbo.getClient().sendResponse(serverMessage);
|
||||
habbo.getClient().sendResponse(serverMessage);
|
||||
}
|
||||
} finally {
|
||||
serverMessage.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user