Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Solved] [New API] Can't cancel Player Move Event

Comments in 'Plugin Development' started by Adaasi, Sep 8, 2014.

  1. Adaasi
    Offline

    Adaasi Active Member

    Joined:
    Aug 14, 2014
    Posts:
    78
    I already did it. I see debug message but I can't cancel the event.
    This is the code:
    PHP:
    public function PlayerMove(EntityMoveEvent $ev){
                
    $dbg $ev->getPlayer();
                
    $dbg->sendMessage("DEBUG");
                
    $ev->setCancelled(true);
    }
    PEMapModder likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Are you sure it is getPlayer()?
  3. Adaasi
    Offline

    Adaasi Active Member

    Joined:
    Aug 14, 2014
    Posts:
    78
    Yes because I see the message ingame
  4. Adaasi
    Offline

    Adaasi Active Member

    Joined:
    Aug 14, 2014
    Posts:
    78
    Yes:
    PHP:
    public function PlayerMove(EntityMoveEvent $ev){
                
    $dbg $ev->getEntity();
                 if (
    $dbg instanceof Player){
                     
    $dbg->sendMessage("DEBUG");
                     
    $ev->setCancelled(true);
                }
    }
    But the event isn't cancelled.
    Last edited: Sep 8, 2014
  5. Adaasi
    Offline

    Adaasi Active Member

    Joined:
    Aug 14, 2014
    Posts:
    78
    I also think that is a PocketMine bug. But the strange thing is that in SimpleAuth the EntityMoveEvent seems to work
  6. GlaciercreepsMC
    Offline

    GlaciercreepsMC Active Member Plugin Developer

    Joined:
    Jan 21, 2014
    Posts:
    91
    Plugins:
    1
    Minecraft User:
    GlaciercreepsMC
    uh, did you forget to implement the Listener interface?
    EDIT: Nvm you probably did, since you're able to receive the debug message in-game.
  7. Tuff
    Offline

    Tuff Active Member

    Joined:
    Jan 25, 2014
    Posts:
    203
    Minecraft User:
    Roboroug2
    $ev->setCancelled()
    Without the "true"? I've never used the true before and it worked fine.
    EkiFoX and GlaciercreepsMC like this.
  8. GlaciercreepsMC
    Offline

    GlaciercreepsMC Active Member Plugin Developer

    Joined:
    Jan 21, 2014
    Posts:
    91
    Plugins:
    1
    Minecraft User:
    GlaciercreepsMC
    Perhaps he comes from Bukkit? Bukkit only has
    event.setCancelled(boolean cancel)
    EkiFoX likes this.
  9. Dutok
    Offline

    Dutok Notable Member Plugin Developer

    Joined:
    Jun 20, 2014
    Posts:
    371
    Plugins:
    3
    Minecraft User:
    Dutok
    SimpleAuth successfully cancels player movement, idk what's going wrong here.
    iJoshuaHD likes this.
  10. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    it cancels the event. its just lag that enables you to move. reconnect and see what happens.
    PEMapModder likes this.
  11. Dutok
    Offline

    Dutok Notable Member Plugin Developer

    Joined:
    Jun 20, 2014
    Posts:
    371
    Plugins:
    3
    Minecraft User:
    Dutok
    If you're able to move, it's probably a permissions problem or, like you said, lag.
    GlaciercreepsMC likes this.
  12. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    its just lag.
    Tuff likes this.
  13. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No, true is the default value.
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Permission?
  15. Dutok
    Offline

    Dutok Notable Member Plugin Developer

    Joined:
    Jun 20, 2014
    Posts:
    371
    Plugins:
    3
    Minecraft User:
    Dutok
    simpleauth.move - Allows moving while not being authenticated
    PEMapModder likes this.
  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Oh. Pointless permission that is -_-
    EkiFoX, Dutok and MCPEPIG like this.
  17. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    Lol
  18. Dutok
    Offline

    Dutok Notable Member Plugin Developer

    Joined:
    Jun 20, 2014
    Posts:
    371
    Plugins:
    3
    Minecraft User:
    Dutok
    Yeah, xD. I can't think of any situation where it would be useful.
  19. Adaasi
    Offline

    Adaasi Active Member

    Joined:
    Aug 14, 2014
    Posts:
    78
    It isn't permission problem.
  20. Adaasi
    Offline

    Adaasi Active Member

    Joined:
    Aug 14, 2014
    Posts:
    78
    I think my code is correct. Maybe I forgot something...

Share This Page

Advertisement