/src/info/luciddevelopment/lalts/MainClass.java
https://bitbucket.org/LucidDevelopment/lucidalts · Java · 64 lines · 49 code · 15 blank · 0 comment · 5 complexity · ea0071c4b80ee2517f93dc6ff8da9be1 MD5 · raw file
- package info.luciddevelopment.lalts;
- import java.util.logging.Logger;
- import lib.PatPeter.SQLibrary.*;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.command.ConsoleCommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- public class MainClass extends JavaPlugin {
-
- public static ConsoleCommandSender ccs = null;
- public static final Logger log = Logger.getLogger("Minecraft");
- public static SQLite sqlite;
-
- public static final String sqliteDir = "plugins/LucidAlts/";
- public static final String sqliteFName = "alts";
- public static final String sqlPrefix = "[LucidAlts][SQLite] ";
- public static String dbTable = "Logged";
- public static String dbName = "Alts";
-
- public static AltWrapper wrapper;
-
- public void onEnable() {
- this.saveConfig();
-
- ccs = this.getServer().getConsoleSender();
- sqlite = new SQLite(log, sqlPrefix, sqliteDir, sqliteFName);
- if (sqlite.open()) {
- log.info("SQLite initialized!");
- }
-
- wrapper = new AltWrapper(this, sqlite);
-
- this.getServer().getPluginManager().registerEvents(new MainEvents(this), this);
- log.info("LucidAlts is programmed and maintained by Lucid Development. See:LucidDevelopment.info");
- }
-
- public void onDisable() {
- sqlite.close();
- log.info("Thank you for choosing LucidDevelopment!");
- }
-
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- return Commands.Process(sender, cmd, label, args);
- }
-
- public void alertOps(String msg) {
- for (Player p : this.getServer().getOnlinePlayers()) {
- if (p.isOp())
- p.sendMessage(msg);
- }
- }
-
- public void alertPerm(String msg, String perm) {
- for (Player p : this.getServer().getOnlinePlayers()) {
- if (p.hasPermission(perm))
- p.sendMessage(msg);
- }
- }
- }