Class MagnetTask
- java.lang.Object
-
- io.github.thebusybiscuit.slimefun4.implementation.tasks.MagnetTask
-
- All Implemented Interfaces:
Runnable
public class MagnetTask extends Object
ThisPlayerTask
is run when aPlayer
carries anInfusedMagnet
. It manages the automatic pickup of nearby items.- Author:
- TheBusyBiscuit
- See Also:
InfusedMagnet
-
-
Constructor Summary
Constructors Constructor Description MagnetTask(Player p, double radius)
This creates a newMagnetTask
for the givenPlayer
with the given pickup radius.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
executeTask()
protected boolean
isValid()
This method checks if thisPlayerTask
should be continued or cancelled.void
run()
void
schedule(long delay)
void
scheduleRepeating(long delay, long interval)
void
setID(int id)
-
-
-
Field Detail
-
id
protected int id
-
p
protected Player p
-
-
Constructor Detail
-
MagnetTask
public MagnetTask(Player p, double radius)
This creates a newMagnetTask
for the givenPlayer
with the given pickup radius.- Parameters:
p
- ThePlayer
who items should be teleported toradius
- The radius in which items should be picked up
-
-
Method Detail
-
executeTask
public void executeTask()
-
isValid
protected boolean isValid()
This method checks if thisPlayerTask
should be continued or cancelled. It will also cancel thisPlayerTask
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)
-
-