Search in sources :

Example 1 with AutoClaimFinishTask

use of com.plotsquared.core.util.task.AutoClaimFinishTask in project PlotSquared by IntellectualSites.

the class Auto method claimSingle.

private void claimSingle(@NonNull final PlotPlayer<?> player, @NonNull final Plot plot, @NonNull final PlotArea plotArea, @Nullable final String schematic) {
    try (final MetaDataAccess<Boolean> metaDataAccess = player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_AUTO)) {
        metaDataAccess.set(true);
    }
    plot.setOwnerAbs(player.getUUID());
    final RunnableVal<Plot> runnableVal = new RunnableVal<>() {

        {
            this.value = plot;
        }

        @Override
        public void run(final Plot plot) {
            try {
                TaskManager.getPlatformImplementation().sync(new AutoClaimFinishTask(player, plot, plotArea, schematic, PlotSquared.get().getEventDispatcher()));
            } catch (final Exception e) {
                e.printStackTrace();
            }
        }
    };
    DBFunc.createPlotSafe(plot, runnableVal, () -> claimSingle(player, plot, plotArea, schematic));
}
Also used : Plot(com.plotsquared.core.plot.Plot) RunnableVal(com.plotsquared.core.util.task.RunnableVal) AutoClaimFinishTask(com.plotsquared.core.util.task.AutoClaimFinishTask)

Aggregations

Plot (com.plotsquared.core.plot.Plot)1 AutoClaimFinishTask (com.plotsquared.core.util.task.AutoClaimFinishTask)1 RunnableVal (com.plotsquared.core.util.task.RunnableVal)1