mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-12 06:48:50 +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.bukkit.Server;
|
||||||
import org.spongepowered.api.Game;
|
import org.spongepowered.api.Game;
|
||||||
|
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class responsible for holding server variable values that do not change
|
* Class responsible for holding server variable values that do not change
|
||||||
* without a reload.
|
* without a reload.
|
||||||
@ -55,9 +57,11 @@ public class ServerProperties {
|
|||||||
throw new IllegalStateException("Game did not inject.");
|
throw new IllegalStateException("Game did not inject.");
|
||||||
}
|
}
|
||||||
version = game.getPlatform().getMinecraftVersion().getName();
|
version = game.getPlatform().getMinecraftVersion().getName();
|
||||||
ip = () -> game.getServer().getBoundAddress().get().getAddress().getHostAddress();
|
ip = () -> game.getServer().getBoundAddress()
|
||||||
|
.orElseGet(() -> new InetSocketAddress(25565))
|
||||||
|
.getAddress().getHostAddress();
|
||||||
name = "Sponge";
|
name = "Sponge";
|
||||||
port = game.getServer().getBoundAddress().get().getPort();
|
port = game.getServer().getBoundAddress().orElseGet(() -> new InetSocketAddress(25565)).getPort();
|
||||||
implVersion = version;
|
implVersion = version;
|
||||||
|
|
||||||
id = game.getServer().getMotd().toPlain();
|
id = game.getServer().getMotd().toPlain();
|
||||||
|
Loading…
Reference in New Issue
Block a user