mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-20 19:52:45 +02:00
Optional getOrElse to Sponge ServerProperties
This commit is contained in:
parent
4dba49f241
commit
a6cc365563
|
@ -5,6 +5,8 @@ import net.md_5.bungee.api.ProxyServer;
|
|||
import org.bukkit.Server;
|
||||
import org.spongepowered.api.Game;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
/**
|
||||
* Class responsible for holding server variable values that do not change
|
||||
* without a reload.
|
||||
|
@ -55,9 +57,11 @@ public class ServerProperties {
|
|||
throw new IllegalStateException("Game did not inject.");
|
||||
}
|
||||
version = game.getPlatform().getMinecraftVersion().getName();
|
||||
ip = () -> game.getServer().getBoundAddress().get().getAddress().getHostAddress();
|
||||
ip = () -> game.getServer().getBoundAddress()
|
||||
.orElseGet(() -> new InetSocketAddress(25565))
|
||||
.getAddress().getHostAddress();
|
||||
name = "Sponge";
|
||||
port = game.getServer().getBoundAddress().get().getPort();
|
||||
port = game.getServer().getBoundAddress().orElseGet(() -> new InetSocketAddress(25565)).getPort();
|
||||
implVersion = version;
|
||||
|
||||
id = game.getServer().getMotd().toPlain();
|
||||
|
|
Loading…
Reference in New Issue
Block a user