Adminstick

Discussion in 'Plugin Development' started by Pazflor, Nov 29, 2011.

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

    Pazflor

    Why doesn't this work? There is error on both of the if statements.

    Code:java
    1.  
    2. public void onBlockBreak(BlockBreakEvent event) {
    3. Player p = event.getPlayer();
    4. Block b = event.getBlock();
    5.  
    6. if (p.hasPermission("lcplugin.adminstick")) {
    7. if (p.getItemInHand() == Material.STICK) {
    8. if (Action.LEFT_CLICK_BLOCK == true) {
    9. b.setType(Material.AIR);
    10. }
    11. }
    12. }
    13. }
    14.  
     
  2. Offline

    TehRandomGuy

  3. I see 3 if statements.
    getItemInHand() returns and ItemStack, not a Material.
    if (Action.LEFT_CLICK_BLOCK == true) {
    is complete nonsense. Try:
    if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
     
    r3Fuze likes this.
Thread Status:
Not open for further replies.

Share This Page