mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 22:16:22 +00:00
haha dependency injection
This commit is contained in:
1 parent
b8f02c3b6f
commit
3eaec44b23
11 files changed
+95
-19
No files matched your search
@@ -111,7 +111,7 @@ public class CarbonChatVelocity implements CarbonChat {
|
||||
ListenerUtils.registerCommonListeners(this.injector);
|
||||
|
||||
// Load channels
|
||||
((CarbonChannelRegistry) this.channelRegistry()).loadConfigChannels();
|
||||
((CarbonChannelRegistry) this.channelRegistry()).loadConfigChannels(this.messageService);
|
||||
|
||||
// Commands
|
||||
CloudUtils.loadCommands(this.injector);
|
||||
|
||||
@@ -24,6 +24,7 @@ import cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator;
|
||||
import cloud.commandframework.velocity.VelocityCommandManager;
|
||||
import cloud.commandframework.velocity.arguments.PlayerArgument;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.Singleton;
|
||||
import com.velocitypowered.api.plugin.PluginContainer;
|
||||
@@ -32,12 +33,17 @@ import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import java.nio.file.Path;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonServer;
|
||||
import net.draycia.carbon.api.util.RenderedMessage;
|
||||
import net.draycia.carbon.api.util.SourcedAudience;
|
||||
import net.draycia.carbon.common.CarbonCommonModule;
|
||||
import net.draycia.carbon.common.ForCarbon;
|
||||
import net.draycia.carbon.common.command.Commander;
|
||||
import net.draycia.carbon.common.command.argument.PlayerSuggestions;
|
||||
import net.draycia.carbon.velocity.command.VelocityCommander;
|
||||
import net.draycia.carbon.velocity.command.VelocityPlayerCommander;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.moonshine.message.IMessageRenderer;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
@@ -88,6 +94,18 @@ public final class CarbonChatVelocityModule extends AbstractModule {
|
||||
return commandManager;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public IMessageRenderer<Audience, String, RenderedMessage, Component> messageRenderer(final Injector injector) {
|
||||
return injector.getInstance(VelocityMessageRenderer.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public IMessageRenderer<SourcedAudience, String, RenderedMessage, Component> sourcedRenderer(final Injector injector) {
|
||||
return injector.getInstance(VelocityMessageRenderer.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() {
|
||||
this.install(new CarbonCommonModule());
|
||||
|
||||
Reference in new issue
Block a user