Skip to content

Commit 7a13a2b

Browse files
Optimisation of CPU, generally decrease cpu usage and increase TPS.
Dont update core settings every tick.
1 parent ec5478f commit 7a13a2b

File tree

7 files changed

+8
-2
lines changed

7 files changed

+8
-2
lines changed
0 Bytes
Binary file not shown.
103 Bytes
Binary file not shown.

build/libs/BotEradicator.jar

63 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.

src/main/java/eradicator/BotEradicator.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,28 @@ private void loadFilters() {
133133
});
134134
}
135135

136+
private int botsBlockedOld = botsBlockedTotal;
137+
136138
@Override
137139
public void update(){
138-
Core.settings.put("eradicator-bots-blocked", botsBlockedTotal);
140+
if(botsBlockedTotal != botsBlockedOld) {
141+
botsBlockedOld = botsBlockedTotal;
142+
Core.settings.put("eradicator-bots-blocked", botsBlockedTotal);
143+
}
139144
}
140145

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

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

0 commit comments

Comments
 (0)