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

package com.hypixel.hytale.server.core.universe.world.commands;

import com.hypixel.hytale.server.core.Message;
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 com.hypixel.hytale.server.core.command.system.CommandContext;
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgumentType;
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractWorldCommand;

public class SetTickingCommand extends AbstractWorldCommand
{
    @Nonnull
    private final RequiredArg<Boolean> tickingArg;
    
    public SetTickingCommand() {
        super("setticking", "server.commands.setticking.desc");
        this.tickingArg = this.withRequiredArg("ticking", "server.commands.setticking.ticking.desc", ArgTypes.BOOLEAN);
    }
    
    @Override
    protected void execute(@Nonnull final CommandContext context, @Nonnull final World world, @Nonnull final Store<EntityStore> store) {
        final boolean isTicking = this.tickingArg.get(context);
        world.setTicking(isTicking);
        context.sendMessage(Message.translation("server.universe.settick.info").param("status", isTicking).param("worldName", world.getName()));
    }
}
