Examples of PlayerProfile


Examples of com.gmail.nossr50.datatypes.player.PlayerProfile

     *
     * @throws InvalidSkillException if the given skill is not valid
     * @throws InvalidPlayerException if the given player does not exist in the database
     */
    public static void addLevelOffline(UUID uuid, String skillType, int levels) {
        PlayerProfile profile = getOfflineProfile(uuid);
        SkillType skill = getSkillType(skillType);

        if (skill.isChildSkill()) {
            Set<SkillType> parentSkills = FamilyTree.getParents(skill);

            for (SkillType parentSkill : parentSkills) {
                profile.addLevels(parentSkill, (levels / parentSkills.size()));
            }

            profile.scheduleAsyncSave();
            return;
        }

        profile.addLevels(skill, levels);
        profile.scheduleAsyncSave();
    }
View Full Code Here

Examples of com.gmail.nossr50.datatypes.player.PlayerProfile

     * @throws InvalidPlayerException if the given player does not exist in the database
     */
    @Deprecated
    public static int getPowerLevelOffline(String playerName) {
        int powerLevel = 0;
        PlayerProfile profile = getOfflineProfile(playerName);

        for (SkillType type : SkillType.NON_CHILD_SKILLS) {
            powerLevel += profile.getSkillLevel(type);
        }

        return powerLevel;
    }
View Full Code Here

Examples of com.gmail.nossr50.datatypes.player.PlayerProfile

    public static void invokeStatPenalty(Player player) {
        double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage();
        int levelThreshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();

        PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
        int totalLevelsLost = 0;

        HashMap<String, Integer> levelChanged = new HashMap<String, Integer>();
        HashMap<String, Float> experienceChanged = new HashMap<String, Float>();

        for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
            if (!skillType.getHardcoreStatLossEnabled()) {
                levelChanged.put(skillType.toString(), 0);
                experienceChanged.put(skillType.toString(), 0F);
                continue;
            }

            int playerSkillLevel = playerProfile.getSkillLevel(skillType);
            int playerSkillXpLevel = playerProfile.getSkillXpLevel(skillType);

            if (playerSkillLevel <= 0 || playerSkillLevel <= levelThreshold) {
                levelChanged.put(skillType.toString(), 0);
                experienceChanged.put(skillType.toString(), 0F);
                continue;
View Full Code Here

Examples of com.gmail.nossr50.datatypes.player.PlayerProfile

     *
     * @throws InvalidPlayerException if the given player does not exist in the database
     */
    public static int getPowerLevelOffline(UUID uuid) {
        int powerLevel = 0;
        PlayerProfile profile = getOfflineProfile(uuid);

        for (SkillType type : SkillType.NON_CHILD_SKILLS) {
            powerLevel += profile.getSkillLevel(type);
        }

        return powerLevel;
    }
View Full Code Here

Examples of com.gmail.nossr50.datatypes.player.PlayerProfile

    public static void invokeVampirism(Player killer, Player victim) {
        double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage();
        int levelThreshold = Config.getInstance().getHardcoreVampirismLevelThreshold();

        PlayerProfile killerProfile = UserManager.getPlayer(killer).getProfile();
        PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
        int totalLevelsStolen = 0;

        HashMap<String, Integer> levelChanged = new HashMap<String, Integer>();
        HashMap<String, Float> experienceChanged = new HashMap<String, Float>();

        for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
            if (!skillType.getHardcoreVampirismEnabled()) {
                levelChanged.put(skillType.toString(), 0);
                experienceChanged.put(skillType.toString(), 0F);
                continue;
            }

            int killerSkillLevel = killerProfile.getSkillLevel(skillType);
            int victimSkillLevel = victimProfile.getSkillLevel(skillType);

            if (victimSkillLevel <= 0 || victimSkillLevel < killerSkillLevel / 2 || victimSkillLevel <= levelThreshold) {
                levelChanged.put(skillType.toString(), 0);
                experienceChanged.put(skillType.toString(), 0F);
                continue;
            }

            int victimSkillXpLevel = victimProfile.getSkillXpLevel(skillType);

            double statsStolen = victimSkillLevel * (vampirismStatLeechPercentage * 0.01D);
            int levelsStolen = (int) statsStolen;
            int xpStolen = (int) Math.floor(victimSkillXpLevel * (statsStolen - levelsStolen));
            levelChanged.put(skillType.toString(), levelsStolen);
View Full Code Here

Examples of com.gmail.nossr50.datatypes.player.PlayerProfile

        return mcMMO.getFormulaManager().getCachedXpToLevel(level, getFormulaType(formulaType));
    }

    // Utility methods follow.
    private static void addOfflineXP(UUID playerUniqueId, SkillType skill, int XP) {
        PlayerProfile profile = getOfflineProfile(playerUniqueId);

        profile.addXp(skill, XP);
        profile.save();
    }
View Full Code Here

Examples of com.gmail.nossr50.datatypes.player.PlayerProfile

        profile.save();
    }

    @Deprecated
    private static void addOfflineXP(String playerName, SkillType skill, int XP) {
        PlayerProfile profile = getOfflineProfile(playerName);

        profile.addXp(skill, XP);
        profile.scheduleAsyncSave();
    }
View Full Code Here

Examples of com.gmail.nossr50.datatypes.player.PlayerProfile

        profile.addXp(skill, XP);
        profile.scheduleAsyncSave();
    }

    private static PlayerProfile getOfflineProfile(UUID uuid) {
        PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);

        if (!profile.isLoaded()) {
            throw new InvalidPlayerException();
        }

        return profile;
    }
View Full Code Here

Examples of com.gmail.nossr50.datatypes.player.PlayerProfile

    }

    @Deprecated
    private static PlayerProfile getOfflineProfile(String playerName) {
        UUID uuid = mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId();
        PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);

        if (!profile.isLoaded()) {
            throw new InvalidPlayerException();
        }

        return profile;
    }
View Full Code Here

Examples of com.gmail.nossr50.datatypes.player.PlayerProfile

                }
                break;

            case STATS_BOARD:
                // Select the profile to read from
                PlayerProfile newProfile;

                if (targetProfile != null) {
                    newProfile = targetProfile; // offline
                }
                else if (targetPlayer == null) {
                    newProfile = mcMMOPlayer.getProfile(); // self
                }
                else {
                    newProfile = UserManager.getPlayer(targetPlayer).getProfile(); // online
                }

                // Calculate power level here
                int powerLevel = 0;
                for (SkillType skill : SkillType.NON_CHILD_SKILLS) { // Don't include child skills, makes the list too long
                    int level = newProfile.getSkillLevel(skill);

                    powerLevel += level;

                    // TODO: Verify that this is what we want - calculated in power level but not displayed
                    if (!skill.getPermissions(player)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.