summaryrefslogtreecommitdiff
path: root/src/com/encrox/cplot/Core.java
diff options
context:
space:
mode:
authorLeonard Kugis <leonard@kug.is>2022-04-25 18:33:18 +0200
committerLeonard Kugis <leonard@kug.is>2022-04-25 18:33:18 +0200
commit54b81b2dccd7cfa58e5bd5fe95a158126115381c (patch)
tree54496832d24749b710880bb342e514739b841155 /src/com/encrox/cplot/Core.java
Initial commitHEADmaster
Diffstat (limited to 'src/com/encrox/cplot/Core.java')
-rwxr-xr-xsrc/com/encrox/cplot/Core.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/com/encrox/cplot/Core.java b/src/com/encrox/cplot/Core.java
new file mode 100755
index 0000000..4d361c7
--- /dev/null
+++ b/src/com/encrox/cplot/Core.java
@@ -0,0 +1,65 @@
+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.");
+ }
+
+}