Skip to content
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

Remove extraneous code in command preprocess event handling #5981

Merged
merged 2 commits into from
Nov 30, 2024

Conversation

Zarkreyy
Copy link
Contributor

no need to recreate a HashMap instance to prevent concurrency since user.getCommandCooldowns() already makes a new HashMap instance

the second if condition verifying entry.getValue() > System.currentTimeMillis() is redundant as it is already implied by the first if condition

Don't break in case there are other command cooldowns left to clear

You need to select a pull request template!

If you're adding a new feature, copy and paste the following parameter at the end of the URL:
?template=new-feature.md

If you're fixing a bug, copy and paste the following parameter at the end of the URL:
?template=bug-fix.md

For more information about contributing to EssentialsX, see CONTRIBUTING.md:
https://github.com/EssentialsX/Essentials/blob/2.x/CONTRIBUTING.md

no need to recreate a HashMap instance to prevent concurrency since user.getCommandCooldowns() already makes a new HashMap  instance

the second if condition verifying entry.getValue() > System.currentTimeMillis() is redundant as it is already implied by the first if condition

Don't break in case there are other command cooldowns left to clear
JRoy
JRoy previously approved these changes Nov 30, 2024
@JRoy
Copy link
Member

JRoy commented Nov 30, 2024

Good catch, thanks!

@JRoy JRoy changed the title Update EssentialsPlayerListener.java -> handlePlayerCommandPreprocess() Remove extraneous code in command preprocess event handling Nov 30, 2024
@JRoy JRoy enabled auto-merge (squash) November 30, 2024 23:52
@JRoy JRoy added the module: main Issues or PRs for the main Essentials module label Nov 30, 2024
@JRoy JRoy merged commit d31ff55 into EssentialsX:2.x Nov 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: main Issues or PRs for the main Essentials module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants