If statement not working correctly

Discussion in 'Plugin Development' started by bigbeno37, Oct 13, 2013.

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

    bigbeno37

    Hey!

    So, I'm creating this plugin that allows you to set two blocks and teleport between them. Thus far, setting the blocks and putting them in a HashMap is fine; the issue is detecting when the player is on the block. Now, as you can see below, I have tried to compare wherever the player moves to where the block is, but it doesn't work.

    Please have a look, and don't laugh too much if it's a newbie mistake :p

    SimpleTeleport.java: http://pastebin.com/mhJM4ky9
    SimpleTeleportListener.java: http://pastebin.com/jqqQBdXy
     
  2. Offline

    Mathias Eklund

    don't post pastebin links, post the code in the thread please.
     
  3. Offline

    MrSnare

    If i were you I would forget the player move event and create a repeating task onEnable that goes through every key in the hashmap and check any player's distance is less than 0.5 blocks from this block.

    For this to work though you would need to add 0.5 to the location x and z that you are storing to get the centre of the block. That's what you really want.
     
Thread Status:
Not open for further replies.

Share This Page