示例#1
0
  /** Called when the screen is unloaded. Used to disable keyboard repeat events */
  public void onGuiClosed() {
    // Spout start
    entitySign.lineBeingEdited = -1;
    entitySign.columnBeingEdited = -1;
    entitySign.recalculateText();
    // Colorize text
    if (sendAsUnicode()) {
      boolean allow = Spoutcraft.hasPermission("spout.client.signcolors");
      for (int i = 0; i < entitySign.signText.length; i++) {
        if (entitySign.signText[i] != null)
          entitySign.signText[i] =
              entitySign.signText[i].replaceAll("(&([a-fA-F0-9]))", allow ? "\u00A7$2" : "");
      }
    } else {
      for (int i = 0; i < entitySign.signText.length; i++) {
        if (entitySign.signText[i] != null)
          entitySign.signText[i] = entitySign.signText[i].replaceAll("(&([a-fA-F0-9]))", "");
      }
    }
    // Spout end
    Keyboard.enableRepeatEvents(false);

    if (mc.theWorld.isRemote) {
      mc.getSendQueue()
          .addToSendQueue(
              new Packet130UpdateSign(
                  entitySign.xCoord, entitySign.yCoord, entitySign.zCoord, entitySign.signText));
    }
  }
示例#2
0
  /**
   * Fired when a control is clicked. This is the equivalent of
   * ActionListener.actionPerformed(ActionEvent e).
   */
  protected void actionPerformed(GuiButton par1GuiButton) {
    if (!par1GuiButton.enabled) {
      return;
    }

    if (par1GuiButton.id == 0) {

      if (!Spoutcraft.hasPermission("spout.client.signcolors")) {
        for (int i = 0; i < entitySign.signText.length; i++) {
          entitySign.signText[i] = ChatColor.stripColor(entitySign.signText[i]);
        }
      }
      entitySign.onInventoryChanged();
      mc.displayGuiScreen(null);
    }
    // Spout start
    else if (par1GuiButton.id == 1 && unicode.enabled) {
      ConfigReader.sendColorsAsUnicode = !ConfigReader.sendColorsAsUnicode;
      if (ConfigReader.sendColorsAsUnicode) {
        unicode.displayString = "Send As Unicode";
      } else {
        unicode.displayString = "Send As Plain Text";
      }
    }
    // Spout end
  }
示例#3
0
 public void sendChat(String message) {
   if (!Spoutcraft.hasPermission("spout.client.chatcolors")) {
     message = message.replaceAll("(&([a-fA-F0-9]))", "");
   }
   List<String> lines = formatChat(message, false);
   for (String chat : lines) {
     SpoutClient.getHandle().thePlayer.sendChatMessage(chat);
   }
 }