mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-28 19:39:22 +00:00
Update Paper
This commit is contained in:
@@ -78,7 +78,7 @@ public class ServerBot extends ServerPlayer {
|
||||
public UUID createPlayer;
|
||||
|
||||
private final int tracingRange;
|
||||
private final ServerStatsCounter stats;
|
||||
private final BotStatsCounter stats;
|
||||
private final BotInventoryContainer container;
|
||||
|
||||
public int notSleepTicks;
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
public class TickTypeConfig extends AbstractBotConfig<ServerBot.TickType> {
|
||||
|
||||
private static final String NAME = "tick_type";
|
||||
private static final CommandArgumentType<ServerBot.TickType> TICK_TYPE_ARGUMENT = CommandArgumentType.of(ServerBot.TickType.class, (string -> ServerBot.TickType.valueOf(string.toUpperCase())));
|
||||
private static final CommandArgumentType<ServerBot.TickType> TICK_TYPE_ARGUMENT = CommandArgumentType.ofEnum(ServerBot.TickType.class);
|
||||
|
||||
private ServerBot.TickType value;
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ import java.util.function.Function;
|
||||
|
||||
public abstract class CommandArgumentType<E> {
|
||||
|
||||
public static final CommandArgumentType<String> STRING = CommandArgumentType.string();
|
||||
public static final CommandArgumentType<Integer> INTEGER = CommandArgumentType.of(Integer.class, Integer::parseInt);
|
||||
public static final CommandArgumentType<Double> DOUBLE = CommandArgumentType.of(Double.class, Double::parseDouble);
|
||||
public static final CommandArgumentType<Float> FLOAT = CommandArgumentType.of(Float.class, Float::parseFloat);
|
||||
public static final CommandArgumentType<String> STRING = CommandArgumentType.of(String.class, (arg) -> arg);
|
||||
public static final CommandArgumentType<Boolean> BOOLEAN = CommandArgumentType.of(Boolean.class, Boolean::parseBoolean);
|
||||
|
||||
private final Class<E> type;
|
||||
@@ -34,6 +34,23 @@ public abstract class CommandArgumentType<E> {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(value = "_ -> new", pure = true)
|
||||
public static <E extends Enum<E>> CommandArgumentType<E> ofEnum(Class<E> type) {
|
||||
return of(type, (string -> Enum.valueOf(type, string.toUpperCase())));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(value = " -> new", pure = true)
|
||||
private static CommandArgumentType<String> string() {
|
||||
return new CommandArgumentType<>(String.class) {
|
||||
@Override
|
||||
public String parse(@NotNull String arg) {
|
||||
return arg;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Class<E> getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user