Solved Spawning Mobs not Working

Discussion in 'Plugin Development' started by spy85, Nov 16, 2013.

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

    spy85

    I made sure this was being called, but for some reason it does not spawn any mob and I do not understand why I have tried all kinds of different things. Thanks for the help here is the code:

    http://gyazo.com/51c580b706455ebbcf9507d6dfc53558

    That link shows the entire private inner class of the SpawnMobs class. Here is just the single part if thats all you guys need:

    Location spawnl = Bukkit.getServer().getPlayer("spy85").getLocation();

    spawnl.getWorld().spawnEntity(spawnl, EntityType.ZOMBIE);
     
  2. Offline

    blm456

    Do you get any errors when you run it?
     
  3. Offline

    spy85

    blm456 I get no errors of any kind in the console.
     
  4. Offline

    Garris0n

    1. Class name really should be "Wave1".
    2. You can't Thread.sleep(), it will hang up the entire server. You have to use schedulers.
    3. Is the server in peaceful mode or anything canceling mob spawns?
    4. You will get no errors no matter what because you're catching all exceptions. To be blunt, don't do that.
     
  5. Offline

    blm456

    spy85 add in the catch
    e.printStackTrace();
     
  6. Offline

    spy85


    I tried it by removing the Thread.sleep() and it still will not work. The reason I have a try catch is because Thread.sleep() must have that, so I will have it printStackTrace now and see what happens though. I named it with a lowercase W because its just a inner class so it didn't really come to my attention.

    Anyway I will test it out a bit now and see what I can come up with.

    Garris0n Thanks for the help I appreciate it! Apparently whether you Thread.sleep or not you cannot event start a Thread or everything in the thread will not work properly. Anyway I have it all figured out now thanks.

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

    Garris0n

    Yes Bukkit methods are not thread safe.
     
Thread Status:
Not open for further replies.

Share This Page