Use Consumers instead of Callbacks
This commit is contained in:
parent
a879a1dc80
commit
cf36c83f4b
@ -1,5 +1,7 @@
|
||||
package mineplex.gemhunters.util;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -18,15 +20,15 @@ public class SimpleNPC implements Listener
|
||||
{
|
||||
|
||||
protected final LivingEntity _entity;
|
||||
private final Callback<Player> _clickEvent;
|
||||
private final Consumer<Player> _clickEvent;
|
||||
private final boolean _vegetated;
|
||||
|
||||
public SimpleNPC(JavaPlugin plugin, Location spawn, Class<? extends LivingEntity> type, String name, Callback<Player> clickEvent)
|
||||
public SimpleNPC(JavaPlugin plugin, Location spawn, Class<? extends LivingEntity> type, String name, Consumer<Player> clickEvent)
|
||||
{
|
||||
this(plugin, spawn, type, name, clickEvent, true);
|
||||
}
|
||||
|
||||
public SimpleNPC(JavaPlugin plugin, Location spawn, Class<? extends LivingEntity> type, String name, Callback<Player> clickEvent, boolean vegetated)
|
||||
public SimpleNPC(JavaPlugin plugin, Location spawn, Class<? extends LivingEntity> type, String name, Consumer<Player> clickEvent, boolean vegetated)
|
||||
{
|
||||
spawn.getWorld().loadChunk(spawn.getChunk());
|
||||
_entity = spawn.getWorld().spawn(spawn, type);
|
||||
@ -57,7 +59,7 @@ public class SimpleNPC implements Listener
|
||||
|
||||
if (_clickEvent != null)
|
||||
{
|
||||
_clickEvent.run(event.getPlayer());
|
||||
_clickEvent.accept(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user