Ejemplo n.º 1
0
  @Override
  public void onEnable() {
    PluginManager pm = Bukkit.getPluginManager();

    AccountsConfig config;
    try {
      config = getLoader().loadOrCreate("config.json", AccountsConfig.class);
    } catch (GsonLoadException exc) {
      getLogger().log(Level.SEVERE, "Unable to load config.json", exc);
      config = new AccountsConfig();
    }

    Accounts accounts = new EVAccounts(this, config);
    EthilVan.registerAccounts(accounts);

    Listener accountsListener = new AccountsListener(this);
    pm.registerEvents(accountsListener, this);

    ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
    protocolManager.addPacketListener(new NamePlatePacketListener(this));

    CommandsRegistration registration = new CommandsRegistration(this, Locale.FRANCE);
    registration.register(new AccountsCommands());

    Bukkit.getScheduler().runTaskTimer(this, this, 6000, 6000);
  }
Ejemplo n.º 2
0
  public void updateStats(Player player, boolean death) {
    AbstractAccount account = (AbstractAccount) EthilVan.getAccounts().get(player);
    account.setLastMinecraftVisit(currentTime());

    MinecraftStats stats = account.getStats();
    if (stats == null) {
      return;
    }

    stats.updateMaxLevel(player.getLevel());
    if (death) {
      stats.updateDeath();
    }
    getDatabase().save(stats);
  }