Use Bukkit for Admin BP pasting.

This commit is contained in:
tastybento 2024-02-23 22:05:32 -08:00
parent a1d19fae74
commit 070c1102db
4 changed files with 2 additions and 6 deletions

View File

@ -25,7 +25,7 @@ public class AdminBlueprintPasteCommand extends CompositeCommand {
AdminBlueprintCommand parent = (AdminBlueprintCommand) getParent();
BlueprintClipboard clipboard = parent.getClipboards().computeIfAbsent(user.getUniqueId(), v -> new BlueprintClipboard());
if (clipboard.isFull()) {
new BlueprintPaster(getPlugin(), clipboard, user.getLocation()).paste().thenAccept(b -> {
new BlueprintPaster(getPlugin(), clipboard, user.getLocation()).paste(false).thenAccept(b -> {
user.sendMessage("general.success");
parent.showClipboard(user);
});

View File

@ -133,7 +133,7 @@ public class BlueprintPaster {
* The main pasting method
*/
public CompletableFuture<Boolean> paste() {
return this.paste(false);
return this.paste(true);
}
/**

View File

@ -8,7 +8,6 @@ import java.util.stream.Collectors;
import org.bukkit.Location;
import org.bukkit.World;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintEntity;
import world.bentobox.bentobox.database.objects.Island;
@ -18,7 +17,6 @@ import world.bentobox.bentobox.util.DefaultPasteUtil;
public class PasteHandlerImpl implements PasteHandler {
@Override
public CompletableFuture<Void> pasteBlocks(Island island, World world, Map<Location, BlueprintBlock> blockMap) {
BentoBox.getInstance().logDebug("fallback paste");
return blockMap.entrySet().stream()
.map(entry -> setBlock(island, entry.getKey(), entry.getValue()))
.collect(

View File

@ -11,7 +11,6 @@ import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.chunk.Chunk;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.nms.PasteHandler;
@ -31,7 +30,6 @@ public class PasteHandlerImpl implements PasteHandler {
*/
@Override
public CompletableFuture<Void> setBlock(Island island, Location location, BlueprintBlock bpBlock) {
BentoBox.getInstance().logDebug("nms paste");
return Util.getChunkAtAsync(location).thenRun(() -> {
Block block = location.getBlock();
// Set the block data - default is AIR