Package org.kingdoms.utils
Class Laser
java.lang.Object
org.kingdoms.utils.Laser
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidattachEndEntity(org.bukkit.entity.LivingEntity entity) Makes the laser follow an entity (moving end location).voidThis simply "resets" the color change gradient phase, so calling it doesn't really yield great results.voidclear()voiddestroy(org.bukkit.entity.Player player) protected org.bukkit.LocationgetCorrectEnd(org.bukkit.Location end) protected org.bukkit.Locationorg.bukkit.entity.LivingEntityorg.bukkit.LocationgetStart()booleanvoidvoidmoveStart(org.bukkit.Location location) voidstart()voidstop()toString()
-
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
-
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
-
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()
-