Merge branch 'modular' of https://github.com/MylesIsCool/ViaVersion into modular

This commit is contained in:
Matsv 2016-09-30 20:09:03 +02:00
commit 313b794285
No known key found for this signature in database
GPG Key ID: 97CEC2A2EA31350F
3 changed files with 19 additions and 5 deletions

View File

@ -19,11 +19,16 @@ import us.myles.ViaVersion.bungee.commands.BungeeCommand;
import us.myles.ViaVersion.bungee.commands.BungeeCommandHandler;
import us.myles.ViaVersion.bungee.commands.BungeeCommandSender;
import us.myles.ViaVersion.bungee.platform.*;
import us.myles.ViaVersion.dump.PluginInfo;
import us.myles.ViaVersion.util.GsonUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
public class Bungee extends Plugin implements ViaPlatform, Listener {
public class BungeePlugin extends Plugin implements ViaPlatform, Listener {
private BungeeViaAPI api;
private BungeeConfigAPI config;
@ -137,7 +142,16 @@ public class Bungee extends Plugin implements ViaPlatform, Listener {
@Override
public JsonObject getDump() {
return new JsonObject();
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(), Arrays.asList(p.getDescription().getAuthor())));
platformSpecific.add("plugins", GsonUtil.getGson().toJsonTree(plugins));
// TODO more? ProtocolLib things etc?
return platformSpecific;
}
@EventHandler

View File

@ -1,4 +1,4 @@
name: ViaVersion
main: us.myles.ViaVersion.Bungee
author: _MylesC
main: us.myles.ViaVersion.BungeePlugin
author: _MylesC, Matsv
version: ${project.version}

View File

@ -57,7 +57,7 @@ public class DumpSubCmd extends ViaSubCommand {
con.setDoOutput(true);
OutputStream out = con.getOutputStream();
out.write(GsonUtil.getGson().toJson(template).getBytes(Charset.forName("UTF-8")));
out.write(GsonUtil.getGsonBuilder().setPrettyPrinting().create().toJson(template).getBytes(Charset.forName("UTF-8")));
out.close();
JsonObject output = GsonUtil.getGson().fromJson(new InputStreamReader(con.getInputStream()), JsonObject.class);