mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-27 19:47:49 +01:00
Replaced redundant interfaces with Supplier in ServerProperties
This commit is contained in:
parent
25707bdb4c
commit
bf101d17bd
@ -6,6 +6,7 @@ import org.bukkit.Server;
|
|||||||
import org.spongepowered.api.Game;
|
import org.spongepowered.api.Game;
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class responsible for holding server variable values that do not change
|
* Class responsible for holding server variable values that do not change
|
||||||
@ -21,10 +22,10 @@ public class ServerProperties {
|
|||||||
private final int port;
|
private final int port;
|
||||||
private final String version;
|
private final String version;
|
||||||
private final String implVersion;
|
private final String implVersion;
|
||||||
private final IPWrapper ip;
|
private final Supplier<String> ip;
|
||||||
private final int maxPlayers;
|
private final int maxPlayers;
|
||||||
|
|
||||||
private final OnlinePlayersWrapper onlinePlayers;
|
private final Supplier<Integer> onlinePlayers;
|
||||||
|
|
||||||
public ServerProperties(Server server) {
|
public ServerProperties(Server server) {
|
||||||
id = server.getServerId();
|
id = server.getServerId();
|
||||||
@ -76,7 +77,7 @@ public class ServerProperties {
|
|||||||
* @return the ip.
|
* @return the ip.
|
||||||
*/
|
*/
|
||||||
public String getIp() {
|
public String getIp() {
|
||||||
return ip.getIP();
|
return ip.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -104,14 +105,6 @@ public class ServerProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getOnlinePlayers() {
|
public int getOnlinePlayers() {
|
||||||
return onlinePlayers.getOnlinePlayers();
|
return onlinePlayers.get();
|
||||||
}
|
|
||||||
|
|
||||||
private interface OnlinePlayersWrapper {
|
|
||||||
int getOnlinePlayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
private interface IPWrapper {
|
|
||||||
String getIP();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user