[HARD] Jump tracker

Discussion in 'Plugin Development' started by MrFrozen, Jul 13, 2015.

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

    MrFrozen

    Hey guys,

    I wanna see if the player jumps a specific way and I do have the start of it by checking if the player jumps amd it does work good.
    Code:
    @EventHandler
        public void onMove (PlayerMoveEvent e) {
            if (e.isCancelled()) {
                return;
            }
            // Y was 79 jumped says 80
            // v LONG VALUES v
            // 80.00133597911214
            // 80.16610926093821
            // ==
            // 80.16610926093821
            // 80.24918707874468
            if(e.getTo().getY() > e.getFrom().getY()) {
                Player p = e.getPlayer();
                if (p.getLocation().subtract(0, 1, 0).getBlock().getType().equals(Material.AIR)) {
                    if (!p.isFlying()) {
                        long userY = Math.round(p.getLocation().getY());
                        String userJ = userY + ".24918707874468";
                        String userJJ = "" + e.getTo().getY();
                        if(userJJ.equals(userJ)) {
                            //Player Jumped
                        }
                    }
                }
            }
           
        }
    Now I wanna check if the user makes this jump anywhere in the world:
    [​IMG]
    * Iron Block = Start
    * Gold Block = Jump End

    The values may have a little margin if that makes life ez
     
  2. Offline

    xMrPoi

    When they jump, store their location. When they land, compare that location and see if the distances for the x and z value are correct.
     
  3. Offline

    MrFrozen

    Store it in what? I do not know what is the best way
     
  4. In a HashMap<UUID, List<Location>>
    Btw: Isn't it easier to just check if the block under the player (y - 0.1 or something like this) is not iron or gold?
     
  5. Offline

    MrFrozen

    Normally it can be any block you want but iron & gold was for explaining purposes!
     
  6. Then do it with locations instead of gold & iron. Check if p.isOnGround() and if the blocks location under him isn't in the list of locations you have. If this is true the player failed the jump
     
  7. Offline

    MrFrozen

    Woow I get confused. I will waste my time on this to find it out myself cause this wont help me furthur.

    Thanks for your suggestions!
     
Thread Status:
Not open for further replies.

Share This Page