How does onPlayerMove work?

Discussion in 'Plugin Development' started by Jacob Litewski, Jan 30, 2011.

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

    Jacob Litewski

    I can't seem to get it to do anything. I even tried to put pme.getPlayer().sendMessage("HI"); in it to have it send me messages, but no go.

    I need to have this or a event like it, because I need to calculate the difference between a stored Y coord and the players y coord. I think I'm doing it right, but I'm not sure (the command itself works, It just won't update when I move.)

    Thanks for your help!
     
  2. Offline

    Reil

    Pastebin your function please. :3
     
  3. Offline

    Jacob Litewski

    It's seriously only this:

    onPlayerMove(PlayerMoveEvent pme);
    Code:
    //package
    //required imports
    
    public class HcPlayerListener extends PlayerListener {
        public static HACKchat plugin;
    
        public HcPlayerListener(HACKchat instance)
           { plugin = instance; }
    
        public void onPlayerMove(PlayerMoveEvent pme)
            { plugin.monitorGPS(event.getPlayer()); }
    }
    
    http://pastie.org/private/2vfqwjzctguakgkrzgsbrw is the main class.

    I'm seriously at a loss on why it doesn't work. I believe I called everything correctly, but it's not seeing that my player moved.
     
  4. Look at this:
    Code:
    public void onPlayerMove(PlayerMoveEvent pme)
          { plugin.monitorGPS(event.getPlayer()); }
    You have it calling your function with event.getPlayer() instead of pme.getPlayer()
     
  5. Offline

    Purre

    It looks like you forgot to register the event in the main class.
    --- merged: Jan 30, 2011 5:11 PM ---
    And this.
     
  6. Offline

    Jacob Litewski

    Yea, that was an error on my part when copying over my code. I didn't change event to pme, but I have pme.getPlayer(); and it still didn't work.

    and your right, i didn't register the event. Thats what 30 hours up in a row does to someone :p

    Let me do that and I'll get back with you guys.
    --- merged: Jan 30, 2011 5:36 PM ---
    Awesome, that's what the problem was, I forgot to register the command with the plugin >.<

    and now it works fairly well! That project is done, now it's time to play with chunks!
     
Thread Status:
Not open for further replies.

Share This Page