mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 06:28:54 +00:00
feat: cloud v2 (#424)
* feat: cloud v2 * updates * ArgumentFactory -> ParserFactory * Use parsing context instead of context hack for player parser input * fix: Allow console to clearchat * revert behavior change to player suggestions * Fixup command/argument description issues * remove unused method * paper: remove redundant command manager config * fix cloud relocation * remove redundant method call * Update cloud * thenCompose -> thenApply in CarbonPlayerParser * bump luckperms * adjust exception handling --------- Co-authored-by: Alexander Söderberg <[email protected]>
This commit is contained in:
1 parent
1110b48f90
commit
048321d17c
40 files changed
+518
-592
No files matched your search
@@ -22,9 +22,9 @@ dependencies {
|
||||
exclude("net.kyori", "adventure-api")
|
||||
exclude("net.kyori", "adventure-text-serializer-gson")
|
||||
exclude("net.kyori", "adventure-text-serializer-plain")
|
||||
exclude("cloud.commandframework", "cloud-core")
|
||||
exclude("cloud.commandframework", "cloud-services")
|
||||
exclude("cloud.commandframework", "cloud-brigadier")
|
||||
exclude("org.incendo", "cloud-core")
|
||||
exclude("org.incendo", "cloud-services")
|
||||
exclude("org.incendo", "cloud-brigadier")
|
||||
exclude("io.leangen.geantyref")
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ carbonPlatform {
|
||||
tasks {
|
||||
shadowJar {
|
||||
configurations = listOf(shade)
|
||||
relocateDependency("cloud.commandframework.minecraft.extras")
|
||||
relocateDependency("org.incendo.cloud.minecraft.extras")
|
||||
standardRuntimeRelocations()
|
||||
relocateGuice()
|
||||
relocateDependency("org.checkerframework")
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
*/
|
||||
package net.draycia.carbon.fabric;
|
||||
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.fabric.FabricServerCommandManager;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.Singleton;
|
||||
@@ -58,6 +56,9 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.incendo.cloud.CommandManager;
|
||||
import org.incendo.cloud.SenderMapper;
|
||||
import org.incendo.cloud.fabric.FabricServerCommandManager;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public final class CarbonChatFabricModule extends CarbonPlatformModule {
|
||||
@@ -94,16 +95,18 @@ public final class CarbonChatFabricModule extends CarbonPlatformModule {
|
||||
|
||||
final FabricServerCommandManager<Commander> commandManager = new FabricServerCommandManager<>(
|
||||
executionCoordinatorHolder.executionCoordinator(),
|
||||
commandSourceStack -> {
|
||||
if (commandSourceStack.getEntity() instanceof ServerPlayer) {
|
||||
return new FabricPlayerCommander(carbonChat.get(), commandSourceStack);
|
||||
}
|
||||
return FabricCommander.from(commandSourceStack);
|
||||
},
|
||||
commander -> ((FabricCommander) commander).commandSourceStack()
|
||||
SenderMapper.create(
|
||||
commandSourceStack -> {
|
||||
if (commandSourceStack.getEntity() instanceof ServerPlayer) {
|
||||
return new FabricPlayerCommander(carbonChat.get(), commandSourceStack);
|
||||
}
|
||||
return FabricCommander.from(commandSourceStack);
|
||||
},
|
||||
commander -> ((FabricCommander) commander).commandSourceStack()
|
||||
)
|
||||
);
|
||||
|
||||
CloudUtils.decorateCommandManager(commandManager, carbonMessages);
|
||||
CloudUtils.decorateCommandManager(commandManager, carbonMessages, this.logger);
|
||||
|
||||
commandManager.brigadierManager().setNativeNumberSuggestions(false);
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
package net.draycia.carbon.fabric.mixin;
|
||||
|
||||
import cloud.commandframework.types.tuples.Pair;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import net.draycia.carbon.fabric.callback.PlayerStatusMessageEvents;
|
||||
@@ -31,6 +30,7 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.CommonListenerCookie;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.incendo.cloud.type.tuple.Pair;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@@ -70,12 +70,12 @@ abstract class PlayerListMixin {
|
||||
final @Nullable Pair<Component, Boolean> remove = this.joinMsg.remove(Thread.currentThread());
|
||||
if (remove != null) {
|
||||
final PlayerStatusMessageEvents.MessageEvent event = PlayerStatusMessageEvents.MessageEvent.of(
|
||||
serverPlayer, remove.getFirst().asComponent()
|
||||
serverPlayer, remove.first().asComponent()
|
||||
);
|
||||
PlayerStatusMessageEvents.JOIN_MESSAGE.invoker().onMessage(event);
|
||||
final net.kyori.adventure.text.@Nullable Component message = event.message();
|
||||
if (message != null) {
|
||||
this.broadcastSystemMessage(FabricServerAudiences.of(this.server).toNative(message), remove.getSecond());
|
||||
this.broadcastSystemMessage(FabricServerAudiences.of(this.server).toNative(message), remove.second());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user