/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

  1. package info.luciddevelopment.lalts;
  2. import java.util.logging.Logger;
  3. import lib.PatPeter.SQLibrary.*;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandSender;
  6. import org.bukkit.command.ConsoleCommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9. public class MainClass extends JavaPlugin {
  10. public static ConsoleCommandSender ccs = null;
  11. public static final Logger log = Logger.getLogger("Minecraft");
  12. public static SQLite sqlite;
  13. public static final String sqliteDir = "plugins/LucidAlts/";
  14. public static final String sqliteFName = "alts";
  15. public static final String sqlPrefix = "[LucidAlts][SQLite] ";
  16. public static String dbTable = "Logged";
  17. public static String dbName = "Alts";
  18. public static AltWrapper wrapper;
  19. public void onEnable() {
  20. this.saveConfig();
  21. ccs = this.getServer().getConsoleSender();
  22. sqlite = new SQLite(log, sqlPrefix, sqliteDir, sqliteFName);
  23. if (sqlite.open()) {
  24. log.info("SQLite initialized!");
  25. }
  26. wrapper = new AltWrapper(this, sqlite);
  27. this.getServer().getPluginManager().registerEvents(new MainEvents(this), this);
  28. log.info("LucidAlts is programmed and maintained by Lucid Development. See:LucidDevelopment.info");
  29. }
  30. public void onDisable() {
  31. sqlite.close();
  32. log.info("Thank you for choosing LucidDevelopment!");
  33. }
  34. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  35. return Commands.Process(sender, cmd, label, args);
  36. }
  37. public void alertOps(String msg) {
  38. for (Player p : this.getServer().getOnlinePlayers()) {
  39. if (p.isOp())
  40. p.sendMessage(msg);
  41. }
  42. }
  43. public void alertPerm(String msg, String perm) {
  44. for (Player p : this.getServer().getOnlinePlayers()) {
  45. if (p.hasPermission(perm))
  46. p.sendMessage(msg);
  47. }
  48. }
  49. }