@Override public boolean isOnlineMode() { return ((SpongeLoader)loader).getGame().getServer().getOnlineMode(); }
/** * Gets the server specific data. * * @return The server specific data. */ private JsonObject getServerData() { // Minecraft specific data int playerAmount = Sponge.getServer().getOnlinePlayers().size(); playerAmount = playerAmount > 200 ? 200 : playerAmount; int onlineMode = Sponge.getServer().getOnlineMode() ? 1 : 0; String minecraftVersion = Sponge.getGame().getPlatform().getMinecraftVersion().getName(); // OS/Java specific data String javaVersion = System.getProperty("java.version"); String osName = System.getProperty("os.name"); String osArch = System.getProperty("os.arch"); String osVersion = System.getProperty("os.version"); int coreCount = Runtime.getRuntime().availableProcessors(); JsonObject data = new JsonObject(); data.addProperty("serverUUID", serverUUID); data.addProperty("playerAmount", playerAmount); data.addProperty("onlineMode", onlineMode); data.addProperty("minecraftVersion", minecraftVersion); data.addProperty("javaVersion", javaVersion); data.addProperty("osName", osName); data.addProperty("osArch", osArch); data.addProperty("osVersion", osVersion); data.addProperty("coreCount", coreCount); return data; }
int onlineMode = Sponge.getServer().getOnlineMode() ? 1 : 0; String minecraftVersion = Sponge.getGame().getPlatform().getMinecraftVersion().getName(); String spongeImplementation = Sponge.getPlatform().getContainer(Platform.Component.IMPLEMENTATION).getName();
int onlineMode = Sponge.getServer().getOnlineMode() ? 1 : 0; String minecraftVersion = Sponge.getGame().getPlatform().getMinecraftVersion().getName(); String spongeImplementation = Sponge.getPlatform().getContainer(Platform.Component.IMPLEMENTATION).getName();
public void updateInformation(ApiClient client) throws IOException, ApiException { serverInformation = client.getServerInformation(); if (!configuration.isBungeeCord() && Sponge.getServer().getOnlineMode() != serverInformation.getAccount().isOnlineMode()) { getLogger().warn("Your server and webstore online mode settings are mismatched. Unless you are using" + " a proxy and server combination (such as BungeeCord/Spigot or LilyPad/Connect) that corrects UUIDs, then" + " you may experience issues with packages not applying."); getLogger().warn("If you have verified that your set up is correct, you can suppress this message by setting " + "is-bungeecord=true in your BuycraftX config.properties."); } }
final boolean onlineMode = game.getServer().getOnlineMode(); // TRUE if online mode is enabled final String pluginVersion = plugin.getVersion().orElse("unknown"); final String serverVersion = String.format("%s %s", "Sponge", game.getPlatform().getMinecraftVersion());
public ServerInfo() { Server server = Sponge.getServer(); Platform platform = Sponge.getPlatform(); this.motd = server.getMotd().toBuilder().build(); this.players = server.getOnlinePlayers().size(); this.maxPlayers = server.getMaxPlayers(); if (server.getBoundAddress().isPresent()) { InetSocketAddress addr = server.getBoundAddress().get(); this.address = addr.getHostName() + (addr.getPort() == 25565 ? "" : ":" + addr.getPort()); } this.onlineMode = server.getOnlineMode(); this.resourcePack = server.getDefaultResourcePack().map(ResourcePack::getName).orElse(null); this.hasWhitelist = server.hasWhitelist(); this.uptimeTicks = server.getRunningTimeTicks(); this.tps = server.getTicksPerSecond(); this.minecraftVersion = platform.getMinecraftVersion().getName(); this.game = new CachedPluginContainer(platform.getContainer(Platform.Component.GAME)); this.api = new CachedPluginContainer(platform.getContainer(Platform.Component.API)); this.implementation = new CachedPluginContainer(platform.getContainer(Platform.Component.IMPLEMENTATION)); } }
.port(serverPort) .listingUpdateTask(plugin.getListingUpdateTask()) .serverOnlineMode(Sponge.getServer().getOnlineMode()) .build();
private Optional<Player> getPlayer(QueuedPlayer player) { if (player.getUuid() != null && (plugin.getConfiguration().isBungeeCord() || Sponge.getServer().getOnlineMode())) { return Sponge.getServer().getPlayer(UuidUtil.mojangUuidToJavaUuid(player.getUuid())); } return Sponge.getServer().getPlayer(player.getName()); }
try { AnalyticsSend.postServerInformation(httpClient, configuration.getServerKey(), platform, Sponge.getServer().getOnlineMode()); } catch (IOException e) { getLogger().warn("Can't send analytics", e);