Package simpleserver.command

Examples of simpleserver.command.PlayerCommand


    String commandName = message.split(" ")[0].substring(1).toLowerCase();
    String args = commandName.length() + 1 >= message.length() ? "" : message.substring(commandName.length() + 2);
    CommandConfig config = server.config.commands.getTopConfig(commandName);
    String originalName = config == null ? commandName : config.originalName;

    PlayerCommand command = server.resolvePlayerCommand(originalName, groupObject);

    if (config != null && !overridePermissions) {
      Permission permission = server.config.getCommandPermission(config.name, args, position.coordinate());
      if (!permission.contains(this)) {
        addTMessage(Color.RED, "Insufficient permission.");
        return null;
      }
    }

    try {
      if (server.options.getBoolean("enableEvents") && config.event != null) {
        Event e = server.eventhost.findEvent(config.event);
        if (e != null) {
          ArrayList<String> arguments = new ArrayList<String>();
          if (!args.equals("")) {
            arguments = new ArrayList<String>(java.util.Arrays.asList(args.split("\\s+")));
          }
          server.eventhost.execute(e, this, true, arguments);
        } else {
          System.out.println("Error in player command " + originalName + ": Event " + config.event + " not found!");
        }
      }
    } catch (NullPointerException e) {
      System.out.println("Error evaluating player command: " + originalName);
    }

    if (!(command instanceof ExternalCommand) && (config == null || config.forwarding != Forwarding.ONLY)) {
      command.execute(this, message);
    }

    if (command instanceof ExternalCommand) {
      // commands with bound events have to be forwarded explicitly
      // (to prevent unknown command error by server)
View Full Code Here


    // execute the server command, overriding the player permissions
    p.parseCommand(message, true);

    // handle forwarding
    String cmd = tokens.get(0);
    PlayerCommand command = server.resolvePlayerCommand(cmd, p.getGroup());

    // forwarding if necessary
    CommandConfig config = server.config.commands.getTopConfig(cmd);
    if ((command instanceof ExternalCommand)
        || (config != null && config.forwarding != Forwarding.NONE)
View Full Code Here

TOP

Related Classes of simpleserver.command.PlayerCommand

Copyright © 2018 www.massapicom. 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.