mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Refactored Permissions Groups, changed command and rights keys
This commit is contained in:
parent
e2b0299aec
commit
ff2cfc2498
@ -1,11 +1,11 @@
|
|||||||
package com.eu.habbo.habbohotel.commands.list;
|
package com.eu.habbo.habbohotel.commands.list;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.commands.Command;
|
import com.eu.habbo.habbohotel.commands.Command;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.permissions.PermissionCommand;
|
import com.eu.habbo.habbohotel.permissions.PermissionCommand;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CommandsCommand extends Command {
|
public class CommandsCommand extends Command {
|
||||||
@ -17,13 +17,19 @@ public class CommandsCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
StringBuilder message = new StringBuilder(getTextsValue("commands.generic.cmd_commands.text"));
|
StringBuilder message = new StringBuilder(getTextsValue("commands.generic.cmd_commands.text"));
|
||||||
|
|
||||||
List<PermissionCommand> commands = gameClient.getHabbo().getHabboInfo().getPermissionGroup().getCommands();
|
List<String> commands = gameClient.getHabbo().getHabboInfo().getPermissionGroup().getCommands();
|
||||||
|
|
||||||
Collections.sort(commands, Comparator.comparing(PermissionCommand::getName));
|
Collections.sort(commands);
|
||||||
|
|
||||||
message.append("(").append(commands.size()).append("):\r\n");
|
message.append("(").append(commands.size()).append("):\r\n");
|
||||||
|
|
||||||
for(PermissionCommand command : commands) {
|
for(String commandName : commands) {
|
||||||
|
PermissionCommand command = Emulator.getGameEnvironment().getPermissionsManager().getCommand(commandName);
|
||||||
|
|
||||||
|
if(command == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
message.append(command.getDescription()).append("\r");
|
message.append(command.getDescription()).append("\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.eu.habbo.habbohotel.commands.list;
|
package com.eu.habbo.habbohotel.commands.list;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.commands.Command;
|
import com.eu.habbo.habbohotel.commands.Command;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.permissions.PermissionRight;
|
import com.eu.habbo.habbohotel.permissions.PermissionRight;
|
||||||
@ -15,11 +16,17 @@ public class RightsCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
StringBuilder message = new StringBuilder(getTextsValue("commands.generic.cmd_rights.text"));
|
StringBuilder message = new StringBuilder(getTextsValue("commands.generic.cmd_rights.text"));
|
||||||
|
|
||||||
Set<PermissionRight> rights = gameClient.getHabbo().getHabboInfo().getPermissionGroup().getRights();
|
Set<String> rights = gameClient.getHabbo().getHabboInfo().getPermissionGroup().getRights();
|
||||||
|
|
||||||
message.append("(").append(rights.size()).append("):\r\n");
|
message.append("(").append(rights.size()).append("):\r\n");
|
||||||
|
|
||||||
for(PermissionRight right : rights) {
|
for(String rightName : rights) {
|
||||||
|
PermissionRight right = Emulator.getGameEnvironment().getPermissionsManager().getRight(rightName);
|
||||||
|
|
||||||
|
if(right == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
message.append(right.getName()).append(" - ").append(right.getDescription()).append("\r");
|
message.append(right.getName()).append(" - ").append(right.getDescription()).append("\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ public class PermissionsManager {
|
|||||||
log.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO if Group is eliminated every user that has this rank must update to lowest Rank
|
||||||
this.permissionGroups.entrySet().removeIf(entry -> !currentGroupIds.contains(entry.getKey()));
|
this.permissionGroups.entrySet().removeIf(entry -> !currentGroupIds.contains(entry.getKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user