diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 79544ae..4697c85 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -65,9 +65,9 @@ import org.bukkit.entity.Zombie; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; -import org.bukkit.inventory.ShapedRecipe; -import org.bukkit.inventory.meta.FireworkMeta; -import org.bukkit.inventory.ShapelessRecipe; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.inventory.meta.FireworkMeta; +import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.map.MapRenderer; @@ -2573,7 +2573,7 @@ public void runTick() { } public String healthbar(double curHP,double maxHP) { - //笆�笆� + //隨�ソス隨�ソス int bits=(int)(Math.ceil(curHP/maxHP*10)); String bar=" "; if (bits>6) { @@ -2595,7 +2595,7 @@ public String healthbar(double curHP,double maxHP) { } public String healthbar(double curHP,double maxHP,int hunger) { - //笆�笆� + //隨�ソス隨�ソス int bits=(int)(Math.ceil(curHP/maxHP*10)); String bar=" "; if (hunger>=17) { @@ -3601,6 +3601,13 @@ public void payDay(int time) if (getConfig().getInt("jobs."+ValidJobs[matchedjob])>=getConfig().getInt("jobs.MAX_JOBS")) { p.sendMessage(ChatColor.GOLD+"Sorry, there are already "+getConfig().getInt("jobs.MAX_JOBS")+" people in this job!"); return false; + } + if (getConfig().getInt("jobs."+ValidJobs[matchedjob])==0) { + //Simply set the string. + getConfig().set("jobs."+ValidJobs[matchedjob]+"_members",String.valueOf(p.getName().toLowerCase())); + } else { + //Append to list. + getConfig().set("jobs."+ValidJobs[matchedjob]+"_members",String.valueOf(getConfig().getString("jobs."+ValidJobs[matchedjob]+"_members")+", "+p.getName().toLowerCase())); } Bukkit.getLogger().info("Well, they are allowed to join this job."); //Add 1 to main config. @@ -3716,7 +3723,7 @@ public void payDay(int time) } } JobsDataInfo info = Jobsinfo[getJobSlot(job)]; - economy.depositPlayer(p.getName().toLowerCase(), amount*(1d+(info.moneymult*getAccountsConfig().getInt(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"lv")))); + economy.depositPlayer(p.getName(), amount*(1d+(info.moneymult*getAccountsConfig().getInt(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"lv")))); getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"exp", Double.valueOf(getAccountsConfig().getDouble(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"exp")+exp)); if (getAccountsConfig().getDouble(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"exp")<0) { //It can't be negative. @@ -3763,7 +3770,7 @@ public void payDay(int time) JobsDataInfo info = Jobsinfo[getJobSlot(job)]; if (getJobLv(job,p)<40) { getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"lv", Integer.valueOf(getAccountsConfig().getInt(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"lv")+1)); - Bukkit.broadcastMessage(p.getName().toLowerCase()+" is now a Level "+getAccountsConfig().getInt(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"lv")+" "+getJobColor(job)+job+ChatColor.WHITE+"."); + Bukkit.broadcastMessage(p.getName()+" is now a Level "+getAccountsConfig().getInt(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"lv")+" "+getJobColor(job)+job+ChatColor.WHITE+"."); if (getJobTotalLvs(p)%5==0) { Bukkit.broadcastMessage(ChatColor.GREEN+p.getName()+" has reached Level "+getJobTotalLvs(p)+"!"); if ((((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))>0) { @@ -3804,7 +3811,7 @@ public void payDay(int time) } } JobsDataInfo info = Jobsinfo[getJobSlot(job)]; - economy.depositPlayer(p.getName().toLowerCase(), amount*(1d+(info.moneymult*getAccountsConfig().getInt(p.getName().toLowerCase()+".jobs.job"+slot+"lv")))); + economy.depositPlayer(p.getName(), amount*(1d+(info.moneymult*getAccountsConfig().getInt(p.getName().toLowerCase()+".jobs.job"+slot+"lv")))); } public ChatColor getJobColor(String job) { @@ -4535,35 +4542,47 @@ public void payDay(int time) String[] jobs = getJobs(p); //We can remove them from this job. if (job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1"))) { + //Remove from job members list. + getConfig().set("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1"))+"_members", getConfig().getString("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1"))+"_members").replace(", "+p.getName().toLowerCase(), "")); + /*Try again in case it's the only entry.*/ + getConfig().set("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1"))+"_members", getConfig().getString("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1"))+"_members").replace(p.getName().toLowerCase(), "")); //Remove 1 from main config. getConfig().set("jobs."+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1"), Integer.valueOf(getConfig().getInt("jobs."+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1"))-1)); saveConfig(); //Remove from job 1. - Bukkit.broadcastMessage(p.getName().toLowerCase()+" has left the "+getJobColor(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1"))+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1")+ChatColor.WHITE+" job!"); + Bukkit.broadcastMessage(p.getName()+" has left the "+getJobColor(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1"))+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1")+ChatColor.WHITE+" job!"); getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job1", String.valueOf("None")); getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job1lv", Integer.valueOf(0)); getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job1exp", Double.valueOf(0)); //saveAccountsConfig(); return true; } else - if (job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"))) { - //Remove 1 from main config. + if (job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"))) { + //Remove from job members list. + getConfig().set("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"))+"_members", getConfig().getString("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"))+"_members").replace(", "+p.getName().toLowerCase(), "")); + /*Try again in case it's the only entry.*/ + getConfig().set("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"))+"_members", getConfig().getString("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"))+"_members").replace(p.getName().toLowerCase(), "")); + //Remove 1 from main config. getConfig().set("jobs."+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"), Integer.valueOf(getConfig().getInt("jobs."+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"))-1)); saveConfig(); //Remove from job 2. - Bukkit.broadcastMessage(p.getName().toLowerCase()+" has left the "+getJobColor(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"))+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2")+ChatColor.WHITE+" job!"); + Bukkit.broadcastMessage(p.getName()+" has left the "+getJobColor(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"))+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2")+ChatColor.WHITE+" job!"); getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job2", String.valueOf("None")); getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job2lv", Integer.valueOf(0)); getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job2exp", Double.valueOf(0)); //saveAccountsConfig(); return true; } else - if (job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3"))) { - //Remove 1 from main config. + if (job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3"))) { + //Remove from job members list. + getConfig().set("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3"))+"_members", getConfig().getString("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3"))+"_members").replace(", "+p.getName().toLowerCase(), "")); + /*Try again in case it's the only entry.*/ + getConfig().set("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3"))+"_members", getConfig().getString("jobs."+job.equalsIgnoreCase(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3"))+"_members").replace(p.getName().toLowerCase(), "")); + //Remove 1 from main config. getConfig().set("jobs."+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3"), Integer.valueOf(getConfig().getInt("jobs."+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3"))-1)); saveConfig(); //Remove from job 3. - Bukkit.broadcastMessage(p.getName().toLowerCase()+" has left the "+getJobColor(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3"))+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3")+ChatColor.WHITE+" job!"); + Bukkit.broadcastMessage(p.getName()+" has left the "+getJobColor(getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3"))+getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3")+ChatColor.WHITE+" job!"); getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job3", String.valueOf("None")); getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job3lv", Integer.valueOf(0)); getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job3exp", Double.valueOf(0)); @@ -4750,4 +4769,4 @@ public void payDay(int time) // not a Beta1.4.6R0.2 Server } } -} +} diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 571b20d..ee737d1 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -1691,6 +1691,9 @@ public String convertToItemName(String val) { if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && args.length == 1 && args[0].equalsIgnoreCase("join")) { p.sendMessage("Usage: "+ChatColor.GREEN+"/jobs join [JobName]"+ChatColor.WHITE+" - Join a job. Type /jobs to see the jobs."); } else + if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 1 && args[0].equalsIgnoreCase("members")) { + p.sendMessage("Usage: "+ChatColor.GREEN+"/jobs members [JobName]"+ChatColor.WHITE+" - Check all members in a job."); + } else if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && args.length == 1 && args[0].equalsIgnoreCase("leave")) { p.sendMessage("Usage: "+ChatColor.GREEN+"/jobs leave [JobName]"+ChatColor.WHITE+" - Leave a job. Type /jobs stats to see your jobs."); } else @@ -1713,6 +1716,54 @@ public String convertToItemName(String val) { //Attempt to join the job. this.plugin.leaveJob(p,args[1]); } else + if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("members")) { + JobsDataInfo[] Jobsinfo = {this.plugin.Woodcutter_job,this.plugin.Miner_job,this.plugin.Builder_job,this.plugin.Digger_job,this.plugin.Farmer_job,this.plugin.Hunter_job,this.plugin.Fisherman_job,this.plugin.Weaponsmith_job,this.plugin.Blacksmith_job,this.plugin.Cook_job,this.plugin.Brewer_job,this.plugin.Enchanter_job,this.plugin.Breeder_job,this.plugin.Explorer_job,this.plugin.Support_job}; + boolean found=false; + String job = ""; + ChatColor job_color = null; + for (int i=0;i sorted_players = new ArrayList(); + for (int i=0;i sorted_list_players = new ArrayList(); + int lowest_slot = -1; + while (sorted_players.size()>0) { + for (int i=0;i