Reduced and updated dependancies

Also includes potential fixes for external host state desyncing
This commit is contained in:
ME1312 2023-04-07 22:47:16 -04:00
parent 01456fd964
commit ecf76a97de
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
14 changed files with 53 additions and 39 deletions

View File

@ -28,7 +28,7 @@
<dependency> <dependency>
<groupId>net.ME1312.Galaxi</groupId> <groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiBase</artifactId> <artifactId>GalaxiBase</artifactId>
<version>23w08b</version> <version>23w14a</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -126,9 +126,9 @@
<archive> <archive>
<manifestFile>src/META-INF/MANIFEST.MF</manifestFile> <manifestFile>src/META-INF/MANIFEST.MF</manifestFile>
</archive> </archive>
<descriptorRefs> <descriptors>
<descriptorRef>jar-with-dependencies</descriptorRef> <descriptor>../SubServers.Client/Common/jar-with-some-dependencies.xml</descriptor>
</descriptorRefs> </descriptors>
<appendAssemblyId>false</appendAssemblyId> <appendAssemblyId>false</appendAssemblyId>
</configuration> </configuration>
<executions> <executions>

View File

@ -120,6 +120,7 @@ public class ExternalHost extends Host implements ClientHandler {
if (!served.contains(server.getName())) { if (!served.contains(server.getName())) {
client.sendPacket(new PacketExAddServer((ExternalSubServer) server, (server.isRunning())?((ExternalSubLogger) server.getLogger()).getExternalAddress():null, data -> { client.sendPacket(new PacketExAddServer((ExternalSubServer) server, (server.isRunning())?((ExternalSubLogger) server.getLogger()).getExternalAddress():null, data -> {
if (data.contains(0x0002)) ((ExternalSubServer) server).started(data.getUUID(0x0002)); if (data.contains(0x0002)) ((ExternalSubServer) server).started(data.getUUID(0x0002));
else if (server.isRunning()) ((ExternalSubServer) server).stopped(false);
})); }));
} }
} }

View File

@ -158,7 +158,7 @@ public class ExternalSubServer extends SubServerImpl {
} else return false; } else return false;
} else return false; } else return false;
} }
private void stopped(Boolean allowrestart) { void stopped(Boolean allowrestart) {
logger.stop(); logger.stop();
history.clear(); history.clear();
started = false; started = false;

View File

@ -15,6 +15,7 @@ import net.ME1312.SubServers.Bungee.SubProxy;
import com.dosse.upnp.UPnP; import com.dosse.upnp.UPnP;
import com.google.common.collect.Range; import com.google.common.collect.Range;
import com.google.gson.Gson;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
@ -185,7 +186,7 @@ public class InternalHost extends Host {
} }
if (!to.exists()) to.mkdirs(); if (!to.exists()) to.mkdirs();
FileWriter writer = new FileWriter(new File(to, "info.json"), false); FileWriter writer = new FileWriter(new File(to, "info.json"), false);
writer.write(info.toJSON().toString()); writer.write(new Gson().toJson(info.get()));
writer.close(); writer.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -606,7 +606,7 @@ public class InternalSubCreator extends SubCreator {
YAMLSection config = new YAMLSection(); YAMLSection config = new YAMLSection();
FileWriter writer = new FileWriter(new File(dir, "subdata.json"), false); FileWriter writer = new FileWriter(new File(dir, "subdata.json"), false);
config.setAll(getSubData()); config.setAll(getSubData());
writer.write(config.toJSON().toString()); writer.write(new Gson().toJson(config.get()));
writer.close(); writer.close();
if (!new File(dir, "subdata.rsa.key").exists() && new File("SubServers/subdata.rsa.key").exists()) { if (!new File(dir, "subdata.rsa.key").exists() && new File("SubServers/subdata.rsa.key").exists()) {

View File

@ -121,9 +121,9 @@
<archive> <archive>
<manifestFile>src/META-INF/MANIFEST.MF</manifestFile> <manifestFile>src/META-INF/MANIFEST.MF</manifestFile>
</archive> </archive>
<descriptorRefs> <descriptors>
<descriptorRef>jar-with-dependencies</descriptorRef> <descriptor>../Common/jar-with-some-dependencies.xml</descriptor>
</descriptorRefs> </descriptors>
<appendAssemblyId>false</appendAssemblyId> <appendAssemblyId>false</appendAssemblyId>
</configuration> </configuration>
<executions> <executions>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.1 https://maven.apache.org/xsd/assembly-2.1.1.xsd">
<id>jar-with-some-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
<excludes>
<exclude>org.json:json</exclude>
<exclude>org.yaml:snakeyaml</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>

View File

@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>net.ME1312.Galaxi</groupId> <groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiBase</artifactId> <artifactId>GalaxiBase</artifactId>
<version>23w08b</version> <version>23w14a</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -84,9 +84,11 @@
<configuration> <configuration>
<finalName>SubServers.Client.Common</finalName> <finalName>SubServers.Client.Common</finalName>
<outputDirectory>../../Artifacts/Modulized</outputDirectory> <outputDirectory>../../Artifacts/Modulized</outputDirectory>
<descriptorRefs> <descriptors>
<descriptorRef>jar-with-dependencies</descriptorRef> <descriptor>jar-with-some-dependencies.xml</descriptor>
</descriptorRefs> </descriptors>
<descriptor>
</descriptor>
<appendAssemblyId>false</appendAssemblyId> <appendAssemblyId>false</appendAssemblyId>
</configuration> </configuration>
<executions> <executions>

View File

@ -91,9 +91,9 @@
<archive> <archive>
<manifestFile>src/META-INF/MANIFEST.MF</manifestFile> <manifestFile>src/META-INF/MANIFEST.MF</manifestFile>
</archive> </archive>
<descriptorRefs> <descriptors>
<descriptorRef>jar-with-dependencies</descriptorRef> <descriptor>../Common/jar-with-some-dependencies.xml</descriptor>
</descriptorRefs> </descriptors>
<appendAssemblyId>false</appendAssemblyId> <appendAssemblyId>false</appendAssemblyId>
</configuration> </configuration>
<executions> <executions>

View File

@ -44,9 +44,9 @@
<archive> <archive>
<manifestFile>MANIFEST.MF</manifestFile> <manifestFile>MANIFEST.MF</manifestFile>
</archive> </archive>
<descriptorRefs> <descriptors>
<descriptorRef>jar-with-dependencies</descriptorRef> <descriptor>../Common/jar-with-some-dependencies.xml</descriptor>
</descriptorRefs> </descriptors>
<appendAssemblyId>false</appendAssemblyId> <appendAssemblyId>false</appendAssemblyId>
</configuration> </configuration>
<executions> <executions>

View File

@ -17,8 +17,8 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.fusesource.jansi</groupId> <groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId> <!--suppress MavenPackageUpdate--> <artifactId>jansi</artifactId>
<version>1.18</version> <version>2.4.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -30,13 +30,13 @@
<dependency> <dependency>
<groupId>net.ME1312.Galaxi</groupId> <groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiEngine</artifactId> <artifactId>GalaxiEngine</artifactId>
<version>23w08b</version> <version>23w14a</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.ME1312.Galaxi</groupId> <groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiUI</artifactId> <artifactId>GalaxiUI</artifactId>
<version>23w08b</version> <version>23w14a</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -34,16 +34,6 @@ public class PacketExAddServer implements PacketObjectIn<Integer>, PacketObjectO
this.host = host; this.host = host;
} }
/**
* New PacketExAddServer (Out)
*
* @param response Response ID
* @param tracker Receiver ID
*/
public PacketExAddServer(int response, UUID tracker) {
this(response, null, tracker);
}
/** /**
* New PacketExAddServer (Out) * New PacketExAddServer (Out)
* *
@ -102,16 +92,16 @@ public class PacketExAddServer implements PacketObjectIn<Integer>, PacketObjectO
init(client.getConnection(), new SubServerImpl(host, name, enabled, port, log, dir, exec, stopcmd), running, tracker, logger); init(client.getConnection(), new SubServerImpl(host, name, enabled, port, log, dir, exec, stopcmd), running, tracker, logger);
} }
} catch (Throwable e) { } catch (Throwable e) {
client.sendPacket(new PacketExAddServer(2, tracker)); client.sendPacket(new PacketExAddServer(2, null, tracker));
host.log.error.println(e); host.log.error.println(e);
} }
} }
private void init(SubDataClient client, SubServerImpl server, UUID running, UUID tracker, Logger logger) { private void init(SubDataClient client, SubServerImpl server, UUID running, UUID tracker, Logger logger) {
client.sendPacket(new PacketExAddServer(0, running, tracker));
host.servers.put(server.getName().toLowerCase(), server); host.servers.put(server.getName().toLowerCase(), server);
if (UPnP.isUPnPAvailable() && host.config.get().getMap("Settings").getMap("UPnP", new ObjectMap<String>()).getBoolean("Forward-Servers", false)) UPnP.openPortTCP(server.getPort()); if (UPnP.isUPnPAvailable() && host.config.get().getMap("Settings").getMap("UPnP", new ObjectMap<String>()).getBoolean("Forward-Servers", false)) UPnP.openPortTCP(server.getPort());
logger.info("Added SubServer: " + server.getName()); logger.info("Added SubServer: " + server.getName());
if (running != null) server.start(running); if (running != null) server.start(running);
client.sendPacket(new PacketExAddServer(0, tracker));
} }
} }

View File

@ -124,9 +124,9 @@
<archive> <archive>
<manifestFile>../src/META-INF/MANIFEST.MF</manifestFile> <manifestFile>../src/META-INF/MANIFEST.MF</manifestFile>
</archive> </archive>
<descriptorRefs> <descriptors>
<descriptorRef>jar-with-dependencies</descriptorRef> <descriptor>../../SubServers.Client/Common/jar-with-some-dependencies.xml</descriptor>
</descriptorRefs> </descriptors>
<appendAssemblyId>false</appendAssemblyId> <appendAssemblyId>false</appendAssemblyId>
</configuration> </configuration>
<executions> <executions>