示例#1
0
  /**
   * Resets the class data for the owner under the given group. This will remove the profession
   * entirely, leaving no remaining data until the player professes again to a starting class.
   *
   * @param group group to reset
   */
  public void reset(String group) {
    stopPassives(getPlayer());
    clearBonuses();
    PlayerClass playerClass = classes.remove(group);
    if (playerClass != null) {
      // Remove skills
      RPGClass data = playerClass.getData();
      for (Skill skill : data.getSkills()) {
        skills.remove(skill.getName());
        combos.removeSkill(skill);
      }

      // Update GUI features
      if (getPlayer() != null) {
        ClassBoardManager.clear(new VersionPlayer(getPlayer()));
      }

      // Call the event
      Bukkit.getPluginManager().callEvent(new PlayerClassChangeEvent(playerClass, data, null));
    }

    // Restore default class if applicable
    GroupSettings settings = SkillAPI.getSettings().getGroupSettings(group);
    RPGClass rpgClass = settings.getDefault();
    if (rpgClass != null && settings.getPermission() == null) {
      setClass(rpgClass);
    }
    updateHealthAndMana(player.getPlayer());
  }
示例#2
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);
      }
    }
  }