Package com.gamingmesh.jobs.container

Examples of com.gamingmesh.jobs.container.JobProgression


        message.append(Language.getMessage("command.info.output." + type.getName().toLowerCase()));
        message.append(":\n");
       
        int level = 1;
       
        JobProgression prog = player.getJobProgression(job);
        if (prog != null)
            level = prog.getLevel();
        int numjobs = player.getJobProgression().size();
        List<JobInfo> jobInfo = job.getJobInfo(type);
        for (JobInfo info: jobInfo) {
            String materialName = info.getName().toLowerCase().replace('_', ' ');
           
View Full Code Here


     * @param job - the job
     * @param experience - experience gained
     */
    public void addExperience(JobsPlayer jPlayer, Job job, double experience) {
        synchronized (jPlayer.saveLock) {
            JobProgression prog = jPlayer.getJobProgression(job);
            if (prog == null)
                return;
            int oldLevel = prog.getLevel();
            if (prog.addExperience(experience))
                performLevelUp(jPlayer, job, oldLevel);
   
            jPlayer.save(Jobs.getJobsDAO());
        }
    }
View Full Code Here

     * @param job - the job
     * @param experience - experience gained
     */
    public void removeExperience(JobsPlayer jPlayer, Job job, double experience) {
        synchronized (jPlayer.saveLock) {
            JobProgression prog = jPlayer.getJobProgression(job);
            if (prog == null)
                return;
            prog.addExperience(-experience);
           
            jPlayer.save(Jobs.getJobsDAO());
        }
    }
View Full Code Here

     * @param job
     * @param oldLevel
     */
    public void performLevelUp(JobsPlayer jPlayer, Job job, int oldLevel) {
        Player player = Bukkit.getServer().getPlayer(jPlayer.getPlayerUUID());
        JobProgression prog = jPlayer.getJobProgression(job);
        if (prog == null)
            return;
       
        String message;
        if (ConfigManager.getJobsConfiguration().isBroadcastingLevelups()) {
            message = Language.getMessage("message.levelup.broadcast");
        } else {
            message = Language.getMessage("message.levelup.nobroadcast");
        }
        message = message.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE);
        Title oldTitle = ConfigManager.getJobsConfiguration().getTitleForLevel(oldLevel);
        if (oldTitle != null) {
            message = message.replace("%titlename%", oldTitle.getChatColor() + oldTitle.getName() + ChatColor.WHITE);
        }
        if (player != null) {
            message = message.replace("%playername%", player.getDisplayName());
        } else {
            message = message.replace("%playername%", jPlayer.getUserName());
        }
        message = message.replace("%joblevel%", ""+prog.getLevel());
        for (String line: message.split("\n")) {
            if (ConfigManager.getJobsConfiguration().isBroadcastingLevelups()) {
                Bukkit.getServer().broadcastMessage(line);
            } else if (player != null) {
                player.sendMessage(line);
            }
        }
       
        Title newTitle = ConfigManager.getJobsConfiguration().getTitleForLevel(prog.getLevel());
        if (newTitle != null && !newTitle.equals(oldTitle)) {
            // user would skill up
            if (ConfigManager.getJobsConfiguration().isBroadcastingSkillups()) {
                message = Language.getMessage("message.skillup.broadcast");
            } else {
View Full Code Here

TOP

Related Classes of com.gamingmesh.jobs.container.JobProgression

Copyright © 2018 www.massapicom. 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.