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

Allow Omitting PlayerMoveEvent #76

Merged
merged 3 commits into from
Apr 23, 2020
Merged

Conversation

A248
Copy link
Contributor

@A248 A248 commented Apr 20, 2020

Some programmers may not want to rely on the PlayerMoveEvent, since it fires very quickly and often, even for mere head-movement. As such, the main purpose of this PR adds NPCLibOptions, which is a general wrapper for preferences passed to NPCLib.

In the future more could be added to NPCLibOptions if desired. As it stands, however, the only parameter is movement handling, a.k.a. NPCLibOptions.MovementHandling.

The other 2 commits are self-explanatory. Note that I have tested and ensured that the PlayerQuitEvent is called regardless of whether it was caused by a kick (I used 1.8.8, but it wouldn't make any sense for this contract to change in future versions)

The PlayerQuitEvent is fired even when the player is kicked.
Adds NPCLibOptions as an optional parameter to NPCLib's constructor. The
movement handling specified by the NPCLibOptions will determine whether
to use the PlayerMoveEvent or a task.
CraftBukkit 1.8.8 implementation checks whether Bukkit.getPlayer(<player
uuid>) != null. Bukkit.getPlayer(UUID) is itself not thread safe.
@JitseB
Copy link
Owner

JitseB commented Apr 23, 2020

Thanks for this PR! These are some great additions to the library.
Merging.

@JitseB JitseB merged commit 3a99792 into JitseB:master Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants