mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-27 21:29:14 +01:00
More compat for args
This commit is contained in:
parent
7d676a2302
commit
b7cf0109da
@ -0,0 +1,9 @@
|
||||
package net.citizensnpcs.command;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public interface CommandAnnotationProcessor<T extends Annotation> {
|
||||
void process(CommandSender sender, CommandContext context, T instance, Object[] args);
|
||||
}
|
@ -107,7 +107,7 @@ public class CommandManager {
|
||||
if (method == null && parent == null)
|
||||
throw new UnhandledCommandException();
|
||||
|
||||
if (!serverCommands.contains(method) && methodArgs[1] instanceof ConsoleCommandSender)
|
||||
if (!serverCommands.contains(method) && sender instanceof ConsoleCommandSender)
|
||||
throw new ServerCommandException();
|
||||
|
||||
if (!hasPermission(method, sender))
|
||||
@ -266,7 +266,7 @@ public class CommandManager {
|
||||
|
||||
private void processRequirements(CommandSender sender, Object[] methodArgs, CommandContext context,
|
||||
Requirements cmdRequirements) throws RequirementMissingException {
|
||||
NPC npc = (NPC) methodArgs[2];
|
||||
NPC npc = (methodArgs.length >= 3 && methodArgs[2] instanceof NPC) ? (NPC) methodArgs[2] : null;
|
||||
|
||||
// Requirements
|
||||
if (cmdRequirements.selected()) {
|
||||
|
Loading…
Reference in New Issue
Block a user