mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-04-08 16:10:26 +00:00
new command infrastructure
This commit is contained in:
@@ -15,6 +15,7 @@ dependencies {
|
||||
implementation(libs.adventure.platforms.bungeecord)
|
||||
implementation(libs.adventure.gson)
|
||||
implementation(libs.acf.bungeecord)
|
||||
implementation(project(":RedisBungee-Commands"))
|
||||
}
|
||||
|
||||
description = "RedisBungee Bungeecord implementation"
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.imaginarycode.minecraft.redisbungee;
|
||||
|
||||
import co.aikar.commands.BungeeCommandIssuer;
|
||||
import co.aikar.commands.CommandIssuer;
|
||||
import com.imaginarycode.minecraft.redisbungee.commands.utils.CommandPlatformHelper;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
|
||||
|
||||
public class BungeeCommandPlatformHelper extends CommandPlatformHelper {
|
||||
|
||||
@Override
|
||||
public void sendMessage(CommandIssuer issuer, Component component) {
|
||||
BungeeCommandIssuer bIssuer = (BungeeCommandIssuer) issuer;
|
||||
bIssuer.getIssuer().sendMessage(BungeeComponentSerializer.get().serialize(component));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
package com.imaginarycode.minecraft.redisbungee;
|
||||
|
||||
import co.aikar.commands.BungeeCommandManager;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.PlayerDataManager;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.ProxyDataManager;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeeMode;
|
||||
@@ -27,6 +28,8 @@ import com.imaginarycode.minecraft.redisbungee.api.util.InitialUtils;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.util.uuid.NameFetcher;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDFetcher;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDTranslator;
|
||||
import com.imaginarycode.minecraft.redisbungee.commands.CommandLoader;
|
||||
import com.imaginarycode.minecraft.redisbungee.commands.utils.CommandPlatformHelper;
|
||||
import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetworkEvent;
|
||||
import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent;
|
||||
import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent;
|
||||
@@ -70,6 +73,7 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
|
||||
private RedisBungeeConfiguration configuration;
|
||||
private LangConfiguration langConfiguration;
|
||||
private OkHttpClient httpClient;
|
||||
private BungeeCommandManager commandManager;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger("RedisBungee");
|
||||
|
||||
@@ -254,6 +258,11 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
|
||||
this.api = new RedisBungeeAPI(this);
|
||||
apiStatic = (RedisBungeeAPI) this.api;
|
||||
|
||||
// commands
|
||||
CommandPlatformHelper.init(new BungeeCommandPlatformHelper());
|
||||
this.commandManager = new BungeeCommandManager(this);
|
||||
CommandLoader.initCommands(this.commandManager, configuration());
|
||||
|
||||
logInfo("RedisBungee initialized successfully ");
|
||||
}
|
||||
|
||||
@@ -278,6 +287,9 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (this.commandManager != null) {
|
||||
this.commandManager.unregisterCommands();
|
||||
}
|
||||
logInfo("RedisBungee shutdown successfully");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user