Class ProjectileSpawner
java.lang.Object
me.deecaad.weaponmechanics.weapon.projectile.ProjectileSpawner
- Direct Known Subclasses:
FoliaProjectileSpawner,SpigotProjectileSpawner
This class is responsible for adding projectiles into some runnable.
The implementation varies depending on the server architecture. Typical Spigot/Paper servers will use 1 runnable to handle all projectile ticking. Folia servers use 1 runnable per projectile
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<ProjectileScriptManager> protected final org.bukkit.plugin.Plugin -
Constructor Summary
ConstructorsConstructorDescriptionProjectileSpawner(org.bukkit.plugin.Plugin plugin) Initializes the spawner with the given plugin. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddScriptManager(ProjectileScriptManager manager) Adds the given projectile manager to the list of managers.protected booleandoFirstTick(AProjectile projectile) abstract voidspawn(AProjectile projectile) Spawns the given projectile.
-
Field Details
-
plugin
protected final org.bukkit.plugin.Plugin plugin -
managers
-
-
Constructor Details
-
ProjectileSpawner
public ProjectileSpawner(@NotNull org.bukkit.plugin.Plugin plugin) Initializes the spawner with the given plugin.- Parameters:
plugin- The non-null plugin used to register runnables
-
-
Method Details
-
addScriptManager
Adds the given projectile manager to the list of managers. This manager will be used to attach scripts to projectiles.- Parameters:
manager- The non-null manager to add
-
spawn
Spawns the given projectile. If the thread has control over the region where the projectile is spawned, the projectile will be ticked instantly.- Parameters:
projectile- The non-null projectile to spawn
-
doFirstTick
-