Advertisement
Xephyrr

rtw

Jul 22nd, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. public class SunnyDays extends JavaPlugin {
  2.  
  3.     @Override
  4.     public void onEnable(){
  5.         Bukkit.getServer().getPluginManager().registerEvents(new Eventz(), this); //adds event to main class
  6.  
  7.  
  8.  
  9.  
  10.         //This next Runnable crap is how you make a schedualed task, aka the check to see the time
  11.         Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
  12.             @Override
  13.             public void run() {
  14.                 keepDay();
  15.             }
  16.         }, 0L, 20L);
  17.     }
  18.     public void onDisable(){
  19.     }
  20.  
  21.     public void keepDay(){
  22.         World world = getServer().getWorld("world");
  23.         long time = world.getTime();
  24.         if (time != 5000L){
  25.             world.setTime(5000L);
  26.         }
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement