Archived
0

Bridge: файл настроек

This commit is contained in:
2017-04-29 13:29:13 +03:00
parent 9ca608d7e7
commit 470ac0e97e
4 changed files with 11 additions and 4 deletions

View File

@@ -20,12 +20,13 @@ public class BridgePlugin extends JavaPlugin {
@Override
public void onEnable() {
INSTANCE = this;
client = new Client();
saveDefaultConfig();
client = new Client();
ScheduledExecutorService ses = Executors.newScheduledThreadPool(1);
sesFuture = ses.scheduleAtFixedRate(() -> {
getLogger().info(String.format("Connect(%d) to ASys...", ++tryConnect));
client.connect("127.0.0.1", 8779);
client.connect(getConfig().getString("host"), getConfig().getInt("port"));
if (client.isConnected()) {
getLogger().info(String.format("Connect(%d) OK", tryConnect));
sesFuture.cancel(false);

View File

@@ -40,7 +40,9 @@ public class ClientPacketHandler extends ChannelInboundHandlerAdapter implements
context.channel().attr(KNOWN_PACKETS).set(handshakePackets);
context.channel().attr(KNOWN_HANDLERS).set(handshakeHandlers);
CS_Handshake packet = new CS_Handshake("SpigotServer0", "testpassphrase");
CS_Handshake packet = new CS_Handshake(
BridgePlugin.INSTANCE.getConfig().getString("clientId"),
BridgePlugin.INSTANCE.getConfig().getString("passcode"));
context.channel().writeAndFlush(packet);
}

View File

@@ -0,0 +1,4 @@
clientId: SpigotServer0
host: 127.0.0.1
port: 8779
passcode: testpassphrase