Add TrialSpawnerTriggerEvent (or similar) for better control over Trial Spawners
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Is your feature request related to a problem?
Yes
In the current API, TrialSpawnerSpawnEvent fires when a mob is attempting to spawn, after the charge-up phase has already been completed. By cancelling this you can prevent the entity from spawning on that instance, but unless you continue cancelling forever, it is stuck constantly attempting to spawn until it's able to - any time the spawner is loaded, regardless if anyone is near it or not anymore. This means it's effectively impossible to disable the spawner without just cancelling the spawns for eternity.
Describe the solution you'd like.
Introduce a new event that fires when a spawner is triggered. This event would have access to the TrialSpawner instance, the set of players who activated it, and be cancellable.
Describe alternatives you've considered.
I have attempted:
Setting Affects Spawning false:
Works for normal spawners, does not work on trial spawners.
Cancelling TrialSpawnerSpawnEvent:
Continues attempting to spawn until it is successful, regardless whether or not a player is in the area or not
Cancelling TrialSpawnerSpawnEvent + Resetting spawner.setNextSpawnAttempt(0L):
Same issue as above, just attempts less often
Cancelling TrialSpawnerSpawnEvent + Resetting spawner.setNextSpawnAttempt(0L) + Removing all players from tracked players:
Seemingly no difference in behavior from above
Setting the spawner state to INACTIVE:
Had seemingly no effect on the spawner (Spawned enemies as normal)
Setting the spawner state to INACTIVE and removing all players from tracked players:
Seemingly no effect on the spawner (Spawned enemies as normal)
Setting the spawner state to INACTIVE and removing all players from tracked players every 5 ticks:
Seemingly no effect on the spawner.
Recreating the tracking logic in a plugin, manually overriding the required entity range and setting it to 0 unless an allowed player is within range:
I have not yet done this but it is literally my next step
Other
This is in the context of a vanish plugin, the issue I am running into right now is that there seems to be no way in the API to actually prevent the trial spawners from 'seeing' a vanished user.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing TrialSpawnerSpawnEvent and TrialSpawner API behavior, especially how activated and tracked players are handled. Determine where the trigger phase occurs before charge-up and how a cancellable event should affect subsequent spawning. Done means a documented event exposes the TrialSpawner and activating players and prevents the spawner from proceeding when cancelled, with coverage for vanished-player scenarios.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100