parent
0be6671ddc
commit
fe16e32791
4 changed files with 7 additions and 7 deletions
|
@ -3,5 +3,5 @@ package land.chipmunk.chayapak.chomens_bot.command;
|
||||||
public enum TrustLevel {
|
public enum TrustLevel {
|
||||||
PUBLIC,
|
PUBLIC,
|
||||||
TRUSTED,
|
TRUSTED,
|
||||||
OWNER
|
ADMIN
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class HelpCommand implements Command {
|
||||||
final List<Component> list = new ArrayList<>();
|
final List<Component> list = new ArrayList<>();
|
||||||
list.addAll(getCommandListByTrustLevel(TrustLevel.PUBLIC));
|
list.addAll(getCommandListByTrustLevel(TrustLevel.PUBLIC));
|
||||||
list.addAll(getCommandListByTrustLevel(TrustLevel.TRUSTED));
|
list.addAll(getCommandListByTrustLevel(TrustLevel.TRUSTED));
|
||||||
list.addAll(getCommandListByTrustLevel(TrustLevel.OWNER));
|
list.addAll(getCommandListByTrustLevel(TrustLevel.ADMIN));
|
||||||
|
|
||||||
return Component.empty()
|
return Component.empty()
|
||||||
.append(Component.text("Commands ").color(NamedTextColor.GRAY))
|
.append(Component.text("Commands ").color(NamedTextColor.GRAY))
|
||||||
|
@ -69,7 +69,7 @@ public class HelpCommand implements Command {
|
||||||
.append(Component.text("(").color(NamedTextColor.DARK_GRAY))
|
.append(Component.text("(").color(NamedTextColor.DARK_GRAY))
|
||||||
.append(Component.text("Public ").color(NamedTextColor.GREEN))
|
.append(Component.text("Public ").color(NamedTextColor.GREEN))
|
||||||
.append(Component.text("Trusted ").color(NamedTextColor.RED))
|
.append(Component.text("Trusted ").color(NamedTextColor.RED))
|
||||||
.append(Component.text("Owner").color(NamedTextColor.DARK_RED))
|
.append(Component.text("Admin").color(NamedTextColor.DARK_RED))
|
||||||
.append(Component.text(") - ").color(NamedTextColor.DARK_GRAY))
|
.append(Component.text(") - ").color(NamedTextColor.DARK_GRAY))
|
||||||
.append(Component.join(JoinConfiguration.separator(Component.space()), list));
|
.append(Component.join(JoinConfiguration.separator(Component.space()), list));
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ public class HelpCommand implements Command {
|
||||||
return switch (trustLevel) {
|
return switch (trustLevel) {
|
||||||
case PUBLIC -> NamedTextColor.GREEN;
|
case PUBLIC -> NamedTextColor.GREEN;
|
||||||
case TRUSTED -> NamedTextColor.RED;
|
case TRUSTED -> NamedTextColor.RED;
|
||||||
case OWNER -> NamedTextColor.DARK_RED;
|
case ADMIN -> NamedTextColor.DARK_RED;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ServerEvalCommand implements Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
public TrustLevel trustLevel() {
|
||||||
return TrustLevel.OWNER;
|
return TrustLevel.ADMIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
public Component execute(CommandContext context, String[] args, String[] fullArgs) {
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class CommandHandlerPlugin {
|
||||||
) return Component.text("You're not in the trusted role!").color(NamedTextColor.RED);
|
) return Component.text("You're not in the trusted role!").color(NamedTextColor.RED);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
command.trustLevel() == TrustLevel.OWNER &&
|
command.trustLevel() == TrustLevel.ADMIN &&
|
||||||
roles.stream().noneMatch(role -> role.getName().equalsIgnoreCase(adminRoleName))
|
roles.stream().noneMatch(role -> role.getName().equalsIgnoreCase(adminRoleName))
|
||||||
) return Component.text("You're not in the admin role!").color(NamedTextColor.RED);
|
) return Component.text("You're not in the admin role!").color(NamedTextColor.RED);
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,7 +147,7 @@ public class CommandHandlerPlugin {
|
||||||
) return Component.text("Invalid hash").color(NamedTextColor.RED);
|
) return Component.text("Invalid hash").color(NamedTextColor.RED);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
command.trustLevel() == TrustLevel.OWNER &&
|
command.trustLevel() == TrustLevel.ADMIN &&
|
||||||
!userHash.equals(bot.hashing().ownerHash())
|
!userHash.equals(bot.hashing().ownerHash())
|
||||||
) return Component.text("Invalid OwnerHash").color(NamedTextColor.RED);
|
) return Component.text("Invalid OwnerHash").color(NamedTextColor.RED);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue