Solved player.isSneaking() not working correctly

Discussion in 'Plugin Development' started by mine2012craft, Jun 23, 2017.

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

    mine2012craft

    Hello,

    So during one of my coding sessions I realized that player.isSneaking() is not working correctly at all. I did a Bukkit.broadcastMessage debug with the method, and it showed that it was ALWAYS false, no matter if the player was sneaking or not.

    Code:
    Player player = Bukkit.getPlayer("WarlordWeaponry");
    
    @Override
    public void run(){
    if (player.isOnline()){
    Bukkit.broadcastMessage("" + player.isSneaking());
    }
    [​IMG]


    [​IMG]

    Is this just a bug with the API, or am I doing something wrong here?

    Thank you,
    WarlordWeaponry
     
  2. Offline

    Zombie_Striker

    @mine2012craft
    It looks like you are on 1.12, which is not the default version yet (which means it is still in testing). Well, turns out a few hours ago it was set as the default version. Are you using that version? If not, update and see if the problem still persists. If it still exist on the newest version, report the bug on the spigot forums.
     
  3. Offline

    mine2012craft

    I need to download Buildtools to update right? Or does this website (<redacted very bad website>) provide the updated version too?
     
    Last edited by a moderator: Jun 23, 2017
  4. Offline

    Zombie_Striker

    @mine2012craft
    Yes, you need to use Buildtools. Do not trust websites, as it is illegal to distribute bukkit or spigot jars.
     
  5. Offline

    mine2012craft

    I updated to the recent BuildTools (https://www.spigotmc.org/wiki/buildtools/#latest). However, the player.isSneaking() bool isn't working still. I will report this as soon as possible (or you will)

    EDIT: Wait, I'm using the Spigot one. Do I need to use Bukkit?
     
  6. Offline

    timtower Administrator Administrator Moderator

    Loop through the online players, check the sneak in there and send it to the player.
    Does it give the same results?
     
  7. Offline

    Caderape2

    @mine2012craft
    Debug the event #PlayerToggleSneakEvent for see if you have a return
     
  8. Offline

    RcExtract

    Doesn't it use a lot of memory?
     
  9. Offline

    timtower Administrator Administrator Moderator

    A loop on a timer using a lot of memory? No...
    If you have 500, then a little bit.
     
  10. Offline

    mine2012craft

    Uh... I had a event.setCancelled(true); in one of my PlayerToggleSneakEvent's...

    ...We all good here. Thanks...

    >.>
     
Thread Status:
Not open for further replies.

Share This Page