public static void initDimension(int dim) { WorldServer overworld = getWorld(0); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } try { DimensionManager.getProviderType(dim); } catch (Exception e) { System.err.println("Cannot Hotload Dim: " + e.getMessage()); return; // If a provider hasn't been registered then we can't hotload the dim } MinecraftServer mcServer = overworld.getMinecraftServer(); ISaveHandler savehandler = overworld.getSaveHandler(); WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo()); WorldServer world = (dim == 0 ? overworld : new WorldServerMulti( mcServer, savehandler, overworld.getWorldInfo().getWorldName(), dim, worldSettings, overworld, mcServer.theProfiler)); world.addWorldAccess(new WorldManager(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.func_147139_a(mcServer.func_147135_j()); }
private void getServerStats(ICommandSender sender) { MinecraftServer tmp = ServerUtil.getServerInstance(); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "=================================================="); ChatHelper.sendMessage(sender, TextFormatting.BLUE + " Server Status"); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "=================================================="); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server: " + TextFormatting.AQUA + tmp.getServerModName()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server Version: " + TextFormatting.AQUA + tmp.getMinecraftVersion()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server Online Mode: " + TextFormatting.AQUA + tmp.isServerInOnlineMode()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server Owner: " + TextFormatting.AQUA + tmp.getServerOwner()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server MOTD: " + TextFormatting.AQUA + tmp.getMOTD()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server IP: " + TextFormatting.AQUA + tmp.getServerHostname() + ":" + tmp.getServerPort()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server Max Allowed Players: " + TextFormatting.AQUA + tmp.getMaxPlayers()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server Spawn Protection Size: " + TextFormatting.AQUA + tmp.getSpawnProtectionSize()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server View Distance: " + TextFormatting.AQUA + tmp.getPlayerList().getViewDistance()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server World: " + TextFormatting.AQUA + tmp.getEntityWorld().getWorldInfo().getWorldName()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server Allow Nether: " + TextFormatting.AQUA + tmp.getAllowNether()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server Allow Flight: " + TextFormatting.AQUA + tmp.isFlightAllowed()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server Default Gamemode: " + TextFormatting.AQUA + tmp.getGameType().getName()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server Generate Structure: " + TextFormatting.AQUA + tmp.canStructuresSpawn()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Server Whitelist: " + TextFormatting.AQUA + tmp.getPlayerList().isWhiteListEnabled()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "Hardcore Mode: " + TextFormatting.AQUA + tmp.isHardcore()); ChatHelper.sendMessage( sender, TextFormatting.GOLD + "=================================================="); }
@Override public GameMode getDefaultGameMode() { return GameMode.getByValue(theServer.getGameType().getID()); }