Class ProjectilesRunnable
java.lang.Object
org.bukkit.scheduler.BukkitRunnable
me.deecaad.weaponmechanics.weapon.projectile.ProjectilesRunnable
- All Implemented Interfaces:
Runnable
public class ProjectilesRunnable
extends org.bukkit.scheduler.BukkitRunnable
This class is run once for every Minecraft Server tick (ideally 20 ticks per second). This class
stores the entities we need to tick, and the methods of this class are thread safe. The order in
which the projectiles are ticked is undefined, but every projectile is guaranteed to tick once
for every MC server tick.
-
Constructor Summary
ConstructorsConstructorDescriptionProjectilesRunnable(org.bukkit.plugin.Plugin plugin) Initializes and registers this runnable. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProjectile(@NotNull AProjectile projectile) Adds the given projectiles to be ticked.voidaddProjectiles(Collection<? extends AProjectile> projectiles) Adds the given projectiles to be ticked.voidaddScriptManager(@NotNull ProjectileScriptManager manager) voidrun()This method will always be run on the main server threadMethods inherited from class org.bukkit.scheduler.BukkitRunnable
cancel, getTaskId, isCancelled, runTask, runTaskAsynchronously, runTaskLater, runTaskLaterAsynchronously, runTaskTimer, runTaskTimerAsynchronously
-
Constructor Details
-
ProjectilesRunnable
public ProjectilesRunnable(org.bukkit.plugin.Plugin plugin) Initializes and registers this runnable. This runnable can be cancelled usingBukkitRunnable.cancel()or by cancelling all tasks forpluginusingBukkit.getScheduler().cancelTasks(plugin).WeaponMechanics initializes one of these by default. You probably do not want to instantiate this class unless you know what you are doing. Use
WeaponMechanics.getProjectilesRunnable().- Parameters:
plugin- The non-null plugin
-
-
Method Details
-
addScriptManager
-
addProjectile
Adds the given projectiles to be ticked. Projectile is instantly ticked once. On async call ticking starts during the next tick. This method is threadsafe, and you may call this method async.- Parameters:
projectile- The non-null projectile to tick.
-
addProjectiles
Adds the given projectiles to be ticked. Projectile is instantly ticked once. On async call ticking starts during the next tick. This method is threadsafe, and you may call this method async.- Parameters:
projectiles- The non-null collection of non-null projectiles.
-
run
public void run()This method will always be run on the main server thread
-