Search in sources :

Example 1 with Plugin

use of org.bukkit.plugin.Plugin in project Prism-Bukkit by prism.

the class Prism method checkPluginDependancies.

/**
	 * 
	 */
public void checkPluginDependancies() {
    // WorldEdit
    final Plugin we = getServer().getPluginManager().getPlugin("WorldEdit");
    if (we != null) {
        plugin_worldEdit = (WorldEditPlugin) we;
        //Easier and foolproof way.
        try {
            WorldEdit.getInstance().getEventBus().register(new PrismBlockEditHandler());
            log("WorldEdit found. Associated features enabled.");
        } catch (Throwable error) {
            log("Required WorldEdit version is 6.0.0 or greater! Certain optional features of Prism disabled.");
        }
    } else {
        log("WorldEdit not found. Certain optional features of Prism disabled.");
    }
}
Also used : PrismBlockEditHandler(me.botsko.prism.bridge.PrismBlockEditHandler) Plugin(org.bukkit.plugin.Plugin) JavaPlugin(org.bukkit.plugin.java.JavaPlugin) WorldEditPlugin(com.sk89q.worldedit.bukkit.WorldEditPlugin)

Example 2 with Plugin

use of org.bukkit.plugin.Plugin in project AuthMeReloaded by AuthMe.

the class ServerListenerTest method mockEventWithPluginName.

private static <T extends PluginEvent> T mockEventWithPluginName(Class<T> eventClass, String name) {
    T event = mock(eventClass);
    Plugin plugin = mock(Plugin.class);
    given(plugin.getName()).willReturn(name);
    given(event.getPlugin()).willReturn(plugin);
    return event;
}
Also used : Plugin(org.bukkit.plugin.Plugin)

Example 3 with Plugin

use of org.bukkit.plugin.Plugin in project TotalFreedomMod by TotalFreedom.

the class Command_commandlist method run.

@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) {
    List<String> commands = new ArrayList<>();
    for (Plugin targetPlugin : server.getPluginManager().getPlugins()) {
        try {
            PluginDescriptionFile desc = targetPlugin.getDescription();
            Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) desc.getCommands();
            if (map != null) {
                for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
                    String command_name = (String) entry.getKey();
                    commands.add(command_name);
                }
            }
        } catch (Throwable ex) {
        }
    }
    Collections.sort(commands);
    sender.sendMessage(StringUtils.join(commands, ","));
    return true;
}
Also used : ArrayList(java.util.ArrayList) PluginDescriptionFile(org.bukkit.plugin.PluginDescriptionFile) Map(java.util.Map) Plugin(org.bukkit.plugin.Plugin)

Example 4 with Plugin

use of org.bukkit.plugin.Plugin in project Bukkit by Bukkit.

the class VersionCommand method tabComplete.

@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) {
    Validate.notNull(sender, "Sender cannot be null");
    Validate.notNull(args, "Arguments cannot be null");
    Validate.notNull(alias, "Alias cannot be null");
    if (args.length == 1) {
        List<String> completions = new ArrayList<String>();
        String toComplete = args[0].toLowerCase();
        for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
            if (StringUtil.startsWithIgnoreCase(plugin.getName(), toComplete)) {
                completions.add(plugin.getName());
            }
        }
        return completions;
    }
    return ImmutableList.of();
}
Also used : ArrayList(java.util.ArrayList) Plugin(org.bukkit.plugin.Plugin)

Example 5 with Plugin

use of org.bukkit.plugin.Plugin in project Bukkit by Bukkit.

the class PluginsCommand method getPluginList.

private String getPluginList() {
    StringBuilder pluginList = new StringBuilder();
    Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
    for (Plugin plugin : plugins) {
        if (pluginList.length() > 0) {
            pluginList.append(ChatColor.WHITE);
            pluginList.append(", ");
        }
        pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED);
        pluginList.append(plugin.getDescription().getName());
    }
    return "(" + plugins.length + "): " + pluginList.toString();
}
Also used : Plugin(org.bukkit.plugin.Plugin)

Aggregations

Plugin (org.bukkit.plugin.Plugin)40 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)10 ArrayList (java.util.ArrayList)7 PluginManager (org.bukkit.plugin.PluginManager)5 Questioner (ca.xshade.bukkit.questioner.Questioner)4 Option (ca.xshade.questionmanager.Option)4 Question (ca.xshade.questionmanager.Question)4 CommonPlugin (com.bergerkiller.bukkit.common.internal.CommonPlugin)4 Player (org.bukkit.entity.Player)4 File (java.io.File)3 IOException (java.io.IOException)3 InvalidNameException (javax.naming.InvalidNameException)3 AlreadyRegisteredException (com.palmergames.bukkit.towny.exceptions.AlreadyRegisteredException)2 NotRegisteredException (com.palmergames.bukkit.towny.exceptions.NotRegisteredException)2 TownyException (com.palmergames.bukkit.towny.exceptions.TownyException)2 ResidentTownQuestionTask (com.palmergames.bukkit.towny.questioner.ResidentTownQuestionTask)2 WorldEditPlugin (com.sk89q.worldedit.bukkit.WorldEditPlugin)2 URL (java.net.URL)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2