Exemplo n.º 1
0
  /**
   * Initializes a new account data representation for a player.
   *
   * @param player player to store the data for
   */
  public PlayerData(OfflinePlayer player, boolean init) {
    this.player = player;
    this.skillBar = new PlayerSkillBar(this);
    this.combos = new PlayerCombos(this);
    this.init = SkillAPI.isLoaded() && init;
    this.scheme = "default";
    for (String group : SkillAPI.getGroups()) {
      GroupSettings settings = SkillAPI.getSettings().getGroupSettings(group);
      RPGClass rpgClass = settings.getDefault();

      if (rpgClass != null && settings.getPermission() == null) {
        setClass(rpgClass);
      }
    }
  }
Exemplo n.º 2
0
  private void autoLevel(Skill skill) {
    PlayerSkill data = skills.get(skill.getKey());
    if (data == null) return;

    if (!SkillAPI.isLoaded()) return;

    int lastLevel = data.getLevel();
    while (data.getData().canAutoLevel()
        && !data.isMaxed()
        && data.getLevelReq() <= data.getPlayerClass().getLevel()) {
      upgradeSkill(skill);
      if (lastLevel == data.getLevel()) {
        break;
      }
      lastLevel++;
    }
  }