You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-20 15:36:17 +00:00
fix(housekeeping): enforce target rank ceiling
This commit is contained in:
+5
@@ -41,6 +41,11 @@ public class HousekeepingBanUserEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
long durationLong = (long) hours * SECONDS_IN_HOUR;
|
||||
int duration = durationLong > MAX_DURATION_SECONDS ? MAX_DURATION_SECONDS : (int) durationLong;
|
||||
|
||||
|
||||
+5
@@ -40,6 +40,11 @@ public class HousekeepingForceDisconnectUserEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (reason != null && !reason.isEmpty()) {
|
||||
target.alert(reason);
|
||||
}
|
||||
|
||||
+5
@@ -33,6 +33,11 @@ public class HousekeepingGiveCreditsEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
Habbo online = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||
|
||||
if (online != null) {
|
||||
|
||||
+5
@@ -42,6 +42,11 @@ public class HousekeepingGiveCurrencyEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(actionKey, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
Habbo online = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||
|
||||
if (online != null) {
|
||||
|
||||
+5
@@ -40,6 +40,11 @@ public class HousekeepingGrantItemEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (quantity > MAX_QUANTITY_PER_CALL) {
|
||||
quantity = MAX_QUANTITY_PER_CALL;
|
||||
}
|
||||
|
||||
+5
@@ -42,6 +42,11 @@ public class HousekeepingKickUserEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.hasPermission(Permission.ACC_UNKICKABLE)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.target_unkickable"));
|
||||
return;
|
||||
|
||||
+5
@@ -44,6 +44,11 @@ public class HousekeepingMuteUserEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
target.mute(minutes * SECONDS_IN_MINUTE, false);
|
||||
|
||||
if (reason != null && !reason.isEmpty()) {
|
||||
|
||||
+5
@@ -46,6 +46,11 @@ public class HousekeepingResetUserPasswordEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
String plain = randomPassword();
|
||||
String hash;
|
||||
|
||||
|
||||
+5
@@ -38,6 +38,11 @@ public class HousekeepingSetHcSubscriptionEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
int now = Emulator.getIntUnixTimestamp();
|
||||
int newExpire;
|
||||
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.eu.habbo.messages.incoming.housekeeping;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||
|
||||
final class HousekeepingTargetRankGuard {
|
||||
private HousekeepingTargetRankGuard() {
|
||||
}
|
||||
|
||||
static boolean canTargetUser(Habbo operator, int targetUserId) {
|
||||
if (operator == null || targetUserId <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HabboInfo targetInfo = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(targetUserId);
|
||||
if (targetInfo == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return targetInfo.getRank().getId() < operator.getHabboInfo().getRank().getId();
|
||||
}
|
||||
}
|
||||
+5
@@ -43,6 +43,11 @@ public class HousekeepingTradeLockUserEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
long durationLong = (long) hours * SECONDS_IN_HOUR;
|
||||
int duration = durationLong > MAX_DURATION_SECONDS ? MAX_DURATION_SECONDS : (int) durationLong;
|
||||
int lockedUntil = Emulator.getIntUnixTimestamp() + duration;
|
||||
|
||||
+5
@@ -34,6 +34,11 @@ public class HousekeepingUnbanUserEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HousekeepingTargetRankGuard.canTargetUser(this.client.getHabbo(), userId)) {
|
||||
this.client.sendResponse(new HousekeepingActionResultComposer(ACTION_KEY, false, 0, "housekeeping.error.rank_too_high"));
|
||||
return;
|
||||
}
|
||||
|
||||
// ModToolManager.unban only takes a username; the SQL UPDATE
|
||||
// happens against active bans (ban_expire > now), so calling it
|
||||
// on a never-banned user is a benign no-op that returns false.
|
||||
|
||||
Reference in New Issue
Block a user