Add command cooldown
This commit is contained in:
parent
8346570549
commit
ee896d98bf
@ -32,7 +32,7 @@ public class DonPayInteg implements ModInitializer {
|
|||||||
|
|
||||||
ServerTickEvents.START_SERVER_TICK.register((world) -> {
|
ServerTickEvents.START_SERVER_TICK.register((world) -> {
|
||||||
if(!thread.get().isAlive()) {
|
if(!thread.get().isAlive()) {
|
||||||
if(i.getAndIncrement() % (20 * 15) == 0) {
|
if(i.getAndIncrement() % (20 * ConfigHandler.load().getReqCooldown()) == 0) {
|
||||||
thread.set(new DonateThread());
|
thread.set(new DonateThread());
|
||||||
thread.get().start();
|
thread.get().start();
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package ru.bitheaven.donpayinteg.config;
|
package ru.bitheaven.donpayinteg.config;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
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 lastDonate = 0;
|
private int lastDonate = 0;
|
||||||
private List<Action> actions = List.of(new Action());
|
private List<Action> actions = List.of(new Action());
|
||||||
|
|
||||||
@ -32,5 +32,13 @@ public class Config {
|
|||||||
public void setActions(List<Action> actions) {
|
public void setActions(List<Action> actions) {
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getReqCooldown() {
|
||||||
|
return reqCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReqCooldown(int reqCooldown) {
|
||||||
|
this.reqCooldown = reqCooldown;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user