Search in sources :

Example 6 with PlayerData

use of com.archyx.aureliumskills.data.PlayerData in project AureliumSkills by Archy-X.

the class SkillsCommand method onClaimItems.

@Subcommand("claimitems")
@CommandPermission("aureliumskills.claimitems")
public void onClaimItems(Player player) {
    PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
    Locale locale = Lang.getDefaultLanguage();
    if (playerData != null) {
        locale = playerData.getLocale();
    }
    if (playerData == null || playerData.getUnclaimedItems().size() == 0) {
        player.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.CLAIMITEMS_NO_ITEMS, locale));
        return;
    }
    UnclaimedItemsMenu.getInventory(plugin, playerData).open(player);
}
Also used : Locale(java.util.Locale) PlayerData(com.archyx.aureliumskills.data.PlayerData)

Example 7 with PlayerData

use of com.archyx.aureliumskills.data.PlayerData in project AureliumSkills by Archy-X.

the class AbilityProvider method getXp.

public double getXp(Player player, Source source, Ability ability) {
    PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
    if (playerData != null) {
        double output = plugin.getSourceManager().getXp(source);
        if (ability != null) {
            if (plugin.getAbilityManager().isEnabled(ability)) {
                double modifier = 1;
                modifier += plugin.getAbilityManager().getValue(ability, playerData.getAbilityLevel(ability)) / 100;
                output *= modifier;
            }
        }
        return output;
    }
    return 0.0;
}
Also used : PlayerData(com.archyx.aureliumskills.data.PlayerData)

Example 8 with PlayerData

use of com.archyx.aureliumskills.data.PlayerData in project AureliumSkills by Archy-X.

the class ManaCommand method onManaRemove.

@Subcommand("remove")
@CommandPermission("aureliumskills.mana.remove")
@CommandCompletion("@players")
@Description("Removes mana from a player")
public void onManaRemove(CommandSender sender, @Flags("other") Player player, double amount, @Default("false") boolean silent) {
    PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
    if (playerData == null)
        return;
    Locale locale = playerData.getLocale();
    if (amount >= 0) {
        if (playerData.getMana() - amount >= 0) {
            playerData.setMana(playerData.getMana() - amount);
            if (!silent) {
                sender.sendMessage(AureliumSkills.getPrefix(locale) + TextUtil.replace(Lang.getMessage(CommandMessage.MANA_REMOVE, locale), "{amount}", NumberUtil.format2(amount), "{player}", player.getName()));
            }
        } else {
            double removed = playerData.getMana();
            playerData.setMana(0);
            if (!silent) {
                sender.sendMessage(AureliumSkills.getPrefix(locale) + TextUtil.replace(Lang.getMessage(CommandMessage.MANA_REMOVE, locale), "{amount}", NumberUtil.format2(removed), "{player}", player.getName()));
            }
        }
    } else {
        if (!silent) {
            sender.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.MANA_AT_LEAST_ZERO, locale));
        }
    }
}
Also used : Locale(java.util.Locale) PlayerData(com.archyx.aureliumskills.data.PlayerData)

Example 9 with PlayerData

use of com.archyx.aureliumskills.data.PlayerData in project AureliumSkills by Archy-X.

the class ManaCommand method onManaSet.

@Subcommand("set")
@CommandPermission("aureliumskills.mana.set")
@CommandCompletion("@players @nothing false|true")
@Description("Sets the mana of player")
public void onManaSet(CommandSender sender, @Flags("other") Player player, double amount, @Default("true") boolean allowOverMax, @Default("false") boolean silent) {
    PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
    if (playerData == null)
        return;
    Locale locale = playerData.getLocale();
    if (amount >= 0) {
        if (allowOverMax && OptionL.getBoolean(Option.WISDOM_ALLOW_OVER_MAX_MANA)) {
            playerData.setMana(amount);
            if (!silent) {
                sender.sendMessage(AureliumSkills.getPrefix(locale) + TextUtil.replace(Lang.getMessage(CommandMessage.MANA_SET, locale), "{amount}", NumberUtil.format2(amount), "{player}", player.getName()));
            }
        } else {
            if (amount <= playerData.getMaxMana()) {
                playerData.setMana(amount);
                if (!silent) {
                    sender.sendMessage(AureliumSkills.getPrefix(locale) + TextUtil.replace(Lang.getMessage(CommandMessage.MANA_SET, locale), "{amount}", NumberUtil.format2(amount), "{player}", player.getName()));
                }
            } else {
                playerData.setMana(playerData.getMaxMana());
                if (!silent) {
                    sender.sendMessage(AureliumSkills.getPrefix(locale) + TextUtil.replace(Lang.getMessage(CommandMessage.MANA_SET, locale), "{amount}", NumberUtil.format2(playerData.getMaxMana()), "{player}", player.getName()));
                }
            }
        }
    } else {
        if (!silent) {
            sender.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.MANA_AT_LEAST_ZERO, locale));
        }
    }
}
Also used : Locale(java.util.Locale) PlayerData(com.archyx.aureliumskills.data.PlayerData)

Example 10 with PlayerData

use of com.archyx.aureliumskills.data.PlayerData in project AureliumSkills by Archy-X.

the class SkillLeveler method getXp.

public double getXp(Player player, double input) {
    PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
    if (playerData != null) {
        double output = input;
        if (ability != null) {
            if (plugin.getAbilityManager().isEnabled(ability)) {
                double modifier = 1;
                modifier += plugin.getAbilityManager().getValue(ability, playerData.getAbilityLevel(ability)) / 100;
                output *= modifier;
            }
        }
        return output;
    }
    return 0.0;
}
Also used : PlayerData(com.archyx.aureliumskills.data.PlayerData)

Aggregations

PlayerData (com.archyx.aureliumskills.data.PlayerData)111 Player (org.bukkit.entity.Player)54 EventHandler (org.bukkit.event.EventHandler)43 Locale (java.util.Locale)27 ItemStack (org.bukkit.inventory.ItemStack)25 Skill (com.archyx.aureliumskills.skills.Skill)15 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)10 Stat (com.archyx.aureliumskills.stats.Stat)9 AttributeInstance (org.bukkit.attribute.AttributeInstance)8 PlayerLootDropEvent (com.archyx.aureliumskills.api.event.PlayerLootDropEvent)7 StatModifier (com.archyx.aureliumskills.modifier.StatModifier)7 Material (org.bukkit.Material)7 LivingEntity (org.bukkit.entity.LivingEntity)7 KeyIntPair (com.archyx.aureliumskills.util.misc.KeyIntPair)6 AureliumSkills (com.archyx.aureliumskills.AureliumSkills)5 OptionL (com.archyx.aureliumskills.configuration.OptionL)5 AbilityData (com.archyx.aureliumskills.data.AbilityData)5 File (java.io.File)5 IOException (java.io.IOException)5 PlayerDataLoadEvent (com.archyx.aureliumskills.data.PlayerDataLoadEvent)4