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(modtool): enforce staff target rank ceilings
This commit is contained in:
@@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.modtool;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.permissions.Rank;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomState;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@@ -423,12 +424,16 @@ public class ModToolManager {
|
||||
}
|
||||
|
||||
public void kick(Habbo moderator, Habbo target, String message) {
|
||||
if (moderator.hasPermission(Permission.ACC_SUPPORTTOOL) && !target.hasPermission(Permission.ACC_UNKICKABLE)) {
|
||||
if (target.getHabboInfo().getCurrentRoom() != null) {
|
||||
Emulator.getGameEnvironment().getRoomManager().leaveRoom(target, target.getHabboInfo().getCurrentRoom());
|
||||
}
|
||||
this.alert(moderator, target, message, SupportUserAlertedReason.KICKED);
|
||||
if (moderator == null || target == null || !moderator.hasPermission(Permission.ACC_SUPPORTTOOL) ||
|
||||
target.hasPermission(Permission.ACC_UNKICKABLE) ||
|
||||
!canModerateTarget(moderator, target.getHabboInfo().getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getHabboInfo().getCurrentRoom() != null) {
|
||||
Emulator.getGameEnvironment().getRoomManager().leaveRoom(target, target.getHabboInfo().getCurrentRoom());
|
||||
}
|
||||
this.alert(moderator, target, message, SupportUserAlertedReason.KICKED);
|
||||
}
|
||||
|
||||
public List<ModToolBan> ban(int targetUserId, Habbo moderator, String reason, int duration, ModToolBanType type, int cfhTopic) {
|
||||
@@ -443,7 +448,7 @@ public class ModToolManager {
|
||||
return bans;
|
||||
}
|
||||
|
||||
if (moderator.getHabboInfo().getRank().getId() < offlineInfo.getRank().getId()) {
|
||||
if (!canModerateTarget(moderator, targetUserId)) {
|
||||
return bans;
|
||||
}
|
||||
|
||||
@@ -468,7 +473,7 @@ public class ModToolManager {
|
||||
|
||||
if ((type == ModToolBanType.IP || type == ModToolBanType.SUPER) && target != null && !ban.ip.equals("offline")) {
|
||||
for (Habbo h : Emulator.getGameServer().getGameClientManager().getHabbosWithIP(ban.ip)) {
|
||||
if (h.getHabboInfo().getRank().getId() >= moderator.getHabboInfo().getRank().getId()) continue;
|
||||
if (!canModerateTarget(moderator, h.getHabboInfo().getId())) continue;
|
||||
|
||||
ban = new ModToolBan(h.getHabboInfo().getId(), h != null ? h.getHabboInfo().getIpLogin() : "offline", h != null ? h.getClient().getMachineId() : "offline", moderator.getHabboInfo().getId(), Emulator.getIntUnixTimestamp() + duration, reason, type, cfhTopic);
|
||||
Emulator.getPluginManager().fireEvent(new SupportUserBannedEvent(moderator, h, ban));
|
||||
@@ -480,7 +485,7 @@ public class ModToolManager {
|
||||
|
||||
if ((type == ModToolBanType.MACHINE || type == ModToolBanType.SUPER) && target != null && !ban.machineId.equals("offline")) {
|
||||
for (Habbo h : Emulator.getGameServer().getGameClientManager().getHabbosWithMachineId(ban.machineId)) {
|
||||
if (h.getHabboInfo().getRank().getId() >= moderator.getHabboInfo().getRank().getId()) continue;
|
||||
if (!canModerateTarget(moderator, h.getHabboInfo().getId())) continue;
|
||||
|
||||
ban = new ModToolBan(h.getHabboInfo().getId(), h != null ? h.getHabboInfo().getIpLogin() : "offline", h != null ? h.getClient().getMachineId() : "offline", moderator.getHabboInfo().getId(), Emulator.getIntUnixTimestamp() + duration, reason, type, cfhTopic);
|
||||
Emulator.getPluginManager().fireEvent(new SupportUserBannedEvent(moderator, h, ban));
|
||||
@@ -501,10 +506,27 @@ public class ModToolManager {
|
||||
if (targetInfo == null)
|
||||
return false;
|
||||
|
||||
return targetInfo.getRank().getId() < moderator.getHabboInfo().getRank().getId();
|
||||
int moderatorRankId = moderator.getHabboInfo().getRank().getId();
|
||||
int targetRankId = targetInfo.getRank().getId();
|
||||
|
||||
return targetRankId < moderatorRankId || isCoreRank(moderatorRankId) && targetRankId <= moderatorRankId;
|
||||
}
|
||||
|
||||
private static boolean isCoreRank(int rankId) {
|
||||
int highestRankId = 0;
|
||||
for (Rank rank : Emulator.getGameEnvironment().getPermissionsManager().getAllRanks()) {
|
||||
highestRankId = Math.max(highestRankId, rank.getId());
|
||||
}
|
||||
|
||||
return highestRankId > 0 && rankId >= highestRankId;
|
||||
}
|
||||
|
||||
public void roomAction(Room room, Habbo moderator, boolean kickUsers, boolean lockDoor, boolean changeTitle) {
|
||||
if (room == null || moderator == null || !moderator.hasPermission(Permission.ACC_SUPPORTTOOL) ||
|
||||
!canModerateTarget(moderator, room.getOwnerId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
SupportRoomActionEvent roomActionEvent = new SupportRoomActionEvent(moderator, room, kickUsers, lockDoor, changeTitle);
|
||||
Emulator.getPluginManager().fireEvent(roomActionEvent);
|
||||
|
||||
|
||||
@@ -128,6 +128,10 @@ public class ModToolSanctions {
|
||||
}
|
||||
|
||||
public void run(int habboId, Habbo self, int sanctionLevel, int cfhTopic, String reason, int tradeLockedUntil, boolean isMuted, int muteDuration) {
|
||||
if (!ModToolManager.canModerateTarget(self, habboId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
sanctionLevel++;
|
||||
|
||||
ModToolSanctionLevelItem sanctionLevelItem = getSanctionLevelItem(sanctionLevel);
|
||||
|
||||
+4
@@ -21,6 +21,10 @@ public class ModToolIssueDefaultSanctionEvent extends MessageHandler {
|
||||
|
||||
ModToolIssue issue = Emulator.getGameEnvironment().getModToolManager().getTicket(issueId);
|
||||
|
||||
if (issue == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (issue.modId == this.client.getHabbo().getHabboInfo().getId()) {
|
||||
CfhTopic modToolCategory = Emulator.getGameEnvironment().getModToolManager().getCfhTopic(category);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user