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

package com.hypixel.hytale.server.spawning.local;

import javax.annotation.Nonnull;
import com.hypixel.hytale.server.spawning.SpawningPlugin;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.Component;

public class LocalSpawnController implements Component<EntityStore>
{
    private double timeToNextRunSeconds;
    
    public static ComponentType<EntityStore, LocalSpawnController> getComponentType() {
        return SpawningPlugin.get().getLocalSpawnControllerComponentType();
    }
    
    public LocalSpawnController() {
        this.timeToNextRunSeconds = SpawningPlugin.get().getLocalSpawnControllerJoinDelay();
    }
    
    public void setTimeToNextRunSeconds(final double seconds) {
        this.timeToNextRunSeconds = seconds;
    }
    
    public boolean tickTimeToNextRunSeconds(final float dt) {
        final double timeToNextRunSeconds = this.timeToNextRunSeconds - dt;
        this.timeToNextRunSeconds = timeToNextRunSeconds;
        return timeToNextRunSeconds <= 0.0;
    }
    
    @Nonnull
    @Override
    public Component<EntityStore> clone() {
        final LocalSpawnController controller = new LocalSpawnController();
        controller.timeToNextRunSeconds = this.timeToNextRunSeconds;
        return controller;
    }
    
    @Nonnull
    @Override
    public String toString() {
        return "LocalSpawnController{timeToNextRunSeconds=" + this.timeToNextRunSeconds;
    }
}
