-
-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance Improvement: high-requency listener #4402
Performance Improvement: high-requency listener #4402
Conversation
@@ -164,114 +151,6 @@ public static void sendBlockChange(final org.bukkit.Location bloc, final BlockDa | |||
}, TaskTime.ticks(3L)); | |||
} | |||
|
|||
@EventHandler | |||
public void onRedstoneEvent(BlockRedstoneEvent event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a separate class without making any changes.
} | ||
|
||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) | ||
public void onPhysicsEvent(BlockPhysicsEvent event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a separate class without making any changes.
private static final Set<Material> PHYSICS_BLOCKS = Set.of( | ||
Material.TURTLE_EGG, | ||
Material.TURTLE_SPAWN_EGG | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These sets were only used in the methods involved and could/must also be moved.
* Adding new 'high-frequency-listener' setting * Moving high-frequency event listener in new class * Small typo
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
high-frequency-listener
setting (same setting names as the setting in WorldGuard):onRedstoneEvent(BlockRedstoneEvent event)
andonPhysicsEvent(BlockPhysicsEvent event)
fromBlockEventListener.java
toHighFreqBlockEventListener.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