I'm trying to let players build up for a super jump but it is not working. Code:java this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { @Override public void run() { globalTicks += .05; if (globalTicks % 1 == 0) { for (Player player : getServer().getOnlinePlayers()) { if (player.isSneaking() == true) { addJumpCharge(player); } else { if (jumpCharge.get(player.getName()) > 0) { player.setVelocity(player.getLocation().getDirection().multiply(1 + (jumpCharge.get(player.getName())) * .1)); jumpCharge.remove(player.getName()); } } } } } }, 0L, 1L); Code:java public void addJumpCharge(Player player) { if (jumpCharge.containsKey(player.getName())) { if (jumpCharge.get(player.getName()) < 5) { jumpCharge.put(player.getName(), jumpCharge.get(player.getName()) + 1); player.setExp((float) (jumpCharge.get(player.getName()) * .19) * 17); } } else { jumpCharge.put(player.getName(), 0); } }
fireblast709 The initial chargeup does not work. Its supposed to increase your xp for visuals for the chargeup. 1/5 of the xp bar. The chargeup happens when u are shifted. When you release shift it uses the charge and sends u flying
iWareWolf debug globalTicks. Your addJumpCharge method seems fine, so it has to be that. Also, it might be better not to use doubles in this case, but to use integers (and just making all the numbers larger. For example, add one each tick and use % 20)
fireblast709 Okay thanks I'll try that and haven't seen you on forums for a while fireblast709 Still does not seem to work EDIT by Moderator: merged posts, please use the edit button instead of double posting.