use of com.archyx.aureliumskills.data.PlayerData in project AureliumSkills by Archy-X.
the class AbilityManager method sendMessage.
public void sendMessage(Player player, String message) {
if (OptionL.getBoolean(Option.ACTION_BAR_ABILITY) && OptionL.getBoolean(Option.ACTION_BAR_ENABLED)) {
plugin.getActionBar().sendAbilityActionBar(player, message);
} else {
PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
if (playerData == null)
return;
player.sendMessage(AureliumSkills.getPrefix(playerData.getLocale()) + message);
}
}
use of com.archyx.aureliumskills.data.PlayerData in project AureliumSkills by Archy-X.
the class SkillsCommand method onSkillSetlevel.
@Subcommand("skill setlevel")
@CommandCompletion("@players @skills")
@CommandPermission("aureliumskills.skill.setlevel")
@Description("Sets a specific skill to a level for a player.")
public void onSkillSetlevel(CommandSender sender, @Flags("other") Player player, Skill skill, int level) {
Locale locale = plugin.getLang().getLocale(sender);
if (OptionL.isEnabled(skill)) {
if (level > 0) {
PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
if (playerData == null)
return;
int oldLevel = playerData.getSkillLevel(skill);
playerData.setSkillLevel(skill, level);
playerData.setSkillXp(skill, 0);
plugin.getLeveler().updateStats(player);
plugin.getLeveler().updatePermissions(player);
plugin.getLeveler().applyRevertCommands(player, skill, oldLevel, level);
plugin.getLeveler().applyLevelUpCommands(player, skill, oldLevel, level);
// Reload items and armor to check for newly met requirements
this.plugin.getModifierManager().reloadPlayer(player);
sender.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.SKILL_SETLEVEL_SET, locale).replace("{skill}", skill.getDisplayName(locale)).replace("{level}", String.valueOf(level)).replace("{player}", player.getName()));
} else {
sender.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.SKILL_SETLEVEL_AT_LEAST_ONE, locale));
}
} else {
sender.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.UNKNOWN_SKILL, locale));
}
}
use of com.archyx.aureliumskills.data.PlayerData in project AureliumSkills by Archy-X.
the class SkillsCommand method onRemove.
@Subcommand("modifier remove")
@CommandPermission("aureliumskills.modifier.remove")
@CommandCompletion("@players @modifiers true")
@Description("Removes a specific stat modifier from a player.")
public void onRemove(CommandSender sender, @Flags("other") Player player, String name, @Default("false") boolean silent) {
Locale locale = plugin.getLang().getLocale(sender);
PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
if (playerData != null) {
if (playerData.removeStatModifier(name)) {
if (!silent) {
sender.sendMessage(AureliumSkills.getPrefix(locale) + StatModifier.applyPlaceholders(Lang.getMessage(CommandMessage.MODIFIER_REMOVE_REMOVED, locale), name, player));
}
} else {
if (!silent) {
sender.sendMessage(AureliumSkills.getPrefix(locale) + StatModifier.applyPlaceholders(Lang.getMessage(CommandMessage.MODIFIER_REMOVE_NOT_FOUND, locale), name, player));
}
}
} else {
if (!silent) {
sender.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.NO_PROFILE, locale));
}
}
}
use of com.archyx.aureliumskills.data.PlayerData in project AureliumSkills by Archy-X.
the class SkillsCommand method onAdd.
@Subcommand("modifier add")
@CommandPermission("aureliumskills.modifier.add")
@CommandCompletion("@players @stats @nothing @nothing true")
@Description("Adds a stat modifier to a player.")
public void onAdd(CommandSender sender, @Flags("other") Player player, Stat stat, String name, double value, @Default("false") boolean silent) {
Locale locale = plugin.getLang().getLocale(sender);
PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
if (playerData != null) {
StatModifier modifier = new StatModifier(name, stat, value);
if (!playerData.getStatModifiers().containsKey(name)) {
playerData.addStatModifier(modifier);
if (!silent) {
sender.sendMessage(AureliumSkills.getPrefix(locale) + StatModifier.applyPlaceholders(Lang.getMessage(CommandMessage.MODIFIER_ADD_ADDED, locale), modifier, player, locale));
}
} else {
if (!silent) {
sender.sendMessage(AureliumSkills.getPrefix(locale) + StatModifier.applyPlaceholders(Lang.getMessage(CommandMessage.MODIFIER_ADD_ALREADY_EXISTS, locale), modifier, player, locale));
}
}
} else {
if (!silent) {
sender.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.NO_PROFILE, locale));
}
}
}
use of com.archyx.aureliumskills.data.PlayerData in project AureliumSkills by Archy-X.
the class SkillsCommand method onSkillReset.
@Subcommand("skill reset")
@CommandCompletion("@players @skills")
@CommandPermission("aureliumskills.skill.reset")
@Description("Resets all skills or a specific skill to level 1 for a player.")
public void onSkillReset(CommandSender sender, @Flags("other") Player player, @Optional Skill skill) {
Locale locale = plugin.getLang().getLocale(sender);
if (skill != null) {
if (OptionL.isEnabled(skill)) {
PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
if (playerData == null)
return;
resetPlayerSkills(player, playerData, skill);
// Reload items and armor to check for newly met requirements
this.plugin.getModifierManager().reloadPlayer(player);
sender.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.SKILL_RESET_RESET_SKILL, locale).replace("{skill}", skill.getDisplayName(locale)).replace("{player}", player.getName()));
} else {
sender.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.UNKNOWN_SKILL, locale));
}
} else {
PlayerData playerData = plugin.getPlayerManager().getPlayerData(player);
if (playerData == null)
return;
for (Skill s : plugin.getSkillRegistry().getSkills()) {
resetPlayerSkills(player, playerData, s);
}
sender.sendMessage(AureliumSkills.getPrefix(locale) + Lang.getMessage(CommandMessage.SKILL_RESET_RESET_ALL, locale).replace("{player}", player.getName()));
}
}
Aggregations