remove isNull and nonNull
This commit is contained in:
@@ -34,8 +34,6 @@ import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import java.util.*;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static java.util.Objects.nonNull;
|
||||
|
||||
public enum WorldScanner implements IWorldScanner {
|
||||
|
||||
INSTANCE;
|
||||
@@ -162,7 +160,7 @@ public enum WorldScanner implements IWorldScanner {
|
||||
for (int z = playerChunkZ - 40; z <= playerChunkZ + 40; z++) {
|
||||
Chunk chunk = chunkProvider.getLoadedChunk(x, z);
|
||||
|
||||
if (nonNull(chunk) && !chunk.isEmpty()) {
|
||||
if (chunk != null && !chunk.isEmpty()) {
|
||||
queued++;
|
||||
cachedWorld.queueForPacking(chunk);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class ComeCommand extends Command {
|
||||
|
||||
@@ -42,7 +41,7 @@ public class ComeCommand extends Command {
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
Entity entity = mc.getRenderViewEntity();
|
||||
if (isNull(entity)) {
|
||||
if (entity == null) {
|
||||
throw new CommandInvalidStateException("render view entity is null");
|
||||
}
|
||||
baritone.getCustomGoalProcess().setGoalAndPath(new GoalBlock(new BlockPos(entity)));
|
||||
|
||||
@@ -40,8 +40,6 @@ import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
import static java.util.Objects.nonNull;
|
||||
|
||||
public class FollowCommand extends Command {
|
||||
|
||||
@@ -78,7 +76,7 @@ public class FollowCommand extends Command {
|
||||
: e -> classes.stream().anyMatch(c -> c.isInstance(e))
|
||||
);
|
||||
}
|
||||
if (nonNull(group)) {
|
||||
if (group != null) {
|
||||
logDirect(String.format("Following all %s", group.name().toLowerCase(Locale.US)));
|
||||
} else {
|
||||
logDirect("Following these types of entities:");
|
||||
@@ -112,7 +110,7 @@ public class FollowCommand extends Command {
|
||||
return Stream.empty();
|
||||
}
|
||||
while (args.has(2)) {
|
||||
if (isNull(args.peekDatatypeOrNull(followType))) {
|
||||
if (args.peekDatatypeOrNull(followType) == null) {
|
||||
return Stream.empty();
|
||||
}
|
||||
args.get();
|
||||
|
||||
@@ -32,8 +32,6 @@ import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
import static java.util.Objects.nonNull;
|
||||
|
||||
public class GoalCommand extends Command {
|
||||
|
||||
@@ -46,7 +44,7 @@ public class GoalCommand extends Command {
|
||||
ICustomGoalProcess goalProcess = baritone.getCustomGoalProcess();
|
||||
if (args.has() && asList("reset", "clear", "none").contains(args.peekString())) {
|
||||
args.requireMax(1);
|
||||
if (nonNull(goalProcess.getGoal())) {
|
||||
if (goalProcess.getGoal() != null) {
|
||||
goalProcess.setGoal(null);
|
||||
logDirect("Cleared goal");
|
||||
} else {
|
||||
@@ -69,7 +67,7 @@ public class GoalCommand extends Command {
|
||||
} else {
|
||||
if (args.hasAtMost(3)) {
|
||||
while (args.has(2)) {
|
||||
if (isNull(args.peekDatatypeOrNull(RelativeCoordinate.class))) {
|
||||
if (args.peekDatatypeOrNull(RelativeCoordinate.class) == null) {
|
||||
break;
|
||||
}
|
||||
args.get();
|
||||
|
||||
@@ -38,7 +38,6 @@ import java.util.stream.Stream;
|
||||
import static baritone.api.utils.command.BaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
import static baritone.api.utils.command.manager.CommandManager.getCommand;
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class HelpCommand extends Command {
|
||||
|
||||
@@ -83,7 +82,7 @@ public class HelpCommand extends Command {
|
||||
} else {
|
||||
String commandName = args.getString().toLowerCase();
|
||||
Command command = getCommand(commandName);
|
||||
if (isNull(command)) {
|
||||
if (command == null) {
|
||||
throw new CommandNotFoundException(commandName);
|
||||
}
|
||||
logDirect(String.format("%s - %s", String.join(" / ", command.names), command.getShortDesc()));
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class InvertCommand extends Command {
|
||||
|
||||
@@ -43,7 +42,7 @@ public class InvertCommand extends Command {
|
||||
args.requireMax(0);
|
||||
ICustomGoalProcess customGoalProcess = baritone.getCustomGoalProcess();
|
||||
Goal goal;
|
||||
if (isNull(goal = customGoalProcess.getGoal())) {
|
||||
if ((goal = customGoalProcess.getGoal()) == null) {
|
||||
throw new CommandInvalidStateException("No goal");
|
||||
}
|
||||
if (goal instanceof GoalInverted) {
|
||||
|
||||
@@ -33,7 +33,6 @@ import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class PathCommand extends Command {
|
||||
|
||||
@@ -48,7 +47,7 @@ public class PathCommand extends Command {
|
||||
if (args.has()) {
|
||||
args.requireMax(3);
|
||||
goal = args.getDatatype(RelativeGoal.class).apply(ctx.playerFeet());
|
||||
} else if (isNull(goal = customGoalProcess.getGoal())) {
|
||||
} else if ((goal = customGoalProcess.getGoal()) == null) {
|
||||
throw new CommandInvalidStateException("No goal");
|
||||
}
|
||||
args.requireMax(0);
|
||||
@@ -61,7 +60,7 @@ public class PathCommand extends Command {
|
||||
protected Stream<String> tabCompleted(String label, ArgConsumer args, Settings settings) {
|
||||
if (args.has() && !args.has(4)) {
|
||||
while (args.has(2)) {
|
||||
if (isNull(args.peekDatatypeOrNull(RelativeCoordinate.class))) {
|
||||
if (args.peekDatatypeOrNull(RelativeCoordinate.class) == null) {
|
||||
break;
|
||||
}
|
||||
args.get();
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class ProcCommand extends Command {
|
||||
|
||||
@@ -43,7 +42,7 @@ public class ProcCommand extends Command {
|
||||
args.requireMax(0);
|
||||
IPathingControlManager pathingControlManager = baritone.getPathingControlManager();
|
||||
IBaritoneProcess process = pathingControlManager.mostRecentInControl().orElse(null);
|
||||
if (isNull(process)) {
|
||||
if (process == null) {
|
||||
throw new CommandInvalidStateException("No process in control");
|
||||
}
|
||||
logDirect(String.format(
|
||||
|
||||
@@ -40,8 +40,6 @@ import static baritone.api.utils.SettingsUtil.settingTypeToString;
|
||||
import static baritone.api.utils.SettingsUtil.settingValueToString;
|
||||
import static baritone.api.utils.command.BaritoneChatControl.FORCE_COMMAND_PREFIX;
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
import static java.util.Objects.nonNull;
|
||||
import static java.util.stream.Stream.of;
|
||||
|
||||
public class SetCommand extends Command {
|
||||
@@ -126,7 +124,7 @@ public class SetCommand extends Command {
|
||||
.filter(s -> s.getName().equalsIgnoreCase(settingName))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (isNull(setting)) {
|
||||
if (setting == null) {
|
||||
throw new CommandInvalidTypeException(args.consumed(), "a valid setting");
|
||||
}
|
||||
if (!doingSomething && !args.has()) {
|
||||
@@ -204,7 +202,7 @@ public class SetCommand extends Command {
|
||||
.stream();
|
||||
}
|
||||
Settings.Setting setting = settings.byLowerName.get(arg.toLowerCase(Locale.US));
|
||||
if (nonNull(setting)) {
|
||||
if (setting != null) {
|
||||
if (setting.getType() == Boolean.class) {
|
||||
TabCompleteHelper helper = new TabCompleteHelper();
|
||||
if ((Boolean) setting.value) {
|
||||
|
||||
@@ -27,7 +27,6 @@ import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
public class VersionCommand extends Command {
|
||||
|
||||
@@ -39,7 +38,7 @@ public class VersionCommand extends Command {
|
||||
protected void executed(String label, ArgConsumer args, Settings settings) {
|
||||
args.requireMax(0);
|
||||
String version = getClass().getPackage().getImplementationVersion();
|
||||
if (isNull(version)) {
|
||||
if (version == null) {
|
||||
throw new CommandInvalidStateException("Null version (this is normal in a dev environment)");
|
||||
} else {
|
||||
logDirect(String.format("You are running Baritone v%s", version));
|
||||
|
||||
Reference in New Issue
Block a user