getLineOfSight(), getTargetBlock() crashes server

Discussion in 'Spigot Plugin Development' started by MTM123, May 24, 2015.

  1. Hello.
    I have runned into one problem with methods: getLineOfSight(), getTargetBlock().
    While looking at sky(near y=210) these too methods crashes the server(Stacktrace points to the line where those methods are)
    Code:
    getLineOfSight();
    Code (Text):
    LivingEntity ple = (LivingEntity) player;
    List<Block> blocks = ple.getLineOfSight((Set<Material>) null, reach);
    getTargetBlock();
    Code (Text):
    player.getTargetBlock((Set<Material>) null, reach);
    Have tested this with reach=30

    Errors:
    getLineOfSight();
    http://pastebin.com/sm0KKMZH

    getTargetBlock();
    http://i.imgur.com/HWCyasr.png


    It would be great if someone could suggest a replacement for getTargetBlock() method or fix.
     
  2. Hi MTM123!

    I'm not very confident that a bug like this would have gone unnoticed, and it is possible that the crash is due to your implementation and what you do with the results (for example, an infinite loop which hangs the thread). Could you please share some more code with us to provide more context into your situation?

    I'll go and check this on my server now, too.
     
  3. This is all code that uses information from getTargetBlock()
    Code (Text):
    Location loc = (Location) player.getTargetBlock((Set<Material>) null, reach);

    player.teleport(loc);
     
  4. Tested and working on my server, sorry.
    I'd suggest you do more error logging to find out the line where your server crashes, or simply try updating your version of Spigot.
     
  5. Have you tried looking at sky near y=230+ ?
     
  6. Yep :/
     
    • Informative Informative x 1
  7. Must be because of version then.
    Thanks for your time!
     
    • Creative Creative x 1