Solved player.setWalkSpeed() doesn't work onJoin.

Discussion in 'Plugin Development' started by r0llingthund3r, Jul 26, 2014.

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

    r0llingthund3r

    As stated in the title, when I attempt to set a player's walk speed upon joining, it does nothing.

    Code:java
    1. @EventHandler
    2. public void onJoin(PlayerJoinEvent e){
    3. Player p = e.getPlayer();
    4. boolean pHasTDA = ThunderSuite.perms.playerInGroup(p, "Terminator") || ThunderSuite.perms.playerInGroup(p, "AssaultTerminator");
    5. if(pHasTDA){
    6. p.setWalkSpeed(.015f);
    7. ThunderSuite.debug("TRUE");
    8. }
    9. else{
    10. p.setWalkSpeed(.2f);
    11. ThunderSuite.debug("FALSE");
    12. }
    13. }


    The event is registered and the debug messages are firing, so I'm stumped.
     
  2. Offline

    Garris0n

    Try a one-tick delay, although I could've sworn it worked fine.

    Also, only terrible people write decimals without a '0' in front :p
     
  3. Offline

    r0llingthund3r

    Garris0n Yes I am quite the public menace when it comes to conventions. [creeper]

    To others experiencing the same problem, 1 tick didn't do it. I ended up delaying it by 10 and that did the trick.
     
  4. Offline

    MomsKnife

    Put it in a PlayerMoveEvent, or schedule a task to run after a tick or so
     
  5. Offline

    Garris0n

    wat
     
Thread Status:
Not open for further replies.

Share This Page