import { world, Player, system } from "@minecraft/server";
import { Command } from "../handler";
import { sendPlayerMessage, sendAllMessage, config } from "../../config";
import { deadplayers, random, revivelist } from "../../lifesteal";
import { withdrawHelp } from "./withdraw";
import { reviveHelp } from "./revive";
import { heartHelp } from "./heart";
import { welcomeHelp } from "./misc/welcome";
import { apHelp } from "./staffOnly/adminpanel";
import { getHelp } from "./staffOnly/get";
import { ghostBarrierHelp } from "./staffOnly/ghostbarrier";
import { deadPlayersHelp } from "./misc/deadplayers";
import { logsHelp } from "./staffOnly/logs";
import { forceReviveHelp } from "./staffOnly/forcerevive";
import { killHelp } from "./staffOnly/kill";
import { reviveAllHelp } from "./staffOnly/reviveall";
import { compatibilityHelp } from "./staffOnly/compatibility";

new Command({
    name: "help",
    aliases: ["h"],
    code({ player, args }) {
        if (args[0] == `forcekill`) {
            killHelp(player);
            return;
        }
        if (args[0] == `forcerevive`) {
            forceReviveHelp(player);
            return;
        }
        if (args[0] == `logs`) {
            logsHelp(player);
            return;
        }
        if (args[0] == `deadplayers`) {
            deadPlayersHelp(player);
            return;
        }
        if (args[0] == `ghostbarrier`) {
            ghostBarrierHelp(player);
            return;
        }
        if (args[0] == `get`) {
            getHelp(player);
            return;
        }
        if (args[0] == `withdraw`) {
            withdrawHelp(player);
            return;
        }
        if (args[0] == `revive`) {
            reviveHelp(player);
            return;
        }
        if (args[0] == `heart`) {
            heartHelp(player);
            return;
        }
        if (args[0] == `welcome`) {
            welcomeHelp(player);
            return;
        }
        if (args[0] == `adminpanel`) {
            apHelp(player);
            return;
        }
        if (args[0] == `reviveall`) {
            reviveAllHelp(player);
        }
        if (args[0] == `compatibility`) {
            compatibilityHelp(player);
        }

        sendPlayerMessage(player, `§c----------------------------
§c§lLifesteal Help Page§r
§f§lCommand Prefix: §c${config.prefix}
§r§f§lDo ${config.prefix}help <commandName> for information on that command!
§r§c----------------------------

§6Normal Commands --

§e- §lwithdraw <amount> §r§g| Withdraw one or more hearts from your heart count
§e- §lrevive <player> §r§g| Revive a player (Must have a heart of life in hand)
§e- §ldeadplayers §r§g| Show all dead player's names
§e- §lheart <display/show> §r§g| Heart commands
§e- §lwelcome §r§g| Show the welcome GUI

§r§2Ghost Commands --

§a- §ljumpscare <player> §r§q| Jumpscare a player (must be near them)
§a- §lrps <rock/paper/scissors> §r§q| Play rock paper scissors with an AI
§a- lcookieclicker §r§q| Play cookie clicker
§a- §lguess §r§q| Try to guess a number from a random number generator, completely RNG based
§a- §lleaderboard §r§q| Leaderboard for Cookie clicker and RPS

§r§sStaff Commands --§r
${player.hasTag(config.staffTag) || player.isOp() ?
                `
§9- §lheart <set/setmax/...> §r§u| Heart commands such as set (Sets a max player's hearts), envsteal (Sets whether dying from mobs, fall damage, etc makes you lose a heart), etc
§9- §ladminpanel §r§u| Open the admin panel
§9- §llogs §r§u| Shows everytime a player used a command or gained a heart
§9- §lget <item> <amount> §r§u| Get a lifesteal item without the need of an identifier
§9- §lghostbarrier <amount> §r§u| Set the ghost barrier
§9- §lforcerevive <player> §r§u| Revives a player even if you don't have a Heart of Life
§9- §lforcekill <player> §r§u| Sets a player to 0 hearts and makes them a ghost
§9- §lreviveall §r§u| Revive all players
§9- §lreviveamount <amount> §r§u| Set the amount of hearts a player is given when they are revived
§9- §lbanghosts <true/false> §r§u| Whether people get banned when they reach 0 hearts or not
§9- §lstartamount <amount> §r§u| Set the amount of hearts a new player starts with
§9- §lcompatibility <arg> <true/false> §r§u| Settings for compatibility with other addons/mods/plugins/whatever people call it now` : `§cYou do not have permission to view this! Make sure you have the staff tag.`}`);
    },
});
