Skip to content

Commit

Permalink
Make cooldown configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
BoomEaro committed Dec 14, 2023
1 parent 294bd3f commit 76f2c60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/main/java/ua/nanit/limbo/configuration/LimboConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public final class LimboConfig {
private int maxBytesPerSec;

private String onMoveServer;
private long cooldownTime;

public LimboConfig(Path root) {
this.root = root;
Expand Down Expand Up @@ -141,6 +142,7 @@ public void load() throws Exception {
maxBytesPerSec = conf.node("traffic", "bytes").getInt(-1);

onMoveServer = conf.node("onMoveServer").getString();
cooldownTime = conf.node("cooldownTime").getLong();
}

private BufferedReader getReader() throws IOException {
Expand Down Expand Up @@ -284,4 +286,8 @@ public int getMaxBytesPerSec() {
public String getOnMoveServer() {
return onMoveServer;
}

public long getCooldownTime() {
return cooldownTime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ boolean checkVelocityKeyIntegrity(ByteMessage buf) {
}

public void sendToServer() {
if (System.currentTimeMillis() - this.cooldown > 2000) {
if ((System.currentTimeMillis() - this.cooldown) > this.server.getConfig().getCooldownTime()) {
this.cooldown = System.currentTimeMillis();
sendPacket(PacketSnapshots.PACKET_SERVER_TELEPORT);
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,5 @@ traffic:
# How many bytes per second allowed for single connection
# Ignored if -1
bytes: 2048
onMoveServer: lobby
onMoveServer: lobby
cooldownTime: 5000

0 comments on commit 76f2c60

Please sign in to comment.