/** Updates Client side signs */
  public void handleUpdateSign(Packet130UpdateSign par1Packet130UpdateSign) {
    WorldServer worldserver = mcServer.worldServerForDimension(playerEntity.dimension);

    if (worldserver.blockExists(
        par1Packet130UpdateSign.xPosition,
        par1Packet130UpdateSign.yPosition,
        par1Packet130UpdateSign.zPosition)) {
      TileEntity tileentity =
          worldserver.getBlockTileEntity(
              par1Packet130UpdateSign.xPosition,
              par1Packet130UpdateSign.yPosition,
              par1Packet130UpdateSign.zPosition);

      if (tileentity instanceof TileEntitySign) {
        TileEntitySign tileentitysign = (TileEntitySign) tileentity;

        if (!tileentitysign.isEditable()) {
          mcServer.logWarningMessage(
              (new StringBuilder())
                  .append("Player ")
                  .append(playerEntity.username)
                  .append(" just tried to change non-editable sign")
                  .toString());
          return;
        }
      }

      for (int i = 0; i < 4; i++) {
        boolean flag = true;

        if (par1Packet130UpdateSign.signLines[i].length() > 15) {
          flag = false;
        } else {
          for (int l = 0; l < par1Packet130UpdateSign.signLines[i].length(); l++) {
            if (ChatAllowedCharacters.allowedCharacters.indexOf(
                    par1Packet130UpdateSign.signLines[i].charAt(l))
                < 0) {
              flag = false;
            }
          }
        }

        if (!flag) {
          par1Packet130UpdateSign.signLines[i] = "!?";
        }
      }

      if (tileentity instanceof TileEntitySign) {
        int j = par1Packet130UpdateSign.xPosition;
        int k = par1Packet130UpdateSign.yPosition;
        int i1 = par1Packet130UpdateSign.zPosition;
        TileEntitySign tileentitysign1 = (TileEntitySign) tileentity;
        System.arraycopy(par1Packet130UpdateSign.signLines, 0, tileentitysign1.signText, 0, 4);
        tileentitysign1.onInventoryChanged();
        worldserver.markBlockNeedsUpdate(j, k, i1);
      }
    }
  }
Example #2
0
  /** Updates Client side signs */
  public void handleUpdateSign(Packet130UpdateSign par1Packet130UpdateSign) {
    WorldServer var2 = this.mcServer.getWorldManager(this.playerEntity.dimension);

    if (var2.blockExists(
        par1Packet130UpdateSign.xPosition,
        par1Packet130UpdateSign.yPosition,
        par1Packet130UpdateSign.zPosition)) {
      TileEntity var3 =
          var2.getBlockTileEntity(
              par1Packet130UpdateSign.xPosition,
              par1Packet130UpdateSign.yPosition,
              par1Packet130UpdateSign.zPosition);

      if (var3 instanceof TileEntitySign) {
        TileEntitySign var4 = (TileEntitySign) var3;

        if (!var4.isEditable()) {
          this.mcServer.logWarning(
              "Player " + this.playerEntity.username + " just tried to change non-editable sign");
          return;
        }
      }

      int var6;
      int var8;

      for (var8 = 0; var8 < 4; ++var8) {
        boolean var5 = true;

        if (par1Packet130UpdateSign.signLines[var8].length() > 15) {
          var5 = false;
        } else {
          for (var6 = 0; var6 < par1Packet130UpdateSign.signLines[var8].length(); ++var6) {
            if (ChatAllowedCharacters.allowedCharacters.indexOf(
                    par1Packet130UpdateSign.signLines[var8].charAt(var6))
                < 0) {
              var5 = false;
            }
          }
        }

        if (!var5) {
          par1Packet130UpdateSign.signLines[var8] = "!?";
        }
      }

      if (var3 instanceof TileEntitySign) {
        var8 = par1Packet130UpdateSign.xPosition;
        int var9 = par1Packet130UpdateSign.yPosition;
        var6 = par1Packet130UpdateSign.zPosition;
        TileEntitySign var7 = (TileEntitySign) var3;
        System.arraycopy(par1Packet130UpdateSign.signLines, 0, var7.signText, 0, 4);
        var7.onInventoryChanged();
        var2.markBlockNeedsUpdate(var8, var9, var6);
      }
    }
  }