Skip to content

Commit

Permalink
Add network.packetLimit.releaseUseItemThrottle option
Browse files Browse the repository at this point in the history
  • Loading branch information
Luohuayu committed Feb 23, 2024
1 parent 098e907 commit 5a60044
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@
return;
case RELEASE_USE_ITEM:
+ // CatServer start
+ if (this.releasedUseItemThrottle++ >= 10) {
+ if (catserver.server.CatServer.getConfig().releaseUseItemThrottle > 0 && this.releasedUseItemThrottle++ >= catserver.server.CatServer.getConfig().releaseUseItemThrottle) {
+ LOGGER.warn(this.player.getName() + " released use item too quickly!");
+ this.disconnect("You released use item too quickly (Hacking?)");
+ return;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/catserver/server/CatServerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class CatServerConfig {
public int itemNBTThrottle = 200;
public boolean limitFastClickGUI = false;
public int clickGUIThrottle = 50;
public int releaseUseItemThrottle = 20;

public boolean disableUpdateGameProfile = false;
public boolean disableFMLHandshake = false;
Expand Down Expand Up @@ -99,6 +100,7 @@ public void loadConfig() {
itemNBTThrottle = getOrWriteIntConfig("network.packetLimit.itemNBTThrottle", itemNBTThrottle);
limitFastClickGUI = getOrWriteBooleanConfig("network.packetLimit.fastClickGUI", config.getBoolean("vanilla.limitFastClickGUI", limitFastClickGUI));
clickGUIThrottle = getOrWriteIntConfig("network.packetLimit.clickGUIThrottle", clickGUIThrottle);
releaseUseItemThrottle = getOrWriteIntConfig("network.packetLimit.releaseUseItemThrottle", releaseUseItemThrottle);
disableFMLHandshake = getOrWriteBooleanConfig("network.fml.disableHandshake", config.getBoolean("disableFMLHandshake", disableFMLHandshake));
disableFMLStatusModInfo = getOrWriteBooleanConfig("network.fml.disableStatusModInfo", config.getBoolean("disableFMLStatusModInfo", disableFMLStatusModInfo));
// general
Expand Down

0 comments on commit 5a60044

Please sign in to comment.