/**
 * Manages player-specific settings
 * Settings are stored in dynamic properties on each player
 */
export class SettingsManager {
    DEFAULT_SETTINGS = {
        ghostMode: false,
        disableCheckpointItem: false
    };
    /**
     * Get player settings
     */
    getSettings(player) {
        try {
            const settingsJson = player.getDynamicProperty('player_settings');
            if (settingsJson) {
                return JSON.parse(settingsJson);
            }
        }
        catch (error) {
            // Failed to load settings
        }
        return { ...this.DEFAULT_SETTINGS };
    }
    /**
     * Save player settings
     */
    saveSettings(player, settings) {
        try {
            player.setDynamicProperty('player_settings', JSON.stringify(settings));
        }
        catch (error) {
            // Failed to save settings
        }
    }
    /**
     * Update a specific setting
     */
    updateSetting(player, key, value) {
        const settings = this.getSettings(player);
        settings[key] = value;
        this.saveSettings(player, settings);
    }
    /**
     * Reset settings to defaults
     */
    resetSettings(player) {
        this.saveSettings(player, { ...this.DEFAULT_SETTINGS });
    }
    /**
     * Apply ghost mode effects to player
     */
    applyGhostMode(player, enabled) {
        try {
            if (enabled) {
                // Make player invisible
                player.runCommand('effect @s invisibility 999999 0 true');
                // Give gold boots for visibility
                player.runCommand('replaceitem entity @s slot.armor.feet 0 golden_boots 1 0 {"keep_on_death":{},"minecraft:item_lock":{"mode":"lock_in_slot"}}');
            }
            else {
                // Remove invisibility
                player.runCommand('effect @s invisibility 0');
                // Clear boots
                player.runCommand('replaceitem entity @s slot.armor.feet 0 air');
            }
        }
        catch (error) {
            // Failed to apply ghost mode
        }
    }
}
