How do i make execute my code only if the time is night. Here's chunk of my code. Code (Java): if (Bukkit.getServer().getWorld("world").getTime() <= 10000 ) { }
Code (Text): public boolean day() { Server server = getServer(); long time = server.getWorld("world").getTime(); if(time > 0 && time < 12300) { return true; } else { return false; } } The function return night when it gets dark. (It is already night when time is 12000 but then it isn't dark) Don't forget to change the world name to the name of your world!
No, problem, just call the day() function in the run method. And check if the value is true (day) or false (night).