package com.encrox.cplot; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Properties; import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; import com.earth2me.essentials.api.Economy; import com.encrox.cplot.command.Gs; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; public class Core extends JavaPlugin { public static Logger logger; public static PluginDescriptionFile pdf; public static WorldGuardPlugin wg; public static WorldEditPlugin we; public static Properties p; public void onEnable() { pdf = getDescription(); logger = Logger.getLogger("Minecraft"); if(setupMyself() && setupWorldGuard()) { getCommand("gs").setExecutor(new Gs()); logger.info(pdf.getName() + " " + pdf.getVersion() + " has been enabled."); } else { logger.info(pdf.getName() + " " + pdf.getVersion() + " has been disabled."); } } public boolean setupWorldGuard() { wg = (WorldGuardPlugin) Bukkit.getPluginManager().getPlugin("WorldGuard"); we = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"); return (wg != null) && (we != null); } public boolean setupMyself() { if(!this.getDataFolder().exists()) this.getDataFolder().mkdirs(); p = new Properties(); try { p.load(new FileReader(new File(this.getDataFolder() + "/config.properties"))); } catch (FileNotFoundException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } return true; } public void onDisable() { logger.info(pdf.getName() + " " + pdf.getVersion() + " has been disabled."); } }