command allows player to place blocks

Discussion in 'Plugin Development' started by wildguy99, Jul 11, 2019 at 2:32 AM.

  1. Offline

    wildguy99

    Hi I'm making a plugin for the game I want to do a commnd that allows the player to build I can just cancel the event but i want it to be allowed when a staff member use the command
     
  2. Offline

    KarimAKL

    @wildguy99 What do you mean? Do you want a command that sets a block?
     
  3. Offline

    wildguy99

    I want that command to set canceled false at BlockPlaceEvent for the sender
     
  4. Offline

    KarimAKL

    @wildguy99 So you mean like a toggle command for being able to place blocks? In that case, you can make a Set<UUID> of players that are able to build, then do the following:
    1. Inside the command, if the set contains the player, remove them, if it doesn't contain the player, add them.
    2. Inside your BlockPlaceEvent, check if the set contains the player, if so let them build, otherwise cancel the event.
     
  5. Offline

    wildguy99

    thanks it worked
     
  6. Offline

    KarimAKL

Share This Page