类org.bukkit.command.defaults.BukkitCommand源码实例Demo

下面列出了怎么用org.bukkit.command.defaults.BukkitCommand的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: BlueMap   文件: BukkitCommands.java
public Collection<BukkitCommand> getRootCommands(){
	Collection<BukkitCommand> rootCommands = new ArrayList<>();
	
	for (CommandNode<CommandSender> node : this.dispatcher.getRoot().getChildren()) {
		rootCommands.add(new CommandProxy(node.getName()));
	}
	
	return rootCommands;
}
 
源代码2 项目: Kettle   文件: SimpleHelpMap.java
private String getCommandPluginName(Command command) {
    if (command instanceof VanillaCommandWrapper) {
        return "Minecraft";
    }
    if (command instanceof BukkitCommand) {
        return "Bukkit";
    }
    if (command instanceof PluginIdentifiableCommand) {
        return ((PluginIdentifiableCommand) command).getPlugin().getName();
    }
    return null;
}
 
源代码3 项目: Kettle   文件: SimpleHelpMap.java
private boolean commandInIgnoredPlugin(Command command, Set<String> ignoredPlugins) {
    if ((command instanceof BukkitCommand) && ignoredPlugins.contains("Bukkit")) {
        return true;
    }
    if (command instanceof PluginIdentifiableCommand && ignoredPlugins.contains(((PluginIdentifiableCommand) command).getPlugin().getName())) {
        return true;
    }
    return false;
}
 
源代码4 项目: Thermos   文件: SimpleHelpMap.java
private String getCommandPluginName(Command command) {
    if (command instanceof VanillaCommandWrapper) {
        return "Minecraft";
    }
    if (command instanceof BukkitCommand || command instanceof VanillaCommand) {
        return "Bukkit";
    }
    if (command instanceof PluginIdentifiableCommand) {
        return ((PluginIdentifiableCommand)command).getPlugin().getName();
    }
    return null;
}
 
源代码5 项目: Thermos   文件: SimpleHelpMap.java
private boolean commandInIgnoredPlugin(Command command, Set<String> ignoredPlugins) {
    if ((command instanceof BukkitCommand || command instanceof VanillaCommand) && ignoredPlugins.contains("Bukkit")) {
        return true;
    }
    if (command instanceof PluginIdentifiableCommand && ignoredPlugins.contains(((PluginIdentifiableCommand)command).getPlugin().getName())) {
        return true;
    }
    return false;
}
 
源代码6 项目: BlueMap   文件: BukkitPlugin.java
@Override
public void onEnable() {
	new MetricsLite(this);
	
	//save world so the level.dat is present on new worlds
	Logger.global.logInfo("Saving all worlds once, to make sure the level.dat is present...");
	for (World world : getServer().getWorlds()) {
		world.save();
	}
	
	//register events
	getServer().getPluginManager().registerEvents(eventForwarder, this);
	
	//register commands
	try {
		final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");

		bukkitCommandMap.setAccessible(true);
		CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());

		for (BukkitCommand command : commands.getRootCommands()) {
			commandMap.register(command.getLabel(), command);
		}
	} catch(NoSuchFieldException | SecurityException | IllegalAccessException e) {
		Logger.global.logError("Failed to register commands!", e);
	}
	
	//tab completions
	getServer().getPluginManager().registerEvents(commands, this);
	
	//load bluemap
	getServer().getScheduler().runTaskAsynchronously(this, () -> {
		try {
			Logger.global.logInfo("Loading...");
			this.bluemap.load();
			if (bluemap.isLoaded()) Logger.global.logInfo("Loaded!");
		} catch (Throwable t) {
			Logger.global.logError("Failed to load!", t);
		}
	});
}
 
 类所在包
 类方法
 同包方法