This commit is contained in:
Fangoboyo 2022-06-08 16:38:58 -07:00
parent 62c0ef543f
commit 6fff926ba2
5 changed files with 3 additions and 7 deletions

View File

@ -7,13 +7,8 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.io.IOException;
public class Main extends JavaPlugin {
private static Plugin instance = null;
public static Plugin getInstance() {
return instance;
}
@Override
public void onEnable() {
instance = this;
try {
Updater.UpdateInstaller();
} catch (IOException e) {

View File

@ -8,6 +8,7 @@ import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import static org.bukkit.Bukkit.getServer;
import tech.nully.PluginInstaller.Main;
public class Updater {
public static void UpdateInstaller() throws IOException {
@ -15,7 +16,7 @@ public class Updater {
.toURL().openStream();
File f = new File(Main.getInstance().getDataFolder().getParent() + "/EaglerPluginInstaller.jar");
Files.copy(in, f.toPath(), StandardCopyOption.REPLACE_EXISTING);
getServer().getPluginManager().disablePlugin(tech.nully.PluginInstaller.Main.getInstance());
getServer().getPluginManager().enablePlugin(tech.nully.PluginInstaller.Main.getInstance());
getServer().getPluginManager().disablePlugin(Main.getInstance());
getServer().getPluginManager().enablePlugin(Main.getInstance());
}
}