Package simpleserver

Examples of simpleserver.Server


  public PlayerListCommand() {
    super("who", "Display online players names");
  }

  public void execute(Player player, String message) {
    Server server = player.getServer();
    StringBuilder list = new StringBuilder();
    for (Player friend : server.playerList.getArray()) {
      list.append(friend.getName() + ", ");
    }
    if (list.length() > 2) {
      list.delete(list.length() - 2, list.length());
    }

    player.addCaptionedMessage(t("Connected Players (%s)", server.numPlayers()), list.toString());
  }
View Full Code Here


          "Set the group ID of an IP address");
  }

  @Override
  protected void setGroup(Player player, int group, String target) {
    Server server = player.getServer();
    InetAddress ip;
    try {
      ip = getIP(server, target);
    } catch (Exception e) {
      player.addTMessage(Color.RED, "You must specify a user or a valid IP!");
      return;
    }

    server.config.ips.setGroup(ip, group);
    server.saveConfig();

    player.addTMessage(Color.GRAY, "Group of %s was set to %s!", target, group);
    server.adminLog("User " + player.getName() + " set IP's group:\t "
        + target + "\t(" + group + ")");
    server.updateGroups();
  }
View Full Code Here

  }

  @Override
  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());
View Full Code Here

    super("unmute PLAYER", "Allow the named player to use normal chat again");
  }

  @Override
  protected void executeWithTarget(Player player, String message, String target) {
    Server server = player.getServer();
    unmute(server, target);
    server.adminLog("Admin " + player.getName() + " unmuted player:\t " + target);
  }
View Full Code Here

  public BanCommand() {
    super("ban PLAYER [REASON]", "Kick and ban the named player");
  }

  protected boolean allowed(Player player, String target) {
    Server server = player.getServer();
    Integer group = server.config.players.group(target);
    if (group != null && group >= player.getGroupId()) {
      player.addTMessage(Color.RED, "You cannot ban players that are in your group or higher!");
      return false;
    }
View Full Code Here

  public SetGroupCommand(String name, String commandCode) {
    super(name, commandCode);
  }

  protected boolean allowed(Player player, int group, String target) {
    Server server = player.getServer();
    if (server.config.players.group(target) != null && player.getGroupId() <= server.config.players.group(target)) {
      player.addTMessage(Color.RED, "You cannot set the group of this user!");
      return false;
    }
    if (group >= player.getGroupId()) {
View Full Code Here

      player.getServer().updateGroup(target);
    }
  }

  protected void setGroup(Player player, int group, String target) {
    Server server = player.getServer();
    server.config.players.setGroup(target, group);
    server.saveConfig();

    if (server.options.getBoolean("enableCustAuthExport")) {
      server.custAuthExport.updateGroup(target, group);
    }

    player.addTMessage(Color.GRAY, "Player %s's group was set to %s!",
                       target, new Integer(group).toString());
    server.adminLog("User " + player.getName() + " set player's group:\t "
        + target + "\t(" + group + ")");
  }
View Full Code Here

  public RestartCommand() {
    super("restart", "Stop the Minecraft server and start it again");
  }

  public void execute(Player player, String message) {
    Server server = player.getServer();

    server.adminLog("User " + player.getName() + " attempted a restart!");
    server.restart();
  }
View Full Code Here

  protected boolean sendToPlayer(Player reciever) {
    return true;
  }

  private String getPrefix() {
    Server server = sender.getServer();

    String prefix = "";
    char color = 'f';
    String title = "";
    String format = server.config.properties.get("msgFormat");
View Full Code Here

    super("mute PLAYER", "Block the named player from normal chat");
  }

  @Override
  protected void executeWithTarget(Player player, String message, String target) {
    Server server = player.getServer();
    mute(server, target);
    server.adminLog("Admin " + player.getName() + " muted player:\t " + target);
  }
View Full Code Here

TOP

Related Classes of simpleserver.Server

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.