Skip to content

Commit

Permalink
Optimisation of CPU, generally decrease cpu usage and increase TPS.
Browse files Browse the repository at this point in the history
Dont update core settings every tick.
  • Loading branch information
TheRadioactiveBanana committed Dec 10, 2023
1 parent ec5478f commit 7a13a2b
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 2 deletions.
Binary file modified build/classes/java/main/eradicator/BotEradicator$1.class
Binary file not shown.
Binary file modified build/classes/java/main/eradicator/BotEradicator.class
Binary file not shown.
Binary file modified build/libs/BotEradicator.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
10 changes: 8 additions & 2 deletions src/main/java/eradicator/BotEradicator.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,28 @@ private void loadFilters() {
});
}

private int botsBlockedOld = botsBlockedTotal;

@Override
public void update(){
Core.settings.put("eradicator-bots-blocked", botsBlockedTotal);
if(botsBlockedTotal != botsBlockedOld) {
botsBlockedOld = botsBlockedTotal;
Core.settings.put("eradicator-bots-blocked", botsBlockedTotal);
}
}

@Override
public void dispose(){
info("@ Bots were blocked on this session. @ Bots were blocked in total.", botsBlocked, botsBlockedTotal);
Core.settings.put("eradicator-bots-blocked", botsBlockedTotal);
executor.shutdownNow().forEach(Runnable::run);
}

@Override
public void registerServerCommands(CommandHandler handler){
handler.register("botstatus", "View the status of the plugin, how many bots blocked, etc", (args)->{
info("Bots blocked on this session: @", botsBlocked);
info("Bots blocked always: @", botsBlockedTotal);
info("Bots blocked of all time: @", botsBlockedTotal);
for(var s : botsBlockedPerAddress.entries()) info("Bots blocked for @: @", s.key, s.value);
info("Plugin by TheRadioactiveBanana#0545 (@theradioactivebanana) On discord. ");
});
Expand Down

0 comments on commit 7a13a2b

Please sign in to comment.