Player Interact with a Block Help

Discussion in 'Plugin Development' started by AdityaTD, Feb 24, 2015.

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

    AdityaTD

    Hey guys I am making a Parkour coins system for my network and I want to know how to Give coins on completing parkour when player interact with a Block which is NetherBrick in my case! I put a code but it came up with errors!

    Here's a empty Event, tell me what to add!
    Code:
       @EventHandler
        public void onPlayerInteract(PlayerInteractEvent event){
            Player player = event.getPlayer();
            giveCoins(player, 100) //My coin system give coin system!
    }

    Thanks in Advance!
    - Aditya

    Plz help it's urgent, also edited the code a bit!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
  2. Offline

    mine-care

    @AdityaTD don't bump in periods less than 24 hours.
    To do it, get block under player, get its type and if it is nether brick do The coin system stuff
     
  3. Offline

    wxwsk8er

    Solved?

    If so let's change the title ;)

    Second, if you edited the code, just post it so we can help!

    Third, did you:
    1. Register the handler
    2. Use event's getBlockClicked() method, and check the material.

    Good luck!
     
  4. @AdityaTD Get the player who clicked it (event#getWhoClicked()), check if it was a right click, add the coins.
     
Thread Status:
Not open for further replies.

Share This Page