summaryrefslogtreecommitdiff
path: root/src/main/java/net/benjidial/nswp/Plugin.java
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2022-11-12 13:39:07 -0500
committerBenji Dial <benji6283@gmail.com>2022-11-12 13:39:07 -0500
commitda7924881ab14e4580ae6c56dbdf8346dbf2a267 (patch)
tree3631cbb3a0eaa6c57c6b8476d130472561dc16c6 /src/main/java/net/benjidial/nswp/Plugin.java
downloadnew-simple-waypoints-da7924881ab14e4580ae6c56dbdf8346dbf2a267.tar.gz
first commit for new version
Diffstat (limited to 'src/main/java/net/benjidial/nswp/Plugin.java')
-rw-r--r--src/main/java/net/benjidial/nswp/Plugin.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/net/benjidial/nswp/Plugin.java b/src/main/java/net/benjidial/nswp/Plugin.java
new file mode 100644
index 0000000..9a46cb6
--- /dev/null
+++ b/src/main/java/net/benjidial/nswp/Plugin.java
@@ -0,0 +1,34 @@
+package net.benjidial.nswp;
+
+import net.benjidial.nswp.commands.*;
+
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import java.sql.SQLException;
+import java.io.File;
+
+public class Plugin extends JavaPlugin {
+ public static Logger logger;
+
+ public void onEnable() {
+ logger = getLogger();
+ getDataFolder().mkdirs();
+
+ try {
+ Database.connect(new File(getDataFolder(), "database.db").getPath());
+ }
+ catch (SQLException ex) {
+ logger.log(Level.SEVERE, "Database error: (not enabling plugin)");
+ ex.printStackTrace();
+ return;
+ }
+
+ getCommand("wlist").setExecutor(new ListWaypoints());
+ getCommand("wsave").setExecutor(new SaveWaypoint());
+ getCommand("wtp" ).setExecutor(new TeleportToWaypoint());
+ getCommand("wdel" ).setExecutor(new DeleteWaypoint());
+ getCommand("wback").setExecutor(new WaypointBack());
+ }
+}