help with client info

Discussion in 'Plugin Development' started by josha28, Aug 17, 2017.

Thread Status:
Not open for further replies.
  1. How can i get information about the client.
     
  2. Online

    timtower Administrator Administrator Moderator

    @josha28 What information do you want?
     
  3. like if he is standing on a diamond block.
     
  4. Online

    timtower Administrator Administrator Moderator

    @josha28 Player#getLocation()
    Then you need to get the block below that.
     
  5. Code:
        public void onDiamond() {
            Player player = getName();
            Location playerlocation = player.getLocation();
        }
     
  6. Online

    timtower Administrator Administrator Moderator

    @josha28 My suggestion would be using the PlayerMoveEvent for this. Not a magic method.
    And that is correct, now you need to get the block, call getRelative on that to get the block below it.
     
  7. Code:
        public void onBlock(PlayerMoveEvent e) {
            Player player = player.getPlayer();
                if(player.getLocation.getblock.gettype == material.diamond_block) {
                    // do diamond stuff
                }
                if(player.getLocation.getblock.gettype == material.goldblock) {
                    // do gold stuff
                }
           
        }
    This is what i have but lots of errors
     
  8. Online

    timtower Administrator Administrator Moderator

    @josha28 That is because you are calling methods that don't exist. You are also trying to call methods as variables.
    How long have you been coding in Java?
     
  9. some one send it to me

    how can i fix it

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
  10. Online

    timtower Administrator Administrator Moderator

    @josha28 You can fix it by using the methods and not access them as fields.
    But again: how long have you been coding in Java
     
  11. one week, i want to get better
     
  12. Online

    timtower Administrator Administrator Moderator

    @josha28 Then please do so without Bukkit for now.
    Bukkit will only make it complicated, follow some basic Java tutorials, know how to call methods, what the difference is between public and private.
     
Thread Status:
Not open for further replies.

Share This Page