register new commands

This commit is contained in:
Ryder Belserion 2024-09-08 19:16:13 -04:00
parent bfdd853edd
commit e193f5558d
No known key found for this signature in database

View File

@ -6,12 +6,18 @@ import com.badbones69.crazyauctions.api.enums.Messages;
import com.badbones69.crazyauctions.api.support.MetricsWrapper;
import com.badbones69.crazyauctions.commands.AuctionCommand;
import com.badbones69.crazyauctions.commands.AuctionTab;
import com.badbones69.crazyauctions.commands.v2.BaseCommand;
import com.badbones69.crazyauctions.commands.v2.player.CommandHelp;
import com.badbones69.crazyauctions.commands.v2.staff.CommandReload;
import com.badbones69.crazyauctions.configs.ConfigManager;
import com.badbones69.crazyauctions.controllers.GuiListener;
import com.badbones69.crazyauctions.controllers.MarcoListener;
import com.badbones69.crazyauctions.currency.VaultSupport;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.ryderbelserion.vital.paper.Vital;
import com.ryderbelserion.vital.paper.util.scheduler.FoliaRunnable;
import io.papermc.paper.command.brigadier.CommandSourceStack;
import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
@ -22,6 +28,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.Base64;
import java.util.List;
public class CrazyAuctions extends Vital {
@ -117,7 +124,19 @@ public class CrazyAuctions extends Vital {
getServer().getPluginManager().registerEvents(new GuiListener(), this);
getServer().getPluginManager().registerEvents(new MarcoListener(), this);
registerCommand(getCommand("crazyauctions"), new AuctionTab(), new AuctionCommand());
registerCommand(getCommand("ca"), new AuctionTab(), new AuctionCommand());
// Register commands.
getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, event -> {
LiteralArgumentBuilder<CommandSourceStack> root = new BaseCommand().registerPermission().literal().createBuilder();
List.of(
new CommandReload(),
new CommandHelp()
).forEach(command -> root.then(command.registerPermission().literal()));
event.registrar().register(root.build(), "the base command for CrazyAuctions");
});
this.support = new VaultSupport();
this.support.loadVault();