Exemplo n.º 1
0
  @Override
  public boolean execute() {

    // Check if player already has a rollback processing
    if (session.doingRollback()) {
      Util.sendMessage(sender, "&cYou already have a rollback command processing!");
      return true;
    }

    // Parse arguments
    SearchParser parser = null;
    try {

      parser = new SearchParser(player, args);
      parser.loc = null;

      // Check that supplied actions can rollback
      if (parser.actions.size() > 0) {
        for (DataType type : parser.actions)
          if (!type.canRollback())
            throw new IllegalArgumentException(
                "You cannot rollback that action type: &7" + type.getConfigName());
      }
      // If none supplied, add in all rollback types
      else {
        for (DataType type : DataType.values()) if (type.canRollback()) parser.actions.add(type);
      }

    } catch (IllegalArgumentException e) {
      Util.sendMessage(sender, "&c" + e.getMessage());
      return true;
    }

    // Create new SearchQuery with data
    new SearchQuery(new RollbackCallback(session, RollbackType.LOCAL), parser, SearchDir.DESC);
    session.setInPreview(true);
    return true;
  }
Exemplo n.º 2
0
  @Override
  public boolean execute() {
    Util.sendMessage(sender, "&c-----------&8[ &7Reload Process Started &8]&c-----------");

    HawkEye hawk = HawkEye.instance;

    hawk.reloadConfig();
    hawk.config = new Config(hawk);

    for (DataType dt : DataType.values()) {
      dt.reload();
    }

    Util.sendMessage(sender, "&8|  &7- &cConfig has been reloaded..");

    HandlerList.unregisterAll(hawk); // Unregisters all listeners registered to hawkeye

    hawk.registerListeners(Bukkit.getPluginManager());

    Util.sendMessage(sender, "&8|  &7- &cListeners have been reloaded..");

    Util.sendMessage(sender, "&c-----------&8[ &7Reload Process Finished &8]&c-----------");
    return true;
  }