mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Support signing messages from command arguments (#434)
* Initial signed command argument impl * Implement on Paper and map to greedy string (unsigned) on velocity * Use cloud signed arguments * add relocations * fabric: include instead of shade cloud-signed-arguments * Make whispers between players on the same server signed * Update cloud & loom --------- Co-authored-by: Draycia <[email protected]>
This commit is contained in:
1 parent
a53d2e3d84
commit
a816dcd738
17 files changed
+147
-36
No files matched your search
@@ -21,6 +21,7 @@ dependencies {
|
||||
api(libs.cloudMinecraftExtras) {
|
||||
isTransitive = false
|
||||
}
|
||||
api(libs.cloudSigned)
|
||||
|
||||
// Other
|
||||
compileOnlyApi(libs.guice) {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* CarbonChat
|
||||
*
|
||||
* Copyright (c) 2024 Josua Parks (Vicarious)
|
||||
* Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.draycia.carbon.common;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Injection binding annotation for the raw chat type key.
|
||||
*/
|
||||
@BindingAnnotation
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD})
|
||||
public @interface RawChat {
|
||||
}
|
||||
+16
-10
@@ -48,6 +48,7 @@ import net.draycia.carbon.api.event.events.CarbonChannelRegisterEvent;
|
||||
import net.draycia.carbon.api.event.events.ChannelSwitchEvent;
|
||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
import net.draycia.carbon.common.DataDirectory;
|
||||
import net.draycia.carbon.common.RawChat;
|
||||
import net.draycia.carbon.common.command.Commander;
|
||||
import net.draycia.carbon.common.command.PlayerCommander;
|
||||
import net.draycia.carbon.common.config.ConfigManager;
|
||||
@@ -61,6 +62,7 @@ import net.draycia.carbon.common.users.ConsoleCarbonPlayer;
|
||||
import net.draycia.carbon.common.util.Exceptions;
|
||||
import net.draycia.carbon.common.util.FileUtil;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.chat.ChatType;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
@@ -69,12 +71,13 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.incendo.cloud.Command;
|
||||
import org.incendo.cloud.CommandManager;
|
||||
import org.incendo.cloud.minecraft.signed.SignedString;
|
||||
import org.spongepowered.configurate.ConfigurateException;
|
||||
import org.spongepowered.configurate.ConfigurationNode;
|
||||
import org.spongepowered.configurate.loader.ConfigurationLoader;
|
||||
import org.spongepowered.configurate.transformation.ConfigurationTransformation;
|
||||
|
||||
import static org.incendo.cloud.parser.standard.StringParser.greedyStringParser;
|
||||
import static org.incendo.cloud.minecraft.signed.SignedGreedyStringParser.signedGreedyStringParser;
|
||||
|
||||
@Singleton
|
||||
@DefaultQualifier(NonNull.class)
|
||||
@@ -87,6 +90,7 @@ public class CarbonChannelRegistry extends ChatListenerInternal implements Chann
|
||||
private @MonotonicNonNull Key defaultKey;
|
||||
private final CarbonMessages carbonMessages;
|
||||
private final CarbonEventHandler eventHandler;
|
||||
private final Key rawChatKey;
|
||||
private final Map<String, SpecialHandler<?>> handlers = new HashMap<>();
|
||||
|
||||
private record SpecialHandler<T extends ConfigChatChannel>(Class<T> cls, Supplier<T> defaultSupplier) {}
|
||||
@@ -111,7 +115,8 @@ public class CarbonChannelRegistry extends ChatListenerInternal implements Chann
|
||||
final Logger logger,
|
||||
final ConfigManager config,
|
||||
final CarbonMessages carbonMessages,
|
||||
final CarbonEventHandler events
|
||||
final CarbonEventHandler events,
|
||||
@RawChat final Key rawChatKey
|
||||
) {
|
||||
super(events, carbonMessages, config);
|
||||
this.configChannelDir = dataDirectory.resolve("channels");
|
||||
@@ -120,6 +125,7 @@ public class CarbonChannelRegistry extends ChatListenerInternal implements Chann
|
||||
this.config = config;
|
||||
this.carbonMessages = carbonMessages;
|
||||
this.eventHandler = events;
|
||||
this.rawChatKey = rawChatKey;
|
||||
|
||||
if (config.primaryConfig().partyChat().enabled) {
|
||||
this.registerSpecialConfigChannel(PartyChatChannel.FILE_NAME, PartyChatChannel.class);
|
||||
@@ -327,22 +333,22 @@ public class CarbonChannelRegistry extends ChatListenerInternal implements Chann
|
||||
final ChatChannel channel,
|
||||
final String plainMessage
|
||||
) {
|
||||
this.sendMessageInChannel(new ConsoleCarbonPlayer(sender), channel, plainMessage);
|
||||
this.sendMessageInChannel(new ConsoleCarbonPlayer(sender), channel, SignedString.unsigned(plainMessage));
|
||||
}
|
||||
|
||||
private void sendMessageInChannel(
|
||||
final CarbonPlayer sender,
|
||||
final ChatChannel channel,
|
||||
final String plainMessage
|
||||
final SignedString message
|
||||
) {
|
||||
final @Nullable CarbonChatEventImpl chatEvent = this.prepareAndEmitChatEvent(sender, plainMessage, null, channel);
|
||||
final @Nullable CarbonChatEventImpl chatEvent = this.prepareAndEmitChatEvent(sender, message.string(), message.signedMessage(), channel);
|
||||
|
||||
if (chatEvent == null || chatEvent.cancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (final Audience recipient : chatEvent.recipients()) {
|
||||
recipient.sendMessage(chatEvent.renderFor(recipient));
|
||||
message.sendMessage(recipient, ChatType.chatType(this.rawChatKey), chatEvent.renderFor(recipient));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +361,7 @@ public class CarbonChannelRegistry extends ChatListenerInternal implements Chann
|
||||
|
||||
Command.Builder<Commander> builder = commandManager.commandBuilder(channel.commandName(),
|
||||
channel.commandAliases(), commandManager.createDefaultCommandMeta())
|
||||
.optional("message", greedyStringParser());
|
||||
.optional("message", signedGreedyStringParser());
|
||||
|
||||
if (channel.permission() != null) {
|
||||
builder = builder.permission(channel.permission());
|
||||
@@ -377,10 +383,10 @@ public class CarbonChannelRegistry extends ChatListenerInternal implements Chann
|
||||
|
||||
if (!(commander instanceof PlayerCommander playerCommander)) {
|
||||
if (chatChannel != null && handler.contains("message")) {
|
||||
final String message = handler.get("message");
|
||||
final SignedString message = handler.get("message");
|
||||
|
||||
// TODO: trigger platform events related to chat
|
||||
this.sendMessageInChannelAsConsole(commander, chatChannel, message);
|
||||
this.sendMessageInChannelAsConsole(commander, chatChannel, message.string());
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -397,7 +403,7 @@ public class CarbonChannelRegistry extends ChatListenerInternal implements Chann
|
||||
this.carbonMessages.channelJoined(player);
|
||||
}
|
||||
if (handler.contains("message")) {
|
||||
final String message = handler.get("message");
|
||||
final SignedString message = handler.get("message");
|
||||
|
||||
// TODO: trigger platform events related to chat
|
||||
this.sendMessageInChannel(player, chatChannel, message);
|
||||
|
||||
+1
@@ -102,4 +102,5 @@ public final class CarbonPlayerParser implements ArgumentParser.FutureArgumentPa
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+4
-3
@@ -34,9 +34,10 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.incendo.cloud.CommandManager;
|
||||
import org.incendo.cloud.minecraft.signed.SignedString;
|
||||
|
||||
import static org.incendo.cloud.minecraft.extras.RichDescription.richDescription;
|
||||
import static org.incendo.cloud.parser.standard.StringParser.greedyStringParser;
|
||||
import static org.incendo.cloud.minecraft.signed.SignedGreedyStringParser.signedGreedyStringParser;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public final class ContinueCommand extends CarbonCommand {
|
||||
@@ -72,7 +73,7 @@ public final class ContinueCommand extends CarbonCommand {
|
||||
@Override
|
||||
public void init() {
|
||||
final var command = this.commandManager.commandBuilder(this.commandSettings().name(), this.commandSettings().aliases())
|
||||
.required("message", greedyStringParser(), richDescription(this.messages.commandContinueArgumentMessage()))
|
||||
.required("message", signedGreedyStringParser(), richDescription(this.messages.commandContinueArgumentMessage()))
|
||||
.permission("carbon.whisper.continue")
|
||||
.senderType(PlayerCommander.class)
|
||||
.commandDescription(richDescription(this.messages.commandContinueDescription()))
|
||||
@@ -84,7 +85,7 @@ public final class ContinueCommand extends CarbonCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
final String message = ctx.get("message");
|
||||
final SignedString message = ctx.get("message");
|
||||
final @Nullable UUID whisperTarget = sender.lastWhisperTarget();
|
||||
|
||||
if (whisperTarget == null) {
|
||||
|
||||
@@ -34,9 +34,10 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.incendo.cloud.CommandManager;
|
||||
import org.incendo.cloud.minecraft.signed.SignedString;
|
||||
|
||||
import static org.incendo.cloud.minecraft.extras.RichDescription.richDescription;
|
||||
import static org.incendo.cloud.parser.standard.StringParser.greedyStringParser;
|
||||
import static org.incendo.cloud.minecraft.signed.SignedGreedyStringParser.signedGreedyStringParser;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public final class ReplyCommand extends CarbonCommand {
|
||||
@@ -72,7 +73,7 @@ public final class ReplyCommand extends CarbonCommand {
|
||||
@Override
|
||||
public void init() {
|
||||
final var command = this.commandManager.commandBuilder(this.commandSettings().name(), this.commandSettings().aliases())
|
||||
.required("message", greedyStringParser(), richDescription(this.messages.commandReplyArgumentMessage()))
|
||||
.required("message", signedGreedyStringParser(), richDescription(this.messages.commandReplyArgumentMessage()))
|
||||
.permission("carbon.whisper.reply")
|
||||
.senderType(PlayerCommander.class)
|
||||
.commandDescription(richDescription(this.messages.commandReplyDescription()))
|
||||
@@ -84,7 +85,7 @@ public final class ReplyCommand extends CarbonCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
final String message = ctx.get("message");
|
||||
final SignedString message = ctx.get("message");
|
||||
final @Nullable UUID replyTarget = sender.whisperReplyTarget();
|
||||
|
||||
if (replyTarget == null) {
|
||||
|
||||
+26
-10
@@ -26,6 +26,7 @@ import net.draycia.carbon.api.event.CarbonEventHandler;
|
||||
import net.draycia.carbon.api.event.events.CarbonPrivateChatEvent;
|
||||
import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
import net.draycia.carbon.api.users.UserManager;
|
||||
import net.draycia.carbon.common.RawChat;
|
||||
import net.draycia.carbon.common.command.CarbonCommand;
|
||||
import net.draycia.carbon.common.command.CommandSettings;
|
||||
import net.draycia.carbon.common.command.Commander;
|
||||
@@ -41,6 +42,7 @@ import net.draycia.carbon.common.messaging.packets.PacketFactory;
|
||||
import net.draycia.carbon.common.messaging.packets.WhisperPacket;
|
||||
import net.draycia.carbon.common.users.NetworkUsers;
|
||||
import net.draycia.carbon.common.util.CloudUtils;
|
||||
import net.kyori.adventure.chat.ChatType;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -49,9 +51,10 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.incendo.cloud.CommandManager;
|
||||
import org.incendo.cloud.minecraft.signed.SignedString;
|
||||
|
||||
import static org.incendo.cloud.minecraft.extras.RichDescription.richDescription;
|
||||
import static org.incendo.cloud.parser.standard.StringParser.greedyStringParser;
|
||||
import static org.incendo.cloud.minecraft.signed.SignedGreedyStringParser.signedGreedyStringParser;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public final class WhisperCommand extends CarbonCommand {
|
||||
@@ -88,7 +91,7 @@ public final class WhisperCommand extends CarbonCommand {
|
||||
public void init() {
|
||||
final var command = this.commandManager.commandBuilder(this.commandSettings().name(), this.commandSettings().aliases())
|
||||
.required("player", this.parserFactory.carbonPlayer(), richDescription(this.carbonMessages.commandWhisperArgumentPlayer()))
|
||||
.required("message", greedyStringParser(), richDescription(this.carbonMessages.commandWhisperArgumentMessage()))
|
||||
.required("message", signedGreedyStringParser(), richDescription(this.carbonMessages.commandWhisperArgumentMessage()))
|
||||
.permission("carbon.whisper.message")
|
||||
.senderType(PlayerCommander.class)
|
||||
.commandDescription(richDescription(this.carbonMessages.commandWhisperDescription()))
|
||||
@@ -100,7 +103,7 @@ public final class WhisperCommand extends CarbonCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
final String message = ctx.get("message");
|
||||
final SignedString message = ctx.get("message");
|
||||
final CarbonPlayer recipient = ctx.get("player");
|
||||
|
||||
this.whisper.whisper(sender, recipient, message, ctx.parsingContext("player").consumedInput());
|
||||
@@ -121,6 +124,7 @@ public final class WhisperCommand extends CarbonCommand {
|
||||
private final CarbonServer server;
|
||||
private final CarbonEventHandler events;
|
||||
private final NetworkUsers network;
|
||||
private final Key rawChatKey;
|
||||
|
||||
@Inject
|
||||
private WhisperHandler(
|
||||
@@ -132,7 +136,8 @@ public final class WhisperCommand extends CarbonCommand {
|
||||
final UserManager<?> userManager,
|
||||
final CarbonServer server,
|
||||
final CarbonEventHandler events,
|
||||
final NetworkUsers network
|
||||
final NetworkUsers network,
|
||||
@RawChat final Key rawChatKey
|
||||
) {
|
||||
this.logger = logger;
|
||||
this.messages = messages;
|
||||
@@ -143,12 +148,13 @@ public final class WhisperCommand extends CarbonCommand {
|
||||
this.server = server;
|
||||
this.events = events;
|
||||
this.network = network;
|
||||
this.rawChatKey = rawChatKey;
|
||||
}
|
||||
|
||||
public void whisper(
|
||||
final CarbonPlayer sender,
|
||||
final CarbonPlayer recipient,
|
||||
final String message
|
||||
final SignedString message
|
||||
) {
|
||||
this.whisper(sender, recipient, message, null);
|
||||
}
|
||||
@@ -156,7 +162,7 @@ public final class WhisperCommand extends CarbonCommand {
|
||||
public void whisper(
|
||||
final CarbonPlayer sender,
|
||||
final CarbonPlayer recipient,
|
||||
final String message,
|
||||
final SignedString message,
|
||||
final @Nullable String recipientInputString
|
||||
) {
|
||||
if (sender.equals(recipient)) {
|
||||
@@ -199,7 +205,7 @@ public final class WhisperCommand extends CarbonCommand {
|
||||
final Component senderDisplayName = sender.displayName();
|
||||
final Component recipientDisplayName = recipient.displayName();
|
||||
|
||||
final CarbonPrivateChatEvent privateChatEvent = new CarbonPrivateChatEventImpl(sender, recipient, Component.text(message));
|
||||
final CarbonPrivateChatEvent privateChatEvent = new CarbonPrivateChatEventImpl(sender, recipient, Component.text(message.string()));
|
||||
this.events.emit(privateChatEvent);
|
||||
|
||||
if (privateChatEvent.cancelled()) {
|
||||
@@ -208,9 +214,17 @@ public final class WhisperCommand extends CarbonCommand {
|
||||
}
|
||||
|
||||
final String senderUsername = sender.username();
|
||||
this.messages.whisperSender(SourcedAudience.of(sender, sender), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, privateChatEvent.message());
|
||||
message.sendMessage(
|
||||
sender,
|
||||
ChatType.chatType(this.rawChatKey),
|
||||
this.messages.whisperSender(SourcedAudience.of(sender, sender), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, privateChatEvent.message())
|
||||
);
|
||||
if (localRecipient) {
|
||||
this.messages.whisperRecipient(SourcedAudience.of(sender, recipient), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, privateChatEvent.message());
|
||||
message.sendMessage(
|
||||
recipient,
|
||||
ChatType.chatType(this.rawChatKey),
|
||||
this.messages.whisperRecipient(SourcedAudience.of(sender, recipient), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, privateChatEvent.message())
|
||||
);
|
||||
}
|
||||
this.messages.whisperConsoleLog(this.server.console(), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, privateChatEvent.message());
|
||||
|
||||
@@ -243,7 +257,9 @@ public final class WhisperCommand extends CarbonCommand {
|
||||
final Component recipientDisplayName = recipient.displayName();
|
||||
|
||||
recipient.whisperReplyTarget(sender.uuid());
|
||||
this.messages.whisperRecipient(SourcedAudience.of(sender, recipient), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, packet.message());
|
||||
SourcedAudience.of(sender, recipient).sendMessage(
|
||||
this.messages.whisperRecipient(SourcedAudience.of(sender, recipient), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, packet.message())
|
||||
);
|
||||
this.messages.whisperConsoleLog(this.server.console(), senderUsername, senderDisplayName, recipientUsername, recipientDisplayName, packet.message());
|
||||
final @Nullable Sound messageSound = this.configManager.primaryConfig().messageSound();
|
||||
if (messageSound != null) {
|
||||
|
||||
@@ -108,8 +108,8 @@ public interface CarbonMessages {
|
||||
*/
|
||||
|
||||
@Message("whisper.to")
|
||||
void whisperSender(
|
||||
SourcedAudience audience,
|
||||
Component whisperSender(
|
||||
@NotPlaceholder SourcedAudience audience,
|
||||
String senderUsername,
|
||||
Component senderDisplayName,
|
||||
String recipientUsername,
|
||||
@@ -118,8 +118,8 @@ public interface CarbonMessages {
|
||||
);
|
||||
|
||||
@Message("whisper.from")
|
||||
void whisperRecipient(
|
||||
SourcedAudience audience,
|
||||
Component whisperRecipient(
|
||||
@NotPlaceholder SourcedAudience audience,
|
||||
String senderUsername,
|
||||
Component senderDisplayName,
|
||||
String recipientUsername,
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* CarbonChat
|
||||
*
|
||||
* Copyright (c) 2024 Josua Parks (Vicarious)
|
||||
* Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.draycia.carbon.common.messages;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Documented
|
||||
@Target({ElementType.PARAMETER, ElementType.TYPE_USE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface NotPlaceholder {
|
||||
}
|
||||
+1
-1
@@ -81,7 +81,7 @@ public final class StandardPlaceholderResolverStrategyButDifferent<R, I, F> impl
|
||||
final Parameter parameter = methodParameters[idx];
|
||||
final @Nullable Object value = parameters[idx];
|
||||
// Don't resolve Audiences for now
|
||||
if (value == null || parameter.getType() == Audience.class) {
|
||||
if (value == null || parameter.getType() == Audience.class || parameter.getAnnotation(NotPlaceholder.class) != null) {
|
||||
// Nothing to resolve with.
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -25,11 +25,14 @@ dependencies {
|
||||
exclude("org.incendo", "cloud-core")
|
||||
exclude("org.incendo", "cloud-services")
|
||||
exclude("org.incendo", "cloud-brigadier")
|
||||
exclude("org.incendo", "cloud-minecraft-signed-arguments")
|
||||
exclude("io.leangen.geantyref")
|
||||
}
|
||||
|
||||
modImplementation(libs.cloudFabric)
|
||||
include(libs.cloudFabric)
|
||||
implementation(libs.cloudSigned)
|
||||
include(libs.cloudSigned)
|
||||
modImplementation(libs.fabricPermissionsApi)
|
||||
|
||||
modImplementation(libs.adventurePlatformFabric)
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.draycia.carbon.common.CarbonCommonModule;
|
||||
import net.draycia.carbon.common.CarbonPlatformModule;
|
||||
import net.draycia.carbon.common.DataDirectory;
|
||||
import net.draycia.carbon.common.PlatformScheduler;
|
||||
import net.draycia.carbon.common.RawChat;
|
||||
import net.draycia.carbon.common.command.CommandSettings;
|
||||
import net.draycia.carbon.common.command.Commander;
|
||||
import net.draycia.carbon.common.command.ExecutionCoordinatorHolder;
|
||||
@@ -44,6 +45,7 @@ import net.draycia.carbon.common.users.ProfileResolver;
|
||||
import net.draycia.carbon.common.util.CloudUtils;
|
||||
import net.draycia.carbon.fabric.command.FabricCommander;
|
||||
import net.draycia.carbon.fabric.command.FabricPlayerCommander;
|
||||
import net.draycia.carbon.fabric.listeners.FabricChatHandler;
|
||||
import net.draycia.carbon.fabric.users.CarbonPlayerFabric;
|
||||
import net.draycia.carbon.fabric.users.FabricProfileResolver;
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
@@ -124,6 +126,7 @@ public final class CarbonChatFabricModule extends CarbonPlatformModule {
|
||||
this.bind(PlatformScheduler.class).to(FabricScheduler.class);
|
||||
this.install(PlatformUserManager.PlayerFactory.moduleFor(CarbonPlayerFabric.class));
|
||||
this.bind(CarbonMessageRenderer.class).to(FabricMessageRenderer.class);
|
||||
this.bind(Key.class).annotatedWith(RawChat.class).toProvider(() -> FabricChatHandler.CHAT_TYPE_KEY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,7 +47,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class FabricChatHandler extends ChatListenerInternal implements ServerMessageEvents.AllowChatMessage {
|
||||
|
||||
private static final ResourceLocation CHAT_TYPE_KEY = new ResourceLocation("carbonchat", "chat");
|
||||
public static final ResourceLocation CHAT_TYPE_KEY = new ResourceLocation("carbonchat", "chat");
|
||||
|
||||
private final CarbonChatFabric carbonChat;
|
||||
private @MonotonicNonNull ResourceKey<ChatType> chatTypeResourceKey;
|
||||
|
||||
@@ -13,10 +13,10 @@ gremlin = "0.0.6"
|
||||
runTask = "2.3.0"
|
||||
|
||||
adventure = "4.16.0"
|
||||
cloud = "2.0.0-beta.4"
|
||||
cloudMinecraft = "2.0.0-beta.5"
|
||||
cloudModded = "2.0.0-beta.4"
|
||||
cloudSponge = "2.0.0-SNAPSHOT"
|
||||
cloud = "2.0.0-beta.5"
|
||||
cloudMinecraft = "2.0.0-beta.6"
|
||||
cloudModded = "2.0.0-beta.5"
|
||||
cloudSponge = "2.0.0-beta.6"
|
||||
configurate = "4.2.0-SNAPSHOT"
|
||||
checkerQual = "3.43.0"
|
||||
stylecheck = "0.2.1"
|
||||
@@ -88,9 +88,12 @@ kyoriMoonshineStandard = { group = "net.kyori.moonshine", name = "moonshine-stan
|
||||
|
||||
cloudBom = { module = "org.incendo:cloud-bom", version.ref = "cloud" }
|
||||
cloudCore = { group = "org.incendo", name = "cloud-core", version.ref = "cloud" }
|
||||
brigadier = "com.mojang:brigadier:1.0.18"
|
||||
cloudMinecraftBom = { module = "org.incendo:cloud-minecraft-bom", version.ref = "cloudMinecraft" }
|
||||
cloudMinecraftExtras = { group = "org.incendo", name = "cloud-minecraft-extras", version.ref = "cloudMinecraft" }
|
||||
cloudPaper = { group = "org.incendo", name = "cloud-paper", version.ref = "cloudMinecraft" }
|
||||
cloudSigned = { group = "org.incendo", name = "cloud-minecraft-signed-arguments", version.ref = "cloudMinecraft" }
|
||||
cloudPaperSigned = { group = "org.incendo", name = "cloud-paper-signed-arguments", version.ref = "cloudMinecraft" }
|
||||
cloudSponge = { group = "org.incendo", name = "cloud-sponge", version.ref = "cloudSponge" }
|
||||
cloudVelocity = { group = "org.incendo", name = "cloud-velocity", version.ref = "cloudMinecraft" }
|
||||
cloudFabric = { group = "org.incendo", name = "cloud-fabric", version.ref = "cloudModded"}
|
||||
|
||||
@@ -20,6 +20,7 @@ dependencies {
|
||||
|
||||
// Commands
|
||||
implementation(libs.cloudPaper)
|
||||
implementation(libs.cloudPaperSigned)
|
||||
|
||||
// Misc
|
||||
implementation(libs.bstatsBukkit)
|
||||
@@ -54,6 +55,8 @@ tasks {
|
||||
shadowJar {
|
||||
relocateDependency("io.papermc.papertrail")
|
||||
relocateDependency("io.leangen.geantyref")
|
||||
relocateDependency("xyz.jpenilla.reflectionremapper")
|
||||
relocateDependency("net.fabricmc.mappingio")
|
||||
relocateCloud()
|
||||
}
|
||||
withType(RunServer::class).configureEach {
|
||||
|
||||
@@ -30,6 +30,7 @@ import net.draycia.carbon.common.CarbonCommonModule;
|
||||
import net.draycia.carbon.common.CarbonPlatformModule;
|
||||
import net.draycia.carbon.common.DataDirectory;
|
||||
import net.draycia.carbon.common.PlatformScheduler;
|
||||
import net.draycia.carbon.common.RawChat;
|
||||
import net.draycia.carbon.common.command.Commander;
|
||||
import net.draycia.carbon.common.command.ExecutionCoordinatorHolder;
|
||||
import net.draycia.carbon.common.integration.Integration;
|
||||
@@ -48,6 +49,7 @@ import net.draycia.carbon.paper.listeners.PaperPlayerJoinListener;
|
||||
import net.draycia.carbon.paper.messages.PaperMessageRenderer;
|
||||
import net.draycia.carbon.paper.users.CarbonPlayerPaper;
|
||||
import net.draycia.carbon.paper.users.PaperProfileResolver;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.bukkit.Server;
|
||||
@@ -109,6 +111,7 @@ public final class CarbonChatPaperModule extends CarbonPlatformModule {
|
||||
this.bind(PlatformScheduler.class).to(PaperScheduler.class);
|
||||
this.install(PlatformUserManager.PlayerFactory.moduleFor(CarbonPlayerPaper.class));
|
||||
this.bind(CarbonMessageRenderer.class).to(PaperMessageRenderer.class);
|
||||
this.bind(Key.class).annotatedWith(RawChat.class).toInstance(Key.key("paper:raw"));
|
||||
|
||||
this.configureListeners();
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.draycia.carbon.common.CarbonCommonModule;
|
||||
import net.draycia.carbon.common.CarbonPlatformModule;
|
||||
import net.draycia.carbon.common.DataDirectory;
|
||||
import net.draycia.carbon.common.PlatformScheduler;
|
||||
import net.draycia.carbon.common.RawChat;
|
||||
import net.draycia.carbon.common.command.Commander;
|
||||
import net.draycia.carbon.common.command.ExecutionCoordinatorHolder;
|
||||
import net.draycia.carbon.common.messages.CarbonMessageRenderer;
|
||||
@@ -49,6 +50,7 @@ import net.draycia.carbon.velocity.listeners.VelocityPlayerJoinListener;
|
||||
import net.draycia.carbon.velocity.listeners.VelocityPlayerLeaveListener;
|
||||
import net.draycia.carbon.velocity.users.CarbonPlayerVelocity;
|
||||
import net.draycia.carbon.velocity.users.VelocityProfileResolver;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@@ -115,6 +117,7 @@ public final class CarbonChatVelocityModule extends CarbonPlatformModule {
|
||||
this.bind(PlatformScheduler.class).to(PlatformScheduler.RunImmediately.class);
|
||||
this.install(PlatformUserManager.PlayerFactory.moduleFor(CarbonPlayerVelocity.class));
|
||||
this.bind(CarbonMessageRenderer.class).to(VelocityMessageRenderer.class);
|
||||
this.bind(Key.class).annotatedWith(RawChat.class).toInstance(Key.key("unused:unused"));
|
||||
|
||||
this.configureListeners();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user