Search in sources :

Example 1 with PluginInfo

use of com.viaversion.viaversion.dump.PluginInfo in project ViaVersion by ViaVersion.

the class ViaVersionPlugin method getDump.

@Override
public JsonObject getDump() {
    JsonObject platformSpecific = new JsonObject();
    List<PluginInfo> plugins = new ArrayList<>();
    for (Plugin p : Bukkit.getPluginManager().getPlugins()) plugins.add(new PluginInfo(p.isEnabled(), p.getDescription().getName(), p.getDescription().getVersion(), p.getDescription().getMain(), p.getDescription().getAuthors()));
    platformSpecific.add("plugins", GsonUtil.getGson().toJsonTree(plugins));
    return platformSpecific;
}
Also used : ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject) PluginInfo(com.viaversion.viaversion.dump.PluginInfo) Plugin(org.bukkit.plugin.Plugin) JavaPlugin(org.bukkit.plugin.java.JavaPlugin)

Example 2 with PluginInfo

use of com.viaversion.viaversion.dump.PluginInfo in project ViaVersion by ViaVersion.

the class BungeePlugin method getDump.

@Override
public JsonObject getDump() {
    JsonObject platformSpecific = new JsonObject();
    List<PluginInfo> plugins = new ArrayList<>();
    for (Plugin p : ProxyServer.getInstance().getPluginManager().getPlugins()) plugins.add(new PluginInfo(true, p.getDescription().getName(), p.getDescription().getVersion(), p.getDescription().getMain(), Collections.singletonList(p.getDescription().getAuthor())));
    platformSpecific.add("plugins", GsonUtil.getGson().toJsonTree(plugins));
    platformSpecific.add("servers", GsonUtil.getGson().toJsonTree(ProtocolDetectorService.getDetectedIds()));
    return platformSpecific;
}
Also used : ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject) PluginInfo(com.viaversion.viaversion.dump.PluginInfo) Plugin(net.md_5.bungee.api.plugin.Plugin)

Example 3 with PluginInfo

use of com.viaversion.viaversion.dump.PluginInfo in project ViaVersion by ViaVersion.

the class SpongePlugin method getDump.

@Override
public JsonObject getDump() {
    JsonObject platformSpecific = new JsonObject();
    List<PluginInfo> plugins = new ArrayList<>();
    for (PluginContainer plugin : game.pluginManager().plugins()) {
        PluginMetadata metadata = plugin.metadata();
        plugins.add(new PluginInfo(true, metadata.name().orElse("Unknown"), metadata.version().toString(), plugin.instance().getClass().getCanonicalName(), metadata.contributors().stream().map(PluginContributor::name).collect(Collectors.toList())));
    }
    platformSpecific.add("plugins", GsonUtil.getGson().toJsonTree(plugins));
    return platformSpecific;
}
Also used : PluginContainer(org.spongepowered.plugin.PluginContainer) ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject) PluginInfo(com.viaversion.viaversion.dump.PluginInfo) PluginMetadata(org.spongepowered.plugin.metadata.PluginMetadata)

Example 4 with PluginInfo

use of com.viaversion.viaversion.dump.PluginInfo in project ViaVersion by ViaVersion.

the class VelocityPlugin method getDump.

@Override
public JsonObject getDump() {
    JsonObject extra = new JsonObject();
    List<PluginInfo> plugins = new ArrayList<>();
    for (PluginContainer p : PROXY.getPluginManager().getPlugins()) {
        plugins.add(new PluginInfo(true, p.getDescription().getName().orElse(p.getDescription().getId()), p.getDescription().getVersion().orElse("Unknown Version"), p.getInstance().isPresent() ? p.getInstance().get().getClass().getCanonicalName() : "Unknown", p.getDescription().getAuthors()));
    }
    extra.add("plugins", GsonUtil.getGson().toJsonTree(plugins));
    extra.add("servers", GsonUtil.getGson().toJsonTree(ProtocolDetectorService.getDetectedIds()));
    return extra;
}
Also used : PluginContainer(com.velocitypowered.api.plugin.PluginContainer) ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject) PluginInfo(com.viaversion.viaversion.dump.PluginInfo)

Aggregations

JsonObject (com.google.gson.JsonObject)4 PluginInfo (com.viaversion.viaversion.dump.PluginInfo)4 ArrayList (java.util.ArrayList)4 PluginContainer (com.velocitypowered.api.plugin.PluginContainer)1 Plugin (net.md_5.bungee.api.plugin.Plugin)1 Plugin (org.bukkit.plugin.Plugin)1 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)1 PluginContainer (org.spongepowered.plugin.PluginContainer)1 PluginMetadata (org.spongepowered.plugin.metadata.PluginMetadata)1