Remove some unused zcore files.
This commit is contained in:
		@@ -8,7 +8,6 @@ import org.bukkit.plugin.java.JavaPlugin;
 | 
			
		||||
 | 
			
		||||
import com.massivecraft.factions.zcore.persist.EM;
 | 
			
		||||
import com.massivecraft.factions.zcore.persist.SaveTask;
 | 
			
		||||
import com.massivecraft.factions.zcore.util.LibLoader;
 | 
			
		||||
import com.massivecraft.factions.zcore.util.PermUtil;
 | 
			
		||||
import com.massivecraft.factions.zcore.util.Persist;
 | 
			
		||||
import com.massivecraft.mcore.util.Txt;
 | 
			
		||||
@@ -20,7 +19,6 @@ public abstract class MPlugin extends JavaPlugin
 | 
			
		||||
{
 | 
			
		||||
	// Some utils
 | 
			
		||||
	public Persist persist;
 | 
			
		||||
	public LibLoader lib;
 | 
			
		||||
	public PermUtil perm;
 | 
			
		||||
	
 | 
			
		||||
	// Persist related
 | 
			
		||||
@@ -49,7 +47,6 @@ public abstract class MPlugin extends JavaPlugin
 | 
			
		||||
		// Create Utility Instances
 | 
			
		||||
		this.perm = new PermUtil(this);
 | 
			
		||||
		this.persist = new Persist(this);
 | 
			
		||||
		this.lib = new LibLoader(this);
 | 
			
		||||
 | 
			
		||||
		// GSON 2.1 is now embedded in CraftBukkit, used by the auto-updater: https://github.com/Bukkit/CraftBukkit/commit/0ed1d1fdbb1e0bc09a70bc7bfdf40c1de8411665
 | 
			
		||||
//		if ( ! lib.require("gson.jar", "http://search.maven.org/remotecontent?filepath=com/google/code/gson/gson/2.1/gson-2.1.jar")) return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,51 +0,0 @@
 | 
			
		||||
package com.massivecraft.factions.zcore.util;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.lang.reflect.Method;
 | 
			
		||||
import java.net.MalformedURLException;
 | 
			
		||||
import java.net.URL;
 | 
			
		||||
import java.net.URLClassLoader;
 | 
			
		||||
 | 
			
		||||
public class ClassLoadHack {
 | 
			
		||||
	
 | 
			
		||||
	private static URLClassLoader sysloader = (URLClassLoader)ClassLoader.getSystemClassLoader();
 | 
			
		||||
	
 | 
			
		||||
	public static boolean load(String filename)
 | 
			
		||||
	{
 | 
			
		||||
		return load(new File(filename));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static boolean load(File file)
 | 
			
		||||
	{
 | 
			
		||||
		try
 | 
			
		||||
		{
 | 
			
		||||
			return load(file.toURI().toURL());
 | 
			
		||||
		} 
 | 
			
		||||
		catch (MalformedURLException e)
 | 
			
		||||
		{
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static boolean load(URL url) 
 | 
			
		||||
	{
 | 
			
		||||
		// If the file already is loaded we can skip it
 | 
			
		||||
		for (URL otherUrl : sysloader.getURLs())
 | 
			
		||||
		{
 | 
			
		||||
			if (otherUrl.sameFile(url)) return true;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		try
 | 
			
		||||
		{
 | 
			
		||||
			Method addURLMethod = URLClassLoader.class.getDeclaredMethod("addURL", new Class[]{ URL.class });
 | 
			
		||||
			addURLMethod.setAccessible(true);
 | 
			
		||||
			addURLMethod.invoke(sysloader, new Object[]{ url });
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		catch (Exception e)
 | 
			
		||||
		{
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
@@ -1,51 +0,0 @@
 | 
			
		||||
package com.massivecraft.factions.zcore.util;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
 | 
			
		||||
import com.massivecraft.factions.zcore.MPlugin;
 | 
			
		||||
import com.massivecraft.mcore.util.DiscUtil;
 | 
			
		||||
 | 
			
		||||
public class LibLoader
 | 
			
		||||
{	
 | 
			
		||||
	MPlugin p;
 | 
			
		||||
	public LibLoader(MPlugin p)
 | 
			
		||||
	{
 | 
			
		||||
		this.p = p;
 | 
			
		||||
		new File("./lib").mkdirs();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public boolean require(String filename, String url)
 | 
			
		||||
	{
 | 
			
		||||
		if ( ! include(filename, url))
 | 
			
		||||
		{
 | 
			
		||||
			p.log("Failed to load the required library "+filename);
 | 
			
		||||
			p.suicide();
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public boolean include (String filename, String url)
 | 
			
		||||
	{
 | 
			
		||||
		File file = getFile(filename);
 | 
			
		||||
		if ( ! file.exists())
 | 
			
		||||
		{
 | 
			
		||||
			p.log("Downloading library "+filename);
 | 
			
		||||
			if ( ! DiscUtil.downloadUrl(url, file))
 | 
			
		||||
			{
 | 
			
		||||
				p.log("Failed to download "+filename);
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return ClassLoadHack.load(file);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static File getFile(String filename)
 | 
			
		||||
	{
 | 
			
		||||
		return new File("./lib/"+filename);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -1,39 +0,0 @@
 | 
			
		||||
package com.massivecraft.factions.zcore.util;
 | 
			
		||||
 | 
			
		||||
import java.io.File;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
 | 
			
		||||
public class WorldUtil
 | 
			
		||||
{
 | 
			
		||||
	// Previously We had crappy support for multiworld management.
 | 
			
		||||
	// This should however be handled by an external plugin!
 | 
			
		||||
	/*public static boolean load(String name) {
 | 
			
		||||
		if (isWorldLoaded(name)) {
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if ( ! doesWorldExist(name)) {
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		Environment env = WorldEnv.get(name);
 | 
			
		||||
		if (env == null) {
 | 
			
		||||
			P.log(Level.WARNING, "Failed to load world. Environment was unknown.");
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		P.p.getServer().createWorld(name, env);
 | 
			
		||||
		return true;
 | 
			
		||||
	}*/
 | 
			
		||||
	
 | 
			
		||||
	public static boolean isWorldLoaded(String name)
 | 
			
		||||
	{
 | 
			
		||||
		return Bukkit.getServer().getWorld(name) != null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static boolean doesWorldExist(String name)
 | 
			
		||||
	{
 | 
			
		||||
		return new File(name, "level.dat").exists();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user