Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7424

Chunk#contains(BlockData) has 2 issues

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • None
    • CraftBukkit version 3824-Spigot-9ebce8a-ce545de
    • Just my Test plugin
    • Yes

      I noticed that Chunk#contains(BlockData) appears to have 2 issues:

      1) it appears to only check default states, ex:

      Chunk chunk = player.getLocation().getChunk();
      if (chunk.contains(Material.CHEST.createBlockData())) {
          player.sendMessage("CONTAINS CHEST");
      } else {
          player.sendMessage("DOES NOT CONTAIN CHEST");
      }
      

      This will ONLY check if the block exact matches the default state, ie: NORTH
      If I place a south, east, west chest it will not match.

      2) It appears that once it does return true, if you break the chest it still returns true.
      After re-logging (chunk unloads then loads) it resets

      Steps to reproduce:
      (using the provided plugin)

      • place a chest in any direction other than when you're facing south (facing south = north chest)
      • stand on top of the chest (ensuring you're in the same chunk as the chest)
      • run command `/test`
      • You will see the message "DOES NOT CONTAIN CHEST" (should not do this)
      • Face south (ensures chest will face north) and place a chest in front of yourself
      • stand on top of the chest (ensuring you're in the same chunk as the chest)
      • run command `/test`
      • You will see the message "CONTAINS CHEST" (as expected)
      • break the chest below you
      • run command `/test`
      • You will see the message "CONTAINS CHEST" (this should not be happening)

            Unassigned Unassigned
            ShaneBee Shane Bee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: