Not Working

Discussion in 'Plugin Development' started by iWareWolf, Jun 5, 2014.

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

    iWareWolf

    I'm trying to let players build up for a super jump but it is not working.

    Code:java
    1. this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    2.  
    3. @Override
    4. public void run() {
    5. globalTicks += .05;
    6.  
    7. if (globalTicks % 1 == 0) {
    8. for (Player player : getServer().getOnlinePlayers()) {
    9. if (player.isSneaking() == true) {
    10. addJumpCharge(player);
    11. } else {
    12. if (jumpCharge.get(player.getName()) > 0) {
    13. player.setVelocity(player.getLocation().getDirection().multiply(1 + (jumpCharge.get(player.getName())) * .1));
    14. jumpCharge.remove(player.getName());
    15. }
    16. }
    17. }
    18. }
    19. }
    20.  
    21. }, 0L, 1L);


    Code:java
    1. public void addJumpCharge(Player player) {
    2. if (jumpCharge.containsKey(player.getName())) {
    3. if (jumpCharge.get(player.getName()) < 5) {
    4. jumpCharge.put(player.getName(), jumpCharge.get(player.getName()) + 1);
    5. player.setExp((float) (jumpCharge.get(player.getName()) * .19) * 17);
    6. }
    7. } else {
    8. jumpCharge.put(player.getName(), 0);
    9. }
    10. }
     
  2. Offline

    fireblast709

  3. Offline

    iWareWolf

    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
     
  4. Offline

    fireblast709

    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)
     
  5. Offline

    iWareWolf

    fireblast709

    Okay thanks I'll try that and haven't seen you on forums for a while :p

    fireblast709
    Still does not seem to work

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 30, 2016
  6. Offline

    fireblast709

  7. Offline

    iWareWolf

Thread Status:
Not open for further replies.

Share This Page