Update Biscuit to work on multiple guilds simultaneously
This commit is contained in:
@@ -2,11 +2,15 @@ package com.fpghoti.biscuit.timer;
|
||||
|
||||
import java.util.TimerTask;
|
||||
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
|
||||
public abstract class BiscuitTimer extends TimerTask{
|
||||
|
||||
protected Long delay;
|
||||
protected Long period;
|
||||
|
||||
protected Biscuit biscuit;
|
||||
|
||||
public long getDelay() {
|
||||
if(delay != null) {
|
||||
return delay;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.global.MessageQueue;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
|
||||
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
|
||||
|
||||
public class BotMsgRemoveTimer extends BiscuitTimer{
|
||||
|
||||
public BotMsgRemoveTimer(){
|
||||
delay = (long) 0;
|
||||
period = (long) 5*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
for(String m : MessageQueue.removemessages.keySet()){
|
||||
try{
|
||||
MessageQueue.removemessages.get(m).deleteMessageById(m).complete();
|
||||
}catch(ErrorResponseException ex){
|
||||
}
|
||||
}
|
||||
|
||||
MessageQueue.removemessages.clear();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,19 +1,18 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.global.MessageQueue;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
|
||||
public class ChatCountTimer extends BiscuitTimer {
|
||||
|
||||
public ChatCountTimer(){
|
||||
public ChatCountTimer(Biscuit b){
|
||||
biscuit = b;
|
||||
delay = (long) 0;
|
||||
period = (long) 10*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
MessageQueue.chatssent.clear();
|
||||
MessageQueue.spammsgs.clear();
|
||||
MessageQueue.chatssent10s.clear();
|
||||
biscuit.getMessageStore().forgetChats();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
import com.fpghoti.biscuit.user.PreUser;
|
||||
|
||||
public class DecrementTimer extends BiscuitTimer{
|
||||
|
||||
public DecrementTimer(){
|
||||
public DecrementTimer(Biscuit b){
|
||||
biscuit = b;
|
||||
delay = (long) 0;
|
||||
period = (long) 60*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
if(Main.ready) {
|
||||
for(PreUser p : PreUser.users) {
|
||||
for(PreUser p : biscuit.getPreUsers()) {
|
||||
p.decrementTime();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.global.MessageQueue;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
|
||||
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
|
||||
|
||||
public class FastMsgRemoveTimer extends BiscuitTimer{
|
||||
|
||||
public FastMsgRemoveTimer(){
|
||||
delay = (long) 0;
|
||||
//period = (long) 1*1000;
|
||||
period = (long) 250;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
for(String m : MessageQueue.fastremovemessages.keySet()){
|
||||
try{
|
||||
MessageQueue.fastremovemessages.get(m).deleteMessageById(m).complete();
|
||||
}catch(ErrorResponseException ex){
|
||||
}
|
||||
}
|
||||
MessageQueue.fastremovemessages.clear();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.global.MessageQueue;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
|
||||
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
|
||||
|
||||
public class SlowMsgRemoveTimer extends BiscuitTimer{
|
||||
|
||||
public SlowMsgRemoveTimer(){
|
||||
delay = (long) 0;
|
||||
period = (long) 5*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
for(String m : MessageQueue.slowremovemessages.keySet()){
|
||||
try{
|
||||
MessageQueue.slowremovemessages.get(m).deleteMessageById(m).complete();
|
||||
}catch(ErrorResponseException ex){
|
||||
}
|
||||
}
|
||||
MessageQueue.slowremovemessages.clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.global.MessageQueue;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
|
||||
public class SoftMuteTimer extends BiscuitTimer{
|
||||
|
||||
public SoftMuteTimer(){
|
||||
public SoftMuteTimer(Biscuit b){
|
||||
biscuit = b;
|
||||
delay = (long) 0;
|
||||
period = (long) 120*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
MessageQueue.chatssent2m.clear();
|
||||
biscuit.getMessageStore().allowSoftMutedMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.fpghoti.biscuit.timer.task;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
import com.fpghoti.biscuit.user.PreUser;
|
||||
|
||||
public class StatusTimer extends BiscuitTimer{
|
||||
|
||||
public StatusTimer(Biscuit b){
|
||||
biscuit = b;
|
||||
delay = (long) 0;
|
||||
period = (long) 60*1000;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
if(Main.ready) {
|
||||
for(PreUser p : biscuit.getPreUsers()) {
|
||||
p.decrementTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user