Add command cooldown

This commit is contained in:
BitHeaven 2025-01-27 10:16:27 +05:00
parent fcc4cd59d8
commit 96afb3e8aa
2 changed files with 10 additions and 1 deletions

View File

@ -38,7 +38,7 @@ public class DonPayInteg implements ModInitializer {
} }
} }
if(j.getAndIncrement() % (20 * 2) == 0) { if(j.getAndIncrement() % (20 * ConfigHandler.load().getCmdCooldown()) == 0) {
if (!commands.isEmpty()) { if (!commands.isEmpty()) {
world.getCommandManager().executeWithPrefix(world.getCommandSource(), commands.getFirst()); world.getCommandManager().executeWithPrefix(world.getCommandSource(), commands.getFirst());
commands.removeFirst(); commands.removeFirst();

View File

@ -5,6 +5,7 @@ import java.util.List;
public class Config { public class Config {
private String donpayToken = "<YOUR_TOKEN>"; private String donpayToken = "<YOUR_TOKEN>";
private int reqCooldown = 15; private int reqCooldown = 15;
private int cmdCooldown = 2;
private int lastDonate = 0; private int lastDonate = 0;
private List<Action> actions = List.of(new Action()); private List<Action> actions = List.of(new Action());
@ -40,5 +41,13 @@ public class Config {
public void setReqCooldown(int reqCooldown) { public void setReqCooldown(int reqCooldown) {
this.reqCooldown = reqCooldown; this.reqCooldown = reqCooldown;
} }
public int getCmdCooldown() {
return cmdCooldown;
}
public void setCmdCooldown(int cmdCooldown) {
this.cmdCooldown = cmdCooldown;
}
} }