public BukkitServer(MinecraftServer server) { instance = this; cbBuild = BukkitContainer.CRAFT_VERSION; configMan = server.getConfigurationManager(); theServer = server; List<Integer> ids = Arrays.asList(DimensionManager.getIDs()); Iterator<Integer> _ = ids.iterator(); System.out.println("IS THE INSTANCE NULL? " + (instance == null ? "YES" : "NO")); this.pluginManager = new SimplePluginManager(this, commandMap); //pluginManager = new SimplePluginManager(this, commandMap); bukkitConfig = new YamlConfiguration(); YamlConfiguration yml = new YamlConfiguration(); try { yml.load(getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml")); if (!new File("bukkit.yml").exists()) { new File("bukkit.yml").createNewFile(); yml.save("bukkit.yml"); } bukkitConfig.load("bukkit.yml"); bukkitConfig.addDefaults(yml); bukkitConfig.save("bukkit.yml"); } catch (Exception e) { e.printStackTrace(); } String vanillaName = theServer.worldServerForDimension(0).getWorldInfo().getWorldName(); while(_.hasNext()) { int i = _.next(); WorldServer x = theServer.worldServerForDimension(i); BukkitWorld world = new BukkitWorld(x, this.getGenerator(x.getWorldInfo().getDimension()), this.wtToEnv(x)); worlds.put(i, world); //if (!x.getWorldInfo().getWorldName().equals(vanillaName)) pluginWorldMapping.put(x.getWorldInfo().getWorldName(), world); } this.theLogger = BukkitContainer.bukkitLogger; theLogger.info("Bukkit API for Vanilla, version " + apiVer + " starting up..."); thePluginLoader = new BukkitClassLoader(getClass().getClassLoader()); // I MAINTAIN THAT THIS WILL WORK EVENTUALLY /*try { System.out.println("This is a test of the SPM Loader!"); // this *should* load simplepluginamanger via BukkitClassLoader Class<?> pluginMan = thePluginLoader.loadClass("org.bukkit.plugin.SimplePluginManager"); System.out.println("Loaded class: " + pluginMan.getCanonicalName() + " via " + pluginMan.getClassLoader().getClass().getCanonicalName()); Method insn = pluginMan.getMethod("newInstance", new Class[] { BukkitServer.class, SimpleCommandMap.class }); insn.setAccessible(true); this.pluginManager = (PluginManager) insn.invoke(null, this, this.commandMap); } catch (Exception e1) { throw new RuntimeException("BukkitForge encountered an error (most likely it was installed incorrectly!)", e1); }*/ Bukkit.setServer(this); this.theHelpMap = new SimpleHelpMap(this); this.theMessenger = new StandardMessenger(); //theLogger.info("Testing the bukkit Logger!"); this.entityMetadata = new EntityMetadataStore(); this.playerMetadata = new PlayerMetadataStore(); this.worldMetadata = new WorldMetadataStore(); this.warningState = Warning.WarningState.DEFAULT; this.console = (BukkitConsoleCommandSender) BukkitConsoleCommandSender.getInstance(); // wait until server start /*try { Thread.currentThread().wait(); } catch (InterruptedException e) { theLogger.log(Level.FINE, "The server was interrupted, it might explode!", e); }*/ theLogger.info("Completing load..."); // fix for the 'mod recipes disappear' bug BukkitModRecipeHelper.saveCraftingManagerRecipes(); //configMan = theServer.getConfigurationManager(); //theServer = (DedicatedServer) server; HelpTopic myHelp = new CommandHelpTopic("bexec", "Run a command forcibly bukkit aliases", "", ""); Bukkit.getServer().getHelpMap().addTopic(myHelp); loadPlugins(); enablePlugins(PluginLoadOrder.STARTUP); theLogger.info("Loading PostWorld plugins..."); enablePlugins(PluginLoadOrder.POSTWORLD); theLogger.info("Loaded plugins: "); for (Plugin i : pluginManager.getPlugins()) { theLogger.info(i.getName() + "- Enabled: " + i.isEnabled()); } ForgeEventHandler.ready = true; commandMap.doneLoadingPlugins((ServerCommandManager) theServer.getCommandManager()); if (!theServer.isDedicatedServer()) { EntityPlayer par0 = theServer.getConfigurationManager().getPlayerForUsername(theServer.getServerOwner()); if (par0 != null) { par0.sendChatToPlayer(ChatColor.GREEN + "BukkitForge has finished loading! You may now enjoy a (relatively) lag-free game!"); theServer.getCommandManager().executeCommand(par0, "/plugins"); (new PlayerTracker()).onPlayerLogin(par0); } } }
@Override public void resetRecipes() { CraftingManager.instance = BukkitModRecipeHelper.getOriginalCraftingManager(); }