From a9e99c7cd7f540720eaca58d2e5502e6de618560 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 22 Aug 2018 04:18:10 +1000 Subject: [PATCH] Load dummy jar on first launch --- .../com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 51a5b2fed..98fa9247b 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -47,9 +47,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.*; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPluginLoader; @@ -238,7 +236,14 @@ public class WorldEditPlugin extends JavaPlugin //implements TabCompleter for (File file : pluginsFolder.listFiles()) { if (file.length() == 1073) return; } - MainUtil.copyFile(MainUtil.getJarFile(), "DummyFawe.src", pluginsFolder, "DummyFawe.jar"); + File dummy = MainUtil.copyFile(MainUtil.getJarFile(), "DummyFawe.src", pluginsFolder, "DummyFawe.jar"); + if (dummy != null && dummy.exists()) { + try { + Bukkit.getPluginManager().loadPlugin(dummy); + } catch (Throwable e) { + e.printStackTrace(); + } + } log.log(Level.INFO, "Please restart the server if you have any plugins which depend on FAWE."); } }