"stAnDaRd" ConTinuATion InDEnT
This commit is contained in:
parent
9db07faf49
commit
c54dcdba24
@ -88,15 +88,15 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
|||||||
|
|
||||||
ITextComponent component = new TextComponentString(String.format("> %s", toDisplay));
|
ITextComponent component = new TextComponentString(String.format("> %s", toDisplay));
|
||||||
component.getStyle()
|
component.getStyle()
|
||||||
.setColor(TextFormatting.WHITE)
|
.setColor(TextFormatting.WHITE)
|
||||||
.setHoverEvent(new HoverEvent(
|
.setHoverEvent(new HoverEvent(
|
||||||
HoverEvent.Action.SHOW_TEXT,
|
HoverEvent.Action.SHOW_TEXT,
|
||||||
new TextComponentString("Click to rerun command")
|
new TextComponentString("Click to rerun command")
|
||||||
))
|
))
|
||||||
.setClickEvent(new ClickEvent(
|
.setClickEvent(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
FORCE_COMMAND_PREFIX + msg
|
FORCE_COMMAND_PREFIX + msg
|
||||||
));
|
));
|
||||||
|
|
||||||
logDirect(component);
|
logDirect(component);
|
||||||
}
|
}
|
||||||
@ -195,10 +195,10 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
|||||||
if (argc.hasAtMost(2)) {
|
if (argc.hasAtMost(2)) {
|
||||||
if (argc.hasExactly(1)) {
|
if (argc.hasExactly(1)) {
|
||||||
return new TabCompleteHelper()
|
return new TabCompleteHelper()
|
||||||
.addCommands()
|
.addCommands()
|
||||||
.addSettings()
|
.addSettings()
|
||||||
.filterPrefix(argc.getString())
|
.filterPrefix(argc.getString())
|
||||||
.stream();
|
.stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings.Setting setting = settings.byLowerName.get(argc.getString().toLowerCase(Locale.US));
|
Settings.Setting setting = settings.byLowerName.get(argc.getString().toLowerCase(Locale.US));
|
||||||
|
@ -51,8 +51,8 @@ public abstract class Command implements Helper, AbstractGameEventListener {
|
|||||||
*/
|
*/
|
||||||
protected Command(List<String> names) {
|
protected Command(List<String> names) {
|
||||||
this.names = names.stream()
|
this.names = names.stream()
|
||||||
.map(s -> s.toLowerCase(Locale.US))
|
.map(s -> s.toLowerCase(Locale.US))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
baritone.getGameEventHandler().registerEventListener(this);
|
baritone.getGameEventHandler().registerEventListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ public class ArgParserManager {
|
|||||||
public static <T> ArgParser.Stateless<T> getParserStateless(Class<T> klass) {
|
public static <T> ArgParser.Stateless<T> getParserStateless(Class<T> klass) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return REGISTRY.descendingStream()
|
return REGISTRY.descendingStream()
|
||||||
.filter(ArgParser.Stateless.class::isInstance)
|
.filter(ArgParser.Stateless.class::isInstance)
|
||||||
.map(ArgParser.Stateless.class::cast)
|
.map(ArgParser.Stateless.class::cast)
|
||||||
.filter(parser -> parser.getKlass().isAssignableFrom(klass))
|
.filter(parser -> parser.getKlass().isAssignableFrom(klass))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,13 +52,13 @@ public class ArgParserManager {
|
|||||||
public static <T, S> ArgParser.Stated<T, S> getParserStated(Class<T> klass, Class<S> stateKlass) {
|
public static <T, S> ArgParser.Stated<T, S> getParserStated(Class<T> klass, Class<S> stateKlass) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return REGISTRY.descendingStream()
|
return REGISTRY.descendingStream()
|
||||||
.filter(ArgParser.Stated.class::isInstance)
|
.filter(ArgParser.Stated.class::isInstance)
|
||||||
.map(ArgParser.Stated.class::cast)
|
.map(ArgParser.Stated.class::cast)
|
||||||
.filter(parser -> parser.getKlass().isAssignableFrom(klass))
|
.filter(parser -> parser.getKlass().isAssignableFrom(klass))
|
||||||
.filter(parser -> parser.getStateKlass().isAssignableFrom(stateKlass))
|
.filter(parser -> parser.getStateKlass().isAssignableFrom(stateKlass))
|
||||||
.map(ArgParser.Stated.class::cast)
|
.map(ArgParser.Stated.class::cast)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,10 +114,10 @@ public class DefaultArgParsers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final List<ArgParser<?>> ALL = asList(
|
public static final List<ArgParser<?>> ALL = asList(
|
||||||
IntArgumentParser.INSTANCE,
|
IntArgumentParser.INSTANCE,
|
||||||
LongArgumentParser.INSTANCE,
|
LongArgumentParser.INSTANCE,
|
||||||
FloatArgumentParser.INSTANCE,
|
FloatArgumentParser.INSTANCE,
|
||||||
DoubleArgumentParser.INSTANCE,
|
DoubleArgumentParser.INSTANCE,
|
||||||
BooleanArgumentParser.INSTANCE
|
BooleanArgumentParser.INSTANCE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,9 @@ public class CommandArgument {
|
|||||||
*/
|
*/
|
||||||
public <E extends Enum<?>> E getEnum(Class<E> enumClass) {
|
public <E extends Enum<?>> E getEnum(Class<E> enumClass) {
|
||||||
return Arrays.stream(enumClass.getEnumConstants())
|
return Arrays.stream(enumClass.getEnumConstants())
|
||||||
.filter(e -> e.name().equalsIgnoreCase(value))
|
.filter(e -> e.name().equalsIgnoreCase(value))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseThrow(() -> new CommandInvalidTypeException(this, enumClass.getSimpleName()));
|
.orElseThrow(() -> new CommandInvalidTypeException(this, enumClass.getSimpleName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,9 +145,9 @@ public class CommandArgument {
|
|||||||
int lastEnd = -1;
|
int lastEnd = -1;
|
||||||
while (argMatcher.find()) {
|
while (argMatcher.find()) {
|
||||||
args.add(new CommandArgument(
|
args.add(new CommandArgument(
|
||||||
args.size(),
|
args.size(),
|
||||||
argMatcher.group(),
|
argMatcher.group(),
|
||||||
string.substring(argMatcher.start())
|
string.substring(argMatcher.start())
|
||||||
));
|
));
|
||||||
|
|
||||||
lastEnd = argMatcher.end();
|
lastEnd = argMatcher.end();
|
||||||
|
@ -48,13 +48,13 @@ public class BlockById implements IDatatypeFor<Block> {
|
|||||||
@Override
|
@Override
|
||||||
public Stream<String> tabComplete(ArgConsumer consumer) {
|
public Stream<String> tabComplete(ArgConsumer consumer) {
|
||||||
return new TabCompleteHelper()
|
return new TabCompleteHelper()
|
||||||
.append(
|
.append(
|
||||||
Block.REGISTRY.getKeys()
|
Block.REGISTRY.getKeys()
|
||||||
.stream()
|
.stream()
|
||||||
.map(Object::toString)
|
.map(Object::toString)
|
||||||
)
|
)
|
||||||
.filterPrefixNamespaced(consumer.getString())
|
.filterPrefixNamespaced(consumer.getString())
|
||||||
.sortAlphabetically()
|
.sortAlphabetically()
|
||||||
.stream();
|
.stream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,13 +50,13 @@ public class EntityClassById implements IDatatypeFor<Class<? extends Entity>> {
|
|||||||
@Override
|
@Override
|
||||||
public Stream<String> tabComplete(ArgConsumer consumer) {
|
public Stream<String> tabComplete(ArgConsumer consumer) {
|
||||||
return new TabCompleteHelper()
|
return new TabCompleteHelper()
|
||||||
.append(
|
.append(
|
||||||
EntityList.getEntityNameList()
|
EntityList.getEntityNameList()
|
||||||
.stream()
|
.stream()
|
||||||
.map(Object::toString)
|
.map(Object::toString)
|
||||||
)
|
)
|
||||||
.filterPrefixNamespaced(consumer.getString())
|
.filterPrefixNamespaced(consumer.getString())
|
||||||
.sortAlphabetically()
|
.sortAlphabetically()
|
||||||
.stream();
|
.stream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,12 @@ public class ForEnumFacing implements IDatatypeFor<EnumFacing> {
|
|||||||
@Override
|
@Override
|
||||||
public Stream<String> tabComplete(ArgConsumer consumer) {
|
public Stream<String> tabComplete(ArgConsumer consumer) {
|
||||||
return new TabCompleteHelper()
|
return new TabCompleteHelper()
|
||||||
.append(
|
.append(
|
||||||
Arrays.stream(EnumFacing.values())
|
Arrays.stream(EnumFacing.values())
|
||||||
.map(EnumFacing::getName)
|
.map(EnumFacing::getName)
|
||||||
.map(String::toLowerCase)
|
.map(String::toLowerCase)
|
||||||
)
|
)
|
||||||
.filterPrefix(consumer.getString())
|
.filterPrefix(consumer.getString())
|
||||||
.stream();
|
.stream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,43 +51,43 @@ public class ForWaypoints implements IDatatypeFor<IWaypoint[]> {
|
|||||||
@Override
|
@Override
|
||||||
public Stream<String> tabComplete(ArgConsumer consumer) {
|
public Stream<String> tabComplete(ArgConsumer consumer) {
|
||||||
return new TabCompleteHelper()
|
return new TabCompleteHelper()
|
||||||
.append(getWaypointNames())
|
.append(getWaypointNames())
|
||||||
.sortAlphabetically()
|
.sortAlphabetically()
|
||||||
.prepend(IWaypoint.Tag.getAllNames())
|
.prepend(IWaypoint.Tag.getAllNames())
|
||||||
.filterPrefix(consumer.getString())
|
.filterPrefix(consumer.getString())
|
||||||
.stream();
|
.stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWaypointCollection waypoints() {
|
public static IWaypointCollection waypoints() {
|
||||||
return BaritoneAPI.getProvider()
|
return BaritoneAPI.getProvider()
|
||||||
.getPrimaryBaritone()
|
.getPrimaryBaritone()
|
||||||
.getWorldProvider()
|
.getWorldProvider()
|
||||||
.getCurrentWorld()
|
.getCurrentWorld()
|
||||||
.getWaypoints();
|
.getWaypoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWaypoint[] getWaypoints() {
|
public static IWaypoint[] getWaypoints() {
|
||||||
return waypoints().getAllWaypoints().stream()
|
return waypoints().getAllWaypoints().stream()
|
||||||
.sorted(Comparator.comparingLong(IWaypoint::getCreationTimestamp).reversed())
|
.sorted(Comparator.comparingLong(IWaypoint::getCreationTimestamp).reversed())
|
||||||
.toArray(IWaypoint[]::new);
|
.toArray(IWaypoint[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] getWaypointNames() {
|
public static String[] getWaypointNames() {
|
||||||
return Arrays.stream(getWaypoints())
|
return Arrays.stream(getWaypoints())
|
||||||
.map(IWaypoint::getName)
|
.map(IWaypoint::getName)
|
||||||
.filter(name -> !name.equals(""))
|
.filter(name -> !name.equals(""))
|
||||||
.toArray(String[]::new);
|
.toArray(String[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWaypoint[] getWaypointsByTag(IWaypoint.Tag tag) {
|
public static IWaypoint[] getWaypointsByTag(IWaypoint.Tag tag) {
|
||||||
return waypoints().getByTag(tag).stream()
|
return waypoints().getByTag(tag).stream()
|
||||||
.sorted(Comparator.comparingLong(IWaypoint::getCreationTimestamp).reversed())
|
.sorted(Comparator.comparingLong(IWaypoint::getCreationTimestamp).reversed())
|
||||||
.toArray(IWaypoint[]::new);
|
.toArray(IWaypoint[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWaypoint[] getWaypointsByName(String name) {
|
public static IWaypoint[] getWaypointsByName(String name) {
|
||||||
return Arrays.stream(getWaypoints())
|
return Arrays.stream(getWaypoints())
|
||||||
.filter(waypoint -> waypoint.getName().equalsIgnoreCase(name))
|
.filter(waypoint -> waypoint.getName().equalsIgnoreCase(name))
|
||||||
.toArray(IWaypoint[]::new);
|
.toArray(IWaypoint[]::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import static java.util.Objects.isNull;
|
|||||||
|
|
||||||
public class PlayerByUsername implements IDatatypeFor<EntityPlayer> {
|
public class PlayerByUsername implements IDatatypeFor<EntityPlayer> {
|
||||||
private final List<EntityPlayer> players =
|
private final List<EntityPlayer> players =
|
||||||
BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().playerEntities;
|
BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().playerEntities;
|
||||||
public final EntityPlayer player;
|
public final EntityPlayer player;
|
||||||
|
|
||||||
public PlayerByUsername() {
|
public PlayerByUsername() {
|
||||||
@ -40,10 +40,10 @@ public class PlayerByUsername implements IDatatypeFor<EntityPlayer> {
|
|||||||
String username = consumer.getString();
|
String username = consumer.getString();
|
||||||
|
|
||||||
player = players
|
player = players
|
||||||
.stream()
|
.stream()
|
||||||
.filter(s -> s.getName().equalsIgnoreCase(username))
|
.filter(s -> s.getName().equalsIgnoreCase(username))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
if (isNull(player)) {
|
if (isNull(player)) {
|
||||||
throw new IllegalArgumentException("no player found by that username");
|
throw new IllegalArgumentException("no player found by that username");
|
||||||
@ -58,13 +58,13 @@ public class PlayerByUsername implements IDatatypeFor<EntityPlayer> {
|
|||||||
@Override
|
@Override
|
||||||
public Stream<String> tabComplete(ArgConsumer consumer) {
|
public Stream<String> tabComplete(ArgConsumer consumer) {
|
||||||
return new TabCompleteHelper()
|
return new TabCompleteHelper()
|
||||||
.append(
|
.append(
|
||||||
players
|
players
|
||||||
.stream()
|
.stream()
|
||||||
.map(EntityPlayer::getName)
|
.map(EntityPlayer::getName)
|
||||||
)
|
)
|
||||||
.filterPrefix(consumer.getString())
|
.filterPrefix(consumer.getString())
|
||||||
.sortAlphabetically()
|
.sortAlphabetically()
|
||||||
.stream();
|
.stream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,9 @@ public class RelativeBlockPos implements IDatatypePost<BetterBlockPos, BetterBlo
|
|||||||
@Override
|
@Override
|
||||||
public BetterBlockPos apply(BetterBlockPos origin) {
|
public BetterBlockPos apply(BetterBlockPos origin) {
|
||||||
return new BetterBlockPos(
|
return new BetterBlockPos(
|
||||||
x.apply((double) origin.x),
|
x.apply((double) origin.x),
|
||||||
y.apply((double) origin.y),
|
y.apply((double) origin.y),
|
||||||
z.apply((double) origin.z)
|
z.apply((double) origin.z)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,14 +77,14 @@ public class RelativeFile implements IDatatypePost<File, File> {
|
|||||||
File currentFile = currentPath.isAbsolute() ? currentPath.toFile() : new File(base, currentPathStringThing);
|
File currentFile = currentPath.isAbsolute() ? currentPath.toFile() : new File(base, currentPathStringThing);
|
||||||
|
|
||||||
return Arrays.stream(Objects.requireNonNull(SHUT_THE_FUCK_UP_IOEXCEPTION_NOBODY_LIKES_YOU(
|
return Arrays.stream(Objects.requireNonNull(SHUT_THE_FUCK_UP_IOEXCEPTION_NOBODY_LIKES_YOU(
|
||||||
useParent
|
useParent
|
||||||
? currentFile.getParentFile()
|
? currentFile.getParentFile()
|
||||||
: currentFile
|
: currentFile
|
||||||
).listFiles()))
|
).listFiles()))
|
||||||
.map(f -> (currentPath.isAbsolute() ? f : basePath.relativize(f.toPath()).toString()) +
|
.map(f -> (currentPath.isAbsolute() ? f : basePath.relativize(f.toPath()).toString()) +
|
||||||
(f.isDirectory() ? File.separator : ""))
|
(f.isDirectory() ? File.separator : ""))
|
||||||
.filter(s -> s.toLowerCase(Locale.US).startsWith(currentPathStringThing.toLowerCase(Locale.US)))
|
.filter(s -> s.toLowerCase(Locale.US).startsWith(currentPathStringThing.toLowerCase(Locale.US)))
|
||||||
.filter(s -> !s.contains(" "));
|
.filter(s -> !s.contains(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,18 +56,18 @@ public class RelativeGoal implements IDatatypePost<Goal, BetterBlockPos> {
|
|||||||
return new GoalBlock(origin);
|
return new GoalBlock(origin);
|
||||||
case 1:
|
case 1:
|
||||||
return new GoalYLevel(
|
return new GoalYLevel(
|
||||||
coords[0].applyFloor(origin.y)
|
coords[0].applyFloor(origin.y)
|
||||||
);
|
);
|
||||||
case 2:
|
case 2:
|
||||||
return new GoalXZ(
|
return new GoalXZ(
|
||||||
coords[0].applyFloor(origin.x),
|
coords[0].applyFloor(origin.x),
|
||||||
coords[1].applyFloor(origin.z)
|
coords[1].applyFloor(origin.z)
|
||||||
);
|
);
|
||||||
case 3:
|
case 3:
|
||||||
return new GoalBlock(
|
return new GoalBlock(
|
||||||
coords[0].applyFloor(origin.x),
|
coords[0].applyFloor(origin.x),
|
||||||
coords[1].applyFloor(origin.y),
|
coords[1].applyFloor(origin.y),
|
||||||
coords[2].applyFloor(origin.z)
|
coords[2].applyFloor(origin.z)
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("Unexpected coords size: " + coords.length);
|
throw new IllegalStateException("Unexpected coords size: " + coords.length);
|
||||||
|
@ -32,18 +32,18 @@ public class RelativeGoalBlock implements IDatatypePost<GoalBlock, BetterBlockPo
|
|||||||
|
|
||||||
public RelativeGoalBlock(ArgConsumer consumer) {
|
public RelativeGoalBlock(ArgConsumer consumer) {
|
||||||
coords = new RelativeCoordinate[]{
|
coords = new RelativeCoordinate[]{
|
||||||
consumer.getDatatype(RelativeCoordinate.class),
|
consumer.getDatatype(RelativeCoordinate.class),
|
||||||
consumer.getDatatype(RelativeCoordinate.class),
|
consumer.getDatatype(RelativeCoordinate.class),
|
||||||
consumer.getDatatype(RelativeCoordinate.class)
|
consumer.getDatatype(RelativeCoordinate.class)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GoalBlock apply(BetterBlockPos origin) {
|
public GoalBlock apply(BetterBlockPos origin) {
|
||||||
return new GoalBlock(
|
return new GoalBlock(
|
||||||
coords[0].applyFloor(origin.x),
|
coords[0].applyFloor(origin.x),
|
||||||
coords[1].applyFloor(origin.y),
|
coords[1].applyFloor(origin.y),
|
||||||
coords[2].applyFloor(origin.z)
|
coords[2].applyFloor(origin.z)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,16 +32,16 @@ public class RelativeGoalXZ implements IDatatypePost<GoalXZ, BetterBlockPos> {
|
|||||||
|
|
||||||
public RelativeGoalXZ(ArgConsumer consumer) {
|
public RelativeGoalXZ(ArgConsumer consumer) {
|
||||||
coords = new RelativeCoordinate[]{
|
coords = new RelativeCoordinate[]{
|
||||||
consumer.getDatatype(RelativeCoordinate.class),
|
consumer.getDatatype(RelativeCoordinate.class),
|
||||||
consumer.getDatatype(RelativeCoordinate.class)
|
consumer.getDatatype(RelativeCoordinate.class)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GoalXZ apply(BetterBlockPos origin) {
|
public GoalXZ apply(BetterBlockPos origin) {
|
||||||
return new GoalXZ(
|
return new GoalXZ(
|
||||||
coords[0].applyFloor(origin.x),
|
coords[0].applyFloor(origin.x),
|
||||||
coords[1].applyFloor(origin.z)
|
coords[1].applyFloor(origin.z)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ public abstract class CommandInvalidArgumentException extends CommandErrorMessag
|
|||||||
|
|
||||||
protected CommandInvalidArgumentException(CommandArgument arg, String reason) {
|
protected CommandInvalidArgumentException(CommandArgument arg, String reason) {
|
||||||
super(String.format(
|
super(String.format(
|
||||||
"Error at argument #%s: %s",
|
"Error at argument #%s: %s",
|
||||||
arg.index == -1 ? "<unknown>" : Integer.toString(arg.index + 1),
|
arg.index == -1 ? "<unknown>" : Integer.toString(arg.index + 1),
|
||||||
reason
|
reason
|
||||||
));
|
));
|
||||||
|
|
||||||
this.arg = arg;
|
this.arg = arg;
|
||||||
|
@ -34,7 +34,7 @@ public class CommandUnhandledException extends CommandErrorMessageException {
|
|||||||
|
|
||||||
public static String getBaritoneStackTrace(String stackTrace) {
|
public static String getBaritoneStackTrace(String stackTrace) {
|
||||||
List<String> lines = Arrays.stream(stackTrace.split("\n"))
|
List<String> lines = Arrays.stream(stackTrace.split("\n"))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
int lastBaritoneLine = 0;
|
int lastBaritoneLine = 0;
|
||||||
for (int i = 0; i < lines.size(); i++) {
|
for (int i = 0; i < lines.size(); i++) {
|
||||||
@ -76,8 +76,8 @@ public class CommandUnhandledException extends CommandErrorMessageException {
|
|||||||
|
|
||||||
public CommandUnhandledException(Throwable cause) {
|
public CommandUnhandledException(Throwable cause) {
|
||||||
super(String.format(
|
super(String.format(
|
||||||
"An unhandled exception has occurred:\n\n%s",
|
"An unhandled exception has occurred:\n\n%s",
|
||||||
getFriendlierStackTrace(cause)
|
getFriendlierStackTrace(cause)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,9 +97,9 @@ public class CommandExecution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new CommandExecution(
|
return new CommandExecution(
|
||||||
command,
|
command,
|
||||||
label,
|
label,
|
||||||
args
|
args
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,14 +83,14 @@ public class Paginator<E> implements Helper {
|
|||||||
|
|
||||||
if (hasPrevPage) {
|
if (hasPrevPage) {
|
||||||
prevPageComponent.getStyle()
|
prevPageComponent.getStyle()
|
||||||
.setClickEvent(new ClickEvent(
|
.setClickEvent(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
String.format("%s %d", commandPrefix, page - 1)
|
String.format("%s %d", commandPrefix, page - 1)
|
||||||
))
|
))
|
||||||
.setHoverEvent(new HoverEvent(
|
.setHoverEvent(new HoverEvent(
|
||||||
HoverEvent.Action.SHOW_TEXT,
|
HoverEvent.Action.SHOW_TEXT,
|
||||||
new TextComponentString("Click to view previous page")
|
new TextComponentString("Click to view previous page")
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
prevPageComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
prevPageComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
||||||
}
|
}
|
||||||
@ -99,14 +99,14 @@ public class Paginator<E> implements Helper {
|
|||||||
|
|
||||||
if (hasNextPage) {
|
if (hasNextPage) {
|
||||||
nextPageComponent.getStyle()
|
nextPageComponent.getStyle()
|
||||||
.setClickEvent(new ClickEvent(
|
.setClickEvent(new ClickEvent(
|
||||||
ClickEvent.Action.RUN_COMMAND,
|
ClickEvent.Action.RUN_COMMAND,
|
||||||
String.format("%s %d", commandPrefix, page + 1)
|
String.format("%s %d", commandPrefix, page + 1)
|
||||||
))
|
))
|
||||||
.setHoverEvent(new HoverEvent(
|
.setHoverEvent(new HoverEvent(
|
||||||
HoverEvent.Action.SHOW_TEXT,
|
HoverEvent.Action.SHOW_TEXT,
|
||||||
new TextComponentString("Click to view next page")
|
new TextComponentString("Click to view next page")
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
nextPageComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
nextPageComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
||||||
}
|
}
|
||||||
@ -134,12 +134,12 @@ public class Paginator<E> implements Helper {
|
|||||||
|
|
||||||
if (!pagi.validPage(page)) {
|
if (!pagi.validPage(page)) {
|
||||||
throw new CommandInvalidTypeException(
|
throw new CommandInvalidTypeException(
|
||||||
consumer.consumed(),
|
consumer.consumed(),
|
||||||
String.format(
|
String.format(
|
||||||
"a valid page (1-%d)",
|
"a valid page (1-%d)",
|
||||||
pagi.getMaxPage()
|
pagi.getMaxPage()
|
||||||
),
|
),
|
||||||
consumer.consumed().value
|
consumer.consumed().value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,9 +112,9 @@ public class TabCompleteHelper {
|
|||||||
*/
|
*/
|
||||||
public TabCompleteHelper append(Class<? extends Enum<?>> num) {
|
public TabCompleteHelper append(Class<? extends Enum<?>> num) {
|
||||||
return append(
|
return append(
|
||||||
Arrays.stream(num.getEnumConstants())
|
Arrays.stream(num.getEnumConstants())
|
||||||
.map(Enum::name)
|
.map(Enum::name)
|
||||||
.map(String::toLowerCase)
|
.map(String::toLowerCase)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,9 +163,9 @@ public class TabCompleteHelper {
|
|||||||
*/
|
*/
|
||||||
public TabCompleteHelper prepend(Class<? extends Enum<?>> num) {
|
public TabCompleteHelper prepend(Class<? extends Enum<?>> num) {
|
||||||
return prepend(
|
return prepend(
|
||||||
Arrays.stream(num.getEnumConstants())
|
Arrays.stream(num.getEnumConstants())
|
||||||
.map(Enum::name)
|
.map(Enum::name)
|
||||||
.map(String::toLowerCase)
|
.map(String::toLowerCase)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,9 +263,9 @@ public class TabCompleteHelper {
|
|||||||
*/
|
*/
|
||||||
public TabCompleteHelper addCommands() {
|
public TabCompleteHelper addCommands() {
|
||||||
return append(
|
return append(
|
||||||
CommandManager.REGISTRY.descendingStream()
|
CommandManager.REGISTRY.descendingStream()
|
||||||
.flatMap(command -> command.names.stream())
|
.flatMap(command -> command.names.stream())
|
||||||
.distinct()
|
.distinct()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,10 +276,10 @@ public class TabCompleteHelper {
|
|||||||
*/
|
*/
|
||||||
public TabCompleteHelper addSettings() {
|
public TabCompleteHelper addSettings() {
|
||||||
return append(
|
return append(
|
||||||
BaritoneAPI.getSettings().allSettings.stream()
|
BaritoneAPI.getSettings().allSettings.stream()
|
||||||
.map(Settings.Setting::getName)
|
.map(Settings.Setting::getName)
|
||||||
.filter(s -> !s.equalsIgnoreCase("logger"))
|
.filter(s -> !s.equalsIgnoreCase("logger"))
|
||||||
.sorted(String.CASE_INSENSITIVE_ORDER)
|
.sorted(String.CASE_INSENSITIVE_ORDER)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,9 +290,9 @@ public class TabCompleteHelper {
|
|||||||
*/
|
*/
|
||||||
public TabCompleteHelper addModifiedSettings() {
|
public TabCompleteHelper addModifiedSettings() {
|
||||||
return append(
|
return append(
|
||||||
SettingsUtil.modifiedSettings(BaritoneAPI.getSettings()).stream()
|
SettingsUtil.modifiedSettings(BaritoneAPI.getSettings()).stream()
|
||||||
.map(Settings.Setting::getName)
|
.map(Settings.Setting::getName)
|
||||||
.sorted(String.CASE_INSENSITIVE_ORDER)
|
.sorted(String.CASE_INSENSITIVE_ORDER)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,9 +303,9 @@ public class TabCompleteHelper {
|
|||||||
*/
|
*/
|
||||||
public TabCompleteHelper addToggleableSettings() {
|
public TabCompleteHelper addToggleableSettings() {
|
||||||
return append(
|
return append(
|
||||||
BaritoneAPI.getSettings().getAllValuesByType(Boolean.class).stream()
|
BaritoneAPI.getSettings().getAllValuesByType(Boolean.class).stream()
|
||||||
.map(Settings.Setting::getName)
|
.map(Settings.Setting::getName)
|
||||||
.sorted(String.CASE_INSENSITIVE_ORDER)
|
.sorted(String.CASE_INSENSITIVE_ORDER)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,9 +78,9 @@ public class CommandManager {
|
|||||||
|
|
||||||
if (args.isEmpty()) {
|
if (args.isEmpty()) {
|
||||||
return new TabCompleteHelper()
|
return new TabCompleteHelper()
|
||||||
.addCommands()
|
.addCommands()
|
||||||
.filterPrefix(label)
|
.filterPrefix(label)
|
||||||
.stream();
|
.stream();
|
||||||
} else {
|
} else {
|
||||||
return tabComplete(pair);
|
return tabComplete(pair);
|
||||||
}
|
}
|
||||||
|
@ -132,9 +132,9 @@ public class Registry<V> {
|
|||||||
*/
|
*/
|
||||||
public Stream<V> descendingStream() {
|
public Stream<V> descendingStream() {
|
||||||
return StreamSupport.stream(Spliterators.spliterator(
|
return StreamSupport.stream(Spliterators.spliterator(
|
||||||
descendingIterator(),
|
descendingIterator(),
|
||||||
_entries.size(),
|
_entries.size(),
|
||||||
Spliterator.SIZED | Spliterator.SUBSIZED
|
Spliterator.SIZED | Spliterator.SUBSIZED
|
||||||
), false);
|
), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,9 +131,9 @@ public final class PathRenderer implements IRenderer {
|
|||||||
int dirZ = end.z - start.z;
|
int dirZ = end.z - start.z;
|
||||||
|
|
||||||
while (next + 1 < positions.size() && (!fadeOut || next + 1 < fadeStart) &&
|
while (next + 1 < positions.size() && (!fadeOut || next + 1 < fadeStart) &&
|
||||||
(dirX == positions.get(next + 1).x - end.x &&
|
(dirX == positions.get(next + 1).x - end.x &&
|
||||||
dirY == positions.get(next + 1).y - end.y &&
|
dirY == positions.get(next + 1).y - end.y &&
|
||||||
dirZ == positions.get(next + 1).z - end.z)) {
|
dirZ == positions.get(next + 1).z - end.z)) {
|
||||||
end = positions.get(++next);
|
end = positions.get(++next);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,15 +239,15 @@ public final class PathRenderer implements IRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TileEntityBeaconRenderer.renderBeamSegment(
|
TileEntityBeaconRenderer.renderBeamSegment(
|
||||||
goalPos.getX() - renderPosX,
|
goalPos.getX() - renderPosX,
|
||||||
-renderPosY,
|
-renderPosY,
|
||||||
goalPos.getZ() - renderPosZ,
|
goalPos.getZ() - renderPosZ,
|
||||||
partialTicks,
|
partialTicks,
|
||||||
1.0,
|
1.0,
|
||||||
player.world.getTotalWorldTime(),
|
player.world.getTotalWorldTime(),
|
||||||
0,
|
0,
|
||||||
256,
|
256,
|
||||||
color.getColorComponents(null)
|
color.getColorComponents(null)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (settings.renderGoalIgnoreDepth.value) {
|
if (settings.renderGoalIgnoreDepth.value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user