mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 06:28:54 +00:00
Various compilation/merge issues
This commit is contained in:
1 parent
de834ac32b
commit
523d1d6c01
33 files changed
+263
-162
No files matched your search
@@ -30,6 +30,7 @@ import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChannelRegistry;
|
||||
@@ -37,6 +38,7 @@ import net.draycia.carbon.api.events.CarbonEventHandler;
|
||||
import net.draycia.carbon.api.util.RenderedMessage;
|
||||
import net.draycia.carbon.common.channels.CarbonChannelRegistry;
|
||||
import net.draycia.carbon.common.messages.CarbonMessages;
|
||||
import net.draycia.carbon.common.messaging.MessagingManager;
|
||||
import net.draycia.carbon.common.util.CloudUtils;
|
||||
import net.draycia.carbon.common.util.ListenerUtils;
|
||||
import net.draycia.carbon.velocity.listeners.VelocityChatListener;
|
||||
@@ -44,9 +46,12 @@ import net.draycia.carbon.velocity.listeners.VelocityPlayerJoinListener;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.moonshine.message.IMessageRenderer;
|
||||
import ninja.egg82.messenger.services.PacketService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@Plugin(
|
||||
@@ -75,6 +80,9 @@ public class CarbonChatVelocity implements CarbonChat {
|
||||
private final ChannelRegistry channelRegistry;
|
||||
private final CarbonServerVelocity carbonServer;
|
||||
private final CarbonEventHandler eventHandler = new CarbonEventHandler();
|
||||
private final UUID serverId = UUID.randomUUID();
|
||||
|
||||
private @MonotonicNonNull MessagingManager messagingManager = null;
|
||||
|
||||
@Inject
|
||||
public CarbonChatVelocity(
|
||||
@@ -111,7 +119,7 @@ public class CarbonChatVelocity implements CarbonChat {
|
||||
ListenerUtils.registerCommonListeners(this.injector);
|
||||
|
||||
// Load channels
|
||||
((CarbonChannelRegistry) this.channelRegistry()).loadConfigChannels(this.messageService);
|
||||
((CarbonChannelRegistry) this.channelRegistry()).loadConfigChannels(this.carbonMessages);
|
||||
|
||||
// Commands
|
||||
CloudUtils.loadCommands(this.injector);
|
||||
@@ -119,6 +127,20 @@ public class CarbonChatVelocity implements CarbonChat {
|
||||
CloudUtils.registerCommands(commandSettings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID serverId() {
|
||||
return this.serverId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable PacketService packetService() {
|
||||
if (this.messagingManager == null) {
|
||||
this.messagingManager = this.injector.getInstance(MessagingManager.class);
|
||||
}
|
||||
|
||||
return this.messagingManager.packetService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger logger() {
|
||||
return this.logger;
|
||||
|
||||
@@ -22,8 +22,6 @@ package net.draycia.carbon.velocity;
|
||||
import com.google.inject.Inject;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.draycia.carbon.api.util.RenderedMessage;
|
||||
import net.draycia.carbon.common.config.ConfigFactory;
|
||||
@@ -32,7 +30,7 @@ import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.audience.MessageType;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.kyori.moonshine.message.IMessageRenderer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@@ -57,10 +55,10 @@ public class VelocityMessageRenderer<T extends Audience> implements IMessageRend
|
||||
final Method method,
|
||||
final Type owner
|
||||
) {
|
||||
final List<TagResolver> placeholders = new ArrayList<>();
|
||||
final TagResolver.Builder tagResolver = TagResolver.builder();
|
||||
|
||||
for (final var entry : resolvedPlaceholders.entrySet()) {
|
||||
placeholders.add(Placeholder.component(entry.getKey(), entry.getValue()));
|
||||
tagResolver.tag(entry.getKey(), Tag.inserting(entry.getValue()));
|
||||
}
|
||||
|
||||
// https://github.com/KyoriPowered/adventure-text-minimessage/issues/131
|
||||
@@ -72,7 +70,7 @@ public class VelocityMessageRenderer<T extends Audience> implements IMessageRend
|
||||
entry.getValue());
|
||||
}
|
||||
|
||||
final Component message = MiniMessage.miniMessage().deserialize(placeholderResolvedMessage, TagResolver.resolver(placeholders));
|
||||
final Component message = MiniMessage.miniMessage().deserialize(placeholderResolvedMessage, tagResolver.build());
|
||||
final MessageType messageType;
|
||||
final @Nullable ChatType chatType = method.getAnnotation(ChatType.class);
|
||||
|
||||
|
||||
Reference in new issue
Block a user