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

package com.hypixel.hytale.builtin.buildertools.snapshot;

import com.hypixel.hytale.component.ComponentAccessor;
import javax.annotation.Nonnull;
import com.hypixel.hytale.builtin.buildertools.BuilderToolsPlugin;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.core.prefab.selection.standard.BlockSelection;

public class ClipboardContentsSnapshot implements ClipboardSnapshot<ClipboardContentsSnapshot>
{
    private final BlockSelection selection;
    
    public ClipboardContentsSnapshot(final BlockSelection selection) {
        this.selection = selection;
    }
    
    @Override
    public ClipboardContentsSnapshot restoreClipboard(final Ref<EntityStore> ref, final Player player, final World world, @Nonnull final BuilderToolsPlugin.BuilderState builderState, final ComponentAccessor<EntityStore> componentAccessor) {
        final ClipboardContentsSnapshot snapshot = new ClipboardContentsSnapshot(builderState.getSelection());
        builderState.setSelection(this.selection);
        return snapshot;
    }
    
    @Nonnull
    public static ClipboardContentsSnapshot copyOf(@Nonnull final BlockSelection selection) {
        return new ClipboardContentsSnapshot(selection.cloneSelection());
    }
}
