Closed BumbleTree closed 3 years ago
The plugin only processes any event if that player is in spectator which should not have a large performance issue especially if no one is in spectator. I'll look into it but are there any other details?
This plugin runs shouldCancelMoveEvent
whenever PlayerMoveEvent is triggered. This event is fired even for changes that don't include directional movement such as yaw/pitch.
The dumbest fix would be to run these in two different blocks rather than compare the responses of both. You don't want to be doing all the logic checking for both then cancelling the event. It'll still have to process the results of both variables. Consider also just completely aborting and returning if only the yaw/pitch changes.
if (!shouldProcessEvent(moveEvent)) {
return;
}
if (shouldCancelMoveEvent(moveEvent)) {
cancelPlayerMoveEvent(moveEvent);
}
The plugin first runs the shouldProcess function then if that is true it runs the shouldCancel as it uses the && operator instead of the & operator so that should not be necessary.
Well I can't comment on the code but the plugin was using up 1.8% of the server tick. With the next pkugin using 0.4%. And this had 0 players in spectator with only 15 online
I'll look into it when I can.
From what I found on my test with just me is that the 1.8% is just the onmovelisteners quick if
that runs. I don't think that their is a way to fasten this up.
Is your feature request related to a problem? Please describe. Plugin is most thread intensive plugin even with 0 people in spec and few people online
Describe the solution you'd like It not to make player movement checks 24/7
This plugins usefulness is great however considering 0 people are in spec i believe it shouldn't be the most performance lossy plugin i have.