Example #1
0
 @Override
 public List<String> getPedestalDescription() {
   List<String> list = Lists.newArrayList();
   if (ProjectEConfig.ignitePedCooldown != -1) {
     list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("pe.ignition.pedestal1"));
     list.add(
         EnumChatFormatting.BLUE
             + String.format(
                 StatCollector.translateToLocal("pe.ignition.pedestal2"),
                 MathUtils.tickToSecFormatted(ProjectEConfig.ignitePedCooldown)));
   }
   return list;
 }
Example #2
0
 @Nonnull
 @SideOnly(Side.CLIENT)
 @Override
 public List<String> getPedestalDescription() {
   List<String> list = Lists.newArrayList();
   if (ProjectEConfig.zeroPedCooldown != -1) {
     list.add(TextFormatting.BLUE + I18n.format("pe.zero.pedestal1"));
     list.add(TextFormatting.BLUE + I18n.format("pe.zero.pedestal2"));
     list.add(
         TextFormatting.BLUE
             + I18n.format(
                 "pe.zero.pedestal3",
                 MathUtils.tickToSecFormatted(ProjectEConfig.zeroPedCooldown)));
   }
   return list;
 }
Example #3
0
  @Override
  public void processCommand(ICommandSender sender, String[] params) {
    if (params.length < 1) {
      sendError(sender, new ChatComponentTranslation("pe.command.set.usage"));
      return;
    }

    String name;
    int meta;
    int emc;

    if (params.length == 1) {
      ItemStack heldItem = getCommandSenderAsPlayer(sender).getHeldItem();

      if (heldItem == null) {
        sendError(sender, new ChatComponentTranslation("pe.command.set.notholding"));
        return;
      }

      name = Item.itemRegistry.getNameForObject(heldItem.getItem());
      meta = heldItem.getItemDamage();
      emc = MathUtils.parseInteger(params[0]);

      if (emc < 0) {
        sendError(sender, new ChatComponentTranslation("pe.command.set.invalidemc", params[0]));
      }
    } else {
      name = params[0];
      meta = 0;
      boolean isOD = !name.contains(":");

      if (!isOD) {
        if (params.length > 2) {
          meta = MathUtils.parseInteger(params[1]);

          if (meta < 0) {
            sendError(
                sender, new ChatComponentTranslation("pe.command.set.invalidmeta", params[1]));
            return;
          }

          emc = MathUtils.parseInteger(params[2]);

          if (emc < 0) {
            sendError(sender, new ChatComponentTranslation("pe.command.set.invalidemc", params[0]));
            return;
          }
        } else {
          emc = MathUtils.parseInteger(params[1]);

          if (emc < 0) {
            sendError(sender, new ChatComponentTranslation("pe.command.set.invalidemc", params[0]));
            return;
          }
        }
      } else {
        emc = MathUtils.parseInteger(params[1]);

        if (emc < 0) {
          sendError(sender, new ChatComponentTranslation("pe.command.set.invalidemc", params[0]));
          return;
        }
      }
    }

    if (CustomEMCParser.addToFile(name, meta, emc)) {
      ThreadReloadEMCMap.runEMCRemap(
          sender,
          ChatHelper.modifyColor(
              new ChatComponentTranslation("pe.command.set.success", name, emc),
              EnumChatFormatting.GREEN));
    } else {
      sendError(sender, new ChatComponentTranslation("pe.command.set.invaliditem", name));
    }
  }