From c50af5acfd5239181ed96e663307e5784e341415 Mon Sep 17 00:00:00 2001 From: Brady Date: Tue, 6 Nov 2018 08:02:08 -0600 Subject: [PATCH] A couple minor cleanups --- .../java/baritone/api/IBaritoneProvider.java | 13 ++++++++- .../baritone/api/process/PathingCommand.java | 28 +++++++++++++++++-- .../java/baritone/event/GameEventHandler.java | 7 +++-- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/api/java/baritone/api/IBaritoneProvider.java b/src/api/java/baritone/api/IBaritoneProvider.java index 9bd96e7e..745842ce 100644 --- a/src/api/java/baritone/api/IBaritoneProvider.java +++ b/src/api/java/baritone/api/IBaritoneProvider.java @@ -19,6 +19,17 @@ package baritone.api; import net.minecraft.client.entity.EntityPlayerSP; +/** + * @author Leijurv + */ public interface IBaritoneProvider { - IBaritone getBaritoneForPlayer(EntityPlayerSP player); // tenor be like + + /** + * Provides the {@link IBaritone} instance for a given {@link EntityPlayerSP}. This will likely be + * replaced with {@code #getBaritoneForUser(IBaritoneUser)} when {@code bot-system} is merged. + * + * @param player The player + * @return The {@link IBaritone} instance. + */ + IBaritone getBaritoneForPlayer(EntityPlayerSP player); } diff --git a/src/api/java/baritone/api/process/PathingCommand.java b/src/api/java/baritone/api/process/PathingCommand.java index 0d0d7db3..753e1a2d 100644 --- a/src/api/java/baritone/api/process/PathingCommand.java +++ b/src/api/java/baritone/api/process/PathingCommand.java @@ -19,17 +19,39 @@ package baritone.api.process; import baritone.api.pathing.goals.Goal; +import java.util.Objects; + +/** + * @author Leijurv + */ public class PathingCommand { + /** + * The target goal, may be {@code null}. + */ public final Goal goal; + /** + * The command type. + * + * @see PathingCommandType + */ public final PathingCommandType commandType; + /** + * Create a new {@link PathingCommand}. + * + * @see Goal + * @see PathingCommandType + * + * @param goal The target goal, may be {@code null}. + * @param commandType The command type, cannot be {@code null}. + * @throws NullPointerException if {@code commandType} is {@code null}. + */ public PathingCommand(Goal goal, PathingCommandType commandType) { + Objects.requireNonNull(commandType); + this.goal = goal; this.commandType = commandType; - if (commandType == null) { - throw new IllegalArgumentException(); - } } } diff --git a/src/main/java/baritone/event/GameEventHandler.java b/src/main/java/baritone/event/GameEventHandler.java index 1de1b728..b42b3e06 100644 --- a/src/main/java/baritone/event/GameEventHandler.java +++ b/src/main/java/baritone/event/GameEventHandler.java @@ -27,6 +27,7 @@ import baritone.utils.Helper; import net.minecraft.world.chunk.Chunk; import java.util.ArrayList; +import java.util.List; /** * @author Brady @@ -36,7 +37,7 @@ public final class GameEventHandler implements IGameEventListener, Helper { private final Baritone baritone; - private final ArrayList listeners = new ArrayList<>(); + private final List listeners = new ArrayList<>(); public GameEventHandler(Baritone baritone) { this.baritone = baritone; @@ -54,7 +55,7 @@ public final class GameEventHandler implements IGameEventListener, Helper { @Override public final void onProcessKeyBinds() { - listeners.forEach(l -> l.onProcessKeyBinds()); + listeners.forEach(IGameEventListener::onProcessKeyBinds); } @Override @@ -131,7 +132,7 @@ public final class GameEventHandler implements IGameEventListener, Helper { @Override public void onPlayerDeath() { - listeners.forEach(l -> l.onPlayerDeath()); + listeners.forEach(IGameEventListener::onPlayerDeath); } @Override