mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 13:15:28 +01:00
Fixes error with WorldEdit hook.
This commit is contained in:
parent
349f339be3
commit
cd4bea8a3e
@ -5,6 +5,7 @@ import com.google.common.collect.Sets;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
@ -24,6 +25,11 @@ import java.util.zip.ZipInputStream;
|
||||
* @author CustomEntity
|
||||
*/
|
||||
public class BlueprintClipboardFormat implements ClipboardFormat {
|
||||
|
||||
public BlueprintClipboardFormat() {
|
||||
ClipboardFormats.registerClipboardFormat(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Blueprint";
|
||||
|
@ -1,9 +1,10 @@
|
||||
package world.bentobox.bentobox.hooks;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||
import org.bukkit.Material;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import world.bentobox.bentobox.api.hooks.Hook;
|
||||
import world.bentobox.bentobox.blueprints.worldedit.BlueprintClipboardFormat;
|
||||
|
||||
@ -14,7 +15,6 @@ import world.bentobox.bentobox.blueprints.worldedit.BlueprintClipboardFormat;
|
||||
public class WorldEditHook extends Hook {
|
||||
|
||||
private WorldEdit instance;
|
||||
private BlueprintClipboardFormat clipboardFormat;
|
||||
|
||||
public WorldEditHook() {
|
||||
super("WorldEdit", Material.WOODEN_AXE);
|
||||
@ -22,15 +22,16 @@ public class WorldEditHook extends Hook {
|
||||
|
||||
@Override
|
||||
public boolean hook() {
|
||||
|
||||
try {
|
||||
instance = WorldEdit.getInstance();
|
||||
clipboardFormat = new BlueprintClipboardFormat();
|
||||
ClipboardFormats.registerClipboardFormat(clipboardFormat);
|
||||
} catch (Exception | NoClassDefFoundError | NoSuchMethodError e) {
|
||||
new BlueprintClipboardFormat();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return instance != null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user