Checking if someone is less than a location

Discussion in 'Plugin Development' started by snake4212, Mar 14, 2014.

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

    snake4212

    So basically I have this code I know something really stupid is wrong with it and I really have no idea where to start basically I want to make it so if a players y coordinate is less than 65 it teleports them to coordinates that i say can anyone help?
    Here is the code
    Code:
    Player player;
    Location loc = player.getLocation(); {
    if(loc.getBlockY(> 65));
    player.teleport(arg0) // Some cords that I will input after just don't know how to setup
     
  2. Offline

    ninja_ace202

    If statements should not end with a semicolon.

    They are simply:
    If ( condition )
    {
    Conditional code
    }

    Also > is greater than. < is less than.

    Try looking up Blue Pelican Java. Its a great book for learning Java programming and will make your life so much better.
     
  3. Offline

    snake4212

  4. Offline

    augustt198

    First of all, the variable "player" is never initialized - your IDE, if you're using one - should be making an error.
    Second, the syntax is seriously incorrect - this would be better:
    Code:java
    1. Player player = /* initialize? */;
    2. Location loc = player.getLocation();
    3. if(loc.getBlockY() < 65) {
    4. player.teleport(arg0);
    5. }
     
  5. Offline

    snake4212

    I did that but I still get errors regardless can you please help me
     
Thread Status:
Not open for further replies.

Share This Page