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

package com.hypixel.hytale.server.core.command.commands.world.chunk;

import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.modules.entity.player.ChunkTracker;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import javax.annotation.Nullable;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.Ref;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractTargetPlayerCommand;

public class ChunkTrackerCommand extends AbstractTargetPlayerCommand
{
    public ChunkTrackerCommand() {
        super("tracker", "server.commands.chunk.tracker.desc");
    }
    
    @Override
    protected void execute(@Nonnull final CommandContext context, @Nullable final Ref<EntityStore> sourceRef, @Nonnull final Ref<EntityStore> ref, @Nonnull final PlayerRef playerRef, @Nonnull final World world, @Nonnull final Store<EntityStore> store) {
        final Player playerComponent = store.getComponent(ref, Player.getComponentType());
        assert playerComponent != null;
        final ChunkTracker chunkTrackerComponent = store.getComponent(ref, ChunkTracker.getComponentType());
        assert chunkTrackerComponent != null;
        final ChunkStore chunkStore = world.getChunkStore();
        final String loadedWorldChunks = Integer.toString(chunkStore.getLoadedChunksCount());
        context.sendMessage(Message.translation("server.commands.chunkTracker.summary").param("maxChunksPerSecond", chunkTrackerComponent.getMaxChunksPerSecond()).param("maxChunksPerTick", chunkTrackerComponent.getMaxChunksPerTick()).param("minChunkLoadedRadius", chunkTrackerComponent.getMinLoadedChunksRadius()).param("maxHotChunkLoadedRadius", chunkTrackerComponent.getMaxHotLoadedChunksRadius()).param("loadedPlayerChunks", chunkTrackerComponent.getLoadedChunksCount()).param("loadingPlayerChunks", chunkTrackerComponent.getLoadingChunksCount()).param("loadedWorldChunks", loadedWorldChunks));
    }
}
