Blocking Build Rights?

Discussion in 'Plugin Development' started by ImPhantom, Feb 27, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ImPhantom

    I am just making a freeze command and i have already got the blocking of movement but all i need is to block the players rights to build. How could i do this with BlockPlaceEvent? or is there a more efficient way to do it?
     
  2. Offline

    L33m4n123

    cancel the blockPlaceEvent if they are frozen
     
  3. Offline

    Brendyn Todd

    Just use event.setCancelled(true); in the BlockPlaceEvent and do proper checks.
     
  4. Offline

    ImPhantom

    L33m4n123
    Would that be easier to do within the command or should i do it through a separate Method?
     
  5. Offline

    Traks

    Code:java
    1. @EventHandler
    2. public void onPlace(BlockPlaceEvent e) {
    3. // What ever you use to know if players have been frozen in if statement
    4. e.setCancelled(true); // In if statement
    5. }

    Or if you also want to block all other interactions
    Code:java
    1. @EventHandler
    2. public void onInteract(PlayerInteractEvent e) {
    3. // What ever you use to know if players have been frozen in if statement
    4. e.setCancelled(true); // In if statement
    5. }
     
  6. Offline

    Brendyn Todd

    ImPhantom
    Just use a command to set a variable in the config and then use the event to check if the player has a boolean set to true or false for being frozen.
     
Thread Status:
Not open for further replies.

Share This Page