Merge remote-tracking branch 'origin/ver/6.5.0' into dev/7.0-2

This commit is contained in:
Zoe Gidiere
2024-09-20 16:42:39 -06:00
41 changed files with 133 additions and 184 deletions

View File

@@ -2,6 +2,15 @@ package com.dfsek.terra.api.command.arguments;
import io.leangen.geantyref.TypeToken;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.component.CommandComponent;
import org.incendo.cloud.component.DefaultValue;
import org.incendo.cloud.context.CommandContext;
import org.incendo.cloud.context.CommandInput;
import org.incendo.cloud.parser.ArgumentParseResult;
import org.incendo.cloud.parser.ArgumentParser;
import org.incendo.cloud.parser.ParserDescriptor;
import org.incendo.cloud.suggestion.Suggestion;
import org.incendo.cloud.suggestion.SuggestionProvider;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@@ -13,16 +22,6 @@ import com.dfsek.terra.api.registry.exception.NoSuchEntryException;
import com.dfsek.terra.api.registry.key.RegistryKey;
import com.dfsek.terra.api.util.reflection.TypeKey;
import org.incendo.cloud.component.CommandComponent;
import org.incendo.cloud.component.DefaultValue;
import org.incendo.cloud.context.CommandContext;
import org.incendo.cloud.context.CommandInput;
import org.incendo.cloud.parser.ArgumentParseResult;
import org.incendo.cloud.parser.ArgumentParser;
import org.incendo.cloud.parser.ParserDescriptor;
import org.incendo.cloud.suggestion.Suggestion;
import org.incendo.cloud.suggestion.SuggestionProvider;
public class RegistryArgument {
@@ -49,17 +48,17 @@ public class RegistryArgument {
}
public static <T, R> CommandComponent<T> of(String name, Function<CommandContext<T>, Registry<R>> registryFunction,
TypeKey<R> registryType) {
TypeKey<R> registryType) {
return RegistryArgument.<T, R>builder(name, registryFunction, registryType).build();
}
public static <T, R> CommandComponent<T> optional(String name, Function<CommandContext<T>, Registry<R>> registryFunction,
TypeKey<R> registryType) {
TypeKey<R> registryType) {
return RegistryArgument.builder(name, registryFunction, registryType).optional().build();
}
public static <T, R> CommandComponent<T> optional(String name, Function<CommandContext<T>, Registry<R>> registryFunction,
TypeKey<R> registryType, DefaultValue<T, R> defaultKey) {
TypeKey<R> registryType, DefaultValue<T, R> defaultKey) {
return RegistryArgument.builder(name, registryFunction, registryType).optional(defaultKey).build();
}

View File

@@ -1,10 +1,10 @@
package com.dfsek.terra.api.event.events.platform;
import org.incendo.cloud.CommandManager;
import com.dfsek.terra.api.command.CommandSender;
import com.dfsek.terra.api.event.events.Event;
import org.incendo.cloud.CommandManager;
public class CommandRegistrationEvent implements Event {
private final CommandManager<CommandSender> commandManager;

View File

@@ -30,11 +30,11 @@ public final class ReflectionUtil {
private static final Unsafe UNSAFE;
static {
try{
try {
final Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
unsafeField.setAccessible(true);
UNSAFE = (Unsafe) unsafeField.get(null);
} catch(NoSuchFieldException | IllegalAccessException e){
} catch(NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}