Examples of PlayerProfile


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

        boolean isCancelled = event.isCancelled();

        if (!isCancelled) {
            levelChanged = event.getLevelChanged();
            experienceChanged = event.getExperienceChanged();
            PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();

            for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
                String skillName = skillType.toString();
                int playerSkillLevel = playerProfile.getSkillLevel(skillType);

                playerProfile.modifySkill(skillType, playerSkillLevel - levelChanged.get(skillName));
                playerProfile.removeXp(skillType, experienceChanged.get(skillName));

                if (playerProfile.getSkillXpLevel(skillType) < 0) {
                    playerProfile.setSkillXpLevel(skillType, 0);
                }

                if (playerProfile.getSkillLevel(skillType) < 0) {
                    playerProfile.modifySkill(skillType, 0);
                }
            }
        }

        return !isCancelled;
View Full Code Here

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

            HashMap<String, Integer> levelChangedVictim = eventVictim.getLevelChanged();
            HashMap<String, Float> experienceChangedVictim = eventVictim.getExperienceChanged();

            McMMOPlayer killerPlayer = UserManager.getPlayer(killer);
            PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();

            for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
                String skillName = skillType.toString();
                int victimSkillLevel = victimProfile.getSkillLevel(skillType);

                killerPlayer.addLevels(skillType, levelChangedKiller.get(skillName));
                killerPlayer.beginUnsharedXpGain(skillType, experienceChangedKiller.get(skillName), XPGainReason.VAMPIRISM);

                victimProfile.modifySkill(skillType, victimSkillLevel - levelChangedVictim.get(skillName));
                victimProfile.removeXp(skillType, experienceChangedVictim.get(skillName));

                if (victimProfile.getSkillXpLevel(skillType) < 0) {
                    victimProfile.setSkillXpLevel(skillType, 0);
                }

                if (victimProfile.getSkillLevel(skillType) < 0) {
                    victimProfile.modifySkill(skillType, 0);
                }
            }
        }

        return !isCancelled;
View Full Code Here

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

        if (isBoss(target)) {
            return;
        }

        PlayerProfile profile = UserManager.getPlayer(player).getProfile();

        if (profile.getMobHealthbarType() == null) {
            profile.setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
        }

        if (profile.getMobHealthbarType() == MobHealthbarType.DISABLED) {
            return;
        }

        String oldName = target.getCustomName();
View Full Code Here

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

        }

        // Increment attempt counter and try
        attempt++;

        PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player.getName(), player.getUniqueId(), true);
        // If successful, schedule the apply
        if (profile.isLoaded()) {
            new ApplySuccessfulProfile(profile).runTask(mcMMO.p);
            return;
        }

        // If we've failed five times, give up
View Full Code Here

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

                UserManager.saveAll();
                UserManager.clearAll();

                for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
                    PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getUniqueId());

                    if (profile.isLoaded()) {
                        mcMMO.getDatabaseManager().saveUser(profile);
                    }

                    new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
                }
View Full Code Here

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

                String playerName = CommandUtils.getMatchedPlayerName(args[0]);
                McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);

                // If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
                if (mcMMOPlayer == null) {
                    PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false); // Temporary Profile

                    if (!CommandUtils.isLoaded(sender, profile)) {
                        return true;
                    }
View Full Code Here

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

     * @throws UnsupportedOperationException if the given skill is a child skill
     */
    public static int getXPRemaining(Player player, String skillType) {
        SkillType skill = getNonChildSkillType(skillType);

        PlayerProfile profile = getPlayer(player).getProfile();

        return profile.getXpToLevel(skill) - profile.getSkillXpLevel(skill);
    }
View Full Code Here

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

     * @throws UnsupportedOperationException if the given skill is a child skill
     */
    @Deprecated
    public static int getOfflineXPRemaining(String playerName, String skillType) {
        SkillType skill = getNonChildSkillType(skillType);
        PlayerProfile profile = getOfflineProfile(playerName);

        return profile.getXpToLevel(skill) - profile.getSkillXpLevel(skill);
    }
View Full Code Here

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

     * @throws InvalidPlayerException if the given player does not exist in the database
     * @throws UnsupportedOperationException if the given skill is a child skill
     */
    public static float getOfflineXPRemaining(UUID uuid, String skillType) {
        SkillType skill = getNonChildSkillType(skillType);
        PlayerProfile profile = getOfflineProfile(uuid);

        return profile.getXpToLevel(skill) - profile.getSkillXpLevelRaw(skill);
    }
View Full Code Here

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
     */
    @Deprecated
    public static void addLevelOffline(String playerName, String skillType, int levels) {
        PlayerProfile profile = getOfflineProfile(playerName);
        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
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.