Big cleanup#11
Conversation
This hides commands from players that are being controlled with iControlU.
Since we don't use NMS, this is harmless. Saves about 100ms of startup time on first boot on my machine
Finalizes everything, adds @NotNull to onCommand parameters, and uses pattern matching for the onCommand instanceof Player check.
This was done so spamming CommandSpy commands wouldn't lag the server as much, and having a bunch of players turn on CommandSpy wouldn't fill up the server storage.
We should probably keep kaboom plugins' API version synced with the main server
|
I hate to nag people, but this PR has been sitting here for a while. Bump. |
|
@kaboombot Bump |
1 similar comment
|
@kaboombot Bump |
|
@kaboombot Bump |
| import com.google.common.io.Files; | ||
| import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; |
There was a problem hiding this comment.
What provides these dependencies?
There was a problem hiding this comment.
Minecraft (the vanilla server) utilizes them.
| @Override | ||
| public void onEnable() { | ||
| config = getConfig(); | ||
| this.config = new CommandSpyState(new File(this.getDataFolder(), "state.bin")); |
There was a problem hiding this comment.
Do we really need an unreadable binary file?
There was a problem hiding this comment.
The old YAML config would quickly grow in size to several megabytes after a few hours of the server being online, as bots log in with random usernames and turn on CommandSpy. This is the most efficient way to do it, utilizing only 16 bytes per player, instead of 43 like before.
|
It's a lot of additional code, so I'd appreciate if you could break down how each part improves performance. |
Firstly, the entire state saving system was rewritten to use a custom binary format instead of YAML. This means that when saving the config, we do not need to go through an entire YAML serializer, but instead just write the UUID bytes to disk. This is already a lot faster than the old system, but to further improve the performance, I also made it so the full state is only saved every 30 seconds or on server shutdown, instead of every time The PR also adds a small feature that allows players to toggle other people's CommandSpy, much like the Essentials Normally these sorts of performance changes wouldn't be required, however as Kaboom is filled with bots that utilize commandspy to log commands, it's common to see the server lag small amounts due to a large amount (6-8) of bots trying to enable commandspy at the same time, e.g. at the server start. |
See commit names and descriptions for more info
Before:

After:

This would obviously scale with more spambots, and the lag would be way, way worse on actual Kaboom, as the hardware is much weaker than my computer.