Package com.bergerkiller.bukkit.common

Examples of com.bergerkiller.bukkit.common.MessageBuilder


          if (e instanceof Minecart) {
            minecartCount++;
          }
        }
      }
      MessageBuilder builder = new MessageBuilder();
      builder.green("There are ").yellow(count).green(" trains on this server (of which ");
      builder.yellow(moving).green(" are moving)");
      builder.newLine().green("There are ").yellow(minecartCount).green(" minecart entities");
      builder.send(sender);
      // Show additional information about owned trains to players
      if (sender instanceof Player) {
        StringBuilder statement = new StringBuilder();
        for (int i = 1; i < args.length; i++) {
          if (i > 1) {
View Full Code Here


    }
    return false;
  }

  public static void list(Player player, String statement) {
    MessageBuilder builder = new MessageBuilder();
    builder.yellow("You are the proud owner of the following trains:");
    builder.newLine().setSeparator(ChatColor.WHITE, " / ");
    boolean found = false;
    for (TrainProperties prop : TrainProperties.getAll()) {
      if (!prop.hasOwnership(player)) {
        continue;
      }
      if (prop.hasHolder() && statement.length() > 0) {
        MinecartGroup group = prop.getHolder();
        SignActionEvent event = new SignActionEvent(null, group);
        if (!Statement.has(group, statement, event)) {
          continue;
        }
      }
      found = true;
      if (prop.isLoaded()) {
        builder.green(prop.getTrainName());
      } else {
        builder.red(prop.getTrainName());
      }
    }
    if (found) {
      builder.send(player);
    } else {
      Localization.EDIT_NONEFOUND.message(player);
    }
  }
View Full Code Here

      return true;
    }
  }

  public static void showPathInfo(Player p, IProperties prop) {
    MessageBuilder msg = new MessageBuilder();
    msg.yellow("This ").append(prop.getTypeName());
    final String lastName = prop.getDestination();
    if (LogicUtil.nullOrEmpty(lastName)) {
      msg.append(" is not trying to reach a destination.");
    } else {
      msg.append(" is trying to reach ").green(lastName).newLine();
      final PathNode first = PathNode.get(prop.getLastPathNode());
      if (first == null) {
        msg.yellow("It has not yet visited a routing node, so no route is available yet.");
      } else {
        PathNode last = PathNode.get(lastName);
        if (last == null) {
          msg.red("The destination position to reach can not be found!");
        } else {
          // Calculate the exact route taken from first to last
          PathNode[] route = first.findRoute(last);
          msg.yellow("Route: ");
          if (route.length == 0) {
            msg.red(first.getDisplayName() + " /=/ " + last.getDisplayName() + " (not found)");
          } else {
            msg.setSeparator(ChatColor.YELLOW, " -> ");
            for (PathNode node : route) {
              msg.green(node.getDisplayName());
            }
          }
        }       
      }
    }
    msg.send(p);
  }
View Full Code Here

      return true;
    } else {
      if (!cmd.equals("help") && !cmd.equals("?")) {
        p.sendMessage(ChatColor.RED + "Unknown cart command: '" + cmd + "'!");
      }
      help(new MessageBuilder()).send(p);
      return true;
    }
    prop.tryUpdate();
    return true;
  }
View Full Code Here

    builder.red("pickup").red("break").red("default").red("rename").red("speedlimit").red("setcollide").red("slowdown");
    return builder.red("pushplayers").red("pushmobs").red("pushmisc").setSeparator(null).red("]");
  }

  public static void info(Player p, TrainProperties prop) {
    MessageBuilder message = new MessageBuilder();

    if (!prop.isOwner(p)) {
      if (!prop.hasOwners()) {
        message.newLine().yellow("Note: This train is not owned, claim it using /train claim!");
      }
    }
    message.newLine().yellow("Train name: ").white(prop.getTrainName());
    message.newLine().yellow("Keep nearby chunks loaded: ").white(prop.isKeepingChunksLoaded());
    message.newLine().yellow("Slow down over time: ").white(prop.isSlowingDown());
    message.newLine().yellow("Can collide: ").white(prop.getColliding());

    // Collision states
    message.newLine().yellow("When colliding this train ");
    message.red(prop.mobCollision.getOperationName()).yellow(" mobs, ");
    message.red(prop.playerCollision.getOperationName()).yellow(" players, ");
    message.red(prop.miscCollision.getOperationName()).yellow(" misc entities and ");
    message.red(prop.trainCollision.getOperationName()).yellow(" other trains");

    message.newLine().yellow("Maximum speed: ").white(prop.getSpeedLimit(), " blocks/tick");

    // Remaining common info
    Commands.info(message, prop);

    // Loaded message
    if (prop.getHolder() == null) {
      message.newLine().red("This train is unloaded! To keep it loaded, use:");
      message.newLine().yellow("   /train keepchunksloaded true");
    }

    // Send
    message.send(p);
  }
View Full Code Here

    } else {
      // Show help
      if (!cmd.equals("help") && !cmd.equals("?")) {
        p.sendMessage(ChatColor.RED + "Unknown cart command: '" + cmd + "'!");
      }
      help(new MessageBuilder()).send(p);
      return true;
    }
    prop.tryUpdate();
    return true;
  }
View Full Code Here

    builder.red("pickup").red("break");
    return builder.setSeparator(null).red("]");
  }

  public static void info(Player p, CartProperties prop) {
    MessageBuilder message = new MessageBuilder();
 
    //warning message not taken
    if (!prop.hasOwners()) {
      message.newLine().yellow("Note: This minecart is not owned, claim it using /cart claim!");
    }
    message.yellow("Picks up nearby items: ").white(prop.canPickup());
    if (prop.hasBlockBreakTypes()) {
      message.newLine().yellow("Breaks blocks: ").white(StringUtil.combineNames(prop.getBlockBreakTypes()));
    }
    message.newLine().yellow("Enter message: ").white((prop.hasEnterMessage() ? prop.getEnterMessage() : "None"));

    // Remaining common info
    Commands.info(message, prop);

    // Loaded?
    if (prop.getHolder() == null) {
      message.newLine().red("The train of this cart is unloaded! To keep it loaded, use:");
      message.newLine().yellow("   /train keepchunksloaded true");
    }

    // Send
    p.sendMessage(" ");
    message.send(p);
  }
View Full Code Here

      } else {
        message(ChatColor.RED + "World already exists!");
      }
    } else {
      showInv();
      MessageBuilder modes = new MessageBuilder();
      modes.yellow("Available environments: ").setIndent(2).setSeparator(ChatColor.YELLOW, " / ");
      for (WorldMode mode : WorldMode.values()) {
        modes.green(mode.getName());
      }
      modes.send(sender);
    }
  }
View Full Code Here

        }
        if (affected.isEmpty()) {
          message(ChatColor.RED + "None of the worlds specified were identified, nothing is reset!");
        } else {
          message(ChatColor.GREEN + "The following world configurations have been reset to the defaults:");
          MessageBuilder message = new MessageBuilder().setSeparator(ChatColor.WHITE, " / ");
          for (String worldName : affected) {
            message.append(ChatColor.YELLOW, worldName);
          }
          message.send(sender);
        }
      } else {
        this.showInv();
      }
    } else {
View Full Code Here

  }
 
  public void execute() {
    if (sender instanceof Player) {
      //perform some nice layout coloring
      MessageBuilder builder = new MessageBuilder();
      builder.newLine().green("[Loaded/Online] ").red("[Unloaded/Offline] ").dark_red("[Broken/Dead]");
      builder.newLine().yellow("Available worlds: ");
      builder.setSeparator(ChatColor.WHITE, " / ").setIndent(2).newLine();
      for (String world : WorldUtil.getLoadableWorlds()) {
        if (WorldManager.isLoaded(world)) {
          builder.green(world);
        } else if (WorldConfigStore.get(world).isBroken()) {
          builder.dark_red(world);
        } else {
          builder.red(world);
        }
      }
      builder.send(sender);
    } else {
      //plain world per line
      sender.sendMessage("Available worlds:");
      for (String world : WorldUtil.getLoadableWorlds()) {
        String status = "[Unloaded]";
View Full Code Here

TOP

Related Classes of com.bergerkiller.bukkit.common.MessageBuilder

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.