fix validate and add user input command name
This commit is contained in:
parent
11982fb396
commit
b9a0f55b1d
3 changed files with 5 additions and 3 deletions
|
@ -20,6 +20,7 @@ public class CommandContext {
|
||||||
public final boolean inGame;
|
public final boolean inGame;
|
||||||
|
|
||||||
public String commandName = null;
|
public String commandName = null;
|
||||||
|
public String userInputCommandName = null;
|
||||||
|
|
||||||
public String[] fullArgs;
|
public String[] fullArgs;
|
||||||
public String[] args;
|
public String[] args;
|
||||||
|
@ -45,7 +46,7 @@ public class CommandContext {
|
||||||
"Expected %s at position %s (%s %s)",
|
"Expected %s at position %s (%s %s)",
|
||||||
Component.text(type),
|
Component.text(type),
|
||||||
Component.text(argsPosition),
|
Component.text(argsPosition),
|
||||||
Component.text(prefix + commandName),
|
Component.text(prefix + userInputCommandName),
|
||||||
argsPosition == 0 ?
|
argsPosition == 0 ?
|
||||||
UNKNOWN_ARGUMENT_COMPONENT :
|
UNKNOWN_ARGUMENT_COMPONENT :
|
||||||
Component
|
Component
|
||||||
|
|
|
@ -26,8 +26,8 @@ public class ValidateCommand extends Command {
|
||||||
|
|
||||||
final String hash = context.fullArgs[0];
|
final String hash = context.fullArgs[0];
|
||||||
|
|
||||||
if (bot.hashing.isCorrectHash(hash, context.commandName, context.sender)) return Component.text("Valid hash").color(NamedTextColor.GREEN);
|
if (bot.hashing.isCorrectHash(hash, context.userInputCommandName, context.sender)) return Component.text("Valid hash").color(NamedTextColor.GREEN);
|
||||||
else if (bot.hashing.isCorrectOwnerHash(hash, context.commandName, context.sender)) return Component.text("Valid OwnerHash").color(NamedTextColor.GREEN);
|
else if (bot.hashing.isCorrectOwnerHash(hash, context.userInputCommandName, context.sender)) return Component.text("Valid OwnerHash").color(NamedTextColor.GREEN);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,7 @@ public class CommandHandlerPlugin {
|
||||||
context.fullArgs = fullArgs;
|
context.fullArgs = fullArgs;
|
||||||
context.args = args;
|
context.args = args;
|
||||||
context.commandName = command.name;
|
context.commandName = command.name;
|
||||||
|
context.userInputCommandName = commandName;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return command.execute(context);
|
return command.execute(context);
|
||||||
|
|
Loading…
Reference in a new issue