summaryrefslogtreecommitdiff
path: root/src/main/java/net/benjidial/nswp/Plugin.java
blob: 94c652e8c6e5754bb2c9fe66ff0eab307c604883 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package net.benjidial.nswp;

import net.benjidial.nswp.commands.*;

import org.bukkit.plugin.java.JavaPlugin;

import java.util.logging.Logger;
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());
      Database.createWBacks();
      Database.createTPATable();
    }
    catch (SQLException ex) {
      logger.severe("Database error (not enabling plugin):");
      ex.printStackTrace();
      return;
    }

    getCommand("wtpallow").setExecutor(new AllowTPA());
    getCommand("wdel").setExecutor(new DeleteWaypoint());
    getCommand("wtpdeny").setExecutor(new DenyTPA());
    getCommand("wlist").setExecutor(new ListWaypoints());
    getCommand("wrename").setExecutor(new RenameWaypoint());
    getCommand("wsave").setExecutor(new SaveWaypoint());
    getCommand("wtp").setExecutor(new TeleportToWaypoint());
    getCommand("wtpa").setExecutor(new TPA());
    getCommand("wback").setExecutor(new WaypointBack());

  }
}