You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 23:16:19 +00:00
Merge pull request #213 from simoleo89/fix/room-user-safety
Guard room user moderation packets
This commit is contained in:
+9
@@ -9,6 +9,9 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.users.MutedWhisperComposer;
|
||||
|
||||
public class RoomUserMuteEvent extends MessageHandler {
|
||||
private static final int MIN_MUTE_MINUTES = 1;
|
||||
private static final int MAX_MUTE_MINUTES = 1440;
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int userId = this.packet.readInt();
|
||||
@@ -24,6 +27,12 @@ public class RoomUserMuteEvent extends MessageHandler {
|
||||
Habbo habbo = room.getHabbo(userId);
|
||||
|
||||
if (habbo != null) {
|
||||
if (minutes < MIN_MUTE_MINUTES || minutes > MAX_MUTE_MINUTES)
|
||||
return;
|
||||
|
||||
if (habbo.hasPermission(Permission.ACC_UNKICKABLE))
|
||||
return;
|
||||
|
||||
room.muteHabbo(habbo, minutes);
|
||||
habbo.getClient().sendResponse(new MutedWhisperComposer(minutes * 60));
|
||||
AchievementManager.progressAchievement(this.client.getHabbo(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("SelfModMuteSeen"));
|
||||
|
||||
+10
-6
@@ -11,10 +11,16 @@ import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.plugin.events.users.UserSignEvent;
|
||||
|
||||
public class RoomUserSignEvent extends MessageHandler {
|
||||
private static final int MIN_SIGN_ID = 0;
|
||||
private static final int MAX_SIGN_ID = 10;
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
int signId = this.packet.readInt();
|
||||
|
||||
if (signId < MIN_SIGN_ID || signId > MAX_SIGN_ID)
|
||||
return;
|
||||
|
||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||
|
||||
if (room == null)
|
||||
@@ -26,12 +32,10 @@ public class RoomUserSignEvent extends MessageHandler {
|
||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().unIdle(this.client.getHabbo());
|
||||
WiredManager.triggerUserPerformsAction(room, this.client.getHabbo().getRoomUnit(), WiredUserActionType.SIGN, event.sign);
|
||||
|
||||
if(signId <= 10) {
|
||||
int userId = this.client.getHabbo().getHabboInfo().getId();
|
||||
for (HabboItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionVoteCounter.class)) {
|
||||
if (item instanceof InteractionVoteCounter) {
|
||||
((InteractionVoteCounter)item).vote(room, userId, signId);
|
||||
}
|
||||
int userId = this.client.getHabbo().getHabboInfo().getId();
|
||||
for (HabboItem item : room.getRoomSpecialTypes().getItemsOfType(InteractionVoteCounter.class)) {
|
||||
if (item instanceof InteractionVoteCounter) {
|
||||
((InteractionVoteCounter)item).vote(room, userId, signId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user