meiskam / PlayerHeads

Bukkit Plugin - Drops a player's head when s/he dies, also mob heads
https://dev.bukkit.org/projects/player-heads
Other
16 stars 39 forks source link

BlockBreakEvent will be called twice. #19

Closed WMGameLive closed 4 years ago

WMGameLive commented 4 years ago

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

Servers

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.

crashdemons commented 4 years ago

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.

WMGameLive commented 4 years ago

oh, I see. thank you!