/** * Sets the enabled state of this plugin * * @param enabled true if enabled, otherwise false */ protected void setEnabled(final boolean enabled) { if (isEnabled != enabled) { isEnabled = enabled; if (isEnabled) { onEnable(); } else { onDisable(); } } }
@Override public void onEnable() { super.onEnable(); plugin = this; pconfig = new Pconfig(this); pplayers = new Pplayers(); dbConn = new DBConn(); PExecutor pExecutor = new PExecutor(); getCommand("phorserace").setExecutor(pExecutor); getCommand("phorseracemod").setExecutor(pExecutor); getCommand("phorseraceadmin").setExecutor(pExecutor); setupTracks(); }
public void onEnable() { this.chat = new Chat(); if (getServer().getPluginManager().getPlugin("WorldEdit") == null) { chat.log( "WorldEdit not found! Please download it from http://dev.bukkit.org/bukkit-plugins/worldedit"); Bukkit.getPluginManager().disablePlugin(this); return; } this.maps = new MapUtilities(); this.games = new GameUtilities(); this.game = new GameManager(Splegg.getSplegg()); this.pm = new PlayerManager(); this.utils = new Utilities(); this.config = new Config(this); maps.c.setup(); config.setup(); getConfig().options().copyDefaults(true); saveConfig(); if (getConfig().getBoolean("auto-update")) { u = new Updater(this, "splegg-game", getFile(), UpdateType.NO_DOWNLOAD, false); updateOut = u.getResult() == UpdateResult.UPDATE_AVAILABLE; if (updateOut) { newVer = u.getLatestVersionString(); } getServer().getPluginManager().registerEvents(new UpdateUtils(), this); } // economy.init(this); getServer().getPluginManager().registerEvents(new MapListener(this), this); getServer().getPluginManager().registerEvents(new PlayerListener(), this); getServer().getPluginManager().registerEvents(new SpleggEvents(), this); getServer().getPluginManager().registerEvents(new SignListener(), this); getCommand("splegg").setExecutor(new SpleggCommand()); for (Player players : Bukkit.getOnlinePlayers()) { UtilPlayer u = new UtilPlayer(players); pm.PLAYERS.put(players.getName(), u); } super.onEnable(); }
/* (non-Javadoc) * Called when the plugin loads */ @Override public void onEnable() { plugin = this; log = Logger.getLogger("Minecraft"); dbSettings = new DBSettings(); settings = new Settings(); ConfigHelper.initConfig(); MessageHelper.initMessageHelper(); setupEconomy(); dbHelper = new DBHelper(); StartListeners(); super.onEnable(); if (Bukkit.getPluginManager().isPluginEnabled("PhatLoots")) { phatLootLoaded = true; } }
@Override public void onEnable() { super.onEnable(); instance = this; saveResource("configmsg.yml", false); try { loadMsgConfig(); } catch (IOException | InvalidConfigurationException e) { e.printStackTrace(); } SectionManager.me().init(this); new MVWorldBridge(this); getServer().getPluginManager().registerEvents(new Events(), this); CommandHandler handler = new CommandHandler(this); getCommand("sec").setExecutor(handler); getCommand("section").setExecutor(handler); }
@Override public void onEnable() { // confirm and create directory if required directory wasn't exist File dir = new File(inv_path); if (!dir.exists()) { if (!dir.mkdir()) { this.getServer().getLogger().info("Couldn't create Invation directory."); return; } } dir = new File(inv_path + "/InvasionData"); if (!dir.exists()) { if (!dir.mkdir()) { this.getServer().getLogger().info("Couldn't create InvationData directory."); return; } } // register listener getServer().getPluginManager().registerEvents(new InvasionListeners(this), this); this.inv_data = new HashMap<String, InvasionData>(); // register commands this.getCommand("inv").setExecutor(new InvasionCommands(this, inv_data)); // register custom monsters getPfield_registerEnt.registerEntities(); // test case // this.inv_data.put("test", new InvasionData("test")); // InvasionData data = inv_data.get("test"); // data.set_duration(10); // data.set_spawn_rate(1.0); // data.add_monster(CustomEntityType.NORMALSKELETON, 100, 6, 1.0, 3); // data.add_monster(CustomEntityType.NORMALZOMBIE, 95, 1, 2.0, 4); // data.add_monster(CustomEntityType.NORMALCREEPER,100, 2, 1.0, 5); // World world = this.getServer().getWorld("world"); // data.add_destination(new Location(world, 1700, 6, 1263)); // data.add_destination(new Location(world, 1966, 5, 1261)); super.onEnable(); }
@Override public void onEnable() { super.onEnable(); this.saveDefaultConfig(); maxPortalBlocs = getConfig().getInt(ConfigParam.MAX_PORTAL_BLOCKS.getValue()); usepermissions = getConfig().getBoolean(ConfigParam.USE_PERMISSIONS.getValue()); final String netherFrameBlockName = getConfig().getString(ConfigParam.NETHER_FRAME_BLOCK.getValue()); Material matTmp = BlockUtils.getBlockType(netherFrameBlockName); if (matTmp != null) { netherFrameBlock = matTmp; } final String enderFrameBlockName = getConfig().getString(ConfigParam.ENDER_FRAME_BLOCK.getValue()); matTmp = BlockUtils.getBlockType(enderFrameBlockName); if (matTmp != null) { enderFrameBlock = matTmp; } LOGGER.info( "[CustomPortals] Configuration loaded: " + ConfigParam.NETHER_FRAME_BLOCK.getValue() + "=" + netherFrameBlock + ", " + ConfigParam.ENDER_FRAME_BLOCK.getValue() + "=" + enderFrameBlock + ", " + ConfigParam.MAX_PORTAL_BLOCKS.getValue() + "=" + maxPortalBlocs + ", " + ConfigParam.USE_PERMISSIONS.getValue() + "=" + usepermissions); eventsListener = new EventsListener(this); this.getCommand("customportals").setExecutor(new CommandsExecutor(this)); }
@Override public void onEnable() { super.onEnable(); PLUGIN = this; }
@Override public void onEnable() { super.onEnable(); getServer().getPluginManager().registerEvents(this, this); }