mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-11-24 02:08:48 +00:00
feat: 修复命令参数长度检测
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
5d04234863
commit
417a189f9b
@ -107,23 +107,25 @@ public class CommandInfo {
|
|||||||
if (method == null) {
|
if (method == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
check(cmdArgs);
|
if (check(cmdArgs)) {
|
||||||
final Runnable runnable = new Runnable() {
|
final Runnable runnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
method.invoke(origin, cmdArgs);
|
method.invoke(origin, cmdArgs);
|
||||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||||
throw new CommandException(e);
|
throw new CommandException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
if (async) {
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(P.instance, runnable);
|
||||||
|
} else {
|
||||||
|
runnable.run();
|
||||||
}
|
}
|
||||||
};
|
return true;
|
||||||
if (async) {
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(P.instance, runnable);
|
|
||||||
} else {
|
|
||||||
runnable.run();
|
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,15 +187,19 @@ public class CommandInfo {
|
|||||||
Log.toSender(sender, cmdErr);
|
Log.toSender(sender, cmdErr);
|
||||||
Log.toSender(sender, String.format(cmdUse, cmdArgs.getAlias(), getName(), help.possibleArguments()));
|
Log.toSender(sender, String.format(cmdUse, cmdArgs.getAlias(), getName(), help.possibleArguments()));
|
||||||
Log.toSender(sender, String.format(cmdDes, help.value()));
|
Log.toSender(sender, String.format(cmdDes, help.value()));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (sender instanceof Player && command.onlyConsole()) {
|
if (sender instanceof Player && command.onlyConsole()) {
|
||||||
Log.toSender(sender, onlyConsole);
|
Log.toSender(sender, onlyConsole);
|
||||||
|
return false;
|
||||||
} else if (command.onlyPlayer()) {
|
} else if (command.onlyPlayer()) {
|
||||||
Log.toSender(sender, onlyPlayer);
|
Log.toSender(sender, onlyPlayer);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
final String perm = command.permission();
|
final String perm = command.permission();
|
||||||
if (perm != null && !sender.hasPermission(perm)) {
|
if (perm != null && !sender.hasPermission(perm)) {
|
||||||
Log.toSender(sender, String.format(losePerm, perm));
|
Log.toSender(sender, String.format(losePerm, perm));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user