Class Laser

java.lang.Object
org.kingdoms.utils.Laser

public final class Laser extends Object
A whole class to create Guardian Beams by reflection. Inspired by the API GuardianBeamAPI This stimulates the guardian attacking squid pattern.

1.9+

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Laser(org.bukkit.Location start, Supplier<org.bukkit.Location> endLocationTracker, int duration, int distance)
    Create a Laser instance
    Laser(org.bukkit.Location start, org.bukkit.entity.LivingEntity target, int duration, int distance)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    attachEndEntity(org.bukkit.entity.LivingEntity entity)
    Makes the laser follow an entity (moving end location).
    void
    This simply "resets" the color change gradient phase, so calling it doesn't really yield great results.
    void
     
    void
    destroy(org.bukkit.entity.Player player)
     
    protected org.bukkit.Location
    getCorrectEnd(org.bukkit.Location end)
     
    protected org.bukkit.Location
     
    org.bukkit.entity.LivingEntity
     
    org.bukkit.Location
     
    boolean
     
    void
    moveEnd(Supplier<org.bukkit.Location> endLocationTracker)
     
    void
    moveStart(org.bukkit.Location location)
     
    void
     
    void
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Laser

      public Laser(org.bukkit.Location start, Supplier<org.bukkit.Location> endLocationTracker, int duration, int distance) throws Throwable
      Create a Laser instance
      Parameters:
      start - Location where laser will start.
      endLocationTracker - Location where laser will end.
      duration - Duration of laser in seconds (-1 if infinite)
      distance - Distance where laser will be visible
      Throws:
      Throwable
    • Laser

      public Laser(org.bukkit.Location start, org.bukkit.entity.LivingEntity target, int duration, int distance) throws Throwable
      Throws:
      Throwable
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • start

      public void start()
    • stop

      public void stop()
    • getCorrectStart

      protected org.bukkit.Location getCorrectStart()
    • getCorrectEnd

      protected org.bukkit.Location getCorrectEnd(org.bukkit.Location end)
    • destroy

      public void destroy(org.bukkit.entity.Player player)
    • clear

      public void clear()
    • moveStart

      public void moveStart(org.bukkit.Location location)
    • getStart

      public org.bukkit.Location getStart()
    • moveEnd

      public void moveEnd(Supplier<org.bukkit.Location> endLocationTracker)
    • changeColor

      public void changeColor()
      This simply "resets" the color change gradient phase, so calling it doesn't really yield great results.
    • isStarted

      public boolean isStarted()
    • attachEndEntity

      public void attachEndEntity(org.bukkit.entity.LivingEntity entity)
      Makes the laser follow an entity (moving end location).

      This is done client-side by making the fake guardian follow the existing entity. Hence, there is no consuming of server resources.

      Parameters:
      entity - living entity the laser will follow
    • getEndEntity

      public org.bukkit.entity.LivingEntity getEndEntity()