BungeeCord and Velocity info forwarding support

This commit is contained in:
Nanit
2020-11-27 20:11:43 +02:00
parent d4e553e4be
commit 7953244f80
15 changed files with 280 additions and 47 deletions

View File

@@ -12,6 +12,7 @@ import ru.nanit.limbo.protocol.packets.play.PacketBossBar;
import ru.nanit.limbo.protocol.packets.play.PacketChatMessage;
import ru.nanit.limbo.server.data.*;
import ru.nanit.limbo.util.Logger;
import ru.nanit.limbo.util.VelocityUtil;
import ru.nanit.limbo.world.DimensionRegistry;
import java.net.SocketAddress;
@@ -64,6 +65,10 @@ public final class LimboServer {
Logger.setLevel(config.getDebugLevel());
if (config.getInfoForwarding().isModern()){
VelocityUtil.init(config);
}
dimensionRegistry = new DimensionRegistry();
dimensionRegistry.load(config.getDimensionType());

View File

@@ -4,19 +4,31 @@ import napi.configurate.data.ConfigNode;
import napi.configurate.serializing.NodeSerializer;
import napi.configurate.serializing.NodeSerializingException;
import java.util.Optional;
import java.nio.charset.StandardCharsets;
public class InfoForwarding {
private Type type;
private String secret;
private byte[] secretKey;
public Type getType() {
return type;
}
public Optional<String> getSecret() {
return Optional.ofNullable(secret);
public byte[] getSecretKey() {
return secretKey;
}
public boolean isNone(){
return type == Type.NONE;
}
public boolean isLegacy(){
return type == Type.LEGACY;
}
public boolean isModern(){
return type == Type.MODERN;
}
public enum Type {
@@ -38,14 +50,14 @@ public class InfoForwarding {
}
if (forwarding.type == Type.MODERN){
forwarding.secret = node.getNode("secret").getString();
forwarding.secretKey = node.getNode("secret").getString().getBytes(StandardCharsets.UTF_8);
}
return forwarding;
}
@Override
public void serialize(InfoForwarding infoForwarding, ConfigNode configNode) throws NodeSerializingException {
public void serialize(InfoForwarding infoForwarding, ConfigNode configNode) {
}
}