mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2026-02-10 19:06:14 +01:00
BungeeCord and Velocity info forwarding support
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user