001/*
002 * PlotSquared, a land and world management plugin for Minecraft.
003 * Copyright (C) IntellectualSites <https://intellectualsites.com>
004 * Copyright (C) IntellectualSites team and contributors
005 *
006 * This program is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
018 */
019package com.plotsquared.bukkit.util.fawe;
020
021import com.fastasyncworldedit.bukkit.regions.plotsquared.FaweDelegateSchematicHandler;
022import com.google.inject.Inject;
023import com.plotsquared.core.inject.factory.ProgressSubscriberFactory;
024import com.plotsquared.core.player.PlotPlayer;
025import com.plotsquared.core.plot.Plot;
026import com.plotsquared.core.plot.schematic.Schematic;
027import com.plotsquared.core.queue.QueueCoordinator;
028import com.plotsquared.core.util.SchematicHandler;
029import com.plotsquared.core.util.WorldUtil;
030import com.plotsquared.core.util.task.RunnableVal;
031import com.sk89q.jnbt.CompoundTag;
032import org.checkerframework.checker.nullness.qual.NonNull;
033
034import java.io.InputStream;
035import java.net.URL;
036import java.util.UUID;
037
038public class FaweSchematicHandler extends SchematicHandler {
039
040    private final FaweDelegateSchematicHandler delegate = new FaweDelegateSchematicHandler();
041
042    @Inject
043    public FaweSchematicHandler(WorldUtil worldUtil, ProgressSubscriberFactory subscriberFactory) {
044        super(worldUtil, subscriberFactory);
045    }
046
047    @Override
048    public boolean restoreTile(QueueCoordinator queue, CompoundTag tag, int x, int y, int z) {
049        return false;
050    }
051
052    @Override
053    public void paste(
054            final Schematic schematic,
055            final Plot plot,
056            final int xOffset,
057            final int yOffset,
058            final int zOffset,
059            final boolean autoHeight,
060            final PlotPlayer<?> actor,
061            final RunnableVal<Boolean> whenDone
062    ) {
063        delegate.paste(schematic, plot, xOffset, yOffset, zOffset, autoHeight, actor, whenDone);
064    }
065
066    @Override
067    public boolean save(CompoundTag tag, String path) {
068        return delegate.save(tag, path);
069    }
070
071    @SuppressWarnings("removal") // Just the override
072    @Override
073    public void upload(final CompoundTag tag, final UUID uuid, final String file, final RunnableVal<URL> whenDone) {
074        delegate.upload(tag, uuid, file, whenDone);
075    }
076
077    @Override
078    public Schematic getSchematic(@NonNull InputStream is) {
079        return delegate.getSchematic(is);
080    }
081
082}