Newer
Older
ChallengeSystem / Challenge / src / main / java / de / fanta / challenge / commands / CommandRegistration.java
@fanta fanta on 7 Jun 2024 8 KB ja
package de.fanta.challenge.commands;

import de.fanta.challenge.Challenge;
import de.fanta.challenge.commands.challenges.ChallengeMaxPlayersCommand;
import de.fanta.challenge.commands.challenges.ChallengesBanCommand;
import de.fanta.challenge.commands.challenges.ChallengesCommand;
import de.fanta.challenge.commands.challenges.ChallengesEnderSeeCommand;
import de.fanta.challenge.commands.challenges.ChallengesHelpCommand;
import de.fanta.challenge.commands.challenges.ChallengesInvSeeCommand;
import de.fanta.challenge.commands.challenges.ChallengesKickCommand;
import de.fanta.challenge.commands.challenges.ChallengesMemoryCommand;
import de.fanta.challenge.commands.challenges.ChallengesPingCommand;
import de.fanta.challenge.commands.challenges.ChallengesSaveCommand;
import de.fanta.challenge.commands.event.EventSaveScoresCommand;
import de.fanta.challenge.commands.challenges.ChallengesUnBanCommand;
import de.fanta.challenge.commands.challenges.TeleportCommand;
import de.fanta.challenge.commands.challenges.CheckItemsCommand;
import de.fanta.challenge.commands.coords.CoordsCommand;
import de.fanta.challenge.commands.coords.CoordsDeleteCommand;
import de.fanta.challenge.commands.coords.CoordsGetCommand;
import de.fanta.challenge.commands.coords.CoordsSaveCommand;
import de.fanta.challenge.commands.coords.CoordsShareCommand;
import de.fanta.challenge.commands.coords.CoordsTargetCommand;
import de.fanta.challenge.commands.editor.EditorCommand;
import de.fanta.challenge.commands.editor.EditorSetCommand;
import de.fanta.challenge.commands.event.CreateTeamsCommand;
import de.fanta.challenge.commands.event.EventCommand;
import de.fanta.challenge.commands.event.EventForceTeamCommand;
import de.fanta.challenge.commands.event.EventGetScoreCommand;
import de.fanta.challenge.commands.event.EventSettingsCommand;
import de.fanta.challenge.commands.event.EventStartCommand;
import de.fanta.challenge.commands.event.EventTeamsSetTeamSpawnCommand;
import de.fanta.challenge.commands.event.EventToggleCommand;
import de.fanta.challenge.commands.hp.HPAddCommand;
import de.fanta.challenge.commands.hp.HPGetCommand;
import de.fanta.challenge.commands.hp.HPMaxCommand;
import de.fanta.challenge.commands.hp.HPRemoveCommand;
import de.fanta.challenge.commands.hp.HPSetCommand;
import de.fanta.challenge.commands.reset.ResetCommand;
import de.fanta.challenge.commands.reset.ResetConfirmCommand;
import de.fanta.challenge.commands.settings.SettingsCommand;
import de.fanta.challenge.commands.timer.TimerCommand;
import de.fanta.challenge.commands.timer.TimerGetCommand;
import de.fanta.challenge.commands.timer.TimerPauseCommand;
import de.fanta.challenge.commands.timer.TimerResetCommand;
import de.fanta.challenge.commands.timer.TimerReverseCommand;
import de.fanta.challenge.commands.timer.TimerSetCommand;
import de.fanta.challenge.commands.timer.TimerStartCommand;
import de.iani.cubesideutils.bukkit.MinecraftVersion;
import de.iani.cubesideutils.bukkit.commands.CommandRouter;

public record CommandRegistration(Challenge plugin) {

    public void registerCommands() {

        CommandRouter challengesRouter = new CommandRouter(plugin.getCommand("challenge"));
        challengesRouter.addPluginCommand(plugin.getCommand("adventure"));
        challengesRouter.addCommandMapping(new ChallengesCommand(plugin));
        challengesRouter.addCommandMapping(new ChallengesHelpCommand(plugin), "help");
        challengesRouter.addCommandMapping(new ChallengesKickCommand(plugin), "kick");
        challengesRouter.addCommandMapping(new ChallengesBanCommand(plugin), "ban");
        challengesRouter.addCommandMapping(new ChallengesUnBanCommand(plugin), "unban");
        challengesRouter.addCommandMapping(new ChallengesSaveCommand(plugin), "save");
        challengesRouter.addCommandMapping(new ChallengesPingCommand(), "ping");
        challengesRouter.addCommandMapping(new ChallengesMemoryCommand(), "mem");
        challengesRouter.addCommandMapping(new TeleportCommand(), "tp");
        challengesRouter.addCommandMapping(new ChallengeMaxPlayersCommand(), "maxplayer");
        challengesRouter.addCommandMapping(new CheckItemsCommand(plugin), "checkitems");
        challengesRouter.addCommandMapping(new ChallengesInvSeeCommand(), "invsee");
        challengesRouter.addCommandMapping(new ChallengesEnderSeeCommand(), "endersee");

        CommandRouter resetRouter = new CommandRouter(plugin.getCommand("reset"));
        resetRouter.addCommandMapping(new ResetCommand(plugin));
        resetRouter.addCommandMapping(new ResetConfirmCommand(plugin), "confirm");

        CommandRouter backpackRouter = new CommandRouter(plugin.getCommand("backpack"));
        backpackRouter.addCommandMapping(new BackpackCommand(plugin));

        CommandRouter coordsRouter = new CommandRouter(plugin.getCommand("coords"));
        coordsRouter.addCommandMapping(new CoordsCommand());
        coordsRouter.addCommandMapping(new CoordsShareCommand(), "share");
        coordsRouter.addCommandMapping(new CoordsGetCommand(), "get");
        coordsRouter.addCommandMapping(new CoordsSaveCommand(plugin), "save");
        coordsRouter.addCommandMapping(new CoordsDeleteCommand(), "delete");
        if (MinecraftVersion.isAboveOrEqual(1,19,0)) {
            coordsRouter.addCommandMapping(new CoordsTargetCommand(plugin), "target");
        }
        CommandRouter hpRouter = new CommandRouter(plugin.getCommand("hp"));
        hpRouter.addCommandMapping(new HPAddCommand(plugin), "add");
        hpRouter.addCommandMapping(new HPGetCommand(plugin), "get");
        hpRouter.addCommandMapping(new HPMaxCommand(plugin), "max");
        hpRouter.addCommandMapping(new HPRemoveCommand(plugin), "remove");
        hpRouter.addCommandMapping(new HPSetCommand(plugin), "set");

        CommandRouter timerRouter = new CommandRouter(plugin.getCommand("timer"));
        timerRouter.addCommandMapping(new TimerCommand(plugin));
        timerRouter.addCommandMapping(new TimerPauseCommand(plugin), "pause");
        timerRouter.addCommandMapping(new TimerResetCommand(plugin), "reset");
        timerRouter.addCommandMapping(new TimerReverseCommand(plugin), "reverse");
        timerRouter.addCommandMapping(new TimerSetCommand(plugin), "set");
        timerRouter.addCommandMapping(new TimerStartCommand(plugin), "start");
        timerRouter.addCommandMapping(new TimerGetCommand(plugin), "get");

        CommandRouter forcemlgRouter = new CommandRouter(plugin.getCommand("forcemlg"));
        forcemlgRouter.addCommandMapping(new ForceMLGCommand(plugin));

        CommandRouter editorRouter = new CommandRouter(plugin.getCommand("editor"));
        editorRouter.addCommandMapping(new EditorCommand(plugin));
        editorRouter.addCommandMapping(new EditorSetCommand(plugin), "set");

        CommandRouter leaveRouter = new CommandRouter(plugin.getCommand("leave"));
        leaveRouter.addCommandMapping(new LeaveCommand(plugin));

        CommandRouter eventRouter = new CommandRouter(plugin.getCommand("event"));
        eventRouter.addCommandMapping(new EventCommand());
        eventRouter.addCommandMapping(new EventToggleCommand(plugin, true), "enable");
        eventRouter.addCommandMapping(new EventToggleCommand(plugin, false), "disable");
        eventRouter.addCommandMapping(new EventSettingsCommand(), "settings");
        eventRouter.addCommandMapping(new EventGetScoreCommand(plugin), "getscore");
        eventRouter.addCommandMapping(new EventStartCommand(plugin), "start");
        eventRouter.addCommandMapping(new CreateTeamsCommand(), "createteams");
        eventRouter.addCommandMapping(new EventTeamsSetTeamSpawnCommand(), "setteamspawn");
        eventRouter.addCommandMapping(new EventForceTeamCommand(), "forceteam");
        eventRouter.addCommandMapping(new EventSaveScoresCommand(plugin), "savescores");


        CommandRouter bingoRouter = new CommandRouter(plugin.getCommand("bingo"));
        bingoRouter.addCommandMapping(new BingoCommand(plugin));

        CommandRouter villageRouter = new CommandRouter(plugin.getCommand("village"));
        villageRouter.addCommandMapping(new VillageCommand(plugin));

        CommandRouter netherRouter = new CommandRouter(plugin.getCommand("nether"));
        netherRouter.addCommandMapping(new NetherToggleCommand(plugin, true), "enable");
        netherRouter.addCommandMapping(new NetherToggleCommand(plugin, false), "disable");

        CommandRouter settingsRouter = new CommandRouter(plugin.getCommand("settings"));
        settingsRouter.addCommandMapping(new SettingsCommand(plugin));

        CommandRouter reviveRouter = new CommandRouter(plugin.getCommand("revive"));
        reviveRouter.addCommandMapping(new ReviveCommand(plugin));

        CommandRouter skipItemRouter = new CommandRouter(plugin.getCommand("skipitem"));
        skipItemRouter.addCommandMapping(new SkipItemCommand(plugin));

        CommandRouter unlockRouter = new CommandRouter(plugin.getCommand("unlock"));
        unlockRouter.addPluginCommand(plugin.getCommand("cremove"));
        unlockRouter.addCommandMapping(new ChestUnlockCommand());
    }
}