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 Details

    • ProjectilesRunnable

      public ProjectilesRunnable(org.bukkit.plugin.Plugin plugin)
      Initializes and registers this runnable. This runnable can be cancelled using BukkitRunnable.cancel() or by cancelling all tasks for plugin using Bukkit.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

      public void addScriptManager(@NotNull @NotNull ProjectileScriptManager manager)
    • addProjectile

      public void addProjectile(@NotNull @NotNull AProjectile projectile)
      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

      public void addProjectiles(Collection<? extends AProjectile> projectiles)
      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