Hi, im working with a Thread.Sleep but i cant solution that when its in sleep all server stops until the time passes heres part of the code its a command: Thread.sleep(1000 * Integer.parseInt(args[3])); World w = Bukkit.getServer().getWorld(settings.getData().getString("office." + args[0] + ".world")); double x = settings.getData().getDouble("office." + args[0] + ".x"); double y = settings.getData().getDouble("office." + args[0] + ".y"); double z = settings.getData().getDouble("office." + args[0] + ".z"); target.teleport(new Location(w, x, y, z)); } catch (Exception e) { System.out.println(e); } how can i solucion it so only sends to sleep this code and not all serv? Thx
@Zombie_Striker @timtower Don't ever sleep any of Bukkit's threads, whether they're the main thread or not.
@danichef What do you not understand? What you need to do is call bukkit's "scheduler", create a new sync delayed task, provide a "runnable" (which is just an object that stores what you want to happen), and then set the delay. Have you tried creating a delayed task? If not, try. If you run into any errors/problems, post the code here.
Well as i posted i was working with args. But anyway, Thank you @Zombie_Striker , @timtower and @mythbusterma ur the best!
Someone has watched TheBCBroz on YouTube "and to add a timer, we use Thread.sleep, then milliseconds). " Just a tip, don't watch him. The server runs on the main thread. if you call Thread.sleep, then it is only logical that your entire server will sleep unless you handle this operation on a separate thread. BukkitSchedulers were made for this Sent from my iPhone using Tapatalk
One of your uncles told you to sleep on the main thread? I'm guessing it might work in some cases Sent from my iPhone using Tapatalk