Event for /setblock

Discussion in 'Spigot Plugin Development' started by basdv98, Jun 3, 2016.

  1. Hello,

    I am currently making a rollback system for a minigame, the minigame uses some /setblock commands with commandblocks and I will also need to rollback those actions. I have added all block events from org.bukkit.event.block but it won't rollback those setblock actions.

    I need to get the old blockstate of the block changed with /setblock as soon as the command is executed by a commandblock. How would I do that?

    Thank you!

    Regards,
    Bas
     
  2. Maybe just register a regular CommandExecutor and firstly check if the sender is instance of BlockCommandSender then check the command if it equals setblock and finally get the block from the arguments and save it somewhere. But I'm not sure if this is efficient or if it's even possible because I couldn't find a command block command pre process event(in order to get the block before anything is processed)