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

package com.hypixel.hytale.builtin.weather;

import com.hypixel.hytale.component.ComponentRegistryProxy;
import com.hypixel.hytale.server.core.command.system.AbstractCommand;
import com.hypixel.hytale.builtin.weather.commands.WeatherCommand;
import com.hypixel.hytale.server.core.command.system.CommandManager;
import com.hypixel.hytale.component.system.ISystem;
import com.hypixel.hytale.builtin.weather.systems.WeatherSystem;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
import com.hypixel.hytale.builtin.weather.resources.WeatherResource;
import com.hypixel.hytale.component.ResourceType;
import com.hypixel.hytale.builtin.weather.components.WeatherTracker;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.server.core.plugin.JavaPlugin;

public class WeatherPlugin extends JavaPlugin
{
    private static WeatherPlugin instance;
    private ComponentType<EntityStore, WeatherTracker> weatherTrackerComponentType;
    private ResourceType<EntityStore, WeatherResource> weatherResourceType;
    
    public static WeatherPlugin get() {
        return WeatherPlugin.instance;
    }
    
    public WeatherPlugin(@Nonnull final JavaPluginInit init) {
        super(init);
        WeatherPlugin.instance = this;
    }
    
    @Override
    protected void setup() {
        final ComponentRegistryProxy<EntityStore> entityStoreRegistry = this.getEntityStoreRegistry();
        this.weatherResourceType = EntityStore.REGISTRY.registerResource(WeatherResource.class, WeatherResource::new);
        this.weatherTrackerComponentType = EntityStore.REGISTRY.registerComponent(WeatherTracker.class, WeatherTracker::new);
        entityStoreRegistry.registerSystem(new WeatherSystem.WorldAddedSystem());
        entityStoreRegistry.registerSystem(new WeatherSystem.PlayerAddedSystem());
        entityStoreRegistry.registerSystem(new WeatherSystem.TickingSystem());
        entityStoreRegistry.registerSystem((ISystem<EntityStore>)new WeatherSystem.InvalidateWeatherAfterTeleport());
        CommandManager.get().registerSystemCommand(new WeatherCommand());
    }
    
    @Nonnull
    public ComponentType<EntityStore, WeatherTracker> getWeatherTrackerComponentType() {
        return this.weatherTrackerComponentType;
    }
    
    @Nonnull
    public ResourceType<EntityStore, WeatherResource> getWeatherResourceType() {
        return this.weatherResourceType;
    }
}
