Solved player move event not working

Discussion in 'Plugin Development' started by lrdemolition, Aug 19, 2014.

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

    lrdemolition

    so i have this listener listening for the player move event
    every time the player moves it should send them a message and check to see if they crossed a border
    but neither the message or the check works when i test it on the server. can someone tell me whats wrong
    Code:
        public void pbcheck(PlayerMoveEvent event){
            Player p = (Player) event.getPlayer();
            p.sendMessage("p1");
            Location ia = (Location) p.getLocation();
            double x = ia.getX();
            double z = ia.getZ();
            double y = ia.getY();
            if(x > 500){
                Location l = new Location(p.getWorld(), x - 1, z, y);
                p.teleport(l);
                p.sendMessage(ChatColor.DARK_RED+"Out of Boundries");
            }
            if(x < -500){
                Location l = new Location(p.getWorld(), x + 1, z, y);
                p.teleport(l);
                p.sendMessage(ChatColor.DARK_RED+"Out of Boundries");
            }
            if(z > 500){
                Location l = new Location(p.getWorld(), x, z + 1, y);
                p.teleport(l);
                p.sendMessage(ChatColor.DARK_RED+"Out of Boundries");
            }
           
            if(z < -500){
                Location l = new Location(p.getWorld(), x, z - 1, y);
                p.teleport(l);
                p.sendMessage(ChatColor.DARK_RED+"Out of Boundries");
            }
           
           
           
           
           
        }
     
  2. Offline

    br456

    Do you have @EventHandler above the preceding the event and are your events registered?
     
  3. Offline

    Gater12

    lrdemolition
    Did you register your events? Do you have the @EventHandler annotation above your event methods?
     
  4. Offline

    lrdemolition

Thread Status:
Not open for further replies.

Share This Page