Java Code Examples for org.bukkit.plugin.Plugin#getDescription()

The following examples show how to use org.bukkit.plugin.Plugin#getDescription() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VersionCommand.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
private void describeToSender(Plugin plugin, CommandSender sender) {
    PluginDescriptionFile desc = plugin.getDescription();
    sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + desc.getVersion());

    if (desc.getDescription() != null) {
        sender.sendMessage(desc.getDescription());
    }

    if (desc.getWebsite() != null) {
        sender.sendMessage("Website: " + ChatColor.GREEN + desc.getWebsite());
    }

    if (!desc.getAuthors().isEmpty()) {
        if (desc.getAuthors().size() == 1) {
            sender.sendMessage("Author: " + getAuthors(desc));
        } else {
            sender.sendMessage("Authors: " + getAuthors(desc));
        }
    }
}
 
Example 2
Source File: CraftCrashReport.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
public Object call() throws Exception {
    StringWriter value = new StringWriter();
    try {
        value.append("\n   Running: ").append(Bukkit.getName()).append(" version ").append(Bukkit.getVersion()).append(" (Implementing API version ").append(Bukkit.getBukkitVersion()).append(") ").append(String.valueOf(MinecraftServer.getServerCB().isServerInOnlineMode()));
        value.append("\n   Plugins: {");
        for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
            PluginDescriptionFile description = plugin.getDescription();
            value.append(' ').append(description.getFullName()).append(' ').append(description.getMain()).append(' ').append(Arrays.toString(description.getAuthors().toArray())).append(',');
        }
        value.append("}\n   Warnings: ").append(Bukkit.getWarningState().name());
        value.append("\n   Reload Count: ").append(String.valueOf(MinecraftServer.getServerCB().server.reloadCount));
        value.append("\n   Threads: {");
        for (Map.Entry<Thread, ? extends Object[]> entry : Thread.getAllStackTraces().entrySet()) {
            value.append(' ').append(entry.getKey().getState().name()).append(' ').append(entry.getKey().getName()).append(": ").append(Arrays.toString(entry.getValue())).append(',');
        }
        value.append("}\n   ").append(Bukkit.getScheduler().toString());
    } catch (Throwable t) {
        value.append("\n   Failed to handle CraftCrashReport:\n");
        PrintWriter writer = new PrintWriter(value);
        t.printStackTrace(writer);
        writer.flush();
    }
    return value.toString();
}
 
Example 3
Source File: CraftCrashReport.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
public Object call() throws Exception {
    StringWriter value = new StringWriter();
    try {
        value.append("\n   Running: ").append(Bukkit.getName()).append(" version ").append(Bukkit.getVersion()).append(" (Implementing API version ").append(Bukkit.getBukkitVersion()).append(") ").append(String.valueOf(net.minecraft.server.MinecraftServer.getServer().isServerInOnlineMode()));
        value.append("\n   Plugins: {");
        for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
            PluginDescriptionFile description = plugin.getDescription();
            value.append(' ').append(description.getFullName()).append(' ').append(description.getMain()).append(' ').append(Arrays.toString(description.getAuthors().toArray())).append(',');
        }
        value.append("}\n   Warnings: ").append(Bukkit.getWarningState().name());
        value.append("\n   Threads: {");
        for (Map.Entry<Thread, ? extends Object[]> entry : Thread.getAllStackTraces().entrySet()) {
            value.append(' ').append(entry.getKey().getState().name()).append(' ').append(entry.getKey().getName()).append(": ").append(Arrays.toString(entry.getValue())).append(',');
        }
        value.append("}\n   ").append(Bukkit.getScheduler().toString());
    } catch (Throwable t) {
        value.append("\n   Failed to handle CraftCrashReport:\n");
        PrintWriter writer = new PrintWriter(value);
        t.printStackTrace(writer);
        writer.flush();
    }
    return value.toString();
}
 
Example 4
Source File: SkyBlockHook.java    From CombatLogX with GNU General Public License v3.0 5 votes vote down vote up
private static void printHookInfo(CompatibilitySkyBlock expansion, String pluginName) {
    PluginManager manager = Bukkit.getPluginManager();
    if(!manager.isPluginEnabled(pluginName)) return;
    
    Plugin plugin = manager.getPlugin(pluginName);
    if(plugin == null) return;

    PluginDescriptionFile description = plugin.getDescription();
    String fullName = description.getFullName();
    
    Logger logger = expansion.getLogger();
    logger.info("Successfully hooked into " + fullName);
}
 
Example 5
Source File: HookWorldGuard.java    From CombatLogX with GNU General Public License v3.0 5 votes vote down vote up
public static WorldGuardVersion getWorldGuardVersion() {
    if(worldGuardVersion != null) return worldGuardVersion;

    PluginManager manager = Bukkit.getPluginManager();
    Plugin plugin = manager.getPlugin("WorldGuard");
    if(plugin == null) return (worldGuardVersion = WorldGuardVersion.ERROR);

    PluginDescriptionFile pdf = plugin.getDescription();
    String version = pdf.getVersion();
    if(version.startsWith("6.1")) return (worldGuardVersion = WorldGuardVersion.V6_1);
    if(version.startsWith("6.2")) return (worldGuardVersion = WorldGuardVersion.V6_2);
    if(version.startsWith("7.0")) return (worldGuardVersion = WorldGuardVersion.V7_0);

    return (worldGuardVersion = WorldGuardVersion.ERROR);
}
 
Example 6
Source File: CompatibilityCitizens.java    From CombatLogX with GNU General Public License v3.0 5 votes vote down vote up
private boolean checkForCitizens() {
    PluginManager manager = Bukkit.getPluginManager();
    if(!manager.isPluginEnabled("Citizens")) return true;
    
    Plugin plugin = manager.getPlugin("Citizens");
    if(plugin == null) return true;

    PluginDescriptionFile description = plugin.getDescription();
    String fullName = description.getFullName();
    
    Logger logger = getLogger();
    logger.info("Successfully hooked into " + fullName);
    return false;
}
 
Example 7
Source File: CompatibilityCitizens.java    From CombatLogX with GNU General Public License v3.0 5 votes vote down vote up
private boolean checkForSentinel() {
    PluginManager manager = Bukkit.getPluginManager();
    if(!manager.isPluginEnabled("Sentinel")) return false;

    Plugin plugin = manager.getPlugin("Sentinel");
    if(plugin == null) return false;

    PluginDescriptionFile description = plugin.getDescription();
    String fullName = description.getFullName();

    Logger logger = getLogger();
    logger.info("Successfully hooked into " + fullName);
    return true;
}
 
Example 8
Source File: Notifier.java    From CombatLogX with GNU General Public License v3.0 5 votes vote down vote up
private void hookIfEnabled(String pluginName) {
    PluginManager manager = Bukkit.getPluginManager();
    if(!manager.isPluginEnabled(pluginName)) return;
    
    Plugin plugin = manager.getPlugin(pluginName);
    if(plugin == null) return;

    PluginDescriptionFile description = plugin.getDescription();
    String nameAndVersion = description.getFullName();

    Logger logger = getLogger();
    logger.info("Successfully hooked into " + nameAndVersion);
}
 
Example 9
Source File: Updater.java    From HeavySpleef with GNU General Public License v3.0 5 votes vote down vote up
public Updater(Plugin plugin) {
	ExecutorService execService = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
	this.service = MoreExecutors.listeningDecorator(execService);
	this.plugin = plugin;
	this.desc = plugin.getDescription();
	this.updateFolder = plugin.getServer().getUpdateFolderFile();
	
	Bukkit.getPluginManager().registerEvents(this, plugin);
}
 
Example 10
Source File: CommandVersion.java    From HeavySpleef with GNU General Public License v3.0 5 votes vote down vote up
@Command(name = "version", descref = Messages.Help.Description.VERSION,
		usage = "/spleef version")
public void onVersionCommand(CommandContext context, HeavySpleef heavySpleef) {
	CommandSender sender = context.getSender();
	if (sender instanceof Player) {
		sender = heavySpleef.getSpleefPlayer(sender);
	}
	
	Plugin plugin = heavySpleef.getPlugin();
	PluginDescriptionFile desc = plugin.getDescription();
	
	sender.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "HeavySpleef " + ChatColor.GREEN + "v" + desc.getVersion() + ChatColor.GRAY
			+ " by " + ChatColor.GREEN + "Matze" + ChatColor.GRAY + " (matzefratze123)");
	sender.sendMessage(ChatColor.GRAY + "Visit http://dev.bukkit.org/bukkit-plugins/heavyspleef for more information");
}
 
Example 11
Source File: SkyBlockHook.java    From CombatLogX with GNU General Public License v3.0 4 votes vote down vote up
public static SkyBlockHook getSkyBlockHook(CompatibilitySkyBlock expansion) {
    if(SKYBLOCK_HOOK != null) return SKYBLOCK_HOOK;

    PluginManager manager = Bukkit.getPluginManager();
    Logger logger = expansion.getLogger();

    if(manager.isPluginEnabled("BentoBox")) {
        Plugin plugin = manager.getPlugin("BentoBox");
        if(plugin != null) {
            PluginDescriptionFile description = plugin.getDescription();
            String version = description.getVersion();
            logger.info("Checking 'BentoBox v" + version + "' for BSkyBlock");
            
            if(HookBentoBox.hookIntoBSkyBlock(logger)) {
                SKYBLOCK_HOOK = new HookBSkyBlock();
                return getSkyBlockHook(expansion);
            }
        }
    }

    if(manager.isPluginEnabled("ASkyBlock")) {
        printHookInfo(expansion, "ASkyBlock");
        SKYBLOCK_HOOK = new HookASkyBlock();
        return getSkyBlockHook(expansion);
    }

    if(manager.isPluginEnabled("FabledSkyBlock")) {
        printHookInfo(expansion, "FabledSkyBlock");
        SKYBLOCK_HOOK = new HookFabledSkyBlock();
        return getSkyBlockHook(expansion);
    }
    
    if(manager.isPluginEnabled("SuperiorSkyblock2")) {
        printHookInfo(expansion, "SuperiorSkyblock2");
        SKYBLOCK_HOOK = new HookSuperiorSkyBlock2();
        return getSkyBlockHook(expansion);
    }

    if(manager.isPluginEnabled("uSkyBlock")) {
        printHookInfo(expansion, "uSkyBlock");
        SKYBLOCK_HOOK = new HookUltimateSkyBlock();
        return getSkyBlockHook(expansion);
    }

    return null;
}