Add command cooldown

This commit is contained in:
BitHeaven 2025-01-27 10:10:44 +05:00
parent 8346570549
commit ee896d98bf
2 changed files with 10 additions and 2 deletions

View File

@ -32,7 +32,7 @@ public class DonPayInteg implements ModInitializer {
ServerTickEvents.START_SERVER_TICK.register((world) -> {
if(!thread.get().isAlive()) {
if(i.getAndIncrement() % (20 * 15) == 0) {
if(i.getAndIncrement() % (20 * ConfigHandler.load().getReqCooldown()) == 0) {
thread.set(new DonateThread());
thread.get().start();
}

View File

@ -1,10 +1,10 @@
package ru.bitheaven.donpayinteg.config;
import java.util.Arrays;
import java.util.List;
public class Config {
private String donpayToken = "<YOUR_TOKEN>";
private int reqCooldown = 15;
private int lastDonate = 0;
private List<Action> actions = List.of(new Action());
@ -32,5 +32,13 @@ public class Config {
public void setActions(List<Action> actions) {
this.actions = actions;
}
public int getReqCooldown() {
return reqCooldown;
}
public void setReqCooldown(int reqCooldown) {
this.reqCooldown = reqCooldown;
}
}