private void addMenu() throws IOException { System.out.println("Please enter the classname of the component you want to add"); System.out.println("Enter 0 or 'back' to return to the main menu."); input = in.readLine(); if (input.equals("0") || input.equals("back")) { name = MenuName.MAIN; } else { try { IComponent comp = repo.createComponent(input); manager.add(comp); System.out.println("Compnent has been added."); name = MenuName.MAIN; } catch (Exception e) { System.out.println("The specified component could not be found."); } } }
@Override public void onEnable() { /* Start with clean events */ events = new Events(); permissions = NijikokunPermissions.create(getServer(), "dynmap"); if (permissions == null) permissions = BukkitPermissions.create("dynmap"); if (permissions == null) permissions = new OpPermissions( new String[] { "fullrender", "cancelrender", "radiusrender", "resetstats", "reload", "purgequeue" }); dataDirectory = this.getDataFolder(); if (dataDirectory.exists() == false) dataDirectory.mkdirs(); /* Initialize confguration.txt if needed */ File f = new File(this.getDataFolder(), "configuration.txt"); if (!createDefaultFileFromResource("/configuration.txt", f)) { this.setEnabled(false); return; } /* Load configuration.txt */ org.bukkit.util.config.Configuration bukkitConfiguration = new org.bukkit.util.config.Configuration(f); bukkitConfiguration.load(); configuration = new ConfigurationNode(bukkitConfiguration); /* Load block models */ HDBlockModels.loadModels(dataDirectory, configuration); /* Load texture mappings */ TexturePack.loadTextureMapping(dataDirectory, configuration); /* Now, process worlds.txt - merge it in as an override of existing values (since it is only user supplied values) */ f = new File(this.getDataFolder(), "worlds.txt"); if (!createDefaultFileFromResource("/worlds.txt", f)) { this.setEnabled(false); return; } org.bukkit.util.config.Configuration cfg = new org.bukkit.util.config.Configuration(f); cfg.load(); ConfigurationNode cn = new ConfigurationNode(cfg); mergeConfigurationBranch(cn, "worlds", true, true); /* Now, process templates */ loadTemplates(); Log.verbose = configuration.getBoolean("verbose", true); deftemplatesuffix = configuration.getString("deftemplatesuffix", ""); /* Default swamp shading off for 1.8, on after */ swampshading = configuration.getBoolean("swampshaded", !getServer().getVersion().contains("(MC: 1.8")); /* Default water biome shading off for 1.8, on after */ waterbiomeshading = configuration.getBoolean( "waterbiomeshaded", !getServer().getVersion().contains("(MC: 1.8")); /* Default fence-to-block-join off for 1.8, on after */ fencejoin = configuration.getBoolean( "fence-to-block-join", !getServer().getVersion().contains("(MC: 1.8")); /* Default compassmode to pre19, to newrose after */ String cmode = configuration.getString( "compass-mode", getServer().getVersion().contains("(MC: 1.8") ? "pre19" : "newrose"); if (cmode.equals("newnorth")) compassmode = CompassMode.NEWNORTH; else if (cmode.equals("newrose")) compassmode = CompassMode.NEWROSE; else compassmode = CompassMode.PRE19; loadDebuggers(); tilesDirectory = getFile(configuration.getString("tilespath", "web/tiles")); if (!tilesDirectory.isDirectory() && !tilesDirectory.mkdirs()) { Log.warning("Could not create directory for tiles ('" + tilesDirectory + "')."); } playerList = new PlayerList(getServer(), getFile("hiddenplayers.txt"), configuration); playerList.load(); PlayerListener pl = new PlayerListener() { public void onPlayerJoin(PlayerJoinEvent evt) { playerList.updateOnlinePlayers(null); } public void onPlayerQuit(PlayerQuitEvent evt) { playerList.updateOnlinePlayers(evt.getPlayer()); } }; registerEvent(Type.PLAYER_JOIN, pl); registerEvent(Type.PLAYER_QUIT, pl); mapManager = new MapManager(this, configuration); mapManager.startRendering(); playerfacemgr = new PlayerFaces(this); loadWebserver(); enabledTriggers.clear(); List<String> triggers = configuration.getStrings("render-triggers", new ArrayList<String>()); if (triggers != null) { for (Object trigger : triggers) { enabledTriggers.add((String) trigger); } } // Load components. for (Component component : configuration.<Component>createInstances( "components", new Class<?>[] {DynmapPlugin.class}, new Object[] {this})) { componentManager.add(component); } Log.verboseinfo("Loaded " + componentManager.components.size() + " components."); registerEvents(); if (!configuration.getBoolean("disable-webserver", false)) { startWebserver(); } /* Print version info */ PluginDescriptionFile pdfFile = this.getDescription(); Log.info("version " + pdfFile.getVersion() + " is enabled"); events.<Object>trigger("initialized", null); }