Correct LinkServer packets & server autodetection

This commit is contained in:
ME1312 2018-11-19 12:27:06 -05:00
parent 32cd201697
commit 4ca476c1fa
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
3 changed files with 4 additions and 3 deletions

View File

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2017 ME1312
Copyright (C) 2015-2019 ME1312
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@ -31,7 +31,7 @@ public class PacketLinkServer implements PacketIn, PacketOut {
@Override
public YAMLSection generate() {
YAMLSection json = new YAMLSection();
json.set("name", plugin.subdata.getName());
if (plugin.subdata.getName() != null) json.set("name", plugin.subdata.getName());
json.set("port", Bukkit.getServer().getPort());
return json;
}

View File

@ -38,7 +38,8 @@ public class PacketLinkServer implements PacketIn, PacketOut {
@Override
public YAMLSection generate() {
YAMLSection json = new YAMLSection();
json.set("name", plugin.subdata.getName());
if (plugin.subdata.getName() != null) json.set("name", plugin.subdata.getName());
if (plugin.game.getServer().getBoundAddress().isPresent()) json.set("port", plugin.game.getServer().getBoundAddress().get());
return json;
}