package xyz.tbvns.rogue_block.Managers;

import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
import xyz.tbvns.rogue_block.Upgrades.PassiveUpgrade;
import xyz.tbvns.rogue_block.Upgrades.Upgrade;
import xyz.tbvns.rogue_block.Upgrades.UpgradeType;
import xyz.tbvns.rogue_block.Upgrades.UpgradesManager;

public class RunManager {
    public static void launchRun(MinecraftServer server) {
        WorldManager.createNewRunWorld(server);
        WorldManager.clearAchievements(server);
        WorldManager.teleportToRunWorld(server);

        for (ServerPlayerEntity player : server.getPlayerManager().getPlayerList()) {
            for (Upgrade upgrade : UpgradesManager.registeredUpgrades) {
                if (upgrade.getType() == UpgradeType.Passive) {
                    PassiveUpgrade passiveUpgrade = (PassiveUpgrade) upgrade;
                    passiveUpgrade.executeOnStart(player); //TODO: replace that with a check to verify if the player owns it
                }
            }
        }
    }
}
