Help with playerMoveEvent

Discussion in 'Plugin Development' started by CevinWa, Jul 16, 2012.

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


    Hi im having problems with checking if a hashmap contains the location of the block when the player passes over. i got it to work when i haden't got the if(Hashmap.containsKey(loc)){
    but i need that one
    this is my code.
        @EventHandler(priority = EventPriority.NORMAL)
        public void onPlayerMoveEvent(PlayerMoveEvent event)
            Player player = event.getPlayer();
        Location loc = player.getLocation();
        loc.setY(loc.getY() -2);
        if (plugin.Mine.containsKey(loc)){
          player.sendmessage("you just passed over the block");
    Any help would be much appruciated. :D
  2. Offline


    its not recomment to use locations as key in a hashmap, if the player is standigng on 0.164 then it wont trigger an block on 0.1639, I recommend converting it to an vector, because vectors are just x y z as an int, and then comparing it
  3. Offline


    Ok i'l try that
  4. Offline


    Or use the block location.... player.getLocation().getBlockX() and y and z
Thread Status:
Not open for further replies.

Share This Page