1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Fixed CSCoreLibLoader

This commit is contained in:
TheBusyBiscuit 2017-03-24 14:04:38 +01:00
parent f760dec589
commit fc00c5356c
2 changed files with 156 additions and 153 deletions

View File

@ -1,4 +1,4 @@
package me.mrCookieSlime.CSCoreLibSetup; package me.mrCookieSlime.Slimefun.CSCoreLibSetup;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -35,18 +35,17 @@ public class CSCoreLibLoader {
if (plugin.getServer().getPluginManager().isPluginEnabled("CS-CoreLib")) return true; if (plugin.getServer().getPluginManager().isPluginEnabled("CS-CoreLib")) return true;
else { else {
System.err.println(" "); System.err.println(" ");
System.err.println("#################### - FATAL ERROR - ####################"); System.err.println("#################### - INFO - ####################");
System.err.println(" "); System.err.println(" ");
System.err.println(plugin.getName() + " could not be properly installed!"); System.err.println(plugin.getName() + " could not be loaded.");
System.err.println("It appears that you have not installed CS-CoreLib"); System.err.println("It appears that you have not installed CS-CoreLib");
System.err.println("And because of that, CS-CoreLib is now going to be"); System.err.println("Your Server will now try to download and install");
System.err.println("downloaded and installed."); System.err.println("CS-CoreLib for you.");
System.err.println("But for the time being " + plugin.getName() + " will remain disabled"); System.err.println("You will be asked to restart your Server when it's finished.");
System.err.println("After the installation process has finished,"); System.err.println("If this somehow fails, please download and install CS-CoreLib manually:");
System.out.println("you will be asked to restart your Server."); System.err.println("https://dev.bukkit.org/projects/cs-corelib");
System.err.println("- mrCookieSlime");
System.err.println(" "); System.err.println(" ");
System.err.println("#################### - FATAL ERROR - ####################"); System.err.println("#################### - INFO - ####################");
System.err.println(" "); System.err.println(" ");
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@ -74,11 +73,13 @@ public class CSCoreLibLoader {
return true; return true;
} catch (IOException e) { } catch (IOException e) {
System.err.println(" "); System.err.println(" ");
System.err.println("#################### - FATAL ERROR - ####################"); System.err.println("#################### - WARNING - ####################");
System.err.println(" "); System.err.println(" ");
System.err.println("Could not connect to BukkitDev, is it down?"); System.err.println("Could not connect to BukkitDev.");
System.err.println("Please download & install CS-CoreLib manually:");
System.err.println("https://dev.bukkit.org/projects/cs-corelib");
System.err.println(" "); System.err.println(" ");
System.err.println("#################### - FATAL ERROR - ####################"); System.err.println("#################### - WARNING - ####################");
System.err.println(" "); System.err.println(" ");
return false; return false;
} }
@ -105,7 +106,7 @@ public class CSCoreLibLoader {
break; break;
} }
return connection.getURL(); return new URL(connection.getURL().toString().replaceAll(" ", "%20"));
} }
private void install() { private void install() {
@ -122,23 +123,25 @@ public class CSCoreLibLoader {
} }
} catch (Exception ex) { } catch (Exception ex) {
System.err.println(" "); System.err.println(" ");
System.err.println("#################### - FATAL ERROR - ####################"); System.err.println("#################### - WARNING - ####################");
System.err.println(" "); System.err.println(" ");
System.err.println("Could not download CS-CoreLib"); System.err.println("Failed to download CS-CoreLib");
System.err.println("Please download & install CS-CoreLib manually:");
System.err.println("https://dev.bukkit.org/projects/cs-corelib");
System.err.println(" "); System.err.println(" ");
System.err.println("#################### - FATAL ERROR - ####################"); System.err.println("#################### - WARNING - ####################");
System.err.println(" "); System.err.println(" ");
} finally { } finally {
try { try {
if (input != null) input.close(); if (input != null) input.close();
if (output != null) output.close(); if (output != null) output.close();
System.err.println(" "); System.err.println(" ");
System.err.println("#################### - WARNING - ####################"); System.err.println("#################### - INFO - ####################");
System.err.println(" "); System.err.println(" ");
System.err.println("Please restart your Server to finish the Installation"); System.err.println("Please restart your Server to finish the Installation");
System.err.println("of " + plugin.getName() + " and CS-CoreLib"); System.err.println("of " + plugin.getName() + " and CS-CoreLib");
System.err.println(" "); System.err.println(" ");
System.err.println("#################### - WARNING - ####################"); System.err.println("#################### - INFO - ####################");
System.err.println(" "); System.err.println(" ");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -15,9 +15,6 @@ import java.util.Map;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.AutoEnchanter;
import net.coreprotect.CoreProtect;
import net.coreprotect.CoreProtectAPI;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -39,8 +36,8 @@ import me.mrCookieSlime.CSCoreLibPlugin.PluginUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config; import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Clock; import me.mrCookieSlime.CSCoreLibPlugin.general.Clock;
import me.mrCookieSlime.CSCoreLibPlugin.general.Reflection.ReflectionUtils; import me.mrCookieSlime.CSCoreLibPlugin.general.Reflection.ReflectionUtils;
import me.mrCookieSlime.CSCoreLibSetup.CSCoreLibLoader;
import me.mrCookieSlime.Slimefun.AncientAltar.Pedestals; import me.mrCookieSlime.Slimefun.AncientAltar.Pedestals;
import me.mrCookieSlime.Slimefun.CSCoreLibSetup.CSCoreLibLoader;
import me.mrCookieSlime.Slimefun.Commands.SlimefunCommand; import me.mrCookieSlime.Slimefun.Commands.SlimefunCommand;
import me.mrCookieSlime.Slimefun.Commands.SlimefunTabCompleter; import me.mrCookieSlime.Slimefun.Commands.SlimefunTabCompleter;
import me.mrCookieSlime.Slimefun.GEO.OreGenSystem; import me.mrCookieSlime.Slimefun.GEO.OreGenSystem;
@ -55,6 +52,7 @@ import me.mrCookieSlime.Slimefun.Objects.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunArmorPiece; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunArmorPiece;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.AutoEnchanter;
import me.mrCookieSlime.Slimefun.Setup.Files; import me.mrCookieSlime.Slimefun.Setup.Files;
import me.mrCookieSlime.Slimefun.Setup.Messages; import me.mrCookieSlime.Slimefun.Setup.Messages;
import me.mrCookieSlime.Slimefun.Setup.MiscSetup; import me.mrCookieSlime.Slimefun.Setup.MiscSetup;
@ -89,6 +87,8 @@ import me.mrCookieSlime.Slimefun.listeners.ItemListener;
import me.mrCookieSlime.Slimefun.listeners.TalismanListener; import me.mrCookieSlime.Slimefun.listeners.TalismanListener;
import me.mrCookieSlime.Slimefun.listeners.TeleporterListener; import me.mrCookieSlime.Slimefun.listeners.TeleporterListener;
import me.mrCookieSlime.Slimefun.listeners.ToolListener; import me.mrCookieSlime.Slimefun.listeners.ToolListener;
import net.coreprotect.CoreProtect;
import net.coreprotect.CoreProtectAPI;
public class SlimefunStartup extends JavaPlugin { public class SlimefunStartup extends JavaPlugin {