Package uk.co.oliwali.HawkEye.commands

Source Code of uk.co.oliwali.HawkEye.commands.DeleteCommand

package uk.co.oliwali.HawkEye.commands;

import uk.co.oliwali.HawkEye.SearchParser;
import uk.co.oliwali.HawkEye.callbacks.DeleteCallback;
import uk.co.oliwali.HawkEye.database.SearchQuery;
import uk.co.oliwali.HawkEye.database.SearchQuery.SearchDir;
import uk.co.oliwali.HawkEye.util.Permission;
import uk.co.oliwali.HawkEye.util.Util;

public class DeleteCommand extends BaseCommand {

  public DeleteCommand() {
    bePlayer = false;
    name = "delete";
    argLength = 1;
    usage = "<parameters> <- delete database entries";
  }

  @Override
  public boolean execute() {

    //Parse arguments
    SearchParser parser = null;
    try {
      parser = new SearchParser(sender, args);
    } catch (IllegalArgumentException e) {
      Util.sendMessage(sender, "&c" + e.getMessage());
      return true;
    }

    //Create new SeachQuery with data
    new SearchQuery(new DeleteCallback(session), parser, SearchDir.DESC);
    return true;

  }

  @Override
  public void moreHelp() {
    Util.sendMessage(sender, "&cDeletes specified entries from the database permanently");
    Util.sendMessage(sender, "&cUses the same parameters and format as /hawk search");
  }

  @Override
  public boolean permission() {
    return Permission.delete(sender);
  }

}
TOP

Related Classes of uk.co.oliwali.HawkEye.commands.DeleteCommand

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.