Example #1
0
 public override void HandleUpdateSign(net.minecraft.src.Packet130UpdateSign packet130updatesign)
 {
     if (this.playerEntity.isDead)
     {
         return;                           // CRAFTBUKKIT
     }
     net.minecraft.src.WorldServer worldserver = mcServer.GetWorldServer(playerEntity.dimension);
     if (worldserver.BlockExists(packet130updatesign.xPosition, packet130updatesign.yPosition, packet130updatesign.zPosition))
     {
         net.minecraft.src.TileEntity tileentity = worldserver.GetBlockTileEntity(packet130updatesign.xPosition, packet130updatesign.yPosition, packet130updatesign.zPosition);
         if (tileentity is net.minecraft.src.TileEntitySign)
         {
             net.minecraft.src.TileEntitySign tileentitysign = (net.minecraft.src.TileEntitySign)tileentity;
             if (!tileentitysign.GetEditable())
             {
                 mcServer.LogWarning((new java.lang.StringBuilder()).Append("Player ").Append(playerEntity.username).Append(" just tried to change non-editable sign").ToString());
                 this.SendPacket(new Packet130UpdateSign(packet130updatesign.xPosition, packet130updatesign.yPosition, packet130updatesign.zPosition, tileentitysign.Lines)); // CRAFTBUKKIT
                 return;
             }
         }
         for (int i = 0; i < 4; i++)
         {
             bool lineValid = true;
             if (packet130updatesign.signLines[i].Length > 15)
             {
                 lineValid = false;
             }
             else
             {
                 for (int l = 0; l < packet130updatesign.signLines[i].Length; l++)
                 {
                     if (net.minecraft.src.ChatAllowedCharacters.allowedCharacters.IndexOf(packet130updatesign.signLines[i][l]) < 0)
                     {
                         lineValid = false;
                     }
                 }
             }
             if (!lineValid)
             {
                 packet130updatesign.signLines[i] = "!?";
             }
         }
         if (tileentity is net.minecraft.src.TileEntitySign)
         {
             int x = packet130updatesign.xPosition;
             int y = packet130updatesign.yPosition;
             int z = packet130updatesign.zPosition;
             net.minecraft.src.TileEntitySign tileentitysign1 = (net.minecraft.src.TileEntitySign)tileentity;
             for (int j1 = 0; j1 < 4; j1++)
             {
                 tileentitysign1.Lines[j1] = packet130updatesign.signLines[j1];
             }
             tileentitysign1.SetEditable(false);
             tileentitysign1.OnInventoryChanged();
             worldserver.MarkBlockNeedsUpdate(x, y, z);
         }
     }
 }