// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.builtin.weather.commands;

import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.asset.type.weather.config.Weather;
import com.hypixel.hytale.builtin.weather.resources.WeatherResource;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.universe.world.World;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractWorldCommand;

public class WeatherGetCommand extends AbstractWorldCommand
{
    public WeatherGetCommand() {
        super("get", "server.commands.weather.get.desc");
    }
    
    @Override
    protected void execute(@Nonnull final CommandContext context, @Nonnull final World world, @Nonnull final Store<EntityStore> store) {
        final WeatherResource weatherResource = store.getResource(WeatherResource.getResourceType());
        final int forcedWeatherIndex = weatherResource.getForcedWeatherIndex();
        String weatherId;
        if (forcedWeatherIndex != 0) {
            final Weather weatherAsset = Weather.getAssetMap().getAsset(forcedWeatherIndex);
            weatherId = weatherAsset.getId();
        }
        else {
            weatherId = "not locked";
        }
        context.sendMessage(Message.translation("server.commands.weather.get.getForcedWeather").param("worldName", world.getName()).param("weather", weatherId));
    }
}
