Esempio n. 1
0
 /** Called on plugin disable. */
 @Override
 public void onDisable() {
   for (Player player : getServer().getOnlinePlayers()) {
     LocalPlayer lPlayer = wrapPlayer(player);
     if (controller.getSession(lPlayer).hasCUISupport()) {
       lPlayer.dispatchCUIHandshake();
     }
   }
   controller.clearSessions();
   for (Handler h : controller.commandLogger.getHandlers()) {
     h.close();
   }
   config.unload();
   server.unregisterCommands();
   this.getServer().getScheduler().cancelTasks(this);
 }
Esempio n. 2
0
  /** Called on plugin enable. */
  @Override
  public void onEnable() {
    final String pluginYmlVersion = getDescription().getVersion();
    final String manifestVersion = WorldEdit.getVersion();

    if (!manifestVersion.equalsIgnoreCase(pluginYmlVersion)) {
      WorldEdit.setVersion(manifestVersion + " (" + pluginYmlVersion + ")");
    }

    // Make the data folders that WorldEdit uses
    getDataFolder().mkdirs();

    // Create the default configuration file
    createDefaultConfiguration("config.yml");

    // Set up configuration and such, including the permissions
    // resolver
    config =
        new BukkitConfiguration(
            new YAMLProcessor(new File(getDataFolder(), "config.yml"), true), this);
    PermissionsResolverManager.initialize(this);

    // Load the configuration
    config.load();

    // Setup interfaces
    server = new BukkitServerInterface(this, getServer());
    controller = new WorldEdit(server, config);
    WorldEdit.getInstance().logger.setParent(Bukkit.getLogger());
    api = new WorldEditAPI(this);
    getServer()
        .getMessenger()
        .registerIncomingPluginChannel(this, CUI_PLUGIN_CHANNEL, new CUIChannelListener(this));
    getServer().getMessenger().registerOutgoingPluginChannel(this, CUI_PLUGIN_CHANNEL);
    // Now we can register events!
    getServer().getPluginManager().registerEvents(new WorldEditListener(this), this);

    getServer()
        .getScheduler()
        .scheduleAsyncRepeatingTask(this, new SessionTimer(controller, getServer()), 120, 120);
  }
Esempio n. 3
0
 /** Loads and reloads all configuration. */
 protected void loadConfiguration() {
   config.unload();
   config.load();
   getPermissionsResolver().load();
 }