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

When using BlockBreakEvent#setDropItems(boolean) the broken block in this event isn't added in the player's MINE_BLOCK Statistic

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version 3468-Spigot-ffceeae-d53c4fb (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT)
    • Yes

      The bug is pretty straightforward, here is the code to replicate it:

      public final class TestBlockBreak extends JavaPlugin implements Listener {
      
          @Override
          public void onEnable(){
               this.getServer().getPluginManager().registerEvents(this, this);
           }
      
          @Override
          public void onDisable() {}
      
          @EventHandler
          public void onBreak(BlockBreakEvent e) {
              e.setDropItems(false); // The code in question here
              Player p = e.getPlayer();
              int broken = 0;
              for (Material mat : Material.values()) {             
                  broken += p.getStatistic(Statistic.MINE_BLOCK, mat);
               }
      
              Bukkit.broadcastMessage("Blocks broken: " + broken);
          }
      }
      

      Each time the broadcast is called, the number of blocks broken in the statistic does not change.

      Do note: The version is behind yes, but this bug persists across any version of 1.18 - 1.18.2, I did not test this on any other version

            Unassigned Unassigned
            Burchard37 Dalton Burchard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: