Reenabled CommandAPI

This commit is contained in:
xSquishyLiam
2025-12-16 22:36:33 +00:00
parent 9cd1db1351
commit b023751c61
6 changed files with 28 additions and 21 deletions

View File

@@ -4,7 +4,7 @@ plugins {
}
group = "re.imc"
version = "1.0.1"
version = "1.0.2"
repositories {
mavenCentral()
@@ -21,7 +21,7 @@ repositories {
dependencies {
compileOnly("io.papermc.paper:paper-api:1.21.10-R0.1-SNAPSHOT")
// implementation("dev.jorel:commandapi-paper-shade:11.0.0")
implementation("dev.jorel:commandapi-paper-shade:11.1.0")
compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.9")
compileOnly("io.github.toxicity188:bettermodel:1.14.0")

View File

@@ -2,6 +2,8 @@ package re.imc.geysermodelengine;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.event.PacketListenerPriority;
import dev.jorel.commandapi.CommandAPI;
import dev.jorel.commandapi.CommandAPIPaperConfig;
import io.github.retrooper.packetevents.factory.spigot.SpigotPacketEventsBuilder;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
@@ -34,7 +36,7 @@ public class GeyserModelEngine extends JavaPlugin {
PacketEvents.setAPI(SpigotPacketEventsBuilder.build(this));
PacketEvents.getAPI().load();
// CommandAPI.onLoad(new CommandAPIPaperConfig(this));
CommandAPI.onLoad(new CommandAPIPaperConfig(this));
preLoadManagers();
}
@@ -56,13 +58,13 @@ public class GeyserModelEngine extends JavaPlugin {
this.modelManager.removeEntities();
PacketEvents.getAPI().terminate();
// CommandAPI.onDisable();
CommandAPI.onDisable();
}
private void loadHooks() {
PacketEvents.getAPI().init();
FloodgateAPIHook.loadHook(this);
// CommandAPI.onEnable();
CommandAPI.onEnable();
}
private void loadBStats() {

View File

@@ -1,5 +1,7 @@
package re.imc.geysermodelengine.commands.geysermodelenginecommands;
import dev.jorel.commandapi.CommandAPICommand;
import org.bukkit.Bukkit;
import re.imc.geysermodelengine.GeyserModelEngine;
import re.imc.geysermodelengine.managers.commands.subcommands.SubCommands;
import re.imc.geysermodelengine.util.ColourUtils;
@@ -14,13 +16,13 @@ public class GeyserModelEngineReloadCommand implements SubCommands {
this.plugin = plugin;
}
// @Override
// public CommandAPICommand onCommand() {
// return new CommandAPICommand("reload")
// .withPermission("geysermodelengine.commands.reload")
// .executes((sender, args) -> {
// Bukkit.getAsyncScheduler().runNow(plugin, scheduledTask -> plugin.getConfigManager().load());
// sender.sendMessage(colourUtils.miniFormat(plugin.getConfigManager().getLang().getString("commands.reload.successfully-reloaded")));
// });
// }
@Override
public CommandAPICommand onCommand() {
return new CommandAPICommand("reload")
.withPermission("geysermodelengine.commands.reload")
.executes((sender, args) -> {
Bukkit.getAsyncScheduler().runNow(plugin, scheduledTask -> plugin.getConfigManager().load());
sender.sendMessage(colourUtils.miniFormat(plugin.getConfigManager().getLang().getString("commands.reload.successfully-reloaded")));
});
}
}

View File

@@ -1,5 +1,6 @@
package re.imc.geysermodelengine.managers.commands.managers.geysermodelengine;
import dev.jorel.commandapi.CommandAPICommand;
import re.imc.geysermodelengine.GeyserModelEngine;
import re.imc.geysermodelengine.commands.geysermodelenginecommands.GeyserModelEngineReloadCommand;
import re.imc.geysermodelengine.managers.commands.CommandManagers;
@@ -18,11 +19,11 @@ public class GeyserModelEngineCommandManager implements CommandManagers {
}
private void registerCommand() {
// CommandAPICommand geyserModelEngineCommand = new CommandAPICommand(getName());
//
// commands.forEach(subCommands -> geyserModelEngineCommand.withSubcommand(subCommands.onCommand()));
//
// geyserModelEngineCommand.register();
CommandAPICommand geyserModelEngineCommand = new CommandAPICommand(getName());
commands.forEach(subCommands -> geyserModelEngineCommand.withSubcommand(subCommands.onCommand()));
geyserModelEngineCommand.register();
}
@Override

View File

@@ -1,9 +1,11 @@
package re.imc.geysermodelengine.managers.commands.subcommands;
import dev.jorel.commandapi.CommandAPICommand;
public interface SubCommands {
/**
* Subcommand setup
*/
// CommandAPICommand onCommand();
CommandAPICommand onCommand();
}