Search in sources :

Example 1 with NCPHook

use of fr.neatmonster.nocheatplus.hooks.NCPHook in project NoCheatPlus by NoCheatPlus.

the class VersionCommand method getVersionInfo.

public static List<String> getVersionInfo() {
    final List<String> lines = new LinkedList<String>();
    final MCAccess mcAccess = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(MCAccess.class);
    lines.addAll(Arrays.asList(new String[] { "---- Version information ----", "#### Server ####", alt(Bukkit.getServer().getVersion()), "  detected: " + alt(ServerVersion.getMinecraftVersion()), "#### NoCheatPlus ####", "Plugin: " + alt(Bukkit.getPluginManager().getPlugin("NoCheatPlus").getDescription().getVersion()), "MCAccess: " + alt(mcAccess.getMCVersion() + " / " + mcAccess.getServerVersionTag()) }));
    final Map<String, Set<String>> featureTags = NCPAPIProvider.getNoCheatPlusAPI().getAllFeatureTags();
    if (!featureTags.isEmpty()) {
        final List<String> features = new LinkedList<String>();
        // Add present features.
        for (final Entry<String, Set<String>> entry : featureTags.entrySet()) {
            features.add(alt("  " + entry.getKey() + ": " + StringUtil.join(entry.getValue(), " | ")));
        }
        // Sort and add.
        Collections.sort(features, String.CASE_INSENSITIVE_ORDER);
        features.add(0, "Features:");
        lines.addAll(features);
    }
    final Collection<NCPHook> hooks = NCPHookManager.getAllHooks();
    if (!hooks.isEmpty()) {
        final List<String> fullNames = new LinkedList<String>();
        for (final NCPHook hook : hooks) {
            fullNames.add(alt(hook.getHookName() + " " + hook.getHookVersion()));
        }
        Collections.sort(fullNames, String.CASE_INSENSITIVE_ORDER);
        lines.add("Hooks: " + StringUtil.join(fullNames, " | "));
    }
    final List<String> relatedPlugins = new LinkedList<String>();
    for (final String name : new String[] { "CompatNoCheatPlus", "ProtocolLib", "ViaVersion", "ProtocolSupport", "PNCP", "NTAC" }) {
        Plugin plugin = Bukkit.getPluginManager().getPlugin(name);
        if (plugin != null) {
            relatedPlugins.add(alt(plugin.getDescription().getFullName()));
        }
    }
    if (!relatedPlugins.isEmpty()) {
        lines.add("#### Related Plugins ####");
        lines.add(StringUtil.join(relatedPlugins, " | "));
    }
    return lines;
}
Also used : MCAccess(fr.neatmonster.nocheatplus.compat.MCAccess) Set(java.util.Set) NCPHook(fr.neatmonster.nocheatplus.hooks.NCPHook) LinkedList(java.util.LinkedList) Plugin(org.bukkit.plugin.Plugin) JavaPlugin(org.bukkit.plugin.java.JavaPlugin)

Aggregations

MCAccess (fr.neatmonster.nocheatplus.compat.MCAccess)1 NCPHook (fr.neatmonster.nocheatplus.hooks.NCPHook)1 LinkedList (java.util.LinkedList)1 Set (java.util.Set)1 Plugin (org.bukkit.plugin.Plugin)1 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)1