@Override public void onEnable() { name = this.getDescription().getName(); version = this.getDescription().getVersion(); pm = getServer().getPluginManager(); WarpSettings.initialize(this); LanguageManager.initialize(this); try { connectionManager = new ConnectionManager(WarpSettings.usemySQL, true, true, this); } catch (DataConnectionException e) { WarpLogger.severe("Could not establish database connection. Disabling MyWarp."); getServer().getPluginManager().disablePlugin(this); return; } File newDatabase = new File(getDataFolder(), "warps.db"); File oldDatabase = new File("homes-warps.db"); if (!newDatabase.exists() && oldDatabase.exists()) { updateFiles(oldDatabase, newDatabase); } warpList = new WarpList(getServer()); warpPermissions = new WarpPermissions(this); blockListener = new MWBlockListener(this); entityListener = new MWEntityListener(); playerListener = new MWPlayerListener(this); pm.registerEvents(blockListener, this); pm.registerEvents(entityListener, this); pm.registerEvents(playerListener, this); if (WarpSettings.useDynmap) { if (!pm.isPluginEnabled("dynmap")) { WarpLogger.severe("Failed to hook into Dynmap. Disabeling Dynmap support."); } else { markers = new DynmapMarkers(this); } } commandHandler = new CommandHandler(this); new CommandUtils(this); // basic commands commandHandler.addCommand(new CreateCommand(this)); commandHandler.addCommand(new CreatePrivateCommand(this)); commandHandler.addCommand(new DeleteCommand(this)); commandHandler.addCommand(new ListCommand(this)); commandHandler.addCommand(new ListAllCommand(this)); commandHandler.addCommand(new PointCommand(this)); commandHandler.addCommand(new SearchCommand(this)); commandHandler.addCommand(new UpdateCommand(this)); commandHandler.addCommand(new WelcomeCommand(this)); commandHandler.addCommand(new WarpToCommand(this)); // social commands commandHandler.addCommand(new GiveCommand(this)); commandHandler.addCommand(new InviteCommand(this)); commandHandler.addCommand(new PrivateCommand(this)); commandHandler.addCommand(new PublicCommand(this)); commandHandler.addCommand(new UninviteCommand(this)); // help command commandHandler.addCommand(new HelpCommand(this)); // admin commands commandHandler.addCommand(new AdminWarpToCommand(this)); commandHandler.addCommand(new ReloadCommand(this)); commandHandler.addCommand(new ImportCommand(this)); WarpLogger.info(name + " " + version + " enabled"); }
@Override public boolean onCommand( CommandSender sender, Command command, String commandLabel, String[] args) { return commandHandler.dispatch(sender, command, commandLabel, args); }