mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-25 03:35:26 +01:00
Don't remote reload SubData
It doesn't make any sense to be doing this...
This commit is contained in:
parent
2841bdf061
commit
c261be2215
@ -25,7 +25,7 @@ public class PacketInExReload implements PacketObjectIn<Integer> {
|
||||
@Override
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
if (data != null && data.contains(0x0000)) Bukkit.getLogger().warning("SubData > Received request for a plugin reload: " + data.getString(0x0000));
|
||||
else Bukkit.getLogger().warning("SubData > Received request for a plugin reload");
|
||||
// else Bukkit.getLogger().warning("SubData > Received request for a plugin reload");
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try {
|
||||
plugin.reload(true);
|
||||
|
@ -85,12 +85,38 @@ public final class SubPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
reload(false);
|
||||
|
||||
subdata.put(0, null);
|
||||
subprotocol = SubProtocol.get();
|
||||
subprotocol.registerCipher("DHE", DHE.get(128));
|
||||
subprotocol.registerCipher("DHE-128", DHE.get(128));
|
||||
subprotocol.registerCipher("DHE-192", DHE.get(192));
|
||||
subprotocol.registerCipher("DHE-256", DHE.get(256));
|
||||
reload(false);
|
||||
subprotocol.setBlockSize(config.get().getMap("Settings").getMap("SubData").getLong("Block-Size", (long) DataSize.MB));
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", System.getenv("name"));
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
|
||||
System.out.println("SubData > AES Encryption Available");
|
||||
}
|
||||
if (new UniversalFile(getDataFolder(), "subdata.rsa.key").exists()) {
|
||||
try {
|
||||
subprotocol.registerCipher("RSA", new RSA(new UniversalFile(getDataFolder(), "subdata.rsa.key")));
|
||||
System.out.println("SubData > RSA Encryption Available");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
reconnect = true;
|
||||
System.out.println("SubData > ");
|
||||
System.out.println("SubData > Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
connect(null);
|
||||
|
||||
if (!config.get().getMap("Settings").getBoolean("API-Only-Mode", false)) {
|
||||
CommandMap cmd = Util.reflect(Bukkit.getServer().getClass().getDeclaredField("commandMap"), Bukkit.getServer());
|
||||
@ -130,51 +156,11 @@ public final class SubPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void reload(boolean notifyPlugins) throws IOException {
|
||||
reconnect = false;
|
||||
resetDate = Calendar.getInstance().getTime().getTime();
|
||||
ArrayList<SubDataClient> tmp = new ArrayList<SubDataClient>();
|
||||
tmp.addAll(subdata.values());
|
||||
for (SubDataClient client : tmp) if (client != null) {
|
||||
client.close();
|
||||
Util.isException(client::waitFor);
|
||||
}
|
||||
subdata.clear();
|
||||
subdata.put(0, null);
|
||||
|
||||
ConfigUpdater.updateConfig(new UniversalFile(getDataFolder(), "config.yml"));
|
||||
config.reload();
|
||||
|
||||
subprotocol.unregisterCipher("AES");
|
||||
subprotocol.unregisterCipher("AES-128");
|
||||
subprotocol.unregisterCipher("AES-192");
|
||||
subprotocol.unregisterCipher("AES-256");
|
||||
subprotocol.unregisterCipher("RSA");
|
||||
|
||||
subprotocol.setBlockSize(config.get().getMap("Settings").getMap("SubData").getLong("Block-Size", (long) DataSize.MB));
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", System.getenv("name"));
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
|
||||
System.out.println("SubData > AES Encryption Available");
|
||||
}
|
||||
if (new UniversalFile(getDataFolder(), "subdata.rsa.key").exists()) {
|
||||
try {
|
||||
subprotocol.registerCipher("RSA", new RSA(new UniversalFile(getDataFolder(), "subdata.rsa.key")));
|
||||
System.out.println("SubData > RSA Encryption Available");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
reconnect = true;
|
||||
System.out.println("SubData > ");
|
||||
System.out.println("SubData > Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
connect(null);
|
||||
|
||||
if (notifyPlugins) {
|
||||
List<Runnable> listeners = api.reloadListeners;
|
||||
if (listeners.size() > 0) {
|
||||
|
@ -30,7 +30,7 @@ public class PacketInExReload implements PacketObjectIn<Integer> {
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||
if (data != null && data.contains(0x0000)) log.warning("Received request for a plugin reload: " + data.getString(0x0000));
|
||||
else log.warning("Received request for a plugin reload");
|
||||
// else log.warning("Received request for a plugin reload");
|
||||
Sponge.getScheduler().createTaskBuilder().async().execute(() -> {
|
||||
try {
|
||||
plugin.reload(true);
|
||||
|
@ -104,12 +104,39 @@ public final class SubPlugin {
|
||||
}
|
||||
|
||||
running = true;
|
||||
reload(false);
|
||||
|
||||
subdata.put(0, null);
|
||||
subprotocol = SubProtocol.get();
|
||||
subprotocol.registerCipher("DHE", DHE.get(128));
|
||||
subprotocol.registerCipher("DHE-128", DHE.get(128));
|
||||
subprotocol.registerCipher("DHE-192", DHE.get(192));
|
||||
subprotocol.registerCipher("DHE-256", DHE.get(256));
|
||||
reload(false);
|
||||
subprotocol.setBlockSize(config.get().getMap("Settings").getMap("SubData").getLong("Block-Size", (long) DataSize.MB));
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", System.getenv("name"));
|
||||
Logger log = LoggerFactory.getLogger("SubData");
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
|
||||
log.info("AES Encryption Available");
|
||||
}
|
||||
if (new UniversalFile(dir, "subdata.rsa.key").exists()) {
|
||||
try {
|
||||
subprotocol.registerCipher("RSA", new RSA(new UniversalFile(dir, "subdata.rsa.key")));
|
||||
log.info("RSA Encryption Available");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
reconnect = true;
|
||||
log.info(" ");
|
||||
log.info("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
connect(null);
|
||||
|
||||
if (!config.get().getMap("Settings").getBoolean("API-Only-Mode", false)) {
|
||||
//gui = new InternalUIHandler(this);
|
||||
@ -143,52 +170,11 @@ public final class SubPlugin {
|
||||
|
||||
|
||||
public void reload(boolean notifyPlugins) throws IOException {
|
||||
reconnect = false;
|
||||
resetDate = Calendar.getInstance().getTime().getTime();
|
||||
ArrayList<SubDataClient> tmp = new ArrayList<SubDataClient>();
|
||||
tmp.addAll(subdata.values());
|
||||
for (SubDataClient client : tmp) if (client != null) {
|
||||
client.close();
|
||||
Util.isException(client::waitFor);
|
||||
}
|
||||
subdata.clear();
|
||||
subdata.put(0, null);
|
||||
|
||||
ConfigUpdater.updateConfig(new UniversalFile(dir, "config.yml"));
|
||||
config.reload();
|
||||
|
||||
subprotocol.unregisterCipher("AES");
|
||||
subprotocol.unregisterCipher("AES-128");
|
||||
subprotocol.unregisterCipher("AES-192");
|
||||
subprotocol.unregisterCipher("AES-256");
|
||||
subprotocol.unregisterCipher("RSA");
|
||||
|
||||
subprotocol.setBlockSize(config.get().getMap("Settings").getMap("SubData").getLong("Block-Size", (long) DataSize.MB));
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", System.getenv("name"));
|
||||
Logger log = LoggerFactory.getLogger("SubData");
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
|
||||
log.info("AES Encryption Available");
|
||||
}
|
||||
if (new UniversalFile(dir, "subdata.rsa.key").exists()) {
|
||||
try {
|
||||
subprotocol.registerCipher("RSA", new RSA(new UniversalFile(dir, "subdata.rsa.key")));
|
||||
log.info("RSA Encryption Available");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
reconnect = true;
|
||||
log.info(" ");
|
||||
log.info("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
connect(null);
|
||||
|
||||
if (notifyPlugins) {
|
||||
List<Runnable> listeners = api.reloadListeners;
|
||||
if (listeners.size() > 0) {
|
||||
|
@ -170,17 +170,44 @@ public final class ExHost {
|
||||
Util.reflect(SubLoggerImpl.class.getDeclaredField("logn"), null, config.get().getMap("Settings").getBoolean("Network-Log", true));
|
||||
Util.reflect(SubLoggerImpl.class.getDeclaredField("logc"), null, config.get().getMap("Settings").getBoolean("Console-Log", true));
|
||||
|
||||
loadDefaults();
|
||||
engine.getPluginManager().loadPlugins(new UniversalFile(engine.getRuntimeDirectory(), "Plugins"));
|
||||
|
||||
running = true;
|
||||
creator = new SubCreatorImpl(this);
|
||||
reload(false);
|
||||
|
||||
subdata.put(0, null);
|
||||
subprotocol = SubProtocol.get();
|
||||
subprotocol.registerCipher("DHE", DHE.get(128));
|
||||
subprotocol.registerCipher("DHE-128", DHE.get(128));
|
||||
subprotocol.registerCipher("DHE-192", DHE.get(192));
|
||||
subprotocol.registerCipher("DHE-256", DHE.get(256));
|
||||
loadDefaults();
|
||||
reload(false);
|
||||
subprotocol.setBlockSize(config.get().getMap("Settings").getMap("SubData").getLong("Block-Size", (long) DataSize.MB));
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", null);
|
||||
Logger log = new Logger("SubData");
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
|
||||
log.info.println("AES Encryption Available");
|
||||
}
|
||||
if (new UniversalFile(engine.getRuntimeDirectory(), "subdata.rsa.key").exists()) {
|
||||
try {
|
||||
subprotocol.registerCipher("RSA", new RSA(new UniversalFile(engine.getRuntimeDirectory(), "subdata.rsa.key")));
|
||||
log.info.println("RSA Encryption Available");
|
||||
} catch (Exception e) {
|
||||
log.error.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
reconnect = true;
|
||||
log.info.println();
|
||||
log.info.println("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
connect(log.toPrimitive(), null);
|
||||
|
||||
new Metrics(this);
|
||||
info.setUpdateChecker(() -> {
|
||||
@ -224,52 +251,11 @@ public final class ExHost {
|
||||
|
||||
public void reload(boolean notifyPlugins) throws IOException {
|
||||
resetDate = Calendar.getInstance().getTime().getTime();
|
||||
reconnect = false;
|
||||
ArrayList<SubDataClient> tmp = new ArrayList<SubDataClient>();
|
||||
tmp.addAll(subdata.values());
|
||||
for (SubDataClient client : tmp) if (client != null) {
|
||||
client.close();
|
||||
Util.isException(client::waitFor);
|
||||
}
|
||||
subdata.clear();
|
||||
subdata.put(0, null);
|
||||
|
||||
ConfigUpdater.updateConfig(new UniversalFile(engine.getRuntimeDirectory(), "config.yml"));
|
||||
config.reload();
|
||||
creator.load(false);
|
||||
|
||||
subprotocol.unregisterCipher("AES");
|
||||
subprotocol.unregisterCipher("AES-128");
|
||||
subprotocol.unregisterCipher("AES-192");
|
||||
subprotocol.unregisterCipher("AES-256");
|
||||
subprotocol.unregisterCipher("RSA");
|
||||
|
||||
subprotocol.setBlockSize(config.get().getMap("Settings").getMap("SubData").getLong("Block-Size", (long) DataSize.MB));
|
||||
api.name = config.get().getMap("Settings").getMap("SubData").getString("Name", null);
|
||||
Logger log = new Logger("SubData");
|
||||
|
||||
if (config.get().getMap("Settings").getMap("SubData").getRawString("Password", "").length() > 0) {
|
||||
subprotocol.registerCipher("AES", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-128", new AES(128, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-192", new AES(192, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
subprotocol.registerCipher("AES-256", new AES(256, config.get().getMap("Settings").getMap("SubData").getRawString("Password")));
|
||||
|
||||
log.info.println("AES Encryption Available");
|
||||
}
|
||||
if (new UniversalFile(engine.getRuntimeDirectory(), "subdata.rsa.key").exists()) {
|
||||
try {
|
||||
subprotocol.registerCipher("RSA", new RSA(new UniversalFile(engine.getRuntimeDirectory(), "subdata.rsa.key")));
|
||||
log.info.println("RSA Encryption Available");
|
||||
} catch (Exception e) {
|
||||
log.error.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
reconnect = true;
|
||||
log.info.println();
|
||||
log.info.println("Connecting to /" + config.get().getMap("Settings").getMap("SubData").getRawString("Address", "127.0.0.1:4391"));
|
||||
connect(log.toPrimitive(), null);
|
||||
|
||||
if (notifyPlugins) {
|
||||
engine.getPluginManager().executeEvent(new GalaxiReloadEvent(engine));
|
||||
}
|
||||
@ -280,7 +266,7 @@ public final class ExHost {
|
||||
if (disconnect == null || (this.reconnect && reconnect > 0 && disconnect.key() != DisconnectReason.PROTOCOL_MISMATCH && disconnect.key() != DisconnectReason.ENCRYPTION_MISMATCH)) {
|
||||
long reset = resetDate;
|
||||
Timer timer = new Timer(SubAPI.getInstance().getAppInfo().getName() + "::SubData_Reconnect_Handler");
|
||||
if (disconnect != null) ;
|
||||
if (disconnect != null) log.info("Attempting reconnect in " + reconnect + " seconds");
|
||||
timer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -28,7 +28,7 @@ public class PacketInExReload implements PacketObjectIn<Integer> {
|
||||
public void receive(SubDataSender client, ObjectMap<Integer> data) {
|
||||
Logger log = Util.getDespiteException(() -> Util.reflect(SubDataClient.class.getDeclaredField("log"), client.getConnection()), null);
|
||||
if (data != null && data.contains(0x0000)) log.warning("Received request for a plugin reload: " + data.getString(0x0000));
|
||||
else log.warning("Received request for a plugin reload");
|
||||
// else log.warning("Received request for a plugin reload");
|
||||
new Thread(() -> {
|
||||
try {
|
||||
host.reload(true);
|
||||
|
Loading…
Reference in New Issue
Block a user