Another try at fixing NoClassDefFoundError with WorldEdit hook...

This commit is contained in:
Florian CUNY 2019-07-04 17:11:17 +02:00
parent 67a9dfa1cc
commit f5a3fdee82
6 changed files with 12 additions and 17 deletions

View File

@ -219,9 +219,11 @@ public class BlueprintPaster {
} }
private void pasteEntity(World world, Location location, Entry<Vector, List<BlueprintEntity>> entry) { private void pasteEntity(World world, Location location, Entry<Vector, List<BlueprintEntity>> entry) {
System.out.println(location.toString());
int x = location.getBlockX() + entry.getKey().getBlockX(); int x = location.getBlockX() + entry.getKey().getBlockX();
int y = location.getBlockY() + entry.getKey().getBlockY(); int y = location.getBlockY() + entry.getKey().getBlockY();
int z = location.getBlockZ() + entry.getKey().getBlockZ(); int z = location.getBlockZ() + entry.getKey().getBlockZ();
System.out.println(x + " " + y + " " + z);
setEntity(new Location(world, x, y, z), entry.getValue()); setEntity(new Location(world, x, y, z), entry.getValue());
} }

View File

@ -1,6 +1,5 @@
package world.bentobox.bentobox.blueprints; package world.bentobox.bentobox.blueprints.worldedit;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.gson.Gson; import com.google.gson.Gson;
@ -9,19 +8,13 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.GameModeAddon; import world.bentobox.bentobox.blueprints.Blueprint;
import world.bentobox.bentobox.api.commands.admin.blueprints.AdminBlueprintCommand;
import world.bentobox.bentobox.blueprints.converter.BlueprintClipboardReader;
import world.bentobox.bentobox.blueprints.converter.BlueprintClipboardWriter;
import world.bentobox.bentobox.database.json.BentoboxTypeAdapterFactory; import world.bentobox.bentobox.database.json.BentoboxTypeAdapterFactory;
import world.bentobox.bentobox.managers.BlueprintClipboardManager;
import world.bentobox.bentobox.managers.BlueprintsManager;
import java.io.*; import java.io.*;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Set; import java.util.Set;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;

View File

@ -1,11 +1,10 @@
package world.bentobox.bentobox.blueprints.converter; package world.bentobox.bentobox.blueprints.worldedit;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream;
/** /**
* @since 1.6.0 * @since 1.6.0

View File

@ -1,7 +1,6 @@
package world.bentobox.bentobox.blueprints.converter; package world.bentobox.bentobox.blueprints.worldedit;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
import java.io.IOException; import java.io.IOException;
@ -11,7 +10,7 @@ import java.io.OutputStream;
* @since 1.6.0 * @since 1.6.0
* @author CustomEntity * @author CustomEntity
*/ */
public class BlueprintClipboardWriter implements ClipboardWriter{ public class BlueprintClipboardWriter implements ClipboardWriter {
private OutputStream outputStream; private OutputStream outputStream;

View File

@ -1,4 +1,4 @@
package world.bentobox.bentobox.blueprints.converter; package world.bentobox.bentobox.blueprints.worldedit;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;

View File

@ -5,7 +5,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import org.bukkit.Material; import org.bukkit.Material;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.api.hooks.Hook; import world.bentobox.bentobox.api.hooks.Hook;
import world.bentobox.bentobox.blueprints.BlueprintClipboardFormat; import world.bentobox.bentobox.blueprints.worldedit.BlueprintClipboardFormat;
/** /**
* @since 1.6.0 * @since 1.6.0
@ -14,6 +14,7 @@ import world.bentobox.bentobox.blueprints.BlueprintClipboardFormat;
public class WorldEditHook extends Hook { public class WorldEditHook extends Hook {
private WorldEdit instance; private WorldEdit instance;
private BlueprintClipboardFormat clipboardFormat;
public WorldEditHook() { public WorldEditHook() {
super("WorldEdit", Material.WOODEN_AXE); super("WorldEdit", Material.WOODEN_AXE);
@ -23,7 +24,8 @@ public class WorldEditHook extends Hook {
public boolean hook() { public boolean hook() {
try { try {
instance = WorldEdit.getInstance(); instance = WorldEdit.getInstance();
ClipboardFormats.registerClipboardFormat(new BlueprintClipboardFormat()); clipboardFormat = new BlueprintClipboardFormat();
ClipboardFormats.registerClipboardFormat(clipboardFormat);
} catch (Exception | NoClassDefFoundError | NoSuchMethodError e) { } catch (Exception | NoClassDefFoundError | NoSuchMethodError e) {
return false; return false;
} }