Class MagnetTask

  • All Implemented Interfaces:
    Runnable


    public class MagnetTask
    extends Object
    This PlayerTask is run when a Player carries an InfusedMagnet. It manages the automatic pickup of nearby items.
    Author:
    TheBusyBiscuit
    See Also:
    InfusedMagnet
    • Field Detail

      • id

        protected int id
    • Constructor Detail

      • MagnetTask

        public MagnetTask​(Player p,
                          double radius)
        This creates a new MagnetTask for the given Player with the given pickup radius.
        Parameters:
        p - The Player who items should be teleported to
        radius - The radius in which items should be picked up
    • Method Detail

      • executeTask

        public void executeTask​()
      • isValid

        protected boolean isValid​()
        This method checks if this PlayerTask should be continued or cancelled. It will also cancel this PlayerTask if it became invalid.
        Returns:
        Whether this PlayerTask is still valid
      • setID

        public void setID​(int id)
      • schedule

        public void schedule​(long delay)
      • scheduleRepeating

        public void scheduleRepeating​(long delay,
                                      long interval)
      • run

        public void run​()
        Specified by:
        run in interface Runnable