コード例 #1
0
  /**
   * Modifies an experience gain using skill modifiers, global rate and perks
   *
   * @param skillType Skill being used
   * @param xp Experience amount to process
   * @return Modified experience
   */
  private float modifyXpGain(SkillType skillType, float xp) {
    if (player.getGameMode() == GameMode.CREATIVE
        || (skillType.getMaxLevel() <= getSkillLevel(skillType))
        || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) {
      return 0;
    }

    xp =
        (float)
            (xp
                / skillType.getXpModifier()
                * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());

    if (Config.getInstance().getToolModsEnabled()) {
      CustomTool tool = mcMMO.getModManager().getTool(player.getItemInHand());

      if (tool != null) {
        xp *= tool.getXpMultiplier();
      }
    }

    return PerksUtils.handleXpPerks(player, xp, skillType);
  }
コード例 #2
0
 private boolean hasReachedLevelCap(SkillType skill) {
   return (skill.getMaxLevel() < getSkillLevel(skill) + 1)
       || (Config.getInstance().getPowerLevelCap() < getPowerLevel() + 1);
 }