PlotSquared
PlotSquared copied to clipboard
Performance Improvement: high-requency listener
Overview
As we know, the BlockPhysicsEvent is called very often, while not everyone needs the associated settings or flags.
With this PR I would like to outsource two high-frequency event-listeners to a separate class that can be explicitly deactivated in the settings.yml.
Description
- Adding
high-frequency-listenersetting (same setting names as the setting in WorldGuard):
# The activity of high-frequency event listener can be deactivated here to improve the server performance.
# Affected settings: 'redstone' settings here below. Affected flags: 'disable-physics', 'redstone'.
# Only deactivate this setting if you do not need any of the mentioned settings or flags.
high-frequency-listener: true
- Moving
onRedstoneEvent(BlockRedstoneEvent event)andonPhysicsEvent(BlockPhysicsEvent event)fromBlockEventListener.javatoHighFreqBlockEventListener.java.
Performance Comparison
high-frequency-listener=true
= default value; behavior as before
high-frequency-listener=false
= after deactivation of the high-frequency flags
Test circuit
http://redstoneworld.de/downloads/intern/plugins/laggy_adder.zip
Note: It should be noted that the "/tps" command from Spigot still needs some time after the server start for the value to level out, as it is rounded here.
### Submitter Checklist
- [X] Make sure you are opening from a topic branch (**/feature/fix/docs/ branch** (right side)) and not your main branch.
- [X] Ensure that the pull request title represents the desired changelog entry.
- [X] New public fields and methods are annotated with `@since TODO`.
- [X] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/.github/blob/main/CONTRIBUTING.md).