Package com.gamingmesh.jobs.container

Examples of com.gamingmesh.jobs.container.Job


        }
       
        OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(args[0]);
        JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayerOffline(offlinePlayer);
       
        Job job = Jobs.getJob(args[1]);
        if (job == null) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.error.job"));
            return true;
        }
        double xpLost;
        try {
            xpLost = Double.parseDouble(args[2]);
        } catch (Exception e) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.admin.error"));
            return true;
        }
        if (xpLost <= 0) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.admin.error"));
            return true;
        }
        // check if player already has the job
        if (jPlayer.isInJob(job)) {
            Jobs.getPlayerManager().removeExperience(jPlayer, job, xpLost);

            Player player = Bukkit.getServer().getPlayer(offlinePlayer.getUniqueId());
            if (player != null) {
                String message = Language.getMessage("command.removexp.output.target");
                message = message.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE);
                message = message.replace("%xplost%", Double.valueOf(xpLost).toString());
                player.sendMessage(message);
            }
           
            sender.sendMessage(Language.getMessage("command.admin.success"));
View Full Code Here


        }
       
        OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(args[0]);
        JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayerOffline(offlinePlayer);
       
        Job oldjob = Jobs.getJob(args[1]);
        Job newjob = Jobs.getJob(args[2]);
        if (oldjob == null) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.error.job"));
            return true;
        }
        if (newjob == null) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.error.job"));
            return true;
        }
        try {
            if(jPlayer.isInJob(oldjob) && !jPlayer.isInJob(newjob)) {
                Jobs.getPlayerManager().transferJob(jPlayer, oldjob, newjob);

                Player player = Bukkit.getServer().getPlayer(offlinePlayer.getUniqueId());
                if (player != null) {
                    String message = Language.getMessage("command.transfer.output.target");
                    message = message.replace("%oldjobname%", oldjob.getChatColor() + oldjob.getName() + ChatColor.WHITE);
                    message = message.replace("%newjobname%", newjob.getChatColor() + newjob.getName() + ChatColor.WHITE);
                    player.sendMessage(message);
                }
               
                sender.sendMessage(Language.getMessage("command.admin.success"));
            }
View Full Code Here

    public void reload() {
        synchronized (players) {
            for (JobsPlayer jPlayer : players.values()) {
                for (JobProgression progression : jPlayer.getJobProgression()) {
                    String jobName = progression.getJob().getName();
                    Job job = Jobs.getJob(jobName);
                    if (job != null) {
                        progression.setJob(job);
                    }
                }
                if (jPlayer.isOnline()) {
View Full Code Here

    public static void action(JobsPlayer jPlayer, ActionInfo info, double multiplier) {
        List<JobProgression> progression = jPlayer.getJobProgression();
        int numjobs = progression.size();
        // no job
        if (numjobs == 0) {
            Job jobNone = Jobs.getNoneJob();
            if (jobNone != null) {
                Double income = jobNone.getIncome(info, 1, numjobs);
                if (income != null)
                    Jobs.getEconomy().pay(jPlayer, income*multiplier);
            }
        } else {
            for (JobProgression prog : progression) {
View Full Code Here

                    int levelRequirement = permissionSection.getInt("level", 0);
                    jobPermissions.add(new JobPermission(node, value, levelRequirement));
                }
            }
           
            Job job = new Job(jobName, jobShortName, description, color, maxExpEquation, displayMethod, maxLevel, maxSlots, jobPermissions);
           
            for (ActionType actionType : ActionType.values()) {
                ConfigurationSection typeSection = jobSection.getConfigurationSection(actionType.getName());
                ArrayList<JobInfo> jobInfo = new ArrayList<JobInfo>();
                if (typeSection != null) {
                    for (String key : typeSection.getKeys(false)) {
                        ConfigurationSection section = typeSection.getConfigurationSection(key);
                        String myKey = key.toUpperCase();
                        String type = null;
                        String subType = "";
                       
                        if (myKey.contains("-")) {
                            // uses subType
                            subType = ":" + myKey.split("-")[1];
                            myKey = myKey.split("-")[0];
                        }
                        Material material = Material.matchMaterial(myKey);
                        if (material == null) {
                            // try integer method
                            Integer matId = null;
                            try {
                                matId = Integer.decode(myKey);
                            } catch (NumberFormatException e) {}
                            if (matId != null) {
                                material = Material.getMaterial(matId);
                                if (material != null) {
                                    Jobs.getPluginLogger().warning("Job " + jobKey + " " + actionType.getName() + " is using a block by number ID: " + key + "!");
                                    Jobs.getPluginLogger().warning("Please switch to using the Material name instead: "+material.toString()+"!");
                                    Jobs.getPluginLogger().warning("Blocks by number IDs may break in a future release!");
                                }
                            }
                        }
                       
                        if (material != null) {
                            // Break and Place actions MUST be blocks
                            if (actionType == ActionType.BREAK || actionType == ActionType.PLACE) {
                                if (!material.isBlock()) {
                                    Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid " + actionType.getName() + " type property: " + key + "! Material must be a block!");
                                    continue;
                                }
                            }
                            // START HACK
                            /*
                             * Historically, GLOWING_REDSTONE_ORE would ONLY work as REDSTONE_ORE, and putting
                             * GLOWING_REDSTONE_ORE in the configuration would not work.  Unfortunately, this is
                             * completely backwards and wrong.
                             *
                             * To maintain backwards compatibility, all instances of REDSTONE_ORE should normalize
                             * to GLOWING_REDSTONE_ORE, and warn the user to change their configuration.  In the
                             * future this hack may be removed and anybody using REDSTONE_ORE will have their
                             * configurations broken.
                             */
                            if (material == Material.REDSTONE_ORE) {
                                Jobs.getPluginLogger().warning("Job "+jobKey+" is using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE.");
                                Jobs.getPluginLogger().warning("Automatically changing block to GLOWING_REDSTONE_ORE.  Please update your configuration.");
                                Jobs.getPluginLogger().warning("In vanilla minecraft, REDSTONE_ORE changes to GLOWING_REDSTONE_ORE when interacted with.");
                                Jobs.getPluginLogger().warning("In the future, Jobs using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE may fail to work correctly.");
                                material = Material.GLOWING_REDSTONE_ORE;
                            }
                            // END HACK
                           
                            type = material.toString();
                        } else if (actionType == ActionType.KILL) {
                            // check entities
                            EntityType entity = EntityType.fromName(key);
                            if (entity == null) {
                                try {
                                    entity = EntityType.valueOf(key.toUpperCase());
                                } catch (IllegalArgumentException e) {}
                            }
                           
                            if (entity != null && entity.isAlive())
                                type = entity.toString();
                        }
                       
                        if (type == null) {
                            Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid " + actionType.getName() + " type property: " + key + "!");
                            continue;
                        }
                       
                        double income = section.getDouble("income", 0.0);
                        double experience = section.getDouble("experience", 0.0);
                       
                        jobInfo.add(new JobInfo(type+subType, income, incomeEquation, experience, expEquation));
                    }
                }
                job.setJobInfo(actionType, jobInfo);
            }
           
            if (jobKey.equalsIgnoreCase("none")) {
                Jobs.setNoneJob(job);
            } else {
View Full Code Here

TOP

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

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.