Package simpleserver

Examples of simpleserver.Player


  public void execute(Player player, String message) {
    String[] arguments = extractArguments(message);

    if (arguments.length > 0) {
      Player target = player.getServer().findPlayer(arguments[0]);
      if (target == null) {
        player.addTMessage(Color.RED, "Player not online (%s)", arguments[0]);
      } else {
        executeWithTarget(player, message, target);
      }
View Full Code Here


  public void execute(Server server, String message, CommandFeedback feedback) {
    String[] arguments = extractArguments(message);

    if (arguments.length > 0) {
      Player target = server.findPlayer(arguments[0]);
      if (target == null) {
        feedback.send("Player not online (%s)", arguments[0]);
      } else {
        executeWithTarget(server, message, target, feedback);
      }
View Full Code Here

    } else if (mode.equals("local")) {

      player.setChat(new LocalChat(player));
    } else if (mode.equals("private")) {

      Player reciever = player.getServer().findPlayer(args[1]);
      if (reciever == null) {
        player.addTMessage(Color.RED, "Player not online (%s)", args[1]);
        return;
      } else {
        player.setChat(new PrivateChat(player, reciever));
View Full Code Here

    if (args.length < 3) {
      player.addTMessage(Color.GRAY, "Usage: warpto [player] x y z");
      return;
    }

    Player target = player;
    if (args.length > 3) {
      String trg = args[0];
      target = player.getServer().findPlayer(trg);
      if (target == null) {
        player.addTMessage(Color.RED, "Player not online (%s)", trg);
        return;
      }
    }

    int x = 0;
    int y = 0;
    int z = 0;
    try {
      x = Integer.valueOf(args[args.length - 3]);
      y = Integer.valueOf(args[args.length - 2]);
      z = Integer.valueOf(args[args.length - 1]);
    } catch (Exception e) {
      player.addTMessage(Color.RED, "Invalid coordinate!");
      return;
    }

    c = new Coordinate(x, y, z);
    target.teleportSelf(c);
    player.getServer().adminLog("Admin " + player.getName() + " teleported:\t "
        + target.getName() + "\tto\t" + c.toString());
  }
View Full Code Here

    super("reply MESSAGE",
          "Sends a message to the player that last told you something");
  }

  public void execute(Player player, String message) {
    Player target = player.getReply();

    message = extractArgument(message);

    if (target != null && target.getName() != null) {
      player.execute(TellCommand.class, target.getName() + " " + message);
    } else {
      player.addTMessage(Color.RED, "Nobody sent you a message yet.");
    }
  }
View Full Code Here

  protected void tError(String message, Object... args) {
    executor.addTMessage(Color.RED, message, args);
  }

  protected Player getTarget(String name, Server server) {
    Player target = null;
    target = server.findPlayer(name);
    if (target == null) {
      tError("Player not online (%s)", name);
    }
    return target;
View Full Code Here

        + target + "\t(" + group + ")");
    server.updateGroups();
  }

  private InetAddress getIP(Server server, String value) throws Exception {
    Player targetPlayer = server.findPlayer(value);
    InetAddress ip;
    if (targetPlayer != null) {
      ip = targetPlayer.getInetAddress();
    } else if (!Pattern.matches("^(\\d{1,3}\\.){3}\\d{1,3}$", value)) {
      throw new Exception();
    } else {
      ip = InetAddress.getByName(value);
    }
View Full Code Here

  protected void executeWithTarget(Player player, String message, Player target1) {
    String[] arguments = extractArguments(message);
    Server server = player.getServer();

    if (arguments.length > 1) {
      Player target2 = server.findPlayer(arguments[1]);
      if (target2 == null) {
        player.addTMessage(Color.RED, "Player not online (%s)", arguments[1]);
      } else {
        if (target1.getDimension() == target2.getDimension()) {
          target1.teleportTo(target2);

          player.addTMessage(Color.GRAY, "Teleported %s to %s!",
                             target1.getName(), target2.getName());
          server.adminLog("User " + player.getName() + " teleported:\t "
              + target1.getName() + "\tto\t" + target2.getName());
        } else {
          player.addTMessage(Color.RED, "Players %s and %s are in different dimensions.",
                             target1.getName(),
                             target2.getName());
          player.addTMessage(Color.RED, "No teleport possible!");
        }
      }
    } else {
      player.addTMessage(Color.RED, "Must specify two players.");
View Full Code Here

        }
        break;
      case 0x07: // Use Entity
        int user = in.readInt();
        int target = in.readInt();
        Player targetPlayer = server.playerList.findPlayer(target);
        if (targetPlayer != null) {
          if (targetPlayer.godModeEnabled()) {
            in.readBoolean();
            break;
          }
        }
        write(packetId);
View Full Code Here

        player.addTMessage(Color.RED, "Invalid argument!");
        usage(player);
        return;
      }
      String iPlayer = arguments[1];
      Player onlineTarget = player.getServer().findPlayer(iPlayer);
      if (onlineTarget != null) {
        iPlayer = onlineTarget.getName();
      }
      if (!home.invites.contains(new NBTString(iPlayer))) {
        home.invites.add(new NBTString(iPlayer));
        player.addTMessage(Color.GRAY, "You just invited %s.", iPlayer);
        if (onlineTarget != null) {
          onlineTarget.addTMessage(Color.GRAY, "You were just invited to visit %s's home.", player.getName());
        }
      } else {
        player.addTMessage(Color.GRAY, "Player has already been invited.");
      }
    } else if (command.equals("uninvite")) {
View Full Code Here

TOP

Related Classes of simpleserver.Player

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.