示例#1
0
  public void onEnable() {
    databaseManager = new DatabaseManager();

    if (databaseManager.getConnection() == null) {
      Messaging.severe("Disabling dicks");
      getServer().getPluginManager().disablePlugin(this);
    }

    playerRegistry = new PlayerRegistry();
    new PlayerListener();

    getServer().getPluginManager().registerEvents(this, this);

    getCommand("givecredits").setExecutor(new CmdGiveCredits());
    getCommand("givepoints").setExecutor(new CmdGivePoints());
    getCommand("checkmypoints").setExecutor(new CmdCheckPoints());
    getCommand("checkmycredits").setExecutor(new CmdCheckCredits());
    getCommand("verify").setExecutor(new CmdVerify());

    Bukkit.getScheduler().runTaskTimer(this, databaseManager.getConsumer(), 120L, 120L);

    if (!setupPermissions()) {
      Messaging.severe("Unable to hook into permissions, disabling plugin...");
      Bukkit.getPluginManager().disablePlugin(this);
    }
  }
示例#2
0
 @EventHandler
 public void onPlayerJoin(final PlayerJoinEvent event) {
   final LocalPlayer localPlayer =
       playerRegistry.register(event.getPlayer(), new LocalPlayer(event.getPlayer()));
   databaseManager.getConsumer().queueQuery(new QueryOnline(localPlayer));
 }
示例#3
0
 @EventHandler
 public void onPlayerDisconnect(final PlayerQuitEvent event) {
   final LocalPlayer localPlayer = playerRegistry.getPlayer(event.getPlayer());
   databaseManager.getConsumer().queueQuery(new QueryOffline(localPlayer));
   playerRegistry.unregister(event.getPlayer(), localPlayer);
 }