SHARE
TWEET

Untitled

a guest Feb 17th, 2020 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package fr.youki300.eronyatest;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.scheduler.BukkitRunnable;
  5. import java.text.SimpleDateFormat;
  6. import java.util.Calendar;
  7. import java.util.Date;
  8. import java.util.Locale;
  9.  
  10. public class TesTRefresh extends BukkitRunnable {
  11.  
  12.     @Override
  13.     public void run() {
  14.  
  15.         verifDate("lundi", 22, 40, "broadcast TEST 22h40");
  16.  
  17.     }
  18.  
  19.     public void verifDate(String jour, int heure, int min, String command){
  20.  
  21.         Calendar now2 = Calendar.getInstance();
  22.         Date now = new Date();
  23.         String date = new SimpleDateFormat("EEEE", Locale.FRANCE).format(now).replace(".", "");
  24.  
  25.         if(date.equalsIgnoreCase(jour)){
  26.             if(now2.get(Calendar.HOUR_OF_DAY) == heure){
  27.                 if(now2.get(Calendar.MINUTE) == min && (now2.get(Calendar.SECOND) == (0) || now2.get(Calendar.SECOND) == (1))){
  28.  
  29.                     Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
  30.                     return;
  31.                 }
  32.             }
  33.         }
  34.     }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top