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

Fix spawner delay feature #3239

Merged
merged 12 commits into from
Aug 5, 2020
Merged

Fix spawner delay feature #3239

merged 12 commits into from
Aug 5, 2020

Conversation

pop4959
Copy link
Member

@pop4959 pop4959 commented May 7, 2020

Closes #1332

The spawner delay feature has been broken in Essentials for as long as anyone can remember. The reasons for this are mentioned in the issue above.

This PR fixes this by changing the command to utilize new API for setting the minimum and maximum spawn delay on spawners. This API was added in 1.12.2, so all supported versions before that (1.8.8 thru 1.12.1) require NMS to function properly. I'm aware that Essentials avoids NMS for maintainability reasons, however that should not be of much concern here since all versions 1.12.2 and later are going to be using the Bukkit API. Hence, no NMS updates will be necessary.

Also let me know if you want the NMS code refactored somewhere else. I saw the net.ess3.nms packages, but I wasn't sure where this would fit into the organisation of that.

Tested on:
1.8.8, 1.9.4, 1.10.2, 1.11.2 (NMS)
1.12.2, 1.15.2 (Bukkit API)

@pop4959 pop4959 added the bug: confirmed Confirmed bugs in EssentialsX. label May 7, 2020
@mdcfe
Copy link
Member

mdcfe commented May 7, 2020

NMS should really be in providers - unfortunately the current naming convention of providers makes it difficult to know where to put them.

@pop4959
Copy link
Member Author

pop4959 commented May 7, 2020

Yeah I took a glance at the existing provider system but it wasn't pretty. If I can get some advice with refactoring this spawner code into its own provider that would be neat. Another confusing thing is it seems like the "SpawnerProvider" doesn't really have anything to do with spawners either, so there's that...

@mdcfe
Copy link
Member

mdcfe commented May 19, 2020

As far as I can recall, the current "spawner providers" are for setting the entity type on stacks of spawners when they're spawned in. Perhaps the current spawner providers could be renamed to SpawnerEntityProvider and this could be implemented in an interface called SpawnerDelayProvider?

@pop4959
Copy link
Member Author

pop4959 commented May 19, 2020

@md678685 Sorry for the lack of updates, I did actually figure this out while looking deeper at the spawner provider code. It is indeed intended for accessing the entity type of a spawner ItemStack. My intention is to refactor the code of this PR into a provider (either the existing one, or split into its own as your are suggesting) to allow backwards compatibility with versions that don't have a complete CreatureSpawner API. Perhaps SpawnerItemProvider and SpawnerBlockProvider would be appropriate names?

I'm currently focusing on having #3279 resolved before I continue working on this (so I don't have to make further changes to the code).

@mdcfe
Copy link
Member

mdcfe commented Jun 6, 2020

Perhaps SpawnerItemProvider and SpawnerBlockProvider would be appropriate names?

Sounds good.

@mdcfe mdcfe requested a review from JRoy June 15, 2020 12:59
@pop4959 pop4959 requested a review from mdcfe August 3, 2020 23:42
@pop4959
Copy link
Member Author

pop4959 commented Aug 3, 2020

Ready again for review - all issues resolved and tested

@mdcfe mdcfe dismissed JRoy’s stale review August 5, 2020 19:45

Changes addressed

@mdcfe mdcfe merged commit 14c6c2a into EssentialsX:2.x Aug 5, 2020
JRoy pushed a commit to JRoy/Essentials-PR that referenced this pull request Aug 30, 2020
Closes EssentialsX#1332

The spawner delay feature has been broken in Essentials for as long as anyone can remember. The reasons for this are mentioned in the issue above.

This PR fixes this by changing the command to utilize new API for setting the minimum and maximum spawn delay on spawners. This API was added in 1.12.2, so all supported versions before that (1.8.8 thru 1.12.1) require NMS to function properly. I'm aware that Essentials avoids NMS for maintainability reasons, however that should not be of much concern here since all versions 1.12.2 and later are going to be using the Bukkit API. Hence, no NMS updates will be necessary.

Also let me know if you want the NMS code refactored somewhere else. I saw the net.ess3.nms packages, but I wasn't sure where this would fit into the organisation of that.

Tested on:
1.8.8, 1.9.4, 1.10.2, 1.11.2 (NMS)
1.12.2, 1.15.2 (Bukkit API)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: confirmed Confirmed bugs in EssentialsX.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spawner delay only affects the first spawn
3 participants