the
This commit is contained in:
parent
c8b1e594ff
commit
0be6671ddc
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,
|
||||||
ADMIN
|
OWNER
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.ADMIN));
|
list.addAll(getCommandListByTrustLevel(TrustLevel.OWNER));
|
||||||
|
|
||||||
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("Admin").color(NamedTextColor.DARK_RED))
|
.append(Component.text("Owner").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 ADMIN -> NamedTextColor.DARK_RED;
|
case OWNER -> NamedTextColor.DARK_RED;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ServerEvalCommand implements Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrustLevel trustLevel() {
|
public TrustLevel trustLevel() {
|
||||||
return TrustLevel.ADMIN;
|
return TrustLevel.OWNER;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.ADMIN &&
|
command.trustLevel() == TrustLevel.OWNER &&
|
||||||
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.ADMIN &&
|
command.trustLevel() == TrustLevel.OWNER &&
|
||||||
!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