Exemplo n.º 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);
    }
  }
Exemplo n.º 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));
 }
Exemplo n.º 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);
 }