Correct Daily not triggered #14
This commit is contained in:
parent
bc32bafef6
commit
68116ebfca
@ -2,20 +2,23 @@ package net.Broken.Tools.DayListener;
|
|||||||
import net.Broken.Commands.Spam;
|
import net.Broken.Commands.Spam;
|
||||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by seb65 on 09/11/2016.
|
* Created by seb65 on 09/11/2016.
|
||||||
*/
|
*/
|
||||||
public class DayListener extends Thread {
|
public class DayListener extends Thread {
|
||||||
private GregorianCalendar calendar;
|
private Calendar calendar;
|
||||||
private int previousDay;
|
private int previousDay;
|
||||||
private ArrayList<NewDayListener> listeners = new ArrayList<>();
|
private ArrayList<NewDayListener> listeners = new ArrayList<>();
|
||||||
|
private Logger logger = LogManager.getLogger();
|
||||||
|
|
||||||
private DayListener() {
|
private DayListener() {
|
||||||
calendar = new GregorianCalendar();
|
calendar = Calendar.getInstance();
|
||||||
previousDay = calendar.get(GregorianCalendar.DAY_OF_MONTH);
|
previousDay = calendar.get(GregorianCalendar.DAY_OF_MONTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +43,8 @@ public class DayListener extends Thread {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{ calendar = Calendar.getInstance();
|
||||||
|
logger.debug(calendar.get(GregorianCalendar.DAY_OF_MONTH)+"/"+previousDay);
|
||||||
if(calendar.get(GregorianCalendar.DAY_OF_MONTH) != previousDay)
|
if(calendar.get(GregorianCalendar.DAY_OF_MONTH) != previousDay)
|
||||||
{
|
{
|
||||||
LogManager.getLogger().info("New day triggered!");
|
LogManager.getLogger().info("New day triggered!");
|
||||||
@ -48,10 +52,10 @@ public class DayListener extends Thread {
|
|||||||
previousDay = calendar.get(GregorianCalendar.DAY_OF_MONTH);
|
previousDay = calendar.get(GregorianCalendar.DAY_OF_MONTH);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
sleep(1800000);
|
sleep(600000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
LogManager.getLogger().catching(e);
|
LogManager.getLogger().catching(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user