Exemple #1
0
  public static String makeCircuitDescriptionLine(Chip c, ChatColor argsColor) {
    StringBuilder concat = new StringBuilder();
    for (String arg : c.args) concat.append(arg).append(" ");

    String cargs = "";
    if (concat.length() > 0) cargs = concat.toString().substring(0, concat.length() - 1);

    if (cargs.length() > lineLength) cargs = cargs.substring(0, lineLength - 3) + "...";
    cargs = "[ " + cargs + " ]";

    String sworld = c.world.getName() + " ";
    ChatColor nameColor = (c.isDisabled() ? ChatColor.GRAY : ChatColor.YELLOW);

    return c.id
        + ": "
        + nameColor
        + c.getType()
        + (c.name != null ? ChatColor.AQUA + " (" + c.name + ")" : "")
        + ChatColor.WHITE
        + " @ "
        + c.activationBlock.getBlockX()
        + ","
        + c.activationBlock.getBlockY()
        + ","
        + c.activationBlock.getBlockZ()
        + " "
        + sworld
        + argsColor
        + cargs;
  }
 @Override
 protected void runWithChip(
     Chip target, CommandSender sender, Command command, String label, String[] args) {
   if (target.isDisabled()) {
     target.enable();
     sender.sendMessage(RCPrefs.getInfoColor() + "Enabled " + target + ".");
   } else sender.sendMessage(RCPrefs.getDebugColor() + "The chip is already enabled.");
 }