mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-01 17:36:45 +01:00
Load WorldEdit onEnable
as otherwise it doesn't work
This commit is contained in:
parent
b1835f0998
commit
6b422582a6
@ -48,6 +48,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
|
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
|
||||||
@ -57,26 +58,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
@Getter private static WorldEdit worldEdit;
|
@Getter private static WorldEdit worldEdit;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Disable AWE as otherwise both fail to load
|
|
||||||
PluginManager manager = Bukkit.getPluginManager();
|
|
||||||
try {
|
try {
|
||||||
Settings.load(new File("plugins/PlotSquared/config/settings.yml"));
|
Settings.load(new File("plugins/PlotSquared/config/settings.yml"));
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {}
|
||||||
}
|
|
||||||
|
|
||||||
// Force WorldEdit to load
|
|
||||||
try {
|
|
||||||
System.out.println("[P2] Force loading WorldEdit");
|
|
||||||
if (!manager.isPluginEnabled("WorldEdit")) {
|
|
||||||
manager.enablePlugin(WorldEditPlugin.getPlugin(WorldEditPlugin.class));
|
|
||||||
}
|
|
||||||
System.out.println("[P2] Testing platform capabilities");
|
|
||||||
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS);
|
|
||||||
} catch (final Throwable throwable) {
|
|
||||||
throw new IllegalStateException(
|
|
||||||
"Failed to force load WorldEdit. Road schematics will fail to generate",
|
|
||||||
throwable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final LegacyMappings legacyMappings = new BukkitLegacyMappings();
|
private final LegacyMappings legacyMappings = new BukkitLegacyMappings();
|
||||||
@ -114,7 +98,26 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
return Bukkit.getVersion();
|
return Bukkit.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
try {
|
||||||
|
PluginManager manager = Bukkit.getPluginManager();
|
||||||
|
System.out.println("[P2] Force loading WorldEdit");
|
||||||
|
Plugin plugin = manager.getPlugin("WorldEdit");
|
||||||
|
if (!manager.isPluginEnabled("WorldEdit")) {
|
||||||
|
manager.enablePlugin(WorldEditPlugin.getPlugin(WorldEditPlugin.class));
|
||||||
|
}
|
||||||
|
System.out.println("[P2] Testing platform capabilities");
|
||||||
|
WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS);
|
||||||
|
} catch (final Throwable throwable) {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"Failed to force load WorldEdit. Road schematics will fail to generate",
|
||||||
|
throwable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override public void onEnable() {
|
@Override public void onEnable() {
|
||||||
|
|
||||||
|
|
||||||
this.pluginName = getDescription().getName();
|
this.pluginName = getDescription().getName();
|
||||||
getServer().getName();
|
getServer().getName();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user