mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-01-17 05:41:33 +01:00
DL WorldEdit bukkit if they forget
This commit is contained in:
parent
2d295effee
commit
d43dbab7c5
@ -27,8 +27,12 @@ import com.sk89q.worldedit.bukkit.EditSessionBlockChangeDelegate;
|
|||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.channels.Channels;
|
||||||
|
import java.nio.channels.ReadableByteChannel;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -87,16 +91,28 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setupInjector() {
|
public void setupInjector() {
|
||||||
if (Bukkit.getPluginManager().getPlugin("WorldEdit") != null) {
|
if (Bukkit.getPluginManager().getPlugin("WorldEdit") == null) {
|
||||||
Fawe.setupInjector();
|
try {
|
||||||
// Inject
|
File output = new File(getDirectory().getParentFile(), "WorldEdit.jar");
|
||||||
EditSessionBlockChangeDelegate.inject();
|
URL worldEditUrl = new URL("http://builds.enginehub.org/job/worldedit/9611/download/worldedit-bukkit-6.1.7-SNAPSHOT-dist.jar");
|
||||||
} else {
|
try (ReadableByteChannel rbc = Channels.newChannel(worldEditUrl.openStream())) {
|
||||||
Fawe.debug("====== INSTALL WORLDEDIT ======");
|
try (FileOutputStream fos = new FileOutputStream(output)) {
|
||||||
Fawe.debug("FAWE requires WorldEdit to function correctly");
|
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||||
Fawe.debug("Info: https://github.com/boy0001/FastAsyncWorldedit/releases/");
|
}
|
||||||
Fawe.debug("===============================");
|
}
|
||||||
|
Bukkit.getPluginManager().loadPlugin(output);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Fawe.debug("====== INSTALL WORLDEDIT ======");
|
||||||
|
Fawe.debug("FAWE requires WorldEdit to function correctly");
|
||||||
|
Fawe.debug("Info: https://github.com/boy0001/FastAsyncWorldedit/releases/");
|
||||||
|
Fawe.debug("===============================");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Fawe.setupInjector();
|
||||||
|
// Inject
|
||||||
|
EditSessionBlockChangeDelegate.inject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -239,7 +239,6 @@ public class Fawe {
|
|||||||
this.setupMemoryListener();
|
this.setupMemoryListener();
|
||||||
timer = new FaweTimer();
|
timer = new FaweTimer();
|
||||||
Fawe.this.IMP.setupVault();
|
Fawe.this.IMP.setupVault();
|
||||||
Commands.load(new File(this.IMP.getDirectory(), "commands.yml"));
|
|
||||||
|
|
||||||
// Delayed worldedit setup
|
// Delayed worldedit setup
|
||||||
TaskManager.IMP.later(new Runnable() {
|
TaskManager.IMP.later(new Runnable() {
|
||||||
@ -463,6 +462,7 @@ public class Fawe {
|
|||||||
debug(" - http://builds.enginehub.org/job/worldedit?branch=master");
|
debug(" - http://builds.enginehub.org/job/worldedit?branch=master");
|
||||||
debug("=======================================");
|
debug("=======================================");
|
||||||
}
|
}
|
||||||
|
Commands.load(new File(INSTANCE.IMP.getDirectory(), "commands.yml"));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
debug("====== FAWE FAILED TO INITIALIZE ======");
|
debug("====== FAWE FAILED TO INITIALIZE ======");
|
||||||
MainUtil.handleError(e, false);
|
MainUtil.handleError(e, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user