Automatic ip & port for plugins (#438)

* Automatically set Bukkit ip and port

* Automatically set Velocity ip and port

* Automatically set BungeeCord ip and port

* Moved the config init line to prevent config issues

* Automatically set Sponge ip and port
This commit is contained in:
rtm516 2020-04-27 21:45:14 +01:00 committed by GitHub
parent fc17b7cc7a
commit 7f29710006
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 76 additions and 10 deletions

View file

@ -25,11 +25,11 @@
package org.geysermc.platform.bukkit;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.geysermc.common.PlatformType;
import org.geysermc.common.command.ICommandManager;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.common.bootstrap.IGeyserBootstrap;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.command.CommandManager;
import org.geysermc.platform.bukkit.command.GeyserBukkitCommandExecutor;
import org.geysermc.platform.bukkit.command.GeyserBukkitCommandManager;
@ -54,6 +54,15 @@ public class GeyserBukkitPlugin extends JavaPlugin implements IGeyserBootstrap {
saveConfig();
}
// Don't change the ip if its listening on all interfaces
// By default this should be 127.0.0.1 but may need to be changed in some circumstances
if (!Bukkit.getIp().equals("0.0.0.0")) {
getConfig().set("remote.address", Bukkit.getIp());
}
getConfig().set("remote.port", Bukkit.getPort());
saveConfig();
this.geyserLogger = new GeyserBukkitLogger(getLogger(), geyserConfig.isDebugMode());
this.connector = GeyserConnector.start(PlatformType.BUKKIT, this);