@Override public void setSpawnRadius(int value) { if (theServer instanceof DedicatedServer) { ((DedicatedServer) theServer).settings.setProperty("spawn-radius", value); } else { theLogger.info("Can't set spawn protection radius on client!"); } }
@Subscribe public void preInit(FMLPreInitializationEvent ev) { bukkitLogger = ev.getModLog(); bukkitLogger.setParent(FMLCommonHandler.instance().getFMLLogger()); // ServerGUI.logger = bukkitLogger; if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { FMLCommonHandler.instance() .getFMLLogger() .warning("Bukkit For Vanilla is currently only a server-side mod."); return; } else if (FMLCommonHandler.instance().getEffectiveSide() == Side.BUKKIT) { FMLCommonHandler.instance() .getFMLLogger() .severe("The bukkit API as a forge mod on bukkit? *mind blown*"); return; } this.bukkitLogger.info("Initializing configuration..."); myConfigurationFile = ev.getSuggestedConfigurationFile(); Configuration config = new Configuration(myConfigurationFile); config.addCustomCategoryComment("consoleConfig", "Configuration for the server console"); config.addCustomCategoryComment("dontTouchThis", "Things which are best left untouched"); Property colour = config.get( "consoleConfig", "enablecolour", DedicatedServer.getServer().getGuiEnabled() ? false : true); colour.comment = "Enable coloured ANSI console output"; this.allowAnsi = colour.getBoolean(false); Property plugins = config.get(Configuration.CATEGORY_GENERAL, "pluginDir", "plugins"); plugins.comment = "The folder to look for plugins in."; this.pluginFolder = plugins.value; Property suuid = config.get("dontTouchThis", "serverUUID", this.genUUID()); bukkitLogger.info("Set UUID to " + suuid.value); suuid.comment = "The UUID of the server. Don't touch this or it might break your plugins."; this.serverUUID = suuid.value; /*Property showAllLogs = config.get(Configuration.CATEGORY_GENERAL, "printForgeLogToGui", false); showAllLogs.comment = "Print stuff that's outputted to the logs to the GUI as it happens."; this.showAllLogs = showAllLogs.getBoolean(false);*/ config.save(); }
@SideOnly(Side.SERVER) public static void fmlReentry(ArgsWrapper wrap) { String[] par0ArrayOfStr = wrap.args; StatList.nopInit(); ILogAgent ilogagent = null; try { boolean flag = !GraphicsEnvironment.isHeadless(); String s = null; String s1 = "."; String s2 = null; boolean flag1 = false; boolean flag2 = false; int i = -1; for (int j = 0; j < par0ArrayOfStr.length; ++j) { String s3 = par0ArrayOfStr[j]; String s4 = j == par0ArrayOfStr.length - 1 ? null : par0ArrayOfStr[j + 1]; boolean flag3 = false; if (!s3.equals("nogui") && !s3.equals("--nogui")) { if (s3.equals("--port") && s4 != null) { flag3 = true; try { i = Integer.parseInt(s4); } catch (NumberFormatException numberformatexception) {; } } else if (s3.equals("--singleplayer") && s4 != null) { flag3 = true; s = s4; } else if (s3.equals("--universe") && s4 != null) { flag3 = true; s1 = s4; } else if (s3.equals("--world") && s4 != null) { flag3 = true; s2 = s4; } else if (s3.equals("--demo")) { flag1 = true; } else if (s3.equals("--bonusChest")) { flag2 = true; } } else { flag = false; } if (flag3) { ++j; } } DedicatedServer dedicatedserver = new DedicatedServer(new File(s1)); ilogagent = dedicatedserver.func_98033_al(); if (s != null) { dedicatedserver.setServerOwner(s); } if (s2 != null) { dedicatedserver.setFolderName(s2); } if (i >= 0) { dedicatedserver.setServerPort(i); } if (flag1) { dedicatedserver.setDemo(true); } if (flag2) { dedicatedserver.canCreateBonusChest(true); } if (flag) { dedicatedserver.enableGui(); } dedicatedserver.startServerThread(); Runtime.getRuntime().addShutdownHook(new ThreadDedicatedServer(dedicatedserver)); } catch (Exception exception) { if (ilogagent != null) { ilogagent.func_98234_c("Failed to start the minecraft server", exception); } else { Logger.getAnonymousLogger() .log(Level.SEVERE, "Failed to start the minecraft server", exception); } } }