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>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiBase</artifactId>
<version>23w08b</version>
<version>23w14a</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

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

View File

@ -120,6 +120,7 @@ public class ExternalHost extends Host implements ClientHandler {
if (!served.contains(server.getName())) {
client.sendPacket(new PacketExAddServer((ExternalSubServer) server, (server.isRunning())?((ExternalSubLogger) server.getLogger()).getExternalAddress():null, data -> {
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;
}
private void stopped(Boolean allowrestart) {
void stopped(Boolean allowrestart) {
logger.stop();
history.clear();
started = false;

View File

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

View File

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

View File

@ -121,9 +121,9 @@
<archive>
<manifestFile>src/META-INF/MANIFEST.MF</manifestFile>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<descriptors>
<descriptor>../Common/jar-with-some-dependencies.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<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>
<groupId>net.ME1312.Galaxi</groupId>
<artifactId>GalaxiBase</artifactId>
<version>23w08b</version>
<version>23w14a</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -84,9 +84,11 @@
<configuration>
<finalName>SubServers.Client.Common</finalName>
<outputDirectory>../../Artifacts/Modulized</outputDirectory>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<descriptors>
<descriptor>jar-with-some-dependencies.xml</descriptor>
</descriptors>
<descriptor>
</descriptor>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>

View File

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

View File

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

View File

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

View File

@ -34,16 +34,6 @@ public class PacketExAddServer implements PacketObjectIn<Integer>, PacketObjectO
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)
*
@ -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);
}
} catch (Throwable e) {
client.sendPacket(new PacketExAddServer(2, tracker));
client.sendPacket(new PacketExAddServer(2, null, tracker));
host.log.error.println(e);
}
}
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);
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());
if (running != null) server.start(running);
client.sendPacket(new PacketExAddServer(0, tracker));
}
}

View File

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