use of com.gmail.nossr50.datatypes.skills.SkillType in project TriggerReactor by wysohn.
the class McMmoSupport method setLevel.
/**
* set level of target player's 'skillType' to 'level'
*
* @param player
* @param skillType
* @param level
*/
public void setLevel(Player player, String skillType, int level) {
McMMOPlayer mmoPlayer = (McMMOPlayer) player(player.getName());
if (mmoPlayer == null)
throw new RuntimeException("Could not find MCMMO info for player " + player.getName());
SkillType type = SkillType.valueOf(skillType);
mmoPlayer.modifySkill(type, level);
}
use of com.gmail.nossr50.datatypes.skills.SkillType in project McRPG by Eunoians.
the class McConvert method onCommand.
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
return true;
} else {
if (McRPG.getInstance().isMcmmoEnabled()) {
Bukkit.getLogger().log(Level.INFO, Methods.color(McRPG.getInstance().getPluginPrefix() + "&eBeginning McMMO conversion... please hold."));
Parser equation = new Parser(McRPG.getInstance().getConfig().getString("Configuration.McMMOConversionEquation"));
int playersConverted = 0;
a: for (OfflinePlayer offlinePlayer : Bukkit.getOfflinePlayers()) {
if (playersConverted != 0 && playersConverted % 5 == 0) {
Bukkit.getLogger().log(Level.INFO, Methods.color(McRPG.getInstance().getPluginPrefix() + "&eConverted " + playersConverted + " players so far..."));
}
McRPGPlayer mp = new McRPGPlayer(offlinePlayer.getUniqueId());
int expToConvert = 0;
for (PrimarySkillType skillType : PrimarySkillType.NON_CHILD_SKILLS) {
try {
expToConvert += mcMMO.getFormulaManager().calculateTotalExperience(ExperienceAPI.getLevelOffline(offlinePlayer.getUniqueId(), skillType.getName()), ExperienceAPI.getOfflineXP(offlinePlayer.getUniqueId(), skillType.getName()));
} catch (Exception e) {
Bukkit.getLogger().log(Level.INFO, Methods.color(McRPG.getInstance().getPluginPrefix() + "&eUnable to find data to convert for player " + offlinePlayer.getName() + "."));
continue a;
}
}
if (expToConvert == 0) {
Bukkit.getLogger().log(Level.INFO, Methods.color(McRPG.getInstance().getPluginPrefix() + "&eUnable to find data to convert for player " + offlinePlayer.getName() + "."));
continue;
}
equation.setVariable("skill_exp", expToConvert);
mp.setBoostedExp((int) equation.getValue());
mp.saveData();
playersConverted++;
}
Bukkit.getLogger().log(Level.INFO, Methods.color(McRPG.getInstance().getPluginPrefix() + "&aFinished converting " + playersConverted + " players to McRPG. Please keep a copy of your mcmmo files in case you want to change back! :)" + " Thank you for running McRPG. Remember to shut down server and remove mcMMO for this to function properly!"));
} else {
sender.sendMessage(Methods.color(McRPG.getInstance().getPluginPrefix() + "&cMcMMO was not found on the server and so data could not be converted"));
}
// Legacy commandMcRPG.getInstance().getMcRPGDb().convertLegacyToFlatDB();
return true;
}
}
use of com.gmail.nossr50.datatypes.skills.SkillType in project GDHooks by bloodmc.
the class McMMOProvider method onPlayerAbilityActivate.
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerAbilityActivate(McMMOPlayerAbilityActivateEvent event) {
final Player player = event.getPlayer();
final World world = player.getWorld();
if (!GriefDefender.getCore().isEnabled(world.getUID())) {
return;
}
final Location location = player.getLocation();
final PlayerData playerData = GriefDefender.getCore().getPlayerData(world.getUID(), player.getUniqueId());
final Claim claim = GriefDefender.getCore().getClaimAt(location);
final String ability = event.getAbility().name().toLowerCase().replace(" ", "_");
final String skillType = event.getSkill().name().toLowerCase().replace(" ", "_");
final Set<Context> contexts = new HashSet<>();
contexts.add(new Context("mcmmo:skill_level", String.valueOf(event.getSkillLevel())));
contexts.add(new Context("mcmmo:skill_type", skillType));
final Tristate result = GriefDefender.getPermissionManager().getActiveFlagPermissionValue(event, location, claim, playerData.getUser(), ABILITY_ACTIVATE, player, ability, contexts, null, true);
if (result == Tristate.FALSE) {
event.setCancelled(true);
}
this.playerAbilityMap.put(player.getUniqueId(), new McMMOPlayerAbilityData(player.getUniqueId(), event.getAbility(), event.getSkill(), event.getSkillLevel(), contexts));
}
use of com.gmail.nossr50.datatypes.skills.SkillType in project Nexus by ProjectEdenGG.
the class McMMOResetProvider method prestigeAll.
public void prestigeAll(Player player) {
Koda.say(Nickname.of(player) + " has reset all of their mcMMO skills!");
PlayerUtils.runCommandAsConsole("ce give " + player.getName() + " diamond_chestplate enlighted:1 beserk:1 durability:3 mending:1");
McMMOPlayer mcmmoPlayer = UserManager.getPlayer(player);
boolean allMax = true;
for (PrimarySkillType skillType : PrimarySkillType.values()) {
if (skillType.isChildSkill())
continue;
if (mcmmoPlayer.getSkillLevel(skillType) < TIER_TWO)
allMax = false;
prestige(player, ResetSkillType.valueOf(skillType.name()), false);
}
int deposit = DEPOSIT_ALL;
if (allMax)
deposit += MAX_DEPOSIT_ALL_MULTIPLIER;
new BankerService().deposit(player, deposit, ShopGroup.SURVIVAL, TransactionCause.MCMMO_RESET);
McMMOPrestige mcMMOPrestige = service.getPrestige(player.getUniqueId().toString());
mcMMOPrestige.prestige("all");
service.save(mcMMOPrestige);
}
Aggregations