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.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
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.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;
|
||||||
@ -24,6 +25,11 @@ import java.util.zip.ZipInputStream;
|
|||||||
* @author CustomEntity
|
* @author CustomEntity
|
||||||
*/
|
*/
|
||||||
public class BlueprintClipboardFormat implements ClipboardFormat {
|
public class BlueprintClipboardFormat implements ClipboardFormat {
|
||||||
|
|
||||||
|
public BlueprintClipboardFormat() {
|
||||||
|
ClipboardFormats.registerClipboardFormat(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Blueprint";
|
return "Blueprint";
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package world.bentobox.bentobox.hooks;
|
package world.bentobox.bentobox.hooks;
|
||||||
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
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 com.sk89q.worldedit.WorldEdit;
|
||||||
|
|
||||||
import world.bentobox.bentobox.api.hooks.Hook;
|
import world.bentobox.bentobox.api.hooks.Hook;
|
||||||
import world.bentobox.bentobox.blueprints.worldedit.BlueprintClipboardFormat;
|
import world.bentobox.bentobox.blueprints.worldedit.BlueprintClipboardFormat;
|
||||||
|
|
||||||
@ -14,7 +15,6 @@ import world.bentobox.bentobox.blueprints.worldedit.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);
|
||||||
@ -22,15 +22,16 @@ public class WorldEditHook extends Hook {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hook() {
|
public boolean hook() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
instance = WorldEdit.getInstance();
|
instance = WorldEdit.getInstance();
|
||||||
clipboardFormat = new BlueprintClipboardFormat();
|
new BlueprintClipboardFormat();
|
||||||
ClipboardFormats.registerClipboardFormat(clipboardFormat);
|
} catch (Exception e) {
|
||||||
} catch (Exception | NoClassDefFoundError | NoSuchMethodError e) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance != null;
|
return instance != null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user