Пример #1
0
  public ChatColor getOperatorColor() throws Exception {
    String colorName = config.getString("ops-name-color", null);

    if (colorName == null) return ChatColor.RED;
    if ("none".equalsIgnoreCase(colorName) || colorName.isEmpty()) throw new Exception();

    try {
      return ChatColor.valueOf(colorName.toUpperCase());
    } catch (IllegalArgumentException ex) {
    }

    return ChatColor.getByCode(Integer.parseInt(colorName, 16));
  }
Пример #2
0
  private void loadGroups() {
    FileInputStream inputStream;
    InputStreamReader reader;
    Scanner scanner = null;
    try {
      inputStream = new FileInputStream(currentGroupFileName);
      reader = new InputStreamReader(inputStream, "UTF-8");

      scanner = new Scanner(reader);

      String line = "";
      while (scanner.hasNextLine()) {
        line = scanner.nextLine();

        // Check for comments.
        if (line.startsWith("#") || line.startsWith("//")) continue;

        String[] data = line.split(":");

        if (data.length < 2) continue;

        if (data.length >= 2) {
          Group newGroup = new Group(data[0]);

          groups.add(newGroup);

          newGroup.setColor(ChatColor.getByCode(Integer.parseInt(data[1])));

          if (Kikkit.IsDebugging)
            Kikkit.MinecraftLog.info("    Added group: " + newGroup.getName());

          if (data.length > 2) {
            String[] commands = data[2].split(",");

            // TODO: Why must we do a foreach here?
            // Because java doesn't understand IEnumerable
            for (String str : commands) {
              if (Kikkit.IsDebugging) Kikkit.MinecraftLog.info("        command: " + str);
              newGroup.Commands.add(str);
            }
          }
        }
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      // e.printStackTrace();
      Kikkit.MinecraftLog.info(e.getMessage());
    } finally {
      if (scanner != null) scanner.close();
    }
  }
Пример #3
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int x, int y, float z) {
    drawDefaultBackground();
    drawCenteredString(fontRenderer, screenTitle, width / 2, 40, 0xffffff);

    // Spout Start
    if (org.spoutcraft.client.config.ConfigReader.showChatColors) {
      for (int c = 0; c < 16; c++) {
        ChatColor value = ChatColor.getByCode(c);
        String name = value.name().toLowerCase();
        boolean lastUnderscore = true;
        String parsedName = "";
        for (int chr = 0; chr < name.length(); chr++) {
          char ch = name.charAt(chr);
          if (lastUnderscore) {
            ch = Character.toUpperCase(ch);
          }
          if (ch == '_') {
            lastUnderscore = true;
            ch = ' ';
          } else {
            lastUnderscore = false;
          }
          parsedName += ch;
        }
        char code = (char) ('0' + c);
        if (c >= 10) {
          code = (char) ('a' + c - 10);
        }
        fontRenderer.drawStringWithShadow(
            "&" + code + " - " + value + parsedName, width - 90, 70 + c * 10, 0xffffffff);
      }
    }
    // Spout end

    GL11.glPushMatrix();
    GL11.glTranslatef(width / 2, 0.0F, 50F);
    float f = 93.75F;
    GL11.glScalef(-f, -f, -f);
    GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
    Block block = entitySign.getBlockType();

    if (block == Block.signPost) {
      float f1 = (float) (entitySign.getBlockMetadata() * 360) / 16F;
      GL11.glRotatef(f1, 0.0F, 1.0F, 0.0F);
      GL11.glTranslatef(0.0F, -1.0625F, 0.0F);
    } else {
      int i = entitySign.getBlockMetadata();
      float f2 = 0.0F;

      if (i == 2) {
        f2 = 180F;
      }

      if (i == 4) {
        f2 = 90F;
      }

      if (i == 5) {
        f2 = -90F;
      }

      GL11.glRotatef(f2, 0.0F, 1.0F, 0.0F);
      GL11.glTranslatef(0.0F, -1.0625F, 0.0F);
    }

    // Spout start
    // if(this.updateCounter / 6 % 2 == 0) {
    this.entitySign.lineBeingEdited = this.editLine;
    entitySign.columnBeingEdited = editColumn;
    // }
    // Spout end

    TileEntityRenderer.instance.renderTileEntityAt(entitySign, -0.5D, -0.75D, -0.5D, 0.0F);
    // Spout start
    this.entitySign.lineBeingEdited = -1;
    entitySign.columnBeingEdited = -1;
    // Spout end
    GL11.glPopMatrix();
    super.drawScreen(x, y, z);
    // Spout start
    if (unicode.enabled
        && isInBoundingRect(
            unicode.xPosition,
            unicode.yPosition,
            unicode.field_52007_b,
            unicode.field_52008_a,
            x,
            y)) {
      this.drawTooltip(
          "Some servers censor unicode characters. \nIf yours does, try sending as plain text.",
          x,
          y);
    }
    // Spout end
  }