Rename PlayerByUsername to NearbyPlayer
This commit is contained in:
parent
9ffca6ad66
commit
7292245b55
@ -18,6 +18,7 @@
|
||||
package baritone.api.utils.command.datatypes;
|
||||
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.utils.command.exception.CommandException;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
import baritone.api.utils.command.helpers.tabcomplete.TabCompleteHelper;
|
||||
@ -26,17 +27,21 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class PlayerByUsername implements IDatatypeFor<EntityPlayer> {
|
||||
/**
|
||||
* An {@link IDatatype} used to resolve nearby players, those within
|
||||
* render distance of the target {@link IBaritone} instance.
|
||||
*/
|
||||
public class NearbyPlayer implements IDatatypeFor<EntityPlayer> {
|
||||
|
||||
private final List<EntityPlayer> players =
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().playerEntities;
|
||||
public final EntityPlayer player;
|
||||
|
||||
public PlayerByUsername() {
|
||||
public NearbyPlayer() {
|
||||
player = null;
|
||||
}
|
||||
|
||||
public PlayerByUsername(ArgConsumer consumer) throws CommandException {
|
||||
public NearbyPlayer(ArgConsumer consumer) throws CommandException {
|
||||
String username = consumer.getString();
|
||||
player = players
|
||||
.stream()
|
@ -18,12 +18,11 @@
|
||||
package baritone.utils.command.defaults;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.utils.command.Command;
|
||||
import baritone.api.utils.command.datatypes.EntityClassById;
|
||||
import baritone.api.utils.command.datatypes.IDatatype;
|
||||
import baritone.api.utils.command.datatypes.IDatatypeFor;
|
||||
import baritone.api.utils.command.datatypes.PlayerByUsername;
|
||||
import baritone.api.utils.command.datatypes.NearbyPlayer;
|
||||
import baritone.api.utils.command.exception.CommandException;
|
||||
import baritone.api.utils.command.helpers.arguments.ArgConsumer;
|
||||
import baritone.api.utils.command.helpers.tabcomplete.TabCompleteHelper;
|
||||
@ -147,7 +146,7 @@ public class FollowCommand extends Command {
|
||||
|
||||
private enum FollowList {
|
||||
ENTITY(EntityClassById.class),
|
||||
PLAYER(PlayerByUsername.class);
|
||||
PLAYER(NearbyPlayer.class);
|
||||
final Class<? extends IDatatypeFor> datatype;
|
||||
|
||||
FollowList(Class<? extends IDatatypeFor> datatype) {
|
||||
|
Loading…
Reference in New Issue
Block a user