PlayerMoveEvent getTo() method not working properly?

Discussion in 'Plugin Development' started by PQE, Feb 14, 2017.

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


    Before I give any text, here's the code in question:

        public void onPlayerMove(PlayerMoveEvent event) {
            Player player = event.getPlayer();
            Location loc = event.getTo();
            if (loc.getBlock().getType() != Material.SPONGE) {
    I'm just asking if event.getTo() returns the block the player is now standing on, or the new location of the player's top half or something. Basically, whenever I'm standing on sponge I'll get the "notsponge" message when I move around on it, and my code seems alright, so my only conclusion is that event.getTo() does not give the block the player moved to.
  2. Offline


    It's the block inside the feet. You have to check below the player using Block#getRelative
Thread Status:
Not open for further replies.

Share This Page