Player Heads

Player Heads

897k Downloads

BlockBreakEvent will be called twice.

WMGameLive opened this issue ยท 2 comments

commented

Describe the bug
When the player break a PLAYER_HEAD, BlockBreakEvent will be called twice.

To Reproduce

  1. Install PlayerHead.
  2. Write a super simple plugin that only send a message every time a block is break.
  3. In game, break a player head in survival mode, you will see the message sent twice.

Plugins

  • PlayerHead 5.2.9
  • no other plugin.

Servers

  • OS: windows
  • Server type: paper
  • Server version: 1.15.2

I found this problem when using my plugin to count the number of player destroyed blocks.
I removed all plugins except PlayerHead, and write a test plugin that only have these code

@EventHandler
public void onBreak(BlockBreakEvent e) {
    if(e.isCancelled()) return;
    Bukkit.broadcastMessage("Break A Block!");
}

Every time I break a player head it will send the message twice, and if delete PlayerHead, it will not happen.

commented

This is created by a feature that prevents breaking NCP+protections support.
This issue explains why

please use /ph config set pretestblockbreak false or set the pretestblockbreak config entry to false and reload the config (/ph config reload) to disable this.

In the API there is a SimulatedBlockBreakEvent that the test break is inherited from, if you want to detect or ignore the event specifically.

keep in mind turning off the second blockbreak will cause some really strange behavior when using NoCheatPlus.

commented

oh, I see. thank you!