GroupManager Event Cancellations

Discussion in 'Spigot Plugin Development' started by Qruet, May 31, 2018.

  1. I've created a plugin that can regenerate certain types of blocks. This is so that players are able to break say a tree in a wood warp to collect wood. After a set amount of time the blocks automatically regenerate, however all the other blocks shouldn't be able to be broken, only the ones set to break. I was able to do this by checking for the BlockBreakEvent with the Highest priority. If the event was cancelled I would set cancelled to false, which has allowed for the players to break blocks, however I've noticed that WorldGuard still performs its tasks as if the event wasn't cancelled such as sending a deny message which I resolved by simply using the flag, "deny-message -e" however it also produces the smoke particle effect which apparently there isn't a way to disable that I'm aware of. I know it seems highly unlikely that there's any way around this, however I would think WorldGuard would be sure to first check that the event wasn't cancelled by another plugin before executing its tasks. Curious if there's anything I may have overlooked that may allow me from having this issue. (Reason for removal of smoke particle is due to the amount of lag it causes for some clients whilst breaking the blocks rapidly.) Also a side question, would cancelling such an event still cause the block's to not drop an item? I've noticed before that even though the blocks can be broken when uncancelled, they don't drop anything. I had to manually make the world drop an item naturally based on the drops that the block has (block.getDrops()). Would this still be due to WorldGuard (setting the event drops to null) or an issue with uncancelling a BlockBreakEvent?
    #1 Qruet, May 31, 2018
    Last edited: May 31, 2018
  2. No experience with world guard, however why wouldn't you just un-world guard that specific area? You're making a plugin, handle the area in the plugin
  3. I'd prefer to use all the resources I have at hand instead of creating a new feature to handle players attempting to break a block which I may only have one use for, however I have considered it an option.