コード例 #1
0
ファイル: TurfPoints.java プロジェクト: Gearworks/TurfPoints
  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
ファイル: TurfPoints.java プロジェクト: Gearworks/TurfPoints
 @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
ファイル: TurfPoints.java プロジェクト: Gearworks/TurfPoints
 @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);
 }