/** * @deprecated Feature Not done yet * @param id * @param classes * @return */ CommandCompletionHandler setDefaultCompletion(String id, Class... classes) { // get completion with specified id id = id.toLowerCase(); CommandCompletionHandler completion = completionMap.get(id); if(completion == null) { // Throw something because no completion with specified id ACFUtil.sneaky(new CommandCompletionTextLookupException()); } for(Class clazz : classes) { defaultCompletions.put(clazz, id); } return completion; }
@NotNull private CommandMap hookCommandMap() { CommandMap commandMap = null; try { Server server = Bukkit.getServer(); Method getCommandMap = server.getClass().getDeclaredMethod("getCommandMap"); getCommandMap.setAccessible(true); commandMap = (CommandMap) getCommandMap.invoke(server); if (!SimpleCommandMap.class.isAssignableFrom(commandMap.getClass())) { this.log(LogLevel.ERROR, "ERROR: CommandMap has been hijacked! Offending command map is located at: " + commandMap.getClass().getName()); this.log(LogLevel.ERROR, "We are going to try to hijack it back and resolve this, but you are now in dangerous territory."); this.log(LogLevel.ERROR, "We can not guarantee things are going to work."); Field cmField = server.getClass().getDeclaredField("commandMap"); commandMap = new ProxyCommandMap(this, commandMap); cmField.set(server, commandMap); this.log(LogLevel.INFO, "Injected Proxy Command Map... good luck..."); } Field knownCommands = SimpleCommandMap.class.getDeclaredField("knownCommands"); knownCommands.setAccessible(true); //noinspection unchecked this.knownCommands = (Map<String, Command>) knownCommands.get(commandMap); } catch (Exception e) { this.log(LogLevel.ERROR, "Failed to get Command Map. ACF will not function."); ACFUtil.sneaky(e); } return commandMap; }
ACFUtil.sneaky(new IllegalStateException("Multiple @Default/@HelpCommand commands, duplicate on " + method.getDeclaringClass().getName() + "#" + method.getName())); ACFUtil.sneaky(new IllegalStateException("Multiple @UnknownHandler/@HelpCommand commands, duplicate on " + method.getDeclaringClass().getName() + "#" + method.getName())); this.preCommandHandler = method; } else { ACFUtil.sneaky(new IllegalStateException("Multiple @PreCommand commands, duplicate on " + method.getDeclaringClass().getName() + "#" + method.getName()));
if (resolved == null || paramIdx > resolved.size()) { this.command.scope.manager.log(LogLevel.ERROR, "resolved: " + resolved + " paramIdx: " + paramIdx + " - size: " + (resolved != null ? resolved.size() : null )); ACFUtil.sneaky(new CommandCompletionTextLookupException());
if (handler != null) { if (isAsync && !(handler instanceof AsyncCommandCompletionHandler)) { ACFUtil.sneaky(new SyncCompletionRequired()); return null;
ACFUtil.sneaky(new InvalidCommandContextException( "Parameter " + type.getSimpleName() + " of " + command + " has no applicable context resolver" ));
ACFUtil.sneaky(new IllegalStateException("Weird Command signature... String[] should be last or @Split"));