From 8c668fccc100f37a0c3a67aa329d8dbd2b17a783 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 26 Nov 2013 06:08:51 -0700 Subject: [PATCH 01/16] Add in new ItemSet references. --- BankEconomyMod/src/me/kaZep/Base/.gitignore | 2 + BankEconomyMod/src/sig/ItemSets/ColorSet.java | 24 +++ BankEconomyMod/src/sig/ItemSets/ItemSet.java | 30 ++++ .../src/sig/ItemSets/ItemSetList.java | 151 ++++++++++++++++++ 4 files changed, 207 insertions(+) create mode 100644 BankEconomyMod/src/me/kaZep/Base/.gitignore create mode 100644 BankEconomyMod/src/sig/ItemSets/ColorSet.java create mode 100644 BankEconomyMod/src/sig/ItemSets/ItemSet.java create mode 100644 BankEconomyMod/src/sig/ItemSets/ItemSetList.java diff --git a/BankEconomyMod/src/me/kaZep/Base/.gitignore b/BankEconomyMod/src/me/kaZep/Base/.gitignore new file mode 100644 index 0000000..92e82b9 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/.gitignore @@ -0,0 +1,2 @@ +/._PlayerListener.java1265619304918501342.tmp +/._PlayerListener.java3998199996590245987.tmp diff --git a/BankEconomyMod/src/sig/ItemSets/ColorSet.java b/BankEconomyMod/src/sig/ItemSets/ColorSet.java new file mode 100644 index 0000000..515ee47 --- /dev/null +++ b/BankEconomyMod/src/sig/ItemSets/ColorSet.java @@ -0,0 +1,24 @@ +package sig.ItemSets; + +import org.bukkit.Color; + + +/** + * A collection of colors that defines an item set. + */ +public class ColorSet { + Color helmet, chestplate, leggings, boots; + /** + * + * @param helmet The helmet's Color. + * @param chestplate The chestplate's Color. + * @param leggings The leggings' Color. + * @param boots The boots' Color. + */ + public ColorSet(Color helmet, Color chestplate, Color leggings, Color boots) { + this.helmet=helmet; + this.chestplate=chestplate; + this.leggings=leggings; + this.boots=boots; + } +} \ No newline at end of file diff --git a/BankEconomyMod/src/sig/ItemSets/ItemSet.java b/BankEconomyMod/src/sig/ItemSets/ItemSet.java new file mode 100644 index 0000000..8c933a1 --- /dev/null +++ b/BankEconomyMod/src/sig/ItemSets/ItemSet.java @@ -0,0 +1,30 @@ +package sig.ItemSets; + +import org.bukkit.Color; + +public class ItemSet { + String name = ""; //The name of the ItemSet. + String description = ""; //The description of the ItemSet. + String[] effectlist = {"","",""}; + ColorSet colors = null; + public ItemSet(String name, ColorSet colors, String description, + String effect1, String effect2, String effect3) { + this.name=name; + this.colors=colors; + this.description=description; + this.effectlist[0]=effect1; + this.effectlist[1]=effect2; + this.effectlist[2]=effect3; + } + /* + private static String[] sets = {"Acrobat", "Angel", "Berserker", "Blackguard", "Chilling", "Flaming", + "Glacial", "Guardian", "Holy", "Meteoric", "Monk", "Nature", "Priest", "Ruby", "Sapphire", "Spiritual", + "Summoner", "Trickster", "Venomous", "Visionary", "Warrior", "Witch-hunter"}; //Holds all the sets that exist. + private static ColorSet[] colorsets = { ColorSet(Color.AQUA,Color.AQUA,Color.AQUA,Color.AQUA), + + }; + private static ColorSet ColorSet(Color col1, Color col2, Color col3, + Color col4) { + return ColorSet(col1,col2,col3,col4); + }*/ +} \ No newline at end of file diff --git a/BankEconomyMod/src/sig/ItemSets/ItemSetList.java b/BankEconomyMod/src/sig/ItemSets/ItemSetList.java new file mode 100644 index 0000000..5f79238 --- /dev/null +++ b/BankEconomyMod/src/sig/ItemSets/ItemSetList.java @@ -0,0 +1,151 @@ +package sig.ItemSets; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +public class ItemSetList { + enum Armor {HELMET, CHESTPLATE, LEGGINGS, BOOTS}; + List itemsetlist = null; + /** + * Initializes the Item Set list for adding data and manipulating. + */ + public void Init() { + itemsetlist = new ArrayList(); + } + /** + * + * @param set The ItemSet to add to the list. + * @return Returns the size of the item set list after adding in the ItemSet. + */ + public int addSet(ItemSet set) { + itemsetlist.add(set); + return itemsetlist.size(); + } + /** + * + * @param title The title of the item set. + * @return Returns the size of the item list after removing the ItemSet. + */ + public int removeSet(String title) { + int itemset_slot=-1; + if ((itemset_slot=getSetSlot(title))!=-1) { + itemsetlist.remove(itemset_slot); + } + return itemsetlist.size(); + } + /** + * Generates a random set item. + * @return Returns the ItemStack of the new set item. + */ + public ItemStack randomizeSetItem() { + + } + /** + * The function that hooks into the rest of the item sets. + * @param item The ItemStack to check. + * @return Returns true if this item is identified as a set item, + * false otherwise. + */ + public boolean isSetItem(ItemStack item) { + //A set item is identified by its name. It could be unidentified too. + if (item.hasItemMeta()) { + ItemMeta meta = item.getItemMeta(); + String name = meta.getDisplayName(); + //Parse the name and see if it has the characteristics of a set item. + if (name.contains(ChatColor.GREEN+"") || name.contains(ChatColor.GREEN+""+ChatColor.MAGIC+"")) { + //It is considered a set item. + return true; + } else { + return false; + } + } else { + //If it has no metadata, it can't possible be a set item. + return false; + } + } + /** + * Extracts the set name from the item. + * @param item The ItemStack to extract the item from. + * @return Returns the name of the set. Returns null + * if this item is not a set item. + */ + public String getSetName(ItemStack item) { + if (item.hasItemMeta()) { + ItemMeta meta = item.getItemMeta(); + String name = meta.getDisplayName(); + //Parse the name and see if it has the characteristics of a set item. + if (name.contains(ChatColor.GREEN+"") || name.contains(ChatColor.GREEN+""+ChatColor.MAGIC+"")) { + //Return the first name. + if (name.contains(ChatColor.GREEN+""+ChatColor.MAGIC+"")) { + return name.substring(name.indexOf(ChatColor.GREEN+""+ChatColor.MAGIC+""), name.indexOf(" ")); + } else { + return name.substring(name.indexOf(ChatColor.GREEN+""), name.indexOf(" ")); + } + } else { + return null; + } + } else { + //If it has no metadata, it can't possible be a set item. + return null; + } + } + /** + * + * @param set_slot The slot in the item set list. + * @return Returns the title of the item set. + */ + public String getSetTitle(int set_slot) { + return itemsetlist.get(set_slot).name; + } + /** + * + * @param title The title of the set. + * @param type The armor type. + * @return Returns the color of the specified armor type in the item set. + * Returns null if it couldn't find the item set or an invalid armor + * type was provided. + */ + public Color getSetColor(String title,Armor type) { + int set_slot=-1; + if ((set_slot=getSetSlot(title))!=-1) { + switch (type) { + case HELMET: { + return itemsetlist.get(set_slot).colors.helmet; + } + case CHESTPLATE: { + return itemsetlist.get(set_slot).colors.chestplate; + } + case LEGGINGS: { + return itemsetlist.get(set_slot).colors.leggings; + } + case BOOTS: { + return itemsetlist.get(set_slot).colors.boots; + } + default:{ + return null; + } + } + } else { + return null; + } + } + /** + * + * @param title A title of an item set. + * @return Returns the number of the slot in the itemsetlist if it is found. + * Otherwise returns -1. + */ + private int getSetSlot(String title) { + for (int i=0;i Date: Tue, 26 Nov 2013 06:39:00 -0700 Subject: [PATCH 02/16] Added '\n' to ItemSet descriptions to differentiate new lines. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 5e2eb3e..5d75cdc 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -517,11 +517,11 @@ public class Main extends JavaPlugin Color.fromRGB(133, 184, 133), Color.fromRGB(133, 184, 159), Color.fromRGB(159, 184, 133)), - "Thin and light armor made for" + + "Thin and light armor made for\n" + "nimble and precise movement.", - "When getting hit, you will gain" + + "When getting hit, you will gain\n" + "40% movement speed.", - "Every 20% of bonus movement speed" + + "Every 20% of bonus movement speed\n" + "gives you 10% block chance.", "When jumping, you cannot be hit."); ItemSetList.addSet(set); From 70a92aeaacfe17725ae3e2ef13fc75122b9d8d68 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 26 Nov 2013 10:17:23 -0700 Subject: [PATCH 03/16] Remove all saveAccountsConfig() calls. Add in 30 second account save config. Should reduce a lot of stress on the server when players are grinding jobs. There should be no reason to write to a file so often. --- BankEconomyMod/bin/sig/ItemSets/.gitignore | 4 + BankEconomyMod/src/me/kaZep/Base/Main.java | 316 ++++----- .../src/me/kaZep/Base/PlayerBuffData.java | 18 +- .../src/me/kaZep/Base/PlayerListener.java | 649 +++++++++--------- .../me/kaZep/Commands/commandBankEconomy.java | 338 ++++----- 5 files changed, 666 insertions(+), 659 deletions(-) create mode 100644 BankEconomyMod/bin/sig/ItemSets/.gitignore diff --git a/BankEconomyMod/bin/sig/ItemSets/.gitignore b/BankEconomyMod/bin/sig/ItemSets/.gitignore new file mode 100644 index 0000000..4335a54 --- /dev/null +++ b/BankEconomyMod/bin/sig/ItemSets/.gitignore @@ -0,0 +1,4 @@ +/ColorSet.class +/ItemSet.class +/ItemSetList$Armor.class +/ItemSetList.class diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 151cc7a..79544ae 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -258,7 +258,7 @@ public class Main extends JavaPlugin SERVER_TICK_TIME = getConfig().getLong("server-tick-time"); getAccountsConfig().options().copyDefaults(true); - saveAccountsConfig(); + //saveAccountsConfig(); getConfig().set("spleefrequestatime", Integer.valueOf(0)); getConfig().set("spleefrequestbtime", Integer.valueOf(0)); @@ -1017,6 +1017,7 @@ public class Main extends JavaPlugin public void onDisable() { + saveAccountsConfig(); getConfig().set("server-tick-time", Long.valueOf(SERVER_TICK_TIME)); saveConfig(); PluginDescriptionFile pdf = getDescription(); @@ -1030,31 +1031,31 @@ public void onDisable() //Get list of all players on the server. OfflinePlayer playerlist[] = Bukkit.getOfflinePlayers(); for (int i=0;i=20) { - if (getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating")>rating[0]) { + if (getAccountsConfig().contains(playerlist[i].getName().toLowerCase())) { + if (getAccountsConfig().contains(playerlist[i].getName().toLowerCase()+".spleefrating") && getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleefwins")+getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleeflosses")>=20) { + if (getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating")>rating[0]) { //This beats the top record, move everything down. name[2]=name[1];rating[2]=rating[1];wins[2]=wins[1];losses[2]=losses[1]; name[1]=name[0];rating[1]=rating[0];wins[1]=wins[0];losses[1]=losses[0]; - name[0]=playerlist[i].getName(); - rating[0]=(int)getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating"); - wins[0]=getAccountsConfig().getInt(playerlist[i].getName()+".spleefwins"); - losses[0]=getAccountsConfig().getInt(playerlist[i].getName()+".spleeflosses"); + name[0]=playerlist[i].getName().toLowerCase(); + rating[0]=(int)getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating"); + wins[0]=getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleefwins"); + losses[0]=getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleeflosses"); } else - if (getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating")>rating[1]) { + if (getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating")>rating[1]) { //This beats the 2nd record, move everything down. name[2]=name[1];rating[2]=rating[1];wins[2]=wins[1];losses[2]=losses[1]; - name[1]=playerlist[i].getName(); - rating[1]=(int)getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating"); - wins[1]=getAccountsConfig().getInt(playerlist[i].getName()+".spleefwins"); - losses[1]=getAccountsConfig().getInt(playerlist[i].getName()+".spleeflosses"); + name[1]=playerlist[i].getName().toLowerCase(); + rating[1]=(int)getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating"); + wins[1]=getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleefwins"); + losses[1]=getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleeflosses"); } else - if (getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating")>rating[2]) { + if (getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating")>rating[2]) { //This beats the 3rd record, move everything down. - name[2]=playerlist[i].getName(); - rating[2]=(int)getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating"); - wins[2]=getAccountsConfig().getInt(playerlist[i].getName()+".spleefwins"); - losses[2]=getAccountsConfig().getInt(playerlist[i].getName()+".spleeflosses"); + name[2]=playerlist[i].getName().toLowerCase(); + rating[2]=(int)getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating"); + wins[2]=getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleefwins"); + losses[2]=getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleeflosses"); } } } @@ -1264,7 +1265,7 @@ public void runTick() { Player p = Bukkit.getOnlinePlayers()[zx]; //p.sendMessage("That's item slot #"+p.getInventory().getHeldItemSlot()); /* - if (p.getName().compareTo("sigonasr2")==0) { + if (p.getName().toLowerCase().compareTo("sigonasr2")==0) { //Packet61WorldEvent packet = new Packet61WorldEvent(2004, p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ(), 0, false); //((CraftPlayer)t).getHandle().netServerHandler.sendPacket(packet); @@ -2036,6 +2037,7 @@ public void runTick() { } } if (Main.SERVER_TICK_TIME%600==0) { + saveAccountsConfig(); //Save account data once every 30 seconds. if (turnedon==false && Bukkit.getWorld("world").getTime()>13000) { //Bukkit.getPlayer("sigonasr2").sendMessage("It's night now..."); turnedon=true; @@ -2069,7 +2071,7 @@ public void runTick() { if (getConfig().getBoolean("spleef4insession")) { //Check to see if we fall off. if ((p.getLocation().getX()<1585 || p.getLocation().getX()>1600 || p.getLocation().getZ()<24 || p.getLocation().getZ()>39 || p.getLocation().getY()<86.5d) && ( - (p.getName().compareTo(getConfig().getString("spleefrequesta4player"))==0 || p.getName().compareTo(getConfig().getString("spleefrequestb4player"))==0 + (p.getName().toLowerCase().compareTo(getConfig().getString("spleefrequesta4player"))==0 || p.getName().compareTo(getConfig().getString("spleefrequestb4player"))==0 || p.getName().compareTo(getConfig().getString("spleefrequestc4player"))==0 || p.getName().compareTo(getConfig().getString("spleefrequestd4player"))==0))) { //You lose. //See if we're the winner. @@ -2080,7 +2082,7 @@ public void runTick() { if (getConfig().getString("spleefrequesta4player").compareTo("none")==0) { countdead++; } else { - if (getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { + if (getConfig().getString("spleefrequesta4player").compareTo(p.getName().toLowerCase())==0) { losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequesta4player")); } else { winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequesta4player")); @@ -2089,7 +2091,7 @@ public void runTick() { if (getConfig().getString("spleefrequestb4player").compareTo("none")==0) { countdead++; } else { - if (getConfig().getString("spleefrequestb4player").compareTo(p.getName())==0) { + if (getConfig().getString("spleefrequestb4player").compareTo(p.getName().toLowerCase())==0) { losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestb4player")); } else { winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestb4player")); @@ -2098,7 +2100,7 @@ public void runTick() { if (getConfig().getString("spleefrequestc4player").compareTo("none")==0) { countdead++; } else { - if (getConfig().getString("spleefrequestc4player").compareTo(p.getName())==0) { + if (getConfig().getString("spleefrequestc4player").compareTo(p.getName().toLowerCase())==0) { losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestc4player")); } else { winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestc4player")); @@ -2107,7 +2109,7 @@ public void runTick() { if (getConfig().getString("spleefrequestd4player").compareTo("none")==0) { countdead++; } else { - if (getConfig().getString("spleefrequestd4player").compareTo(p.getName())==0) { + if (getConfig().getString("spleefrequestd4player").compareTo(p.getName().toLowerCase())==0) { losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestd4player")); } else { winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestd4player")); @@ -2146,7 +2148,7 @@ public void runTick() { p.getInventory().clear(); p.getInventory().clear(p.getInventory().getHeldItemSlot()); //Give inventories back. - if (getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { + if (getConfig().getString("spleefrequesta4player").compareTo(p.getName().toLowerCase())==0) { for (int i=0;i78.0d && p.getLocation().getZ()>53.0d && p.getLocation().getZ()<64.0d && p.getLocation().getX()<1627.0d && p.getLocation().getX()>1616.0d) { Location newloc = p.getLocation(); newloc.setX(1622.5d); @@ -2651,7 +2653,7 @@ public void checkJukeboxes() { Player p = Bukkit.getPlayer(explorers.get(i).name); if (explorers.get(i).event==1 && Bukkit.getPlayer(explorers.get(i).name)!=null && !Bukkit.getPlayer(explorers.get(i).name).isDead()) { if (getJobLv("Explorer", p)>=10) { - PersistentExplorerList eve = new PersistentExplorerList(p.getName()); + PersistentExplorerList eve = new PersistentExplorerList(p.getName().toLowerCase()); eve.event=1; eve.data=p.getExp(); eve.data2=p.getLevel(); @@ -2659,12 +2661,12 @@ public void checkJukeboxes() { explorers.add(eve); } } - if (explorers.get(i).event==1 && explorers.get(i).name.compareTo(p.getName())==0) { + if (explorers.get(i).event==1 && explorers.get(i).name.compareTo(p.getName().toLowerCase())==0) { exppoint=i; //p.setTotalExperience(p.getTotalExperience()+explorers.get(j).data); //p.sendMessage("Your experience: "+explorers.get(i).data+"/"+p.getTotalExperience()); } else - if (explorers.get(i).event==2 && explorers.get(i).name.compareTo(p.getName())==0) { + if (explorers.get(i).event==2 && explorers.get(i).name.compareTo(p.getName().toLowerCase())==0) { deadpoint=i; } if (exppoint!=-1 && deadpoint!=-1) { @@ -3367,18 +3369,18 @@ public void payDay(int time) allOnlineP.sendMessage(ChatColor.DARK_GREEN+"<=========["+ChatColor.LIGHT_PURPLE+"Interest"+ChatColor.DARK_GREEN+"]=========>"); DecimalFormat df = new DecimalFormat("#0.00"); allOnlineP.sendMessage(ChatColor.GOLD+"The money interest has been delivered to all players. ("+df.format((double)(Main.this.getConfig().getDouble("payday.amount")*100))+"% interest rate)"); - allOnlineP.sendMessage(ChatColor.GOLD+"Your Balance: $"+df.format((getAccountsConfig().getDouble(allOnlineP.getName() + ".money")))+" -> $"+df.format(((Main.this.getConfig().getDouble("payday.amount")*(getAccountsConfig().getDouble(allOnlineP.getName() + ".money"))+getAccountsConfig().getDouble(allOnlineP.getName() + ".money"))))); + allOnlineP.sendMessage(ChatColor.GOLD+"Your Balance: $"+df.format((getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money")))+" -> $"+df.format(((Main.this.getConfig().getDouble("payday.amount")*(getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money"))+getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money"))))); allOnlineP.sendMessage(ChatColor.DARK_GREEN+"<==========================>"); - getAccountsConfig().set(allOnlineP.getName() + ".money", ((Main.this.getConfig().getDouble("payday.amount")*(getAccountsConfig().getDouble(allOnlineP.getName() + ".money"))+getAccountsConfig().getDouble(allOnlineP.getName() + ".money")))); - //Main.economy.depositPlayer(allOnlineP.getName(), (Main.this.getConfig().getDouble("payday.amount")*Main.economy.bankBalance(allOnlineP.getName()).balance)); + getAccountsConfig().set(allOnlineP.getName().toLowerCase() + ".money", ((Main.this.getConfig().getDouble("payday.amount")*(getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money"))+getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money")))); + //Main.economy.depositPlayer(allOnlineP.getName().toLowerCase(), (Main.this.getConfig().getDouble("payday.amount")*Main.economy.bankBalance(allOnlineP.getName().toLowerCase()).balance)); } for (OfflinePlayer allOnlineP : Bukkit.getOfflinePlayers()) { if (!allOnlineP.isOnline()) { - getAccountsConfig().set(allOnlineP.getName() + ".money", ((Main.this.getConfig().getDouble("payday.amount")*(getAccountsConfig().getDouble(allOnlineP.getName() + ".money"))+getAccountsConfig().getDouble(allOnlineP.getName() + ".money")))); + getAccountsConfig().set(allOnlineP.getName().toLowerCase() + ".money", ((Main.this.getConfig().getDouble("payday.amount")*(getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money"))+getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money")))); } - //Main.economy.depositPlayer(allOnlineP.getName(), (Main.this.getConfig().getDouble("payday.amount")*Main.economy.bankBalance(allOnlineP.getName()).balance)); + //Main.economy.depositPlayer(allOnlineP.getName().toLowerCase(), (Main.this.getConfig().getDouble("payday.amount")*Main.economy.bankBalance(allOnlineP.getName().toLowerCase()).balance)); } - saveAccountsConfig(); + //saveAccountsConfig(); List expired_uuids = new ArrayList(); String moblist = getConfig().getString("fed.mobs"); String finalstring = ""; @@ -3532,13 +3534,13 @@ public void payDay(int time) public int getPlayerJobCount(Player p) { int count=0; - if (getAccountsConfig().getString(p.getName()+".jobs.job1").compareTo("None")!=0) { + if (getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1").compareTo("None")!=0) { count++; } - if (getAccountsConfig().getString(p.getName()+".jobs.job2").compareTo("None")!=0) { + if (getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2").compareTo("None")!=0) { count++; } - if (getAccountsConfig().getString(p.getName()+".jobs.job3").compareTo("None")!=0) { + if (getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3").compareTo("None")!=0) { count++; } return count; @@ -3560,8 +3562,8 @@ public void payDay(int time) return; } if (PlayerinJob(p,job)) { - getAccountsConfig().set(p.getName()+".jobs.ultimate", String.valueOf(ValidJobs[matchedjob])); - saveAccountsConfig(); + getAccountsConfig().set(p.getName().toLowerCase()+".jobs.ultimate", String.valueOf(ValidJobs[matchedjob])); + //saveAccountsConfig(); p.sendMessage(ChatColor.YELLOW+"Set Declared Ultimate job to "+job); } else { p.sendMessage(ChatColor.GOLD+"Sorry, you are not in that job!"); @@ -3609,14 +3611,14 @@ public void payDay(int time) //Check for the slot we have "None" job in first. int openslot=0; for (int i=0;i<3;i++) { - if (getAccountsConfig().getString(p.getName()+".jobs.job"+(i+1)).equalsIgnoreCase("None")) { + if (getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job"+(i+1)).equalsIgnoreCase("None")) { openslot=i; Bukkit.getLogger().info("Found a None job slot."); break; } } if (ValidJobs[matchedjob].compareTo("Explorer")==0) { - explorerlist.add(new ExplorerData(p.getName(), p.getLocation().getX(), p.getLocation().getZ())); + explorerlist.add(new ExplorerData(p.getName().toLowerCase(), p.getLocation().getX(), p.getLocation().getZ())); } if (ValidJobs[matchedjob].compareTo("Support")==0) { supportplayers.add(new SupportPlayer(p)); @@ -3625,18 +3627,18 @@ public void payDay(int time) hunterplayers.add(p); } Bukkit.getLogger().info("Added extra job pieces when joining."); - getAccountsConfig().set(p.getName()+".jobs.job"+(openslot+1), String.valueOf(ValidJobs[matchedjob])); - getAccountsConfig().set(p.getName()+".jobs.job"+(openslot+1)+"lv", Integer.valueOf(1)); - getAccountsConfig().set(p.getName()+".jobs.job"+(openslot+1)+"exp", Double.valueOf(0)); - saveAccountsConfig(); + getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job"+(openslot+1), String.valueOf(ValidJobs[matchedjob])); + getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job"+(openslot+1)+"lv", Integer.valueOf(1)); + getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job"+(openslot+1)+"exp", Double.valueOf(0)); + //saveAccountsConfig(); Bukkit.getLogger().info("Set job data."); - Bukkit.broadcastMessage(p.getName()+" has joined the "+JobColors[matchedjob]+ValidJobs[matchedjob]+ChatColor.WHITE+" job!"); + Bukkit.broadcastMessage(p.getName().toLowerCase()+" has joined the "+JobColors[matchedjob]+ValidJobs[matchedjob]+ChatColor.WHITE+" job!"); p.sendMessage("You can check out your job progress anytime with "+ChatColor.GOLD+"/jobs stats"+ChatColor.WHITE+"."); return true; } public String[] getJobs(Player p) { - String[] string= {getAccountsConfig().getString(p.getName()+".jobs.job1"),getAccountsConfig().getString(p.getName()+".jobs.job2"),getAccountsConfig().getString(p.getName()+".jobs.job3")}; + String[] string= {getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job1"),getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job2"),getAccountsConfig().getString(p.getName().toLowerCase()+".jobs.job3")}; return string; } @@ -3686,10 +3688,10 @@ public void payDay(int time) } JobsDataInfo info = Jobsinfo[getJobSlot(job)]; double val=0; - val = economy.getBalance(p.getName()); - economy.withdrawPlayer(p.getName(), val); - getAccountsConfig().set(p.getName()+".jobs.job"+(slot+1)+"exp", Double.valueOf(newexp)); - saveAccountsConfig(); + val = economy.getBalance(p.getName().toLowerCase()); + economy.withdrawPlayer(p.getName().toLowerCase(), val); + getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"exp", Double.valueOf(newexp)); + //saveAccountsConfig(); } public void gainMoneyExp(Player p,String job,double amount,double exp) { @@ -3701,7 +3703,7 @@ public void payDay(int time) } //Add to how much we've earned so far. for (int i=0;i0) { @@ -3733,7 +3735,7 @@ public void payDay(int time) } } } - saveAccountsConfig(); + //saveAccountsConfig(); } public void levelUpJob(Player p, String job) { @@ -3760,15 +3762,15 @@ public void payDay(int time) if (slot!=-1) { JobsDataInfo info = Jobsinfo[getJobSlot(job)]; if (getJobLv(job,p)<40) { - getAccountsConfig().set(p.getName()+".jobs.job"+(slot+1)+"lv", Integer.valueOf(getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv")+1)); - Bukkit.broadcastMessage(p.getName()+" is now a Level "+getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv")+" "+getJobColor(job)+job+ChatColor.WHITE+"."); + 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+"."); if (getJobTotalLvs(p)%5==0) { Bukkit.broadcastMessage(ChatColor.GREEN+p.getName()+" has reached Level "+getJobTotalLvs(p)+"!"); if ((((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))>0) { p.sendMessage(ChatColor.GOLD+"You have earned 1 stat point! You now have "+(((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))+" stat point"+((((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))==1?"":"s")+" to spend. "+ChatColor.ITALIC+ChatColor.BLUE+" Type /sp to spend them!"); } } - saveAccountsConfig(); + //saveAccountsConfig(); p.getInventory().removeItem(j); } else { p.sendMessage(ChatColor.GOLD+"You can't level this job. It is already at max level."); @@ -3789,7 +3791,7 @@ public void payDay(int time) } //Add to how much we've earned so far. for (int i=0;i0) { - base_hplv+=this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")/2); + if (this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat8")>0) { + base_hplv+=this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat8")/2); } //Check player equipment to see if an item could possibly have a health buff. for (int i=0;i0) { + if (!hasabsorption && this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat4")>0) { p.removePotionEffect(PotionEffectType.ABSORPTION); - p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,3590,this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")/3)/4-1)); - //p.sendMessage("Absorption level is "+(this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")/4)/4-1)); + p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,3590,this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat4")/3)/4-1)); + //p.sendMessage("Absorption level is "+(this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat4")/4)/4-1)); } - if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")>0) { + if (this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat2")>0) { p.removePotionEffect(PotionEffectType.FAST_DIGGING); - p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING,399,this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")/5)/20-1)); + p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING,399,this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat2")/5)/20-1)); } //p.sendMessage("Health: "+p.getHealth()+"/"+p.getMaxHealth()+" Base HP Level: "+base_hplv); if (p.getHealth()>p.getMaxHealth()) { @@ -260,13 +260,13 @@ public class PlayerBuffData { } if (last_money_report_time+72000=20) { - if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating")>rating[0]) { + if (this.plugin.getAccountsConfig().contains(playerlist[i].getName().toLowerCase())) { + if (this.plugin.getAccountsConfig().contains(playerlist[i].getName().toLowerCase()+".spleefrating") && this.plugin.getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleefwins")+this.plugin.getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleeflosses")>=20) { + if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating")>rating[0]) { //This beats the top record, move everything down. name[2]=name[1];rating[2]=rating[1];wins[2]=wins[1];losses[2]=losses[1]; name[1]=name[0];rating[1]=rating[0];wins[1]=wins[0];losses[1]=losses[0]; name[0]=playerlist[i].getName(); - rating[0]=(int)this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating"); - wins[0]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleefwins"); - losses[0]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleeflosses"); + rating[0]=(int)this.plugin.getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating"); + wins[0]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleefwins"); + losses[0]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleeflosses"); } else - if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating")>rating[1]) { + if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating")>rating[1]) { //This beats the 2nd record, move everything down. name[2]=name[1];rating[2]=rating[1];wins[2]=wins[1];losses[2]=losses[1]; name[1]=playerlist[i].getName(); - rating[1]=(int)this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating"); - wins[1]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleefwins"); - losses[1]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleeflosses"); + rating[1]=(int)this.plugin.getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating"); + wins[1]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleefwins"); + losses[1]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleeflosses"); } else - if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating")>rating[2]) { + if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating")>rating[2]) { //This beats the 3rd record, move everything down. name[2]=playerlist[i].getName(); - rating[2]=(int)this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".spleefrating"); - wins[2]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleefwins"); - losses[2]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName()+".spleeflosses"); + rating[2]=(int)this.plugin.getAccountsConfig().getDouble(playerlist[i].getName().toLowerCase()+".spleefrating"); + wins[2]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleefwins"); + losses[2]=this.plugin.getAccountsConfig().getInt(playerlist[i].getName().toLowerCase()+".spleeflosses"); } } } @@ -321,7 +321,7 @@ implements Listener if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) { e.setAmount(e.getAmount()*2); } - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify3")) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify3")) { p.sendMessage(ChatColor.DARK_GREEN+""+ChatColor.ITALIC+"Gained "+e.getAmount()+" exp."); } } @@ -949,7 +949,7 @@ implements Listener this.plugin.animallist.add(new EntityInteractData(e.getRightClicked().getUniqueId(), p.getName())); } else { //Modify the owner. - this.plugin.animallist.get(slot).setOwner(p.getName()); + this.plugin.animallist.get(slot).setOwner(p.getName().toLowerCase()); } if (p.getItemInHand().getType()==Material.WHEAT) { if (e.getRightClicked().getType()==EntityType.COW) { @@ -1396,11 +1396,11 @@ implements Listener } else { Bukkit.getWorld("world").setDifficulty(Difficulty.HARD); } - if (p.getScoreboard().getTeam(p.getName())!=null) { - tempteam=p.getScoreboard().getTeam(p.getName()); + if (p.getScoreboard().getTeam(p.getName().toLowerCase())!=null) { + tempteam=p.getScoreboard().getTeam(p.getName().toLowerCase()); tempteam.unregister(); } - tempteam=p.getScoreboard().registerNewTeam(p.getName()); + tempteam=p.getScoreboard().registerNewTeam(p.getName().toLowerCase()); if (p.hasPermission("group.moderator")) { tempteam.setPrefix(ChatColor.GREEN+""); } @@ -1428,7 +1428,7 @@ implements Listener p.getInventory().getArmorContents()[i].setItemMeta(meta); } } - /*if (p.getName().equalsIgnoreCase("AaMay")) { + /*if (p.getName().toLowerCase().equalsIgnoreCase("AaMay")) { p.removePotionEffect(PotionEffectType.SPEED); } */ @@ -1496,7 +1496,7 @@ implements Listener } String name = players.next().getName(); playerslist += name; - if (name.compareToIgnoreCase(p.getName())==0) { + if (name.compareToIgnoreCase(p.getName().toLowerCase())==0) { playerwhitelisted=true; } } @@ -1524,55 +1524,55 @@ implements Listener */ //System.out.println("Whitelisted Players: "+playerslist); //System.out.println("Maximum Air: "+p.getMaximumAir()); - if (!this.plugin.getAccountsConfig().contains(p.getName())) { + if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase())) { //This is a brand new player. - Main.economy.withdrawPlayer(p.getName(), Main.economy.getBalance(p.getName())); - Main.economy.depositPlayer(p.getName(), 70); - this.plugin.getAccountsConfig().set(p.getName() + ".status", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".money", Double.valueOf(this.plugin.getConfig().getDouble("start-balance"))); - this.plugin.getAccountsConfig().set(p.getName() + ".revived", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".spleefrating", Double.valueOf(1000.0d)); - this.plugin.getAccountsConfig().set(p.getName() + ".spleefwins", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".spleeflosses", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job1", String.valueOf("None")); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job1lv", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job1exp", Double.valueOf(0.0d)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job2", String.valueOf("None")); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job2lv", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job2exp", Double.valueOf(0.0d)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job3", String.valueOf("None")); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job3lv", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.job3exp", Double.valueOf(0.0d)); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.ultimate", String.valueOf("None")); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.ultimatesealed", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat1", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat2", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat3", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat4", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat5", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat6", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat7", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat8", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat9", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat10", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify1", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify2", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify3", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify4", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify5", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify6", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest1", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest2", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest3", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest4", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest5", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest6", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest7", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest8", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest9", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest10", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName()+".bonus.witherskeleton", Integer.valueOf(0)); - this.plugin.saveAccountsConfig(); + Main.economy.withdrawPlayer(p.getName().toLowerCase(), Main.economy.getBalance(p.getName().toLowerCase())); + Main.economy.depositPlayer(p.getName().toLowerCase(), 70); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".status", Boolean.valueOf(true)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".money", Double.valueOf(this.plugin.getConfig().getDouble("start-balance"))); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".revived", Boolean.valueOf(true)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleefrating", Double.valueOf(1000.0d)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleefwins", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleeflosses", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job1", String.valueOf("None")); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job1lv", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job1exp", Double.valueOf(0.0d)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job2", String.valueOf("None")); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job2lv", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job2exp", Double.valueOf(0.0d)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job3", String.valueOf("None")); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job3lv", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.job3exp", Double.valueOf(0.0d)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.ultimate", String.valueOf("None")); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.ultimatesealed", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat1", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat2", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat3", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat4", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat5", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat6", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat7", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat8", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat9", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat10", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify1", Boolean.valueOf(true)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify2", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify3", Boolean.valueOf(true)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify4", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify5", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify6", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest1", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest2", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest3", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest4", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest5", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest6", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest7", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest8", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest9", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest10", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".bonus.witherskeleton", Integer.valueOf(0)); + //this.plugin.saveAccountsConfig(); System.out.println("[BankEconomy] Bank account created for " + p.getName() + "."); if (playerwhitelisted) { Bukkit.broadcastMessage(ChatColor.LIGHT_PURPLE+"New player "+ChatColor.ITALIC+ChatColor.GOLD+p.getName()+ChatColor.RESET+ChatColor.LIGHT_PURPLE+" has joined the game."); @@ -1591,35 +1591,35 @@ implements Listener DecimalFormat df = new DecimalFormat("#0.00"); p.sendMessage(ChatColor.DARK_AQUA+"For a list of all changes made to this server, visit: http://z-gamers.net/changelog.html"); p.sendMessage("----------------------------"); - p.sendMessage(ChatColor.YELLOW+"Current Money Balance: $ "+df.format(Main.economy.bankBalance(p.getName()).balance)+", Bank Balance: $"+df.format(this.plugin.getAccountsConfig().getDouble(p.getName()+".money"))); + p.sendMessage(ChatColor.YELLOW+"Current Money Balance: $ "+df.format(Main.economy.bankBalance(p.getName().toLowerCase()).balance)+", Bank Balance: $"+df.format(this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase()+".money"))); //Update account information for the stat point update. - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".bonus.witherskeleton")) { - this.plugin.getAccountsConfig().set(p.getName()+".bonus.witherskeleton", Integer.valueOf(0)); - this.plugin.saveAccountsConfig(); - } - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".stats.stat1")) { - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat1", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat2", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat3", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat4", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat5", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat6", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat7", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat8", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat9", Integer.valueOf(0)); - this.plugin.getAccountsConfig().set(p.getName() + ".stats.stat10", Integer.valueOf(0)); - this.plugin.saveAccountsConfig(); + if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".bonus.witherskeleton")) { + this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".bonus.witherskeleton", Integer.valueOf(0)); + //this.plugin.saveAccountsConfig(); + } + if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".stats.stat1")) { + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat1", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat2", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat3", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat4", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat5", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat6", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat7", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat8", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat9", Integer.valueOf(0)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat10", Integer.valueOf(0)); + //this.plugin.saveAccountsConfig(); System.out.println("Updated " + p.getName() + "'s data with stat point update."); } //Update account information for notification settings. - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".settings.notify1")) { - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify1", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify2", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify3", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify4", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify5", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".settings.notify6", Boolean.valueOf(false)); - this.plugin.saveAccountsConfig(); + if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".settings.notify1")) { + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify1", Boolean.valueOf(true)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify2", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify3", Boolean.valueOf(true)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify4", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify5", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".settings.notify6", Boolean.valueOf(false)); + //this.plugin.saveAccountsConfig(); System.out.println("Updated " + p.getName() + "'s data with nofitications update."); } if (this.plugin.getConfig().getBoolean("halloween-enabled")) { @@ -1633,9 +1633,9 @@ implements Listener } } if (!full) { - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".join.halloween_book")) { - this.plugin.getAccountsConfig().set(p.getName() + ".join.halloween_book", Boolean.valueOf(true)); - this.plugin.saveAccountsConfig(); + if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".join.halloween_book")) { + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".join.halloween_book", Boolean.valueOf(true)); + //this.plugin.saveAccountsConfig(); System.out.println("Updated " + p.getName() + "'s data with a Halloween Book."); ItemStack book = new ItemStack(Material.WRITTEN_BOOK); BookMeta bookdata = (BookMeta)book.getItemMeta(); @@ -1651,9 +1651,9 @@ implements Listener book.setItemMeta(bookdata); p.getInventory().addItem(book); } - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".join.halloween_vote_signs")) { - this.plugin.getAccountsConfig().set(p.getName() + ".join.halloween_vote_signs", Boolean.valueOf(true)); - this.plugin.saveAccountsConfig(); + if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".join.halloween_vote_signs")) { + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".join.halloween_vote_signs", Boolean.valueOf(true)); + //this.plugin.saveAccountsConfig(); ItemStack sign = new ItemStack(Material.SIGN,2); ItemMeta meta = sign.getItemMeta(); meta.setDisplayName(ChatColor.BLUE+p.getName()); @@ -1662,31 +1662,31 @@ implements Listener p.sendMessage("You have received 2 vote signs. Go vote at the Pumpkin Patch for the best pumpkin! (Note that voting for yourself does not count. Please vote the best of the others' pumpkins.)"); } } else { - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".join.halloween_vote_signs")) { + if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".join.halloween_vote_signs")) { p.sendMessage("You do not have enough room in your inventory to receive Pumpkin vote signs. Clear some of your inventory and then rejoin."); } } - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".halloween.chest1")) { - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest1", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest2", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest3", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest4", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest5", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest6", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest7", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest8", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest9", Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.chest10", Boolean.valueOf(false)); - this.plugin.saveAccountsConfig(); + if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".halloween.chest1")) { + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest1", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest2", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest3", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest4", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest5", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest6", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest7", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest8", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest9", Boolean.valueOf(false)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.chest10", Boolean.valueOf(false)); + //this.plugin.saveAccountsConfig(); } - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".jobs.ultimate")) { - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.ultimate", String.valueOf("None")); - this.plugin.getAccountsConfig().set(p.getName() + ".jobs.ultimatesealed", Boolean.valueOf(false)); - this.plugin.saveAccountsConfig(); + if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".jobs.ultimate")) { + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.ultimate", String.valueOf("None")); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".jobs.ultimatesealed", Boolean.valueOf(false)); + //this.plugin.saveAccountsConfig(); } - if (!this.plugin.getAccountsConfig().contains(p.getName() + ".halloween.wand")) { - this.plugin.getAccountsConfig().set(p.getName() + ".halloween.wand", Long.valueOf(Main.SERVER_TICK_TIME)); - this.plugin.saveAccountsConfig(); + if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".halloween.wand")) { + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".halloween.wand", Long.valueOf(Main.SERVER_TICK_TIME)); + //this.plugin.saveAccountsConfig(); } } //Check if this player has unallocated stat points. @@ -1696,8 +1696,8 @@ implements Listener p.sendMessage(ChatColor.GOLD+""); } //Set Stat Point specific stuff here. - if (this.plugin.getAccountsConfig().getInt(p.getName() + ".stats.stat10")>0) { - p.setMaximumAir(300+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName() + ".stats.stat10"))*20); + if (this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase() + ".stats.stat10")>0) { + p.setMaximumAir(300+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase() + ".stats.stat10"))*20); } if (p.getLocation().getY()>78.0d && p.getLocation().getZ()>53.0d && p.getLocation().getZ()<64.0d && p.getLocation().getX()<1627.0d && p.getLocation().getX()>1616.0d) { //In a spleef zone. Kick this player out. @@ -1711,7 +1711,7 @@ implements Listener } boolean found=false; for (int i=0;i=24 && e.getBlock().getZ()<=39) || (e.getBlock().getX()==1600 && e.getBlock().getZ()>=24 && e.getBlock().getZ()<=39) || (e.getBlock().getZ()==24 && e.getBlock().getX()>=1585 && e.getBlock().getX()<=1600) || (e.getBlock().getZ()==39 && e.getBlock().getX()>=1585 && e.getBlock().getX()<=1600)) { e.setCancelled(true); } - if (this.plugin.getConfig().getBoolean("spleefinsession")==true && (this.plugin.getConfig().getString("spleefrequestaplayer").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestbplayer").compareTo(p.getName())==0)) { + if (this.plugin.getConfig().getBoolean("spleefinsession")==true && (this.plugin.getConfig().getString("spleefrequestaplayer").compareTo(p.getName().toLowerCase())==0 || this.plugin.getConfig().getString("spleefrequestbplayer").compareTo(p.getName().toLowerCase())==0)) { this.plugin.spleef_last_broken_block=p.getPlayerTime(); } - if (this.plugin.getConfig().getBoolean("spleef4insession")==true && (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestb4player").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestc4player").compareTo(p.getName())==0 || this.plugin.getConfig().getString("spleefrequestd4player").compareTo(p.getName())==0)) { + if (this.plugin.getConfig().getBoolean("spleef4insession")==true && (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName().toLowerCase())==0 || this.plugin.getConfig().getString("spleefrequestb4player").compareTo(p.getName().toLowerCase())==0 || this.plugin.getConfig().getString("spleefrequestc4player").compareTo(p.getName().toLowerCase())==0 || this.plugin.getConfig().getString("spleefrequestd4player").compareTo(p.getName().toLowerCase())==0)) { this.plugin.spleef4_last_broken_block=p.getPlayerTime(); } if (p.getItemInHand()!=null && p.getItemInHand().getItemMeta()!=null && p.getItemInHand().getItemMeta().hasDisplayName()==true && p.getItemInHand().getItemMeta().getDisplayName().compareTo("Spleef Wooden Shovel")==0) { @@ -3805,12 +3805,12 @@ implements Listener Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { @Override public void run() { - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); + p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); } },5); if (e.getItem().getType()==Material.MILK_BUCKET) { for (int i=0;i effects = e.getPotion().getEffects().iterator(); try { Collection effects = e.getPotion().getEffects(); @@ -3885,7 +3885,7 @@ implements Listener if (nextpotioneffect.getType().getName().compareTo("SPEED")==0) { this.plugin.gainMoneyExp(shooter,"Support",0.15,6); for (int i=0;ip.getMaxHealth()) { @@ -3937,7 +3937,7 @@ implements Listener if (nextpotioneffect.getType().getName().compareTo("SPEED")==0) { this.plugin.gainMoneyExp(shooter,"Support",0.15,6); for (int i=0;i0) { - if (Math.random()<=this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9"))/100.0d) { + if (this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat9")>0) { + if (Math.random()<=this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat9"))/100.0d) { e.setFoodLevel(e.getFoodLevel()+1); } } @@ -6632,26 +6632,26 @@ implements Listener } // 笆�笆�(Player)e.getPlayer()).sendMessage(((Player)e.getPlayer()).getScoreboard().getPlayerTeam((OfflinePlayer)e.getPlayer()).getName()); Player p = (Player)e.getPlayer(); - p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.DARK_GRAY+""); + p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(ChatColor.DARK_GRAY+""); if (p.hasPermission("group.moderator")) { - p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.DARK_GREEN+""); + p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(ChatColor.DARK_GREEN+""); } if (p.hasPermission("group.administrators")) { - p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.DARK_PURPLE+""); + p.getScoreboard().getTeam(p.getName().toLowerCase()).setPrefix(ChatColor.DARK_PURPLE+""); } if (this.plugin.getConfig().getBoolean("halloween-enabled")) { for (int m=0;m0) { - p.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, (this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6"))/3)*20, 0)); + if (this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat6")>0) { + p.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, (this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat6"))/3)*20, 0)); } } } @@ -6993,7 +6993,7 @@ implements Listener public void onRegainHealth(EntityRegainHealthEvent e) { if (e.getEntity().getType()==EntityType.PLAYER) { final Player p = (Player)e.getEntity(); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); + p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); boolean regen_high=false; int duration=0; if (e.getRegainReason()==RegainReason.MAGIC_REGEN) { @@ -7028,8 +7028,8 @@ implements Listener }, 1L); } } - if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")>0) { - e.setAmount(e.getAmount()+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")/6)); + if (this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat1")>0) { + e.setAmount(e.getAmount()+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat1")/6)); } } } @@ -7274,7 +7274,7 @@ implements Listener if (e.getDamager() instanceof LivingEntity) { final double player_starthp = p.getHealth(); final LivingEntity l = (LivingEntity)e.getDamager(); - if (p.getNoDamageTicks()0) { + if (this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat3")>0) { double olddmg=e.getDamage(); - e.setDamage(e.getDamage()*(((100-this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")/4))/100.0d))); + e.setDamage(e.getDamage()*(((100-this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat3")/4))/100.0d))); //p.sendMessage("Damage set from "+olddmg+" to "+e.getDamage()); } } @@ -7792,7 +7792,7 @@ implements Listener if (e.getEntity().getType()==EntityType.PLAYER && e.getDamager().getType()==EntityType.ZOMBIE) { LivingEntity enemy = (LivingEntity)e.getDamager(); Player p = (Player)e.getEntity(); - p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); + p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); double throughdmg=0; double maxdmg=0; if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.YELLOW+"Charge Zombie")==0 || enemy.getCustomName().compareTo(ChatColor.DARK_PURPLE+"Charge Zombie III")==0)) { @@ -7800,7 +7800,7 @@ implements Listener if (throughdmg>e.getDamage()/2) { if (p.getHealth()-throughdmg>0) { p.setHealth(p.getHealth()-throughdmg); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5") && e.getDamage()!=0) { //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(throughdmg*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); } } else { @@ -7811,12 +7811,12 @@ implements Listener //Check to see if our "fatal s urvivor" effect is available. boolean survivor=false; for (int i=0;i0) { p.setHealth(p.getHealth()-e.getDamage()/2); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5") && e.getDamage()!=0) { //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(e.getDamage()/2*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); } } else { @@ -7844,12 +7844,12 @@ implements Listener //Check to see if our "fatal s urvivor" effect is available. boolean survivor=false; for (int i=0;ie.getDamage()) { if (p.getHealth()-throughdmg>0) { p.setHealth(p.getHealth()-throughdmg); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5") && e.getDamage()!=0) { //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(throughdmg*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); } } else { @@ -7908,12 +7908,12 @@ implements Listener //Check to see if our "fatal s urvivor" effect is available. boolean survivor=false; for (int i=0;i0) { p.setHealth(p.getHealth()-e.getDamage()); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5") && e.getDamage()!=0) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5") && e.getDamage()!=0) { //p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(e.getDamage()*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); } } else { @@ -7946,12 +7946,12 @@ implements Listener //Check to see if our "fatal s urvivor" effect is available. boolean survivor=false; for (int i=0;i0) { - e.setDamage(e.getDamage()+(this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7"))/2)); + if (this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat7")>0) { + e.setDamage(e.getDamage()+(this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat7"))/2)); } //Add Armor penetration from the stat point, if any. - if (this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)>0) { - armor_pen+=this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4); + if (this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat5")/4)>0) { + armor_pen+=this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat5")/4); } if (f.getNoDamageTicks()0) { double normaldmg=(this.plugin.DMGCALC.getDamage(f.getEquipment().getHelmet(), f.getEquipment().getChestplate(), f.getEquipment().getLeggings(), f.getEquipment().getBoots(), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); double throughdmg=(this.plugin.DMGCALC.getDamage(new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); if (throughdmg>normaldmg+armor_pen) { //This means some piercing can be done. - //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)); + //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat5")/4)); if (f.getHealth()-(normaldmg+armor_pen)>0) { f.setHealth(f.getHealth()-(normaldmg+armor_pen)); armor_pen_dmg=(normaldmg+armor_pen); if (f!=null) { - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify4")) { if (f.getCustomName()!=null) { //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); } else { @@ -8148,7 +8148,7 @@ implements Listener f.setHealth(f.getHealth()-throughdmg); armor_pen_dmg=throughdmg; if (f!=null) { - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify4")) { if (f.getCustomName()!=null) { //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); } else { @@ -8163,7 +8163,7 @@ implements Listener e.setDamage(0); } if (f.getNoDamageTicks()0) { - armor_pen+=this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4); + if (this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat5")/4)>0) { + armor_pen+=this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat5")/4); } if (e.getEntity() instanceof LivingEntity) { LivingEntity enemy = (LivingEntity)e.getEntity(); @@ -8288,8 +8288,8 @@ implements Listener //Deal 2 extra damage. e.setDamage(e.getDamage()+2); } - if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")>0) { - e.setDamage(e.getDamage()+(this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7"))/2)); + if (this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat7")>0) { + e.setDamage(e.getDamage()+(this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat7"))/2)); } if (f.getNoDamageTicks()0) { double normaldmg=(this.plugin.DMGCALC.getDamage(f.getEquipment().getHelmet(), f.getEquipment().getChestplate(), f.getEquipment().getLeggings(), f.getEquipment().getBoots(), e.getDamage(), DamageCause.ENTITY_ATTACK, false)); @@ -8298,11 +8298,11 @@ implements Listener if (throughdmg>normaldmg+armor_pen) { //This means some piercing can be done. - //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)); + //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase()+".stats.stat5")/4)); if (f.getHealth()-(normaldmg+armor_pen)>0) { f.setHealth(f.getHealth()-(normaldmg+armor_pen)); armor_pen_dmg=(normaldmg+armor_pen); - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify4")) { if (f.getCustomName()!=null) { //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); } else { @@ -8317,7 +8317,7 @@ implements Listener if (f.getHealth()-throughdmg>0) { f.setHealth(f.getHealth()-throughdmg); armor_pen_dmg=throughdmg; - if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify4")) { if (f.getCustomName()!=null) { //p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); } else { @@ -8331,7 +8331,7 @@ implements Listener e.setDamage(0); } if (f.getNoDamageTicks()=10 && crafteditem==true) { //This is an ugly fix for the problem...But it works somehow. - //Player newp = Bukkit.getPlayer(p.getName()); + //Player newp = Bukkit.getPlayer(p.getName().toLowerCase()); p.getInventory().addItem(new ItemStack(item.getType(),amount,item.getDurability(),item.getData().getData())); } } @@ -11748,7 +11748,7 @@ implements Listener if (this.plugin.getConfig().getBoolean("spleef4insession")) { //Check to see if we fall off. if ((p.getLocation().getX()<1585 || p.getLocation().getX()>1600 || p.getLocation().getZ()<24 || p.getLocation().getZ()>39 || p.getLocation().getY()<86.5d) && ( - (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequesta4player"))==0 || p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestb4player"))==0 + (p.getName().toLowerCase().compareTo(this.plugin.getConfig().getString("spleefrequesta4player"))==0 || p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestb4player"))==0 || p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestc4player"))==0 || p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestd4player"))==0))) { //You lose. //See if we're the winner. @@ -11759,7 +11759,7 @@ implements Listener if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo("none")==0) { countdead++; } else { - if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { + if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName().toLowerCase())==0) { losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequesta4player")); } else { winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequesta4player")); @@ -11768,7 +11768,7 @@ implements Listener if (this.plugin.getConfig().getString("spleefrequestb4player").compareTo("none")==0) { countdead++; } else { - if (this.plugin.getConfig().getString("spleefrequestb4player").compareTo(p.getName())==0) { + if (this.plugin.getConfig().getString("spleefrequestb4player").compareTo(p.getName().toLowerCase())==0) { losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestb4player")); } else { winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestb4player")); @@ -11777,7 +11777,7 @@ implements Listener if (this.plugin.getConfig().getString("spleefrequestc4player").compareTo("none")==0) { countdead++; } else { - if (this.plugin.getConfig().getString("spleefrequestc4player").compareTo(p.getName())==0) { + if (this.plugin.getConfig().getString("spleefrequestc4player").compareTo(p.getName().toLowerCase())==0) { losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestc4player")); } else { winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestc4player")); @@ -11786,7 +11786,7 @@ implements Listener if (this.plugin.getConfig().getString("spleefrequestd4player").compareTo("none")==0) { countdead++; } else { - if (this.plugin.getConfig().getString("spleefrequestd4player").compareTo(p.getName())==0) { + if (this.plugin.getConfig().getString("spleefrequestd4player").compareTo(p.getName().toLowerCase())==0) { losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestd4player")); } else { winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestd4player")); @@ -11810,7 +11810,7 @@ implements Listener p.getInventory().clear(); p.getInventory().clear(p.getInventory().getHeldItemSlot()); //Give inventories back. - if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { + if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName().toLowerCase())==0) { for (int i=0;i78.0d && p.getLocation().getZ()>53.0d && p.getLocation().getZ()<64.0d && p.getLocation().getX()<1627.0d && p.getLocation().getX()>1616.0d) { Location newloc = p.getLocation(); newloc.setX(1622.5d); @@ -12150,7 +12150,7 @@ implements Listener p.closeInventory(); } for (int i=0;i=10) { //Check to see if our "fatal s urvivor" effect is available. for (int i=0;i=20) { finalcost*=0.25; @@ -12644,7 +12644,7 @@ implements Listener this.plugin.economy.withdrawPlayer(e.getPlayer().getName(), val); double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(mymoney+val)); - this.plugin.saveAccountsConfig(); + //this.plugin.saveAccountsConfig(); e.getPlayer().sendMessage(ChatColor.GREEN+"Deposited $" + df.format(val) + " into your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); this.plugin.last_bank_deposit_use_time=0; } else { @@ -12657,7 +12657,7 @@ implements Listener this.plugin.economy.withdrawPlayer(e.getPlayer().getName(), val); double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(mymoney+val)); - this.plugin.saveAccountsConfig(); + //this.plugin.saveAccountsConfig(); e.getPlayer().sendMessage(ChatColor.GREEN+"Deposited $" + df.format(val) + " into your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); this.plugin.last_bank_deposit_use_time=0; } else { @@ -12678,7 +12678,7 @@ implements Listener //Withdraw all the money in their account. val = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(0)); - this.plugin.saveAccountsConfig(); + //this.plugin.saveAccountsConfig(); this.plugin.economy.depositPlayer(e.getPlayer().getName(), val); e.getPlayer().sendMessage(ChatColor.GREEN+"Withdrawed $" + df.format(val) + " from your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); this.plugin.last_bank_withdraw_use_time=0; @@ -12692,7 +12692,7 @@ implements Listener this.plugin.economy.depositPlayer(e.getPlayer().getName(), val); double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(mymoney-val)); - this.plugin.saveAccountsConfig(); + //this.plugin.saveAccountsConfig(); e.getPlayer().sendMessage(ChatColor.GREEN+"Withdrawed $" + df.format(val) + " from your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); this.plugin.last_bank_withdraw_use_time=0; } else { @@ -13028,12 +13028,12 @@ implements Listener Action blockAction = e.getAction(); String currencySG = Main.economy.currencyNameSingular(); String currencyPL = Main.economy.currencyNamePlural(); - boolean stats = this.plugin.getAccountsConfig().getBoolean(p.getName() + ".status"); - double actMon = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); - int actHand = (int)Main.economy.getBalance(p.getName()); + boolean stats = this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase() + ".status"); + double actMon = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase() + ".money"); + int actHand = (int)Main.economy.getBalance(p.getName().toLowerCase()); if (this.plugin.PlayerinJob(p, "Explorer")) { for (int i=0;i400) { - if (p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestatime")>400 && (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestbplayer"))!=0 || p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestbtime")>400)) { + if (p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestatime")>400 && (p.getName().toLowerCase().compareTo(this.plugin.getConfig().getString("spleefrequestbplayer"))!=0 || p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestbtime")>400)) { Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+"Spleef Player "+p.getName()+" requested a game in slot A. Join within 20 seconds."); this.plugin.getConfig().set("spleefrequestatime", Double.valueOf(p.getPlayerTime())); - this.plugin.getConfig().set("spleefrequestaplayer", String.valueOf(p.getName())); + this.plugin.getConfig().set("spleefrequestaplayer", String.valueOf(p.getName().toLowerCase())); } } else { - if (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestbplayer"))!=0) { + if (p.getName().toLowerCase().compareTo(this.plugin.getConfig().getString("spleefrequestbplayer"))!=0) { //This is a confirmed Spleef game. int playerarating,playerbrating; Player playera,playerb; playera=p; this.plugin.getConfig().set("spleefrequestatime", Double.valueOf(p.getPlayerTime())); - this.plugin.getConfig().set("spleefrequestaplayer", String.valueOf(p.getName())); + this.plugin.getConfig().set("spleefrequestaplayer", String.valueOf(p.getName().toLowerCase())); playerb=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")); if (this.plugin.getAccountsConfig().contains(this.plugin.getConfig().getString("spleefrequestaplayer")+".spleefrating")) { playerarating=(int)this.plugin.getAccountsConfig().getDouble(this.plugin.getConfig().getString("spleefrequestaplayer")+".spleefrating")/10; @@ -13423,25 +13424,25 @@ implements Listener } } this.plugin.saveConfig(); - this.plugin.saveAccountsConfig(); + //this.plugin.saveAccountsConfig(); } } else if (sign.getBlock().getX()==1620 && sign.getBlock().getY()==83 && sign.getBlock().getZ()==45) { //Side B Request. //If not requested already. if (!this.plugin.getConfig().getBoolean("spleefinsession")) { if (p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestatime")>400) { - if (p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestbtime")>400 && (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestaplayer"))!=0 || p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestatime")>400)) { + if (p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestbtime")>400 && (p.getName().toLowerCase().compareTo(this.plugin.getConfig().getString("spleefrequestaplayer"))!=0 || p.getPlayerTime()-this.plugin.getConfig().getDouble("spleefrequestatime")>400)) { Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+"Spleef Player "+p.getName()+" requested a game in slot B. Join within 20 seconds."); this.plugin.getConfig().set("spleefrequestbtime", Double.valueOf(p.getPlayerTime())); - this.plugin.getConfig().set("spleefrequestbplayer", String.valueOf(p.getName())); + this.plugin.getConfig().set("spleefrequestbplayer", String.valueOf(p.getName().toLowerCase())); } } else { - if (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestaplayer"))!=0) { + if (p.getName().toLowerCase().compareTo(this.plugin.getConfig().getString("spleefrequestaplayer"))!=0) { //This is a confirmed Spleef game. int playerarating,playerbrating; Player playera,playerb; this.plugin.getConfig().set("spleefrequestbtime", Double.valueOf(p.getPlayerTime())); - this.plugin.getConfig().set("spleefrequestbplayer", String.valueOf(p.getName())); + this.plugin.getConfig().set("spleefrequestbplayer", String.valueOf(p.getName().toLowerCase())); playera=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")); playerb=p; if (this.plugin.getAccountsConfig().contains(this.plugin.getConfig().getString("spleefrequestaplayer")+".spleefrating")) { @@ -13494,7 +13495,7 @@ implements Listener } } this.plugin.saveConfig(); - this.plugin.saveAccountsConfig(); + //this.plugin.saveAccountsConfig(); } } if (stats) { @@ -13503,22 +13504,22 @@ implements Listener /*double value = Double.parseDouble(arg0); double total = actMon + value; if (value <= actHand) { - this.plugin.getAccountsConfig().set(p.getName() + ".money", Double.valueOf(total)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".money", Double.valueOf(total)); this.plugin.saveAccountsConfig(); if (value <= 1) p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " You added " + value + " " + currencySG + " to your bank account."); else { p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " You added " + value + " " + currencyPL + " to your bank account."); } - Main.economy.withdrawPlayer(p.getName(), value); + Main.economy.withdrawPlayer(p.getName().toLowerCase(), value); } else { p.sendMessage("�ァ2[BankEconomy]" + ChatColor.AQUA + " Sorry, you can't deposit that amount of money."); }*/ //If they were using the withdraw bank before, clear them from it. - if (this.plugin.last_bank_withdraw_user.equalsIgnoreCase(p.getName())) { + if (this.plugin.last_bank_withdraw_user.equalsIgnoreCase(p.getName().toLowerCase())) { this.plugin.last_bank_withdraw_user=""; } - if (this.plugin.last_bank_deposit_use_time+2000/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")/6)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")/6+1):ChatColor.RED+"+"+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")/6+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")/6))))+ChatColor.GREEN+" Health Regeneration."); - p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#9 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")/5+" - "+ChatColor.AQUA+" 5 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")/5)+"%"+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")/5+1)+"%":ChatColor.RED+"+"+this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")/5+1)+"%"):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")/5)+"%")))+ChatColor.GREEN+" block destroying speed."); - p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#8 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")/4+" - "+ChatColor.AQUA+" 4 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")/4)+"%"+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")/4+1)+"%":ChatColor.RED+"+"+this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")/4+1)+"%"):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")/4)+"%")))+ChatColor.GREEN+" damage reduction."); - p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#7 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4+" - "+ChatColor.AQUA+" 4 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4+1):ChatColor.RED+"+"+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))))+ChatColor.GREEN+" armor penetration."); - p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#6 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")/3+" - "+ChatColor.AQUA+" 3 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")/3)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")/3+1):ChatColor.RED+"+"+this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")/3+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")/3))))+ChatColor.GREEN+" temporary health. (Regenerates every 3 minutes)"); - p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#5 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")/3+" - "+ChatColor.AQUA+" 3 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")/3)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")/3+1):ChatColor.RED+"+"+this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")/3+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")/3))))+ChatColor.GREEN+" seconds of fire resistance when caught on fire."); - p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#4 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")/2+" - "+ChatColor.AQUA+" 2 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")/2)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")/2+1):ChatColor.RED+"+"+this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")/2+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")/2))))+ChatColor.GREEN+" base damage."); - p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#3 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")/2+" - "+ChatColor.AQUA+" 2 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")/2)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")/2+1):ChatColor.RED+"+"+this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")/2+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")/2))))+ChatColor.GREEN+" health."); - p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#2 "+ChatColor.RESET+ChatColor.WHITE+"-"+this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")/1+" - "+ChatColor.AQUA+" 1 pt: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")<25 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")>0/*Has a point in it.*/?ChatColor.YELLOW+"-"+this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")/1)+"%"+"/"+ChatColor.RED+"-"+this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")/1+1)+"%":ChatColor.RED+"-"+this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")/1+1)+"%"):(ChatColor.YELLOW+"-"+this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")/1)+"%")))+ChatColor.GREEN+" hunger decay."); - p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#1 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat10")/1+" - "+ChatColor.AQUA+" 1 pt: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat10")<25 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat10")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat10")/1)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat10")/1+1):ChatColor.RED+"+"+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat10")/1+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat10")/1))))+ChatColor.GREEN+" seconds of water breathing."); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#10 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat1")/6+" - "+ChatColor.AQUA+" 6 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat1")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat1")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat1")/6)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat1")/6+1):ChatColor.RED+"+"+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat1")/6+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat1")/6))))+ChatColor.GREEN+" Health Regeneration."); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#9 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat2")/5+" - "+ChatColor.AQUA+" 5 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat2")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat2")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat2")/5)+"%"+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat2")/5+1)+"%":ChatColor.RED+"+"+this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat2")/5+1)+"%"):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat2")/5)+"%")))+ChatColor.GREEN+" block destroying speed."); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#8 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat3")/4+" - "+ChatColor.AQUA+" 4 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat3")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat3")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat3")/4)+"%"+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat3")/4+1)+"%":ChatColor.RED+"+"+this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat3")/4+1)+"%"):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat3")/4)+"%")))+ChatColor.GREEN+" damage reduction."); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#7 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat5")/4+" - "+ChatColor.AQUA+" 4 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat5")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat5")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat5")/4)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat5")/4+1):ChatColor.RED+"+"+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat5")/4+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat5")/4))))+ChatColor.GREEN+" armor penetration."); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#6 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat4")/3+" - "+ChatColor.AQUA+" 3 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat4")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat4")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat4")/3)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat4")/3+1):ChatColor.RED+"+"+this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat4")/3+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat4")/3))))+ChatColor.GREEN+" temporary health. (Regenerates every 3 minutes)"); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#5 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat6")/3+" - "+ChatColor.AQUA+" 3 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat6")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat6")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat6")/3)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat6")/3+1):ChatColor.RED+"+"+this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat6")/3+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat6")/3))))+ChatColor.GREEN+" seconds of fire resistance when caught on fire."); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#4 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat7")/2+" - "+ChatColor.AQUA+" 2 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat7")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat7")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat7")/2)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat7")/2+1):ChatColor.RED+"+"+this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat7")/2+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat7")/2))))+ChatColor.GREEN+" base damage."); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#3 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat8")/2+" - "+ChatColor.AQUA+" 2 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat8")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat8")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat8")/2)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat8")/2+1):ChatColor.RED+"+"+this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat8")/2+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat8")/2))))+ChatColor.GREEN+" health."); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#2 "+ChatColor.RESET+ChatColor.WHITE+"-"+this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat9")/1+" - "+ChatColor.AQUA+" 1 pt: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat9")<25 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat9")>0/*Has a point in it.*/?ChatColor.YELLOW+"-"+this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat9")/1)+"%"+"/"+ChatColor.RED+"-"+this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat9")/1+1)+"%":ChatColor.RED+"-"+this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat9")/1+1)+"%"):(ChatColor.YELLOW+"-"+this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat9")/1)+"%")))+ChatColor.GREEN+" hunger decay."); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#1 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat10")/1+" - "+ChatColor.AQUA+" 1 pt: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat10")<25 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat10")>0/*Has a point in it.*/?ChatColor.YELLOW+"+"+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat10")/1)+"/"+ChatColor.RED+"+"+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat10")/1+1):ChatColor.RED+"+"+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat10")/1+1)):(ChatColor.YELLOW+"+"+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat10")/1))))+ChatColor.GREEN+" seconds of water breathing."); p.sendMessage(ChatColor.ITALIC+""+ChatColor.DARK_AQUA+"Remember that 1 Health / Damage point is half a heart."); if (this.plugin.getStatPointTotal(p)"+ChatColor.WHITE+" - Teleport to a player for a cost."); } else - if (cmd.getName().equalsIgnoreCase("settings")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("settings")) { Inventory i = Bukkit.createInventory(p, 27, "Notification Options"); int count=-1; ItemStack temp,on,off; @@ -379,30 +379,30 @@ public String convertToItemName(String val) { ItemMeta temp_meta=temp.getItemMeta();temp_meta.setDisplayName(ChatColor.YELLOW+"Pick Up Items");List temp_meta_lore = new ArrayList();temp_meta_lore.add(ChatColor.ITALIC+"Get notified whenever you pick up items.");temp_meta_lore.add(ChatColor.ITALIC+"");temp_meta_lore.add(ChatColor.ITALIC+""+ChatColor.GRAY+"Click to toggle this option on or off.");temp_meta.setLore(temp_meta_lore);temp.setItemMeta(temp_meta); on=new ItemStack(Material.REDSTONE_TORCH_ON); off=new ItemStack(Material.REDSTONE_TORCH_OFF); - i.setItem(count+=2, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify1")?on:off)); + i.setItem(count+=2, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase().toLowerCase()+".settings.notify1")?on:off)); temp_meta.setDisplayName(ChatColor.YELLOW+"Craft Items");temp_meta_lore = new ArrayList();temp_meta_lore.add(ChatColor.ITALIC+"Get notified whenever you craft an item.");temp_meta_lore.add(ChatColor.ITALIC+"");temp_meta_lore.add(ChatColor.ITALIC+""+ChatColor.GRAY+"Click to toggle this option on or off.");temp_meta.setLore(temp_meta_lore); temp=new ItemStack(Material.WORKBENCH); - temp.setItemMeta(temp_meta);i.setItem(count+=3, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify2")?on:off)); + temp.setItemMeta(temp_meta);i.setItem(count+=3, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase().toLowerCase()+".settings.notify2")?on:off)); temp_meta.setDisplayName(ChatColor.YELLOW+"Experience Points");temp_meta_lore = new ArrayList();temp_meta_lore.add(ChatColor.ITALIC+"Get notified whenever you gain");temp_meta_lore.add(ChatColor.ITALIC+"experience points.");temp_meta_lore.add(ChatColor.ITALIC+"");temp_meta_lore.add(ChatColor.ITALIC+""+ChatColor.GRAY+"Click to toggle this option on or off.");temp_meta.setLore(temp_meta_lore); temp=new ItemStack(Material.SLIME_BALL); - temp.setItemMeta(temp_meta);i.setItem(count+=4, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify3")?on:off)); + temp.setItemMeta(temp_meta);i.setItem(count+=4, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase().toLowerCase()+".settings.notify3")?on:off)); temp_meta.setDisplayName(ChatColor.YELLOW+"Damage Dealt");temp_meta_lore = new ArrayList();temp_meta_lore.add(ChatColor.ITALIC+"Get notified whenever you deal");temp_meta_lore.add(ChatColor.ITALIC+"damage to enemies.");temp_meta_lore.add(ChatColor.ITALIC+"");temp_meta_lore.add(ChatColor.ITALIC+""+ChatColor.GRAY+"Click to toggle this option on or off.");temp_meta.setLore(temp_meta_lore); temp=new ItemStack(Material.IRON_SWORD); - temp.setItemMeta(temp_meta);i.setItem(count+=3, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")?on:off)); + temp.setItemMeta(temp_meta);i.setItem(count+=3, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase().toLowerCase()+".settings.notify4")?on:off)); temp_meta.setDisplayName(ChatColor.YELLOW+"Damage Received");temp_meta_lore = new ArrayList();temp_meta_lore.add(ChatColor.ITALIC+"Get notified whenever you take damage");temp_meta_lore.add(ChatColor.ITALIC+" from enemies and other sources of damage.");temp_meta_lore.add(ChatColor.ITALIC+"");temp_meta_lore.add(ChatColor.ITALIC+""+ChatColor.GRAY+"Click to toggle this option on or off.");temp_meta.setLore(temp_meta_lore); temp=new ItemStack(Material.IRON_CHESTPLATE); - temp.setItemMeta(temp_meta); i.setItem(count+=4, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify5")?on:off)); + temp.setItemMeta(temp_meta); i.setItem(count+=4, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase().toLowerCase()+".settings.notify5")?on:off)); temp_meta.setDisplayName(ChatColor.YELLOW+"Money Gained");temp_meta_lore = new ArrayList();temp_meta_lore.add(ChatColor.ITALIC+"Get notified of how much money you made");temp_meta_lore.add(ChatColor.ITALIC+" from your jobs in the past hour.");temp_meta_lore.add(ChatColor.ITALIC+"");temp_meta_lore.add(ChatColor.ITALIC+""+ChatColor.GRAY+"Click to toggle this option on or off.");temp_meta.setLore(temp_meta_lore); temp=new ItemStack(Material.GOLD_INGOT); - temp.setItemMeta(temp_meta);i.setItem(count+=3, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify6")?on:off)); + temp.setItemMeta(temp_meta);i.setItem(count+=3, temp);on.setItemMeta(temp_meta);off.setItemMeta(temp_meta); i.setItem(count+=1, (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase().toLowerCase()+".settings.notify6")?on:off)); p.openInventory(i); } else - if (cmd.getName().equalsIgnoreCase("event")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("event")) { if (p.hasPermission("maintenance-mode-admin")) { p.sendMessage("Events available: halloween, thanksgiving. Use: /event "); } } else - if (cmd.getName().equalsIgnoreCase("maintenance")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("maintenance")) { if (p.hasPermission("maintenance-mode-admin")) { if (this.plugin.getConfig().getBoolean("maintenance-mode")) { this.plugin.getConfig().set("maintenance-mode", Boolean.valueOf(false)); @@ -414,13 +414,13 @@ public String convertToItemName(String val) { this.plugin.saveConfig(); } } else - if (cmd.getName().equalsIgnoreCase("transfer")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("transfer")) { p.sendMessage("Usage: "+ChatColor.RED+"/transfer name money"+ChatColor.WHITE+" - Transfer money to a player."); } else - if (cmd.getName().equalsIgnoreCase("revive")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("revive")) { p.sendMessage("Usage: "+ChatColor.RED+"/revive me "+ChatColor.WHITE+" - Revive to the last location you died at."); } else - if (cmd.getName().equalsIgnoreCase("unenchant")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("unenchant")) { Map map = p.getItemInHand().getEnchantments(); for (Map.Entry entry : map.entrySet()) { p.getItemInHand().removeEnchantment(entry.getKey()); @@ -441,11 +441,11 @@ public String convertToItemName(String val) { p.sendMessage("Enchantments and bonuses removed on this item."); } else - if (cmd.getName().equalsIgnoreCase("ticktime")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("ticktime")) { p.sendMessage("Current Server Time: "+ChatColor.GRAY+""+ChatColor.ITALIC+Main.SERVER_TICK_TIME); } else - if (cmd.getName().equalsIgnoreCase("jobs")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs")) { FileConfiguration config = this.plugin.getConfig(); int MAXJOBS = config.getInt("jobs.MAX_JOBS"); p.sendMessage(ChatColor.GOLD+" Blacksmith ("+config.getInt("jobs.Blacksmith")+"/"+MAXJOBS+")"); @@ -502,7 +502,7 @@ public String convertToItemName(String val) { "- Reloads config and accounts."); } } else - if (cmd.getName().equalsIgnoreCase("event") && args.length==1 && p.hasPermission("maintenance-mode-admin")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("event") && args.length==1 && p.hasPermission("maintenance-mode-admin")) { if (args[0].equalsIgnoreCase("halloween")) { if (this.plugin.getConfig().getBoolean("halloween-enabled")) { this.plugin.getConfig().set("halloween-enabled", Boolean.valueOf(false)); @@ -540,7 +540,7 @@ public String convertToItemName(String val) { p.getWorld().dropItemNaturally(p.getLocation(), chest); } } else - if (cmd.getName().equalsIgnoreCase("event") && args.length==2 && p.hasPermission("maintenance-mode-admin")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("event") && args.length==2 && p.hasPermission("maintenance-mode-admin")) { if (args[0].equalsIgnoreCase("head")) { ItemStack m = new ItemStack(Material.SKULL_ITEM, 64, (short)SkullType.PLAYER.ordinal()); SkullMeta skullMeta = (SkullMeta) m.getItemMeta(); @@ -1195,136 +1195,136 @@ public String convertToItemName(String val) { this.plugin.saveConfig(); } } else - if (cmd.getName().equalsIgnoreCase("dungeon") && p.hasPermission("maintenance-mode-admin") && args.length==1) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("dungeon") && p.hasPermission("maintenance-mode-admin") && args.length==1) { //Dungeon x = new Dungeon(new Location(Bukkit.getWorld("world"),-8990,0,-4),new Location(Bukkit.getWorld("world"),50,255,50),Integer.valueOf(args[0])); } else - if (cmd.getName().equalsIgnoreCase("transfer") && args.length==1) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("transfer") && args.length==1) { p.sendMessage("Usage: "+ChatColor.RED+"/transfer name money"+ChatColor.WHITE+" - Transfer money to a player."); } else - if (cmd.getName().equalsIgnoreCase("transfer") && args.length==2) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("transfer") && args.length==2) { double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", "")); Player target = p.getServer().getPlayer(args[0]); if (target == null) { p.sendMessage(this.prefix + " " + this.offlinePlayer); } - else if (target.getName() == p.getName()) { + else if (target.getName().toLowerCase() == p.getName().toLowerCase()) { p.sendMessage(this.prefix + " " + this.cmdTransferSameNick); } else if (amount > playerBankBalance) { p.sendMessage(this.prefix + " " + this.notEnoughMoney); } else if (amount <= playerBankBalance) { double totalWithdraw = playerBankBalance - amount; - double totalDeposit = amount + this.plugin.getAccountsConfig().getInt(target.getName() + ".money"); + double totalDeposit = amount + this.plugin.getAccountsConfig().getInt(target.getName().toLowerCase() + ".money"); - this.plugin.getAccountsConfig().set(p.getName() + ".money", Double.valueOf(totalWithdraw)); - this.plugin.getAccountsConfig().set(target.getName() + ".money", Double.valueOf(totalDeposit)); - this.plugin.saveAccountsConfig(); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".money", Double.valueOf(totalWithdraw)); + this.plugin.getAccountsConfig().set(target.getName().toLowerCase() + ".money", Double.valueOf(totalDeposit)); + //this.plugin.saveAccountsConfig(); if (amount > 1.0D) { - p.sendMessage(this.prefix + " " + this.cmdTransferToPlayer1 + " " + amount + currencyPlural + " " + this.cmdTransferToPlayer2 + " " + target.getName() + "˜a."); - target.sendMessage(this.prefix + " ˜b" + p.getName() + " " + this.cmdTransferToTarget1 + " " + amount + currencyPlural + "˜a."); + p.sendMessage(this.prefix + " " + this.cmdTransferToPlayer1 + " " + amount + currencyPlural + " " + this.cmdTransferToPlayer2 + " " + target.getName().toLowerCase() + "˜a."); + target.sendMessage(this.prefix + " ˜b" + p.getName().toLowerCase() + " " + this.cmdTransferToTarget1 + " " + amount + currencyPlural + "˜a."); } else if (amount <= 1.0D) { - p.sendMessage(this.prefix + " " + this.cmdTransferToPlayer1 + " " + amount + currencySingular + " " + this.cmdTransferToPlayer2 + " " + target.getName() + "˜a."); - target.sendMessage(this.prefix + " ˜b" + p.getName() + " " + this.cmdTransferToTarget1 + " " + amount + currencySingular + "˜a."); + p.sendMessage(this.prefix + " " + this.cmdTransferToPlayer1 + " " + amount + currencySingular + " " + this.cmdTransferToPlayer2 + " " + target.getName().toLowerCase() + "˜a."); + target.sendMessage(this.prefix + " ˜b" + p.getName().toLowerCase() + " " + this.cmdTransferToTarget1 + " " + amount + currencySingular + "˜a."); } } } else - if (cmd.getName().equalsIgnoreCase("sp") && args.length==1) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("sp") && args.length==1) { try { int readvalue = Integer.valueOf(args[0]); if (readvalue<=10 && readvalue>=1) { int statpoints = (this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p); if (readvalue==10) { if (statpoints>=6) { - this.plugin.getAccountsConfig().set(p.getName()+".stats.stat1", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")+6)); - this.plugin.saveAccountsConfig(); - p.sendMessage("You added 1 stat point to Health Regeneration! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")/6)+" of extra health regeneration! (Every time you regenerate health, you get "+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1"))+" extra hearts!) "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase()+".stats.stat1", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat1")+6)); + //this.plugin.saveAccountsConfig(); + p.sendMessage("You added 1 stat point to Health Regeneration! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat1")/6)+" of extra health regeneration! (Every time you regenerate health, you get "+this.plugin.getStatBonus(0, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat1"))+" extra hearts!) "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); } else { p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 6.)"); } } else if (readvalue==9) { if (statpoints>=5) { - this.plugin.getAccountsConfig().set(p.getName()+".stats.stat2", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")+5)); - this.plugin.saveAccountsConfig(); - p.sendMessage("You added 1 stat point to block destroying speed! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat2")/5)+"% block destruction speed! "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase()+".stats.stat2", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat2")+5)); + //this.plugin.saveAccountsConfig(); + p.sendMessage("You added 1 stat point to block destroying speed! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(1, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat2")/5)+"% block destruction speed! "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); } else { p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 5.)"); } } else if (readvalue==8) { if (statpoints>=4) { - this.plugin.getAccountsConfig().set(p.getName()+".stats.stat3", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")+4)); - this.plugin.saveAccountsConfig(); - p.sendMessage("You added 1 stat point to block damage reduction! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat3")/4)+"% of damage taken reduced! "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase()+".stats.stat3", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat3")+4)); + //this.plugin.saveAccountsConfig(); + p.sendMessage("You added 1 stat point to block damage reduction! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(2, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat3")/4)+"% of damage taken reduced! "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); } else { p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 4.)"); } } else if (readvalue==6) { if (statpoints>=3) { - this.plugin.getAccountsConfig().set(p.getName()+".stats.stat4", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")+3)); - this.plugin.saveAccountsConfig(); - p.sendMessage("You added 1 stat point to temporary health! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")/4)+" extra temporary health. (Regenerates every 3 minutes.) "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase()+".stats.stat4", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat4")+3)); + //this.plugin.saveAccountsConfig(); + p.sendMessage("You added 1 stat point to temporary health! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(3, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat4")/4)+" extra temporary health. (Regenerates every 3 minutes.) "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); } else { p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 3.)"); } } else if (readvalue==7) { if (statpoints>=4) { - this.plugin.getAccountsConfig().set(p.getName()+".stats.stat5", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")+4)); - this.plugin.saveAccountsConfig(); - p.sendMessage("You added 1 stat point to armor penetration! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)+" damage of armor penetration. Armor-Wearers will be more afraid of you! "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase()+".stats.stat5", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat5")+4)); + //this.plugin.saveAccountsConfig(); + p.sendMessage("You added 1 stat point to armor penetration! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat5")/4)+" damage of armor penetration. Armor-Wearers will be more afraid of you! "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); } else { p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 4.)"); } } else if (readvalue==5) { if (statpoints>=3) { - this.plugin.getAccountsConfig().set(p.getName()+".stats.stat6", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")+3)); - this.plugin.saveAccountsConfig(); - p.sendMessage("You added 1 stat point to fire resistance! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")/3)+" seconds of fire resistance when you catch on fire. (Resets when you stop burning) "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase()+".stats.stat6", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat6")+3)); + //this.plugin.saveAccountsConfig(); + p.sendMessage("You added 1 stat point to fire resistance! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat6")/3)+" seconds of fire resistance when you catch on fire. (Resets when you stop burning) "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); } else { p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 3.)"); } } else if (readvalue==4) { if (statpoints>=2) { - this.plugin.getAccountsConfig().set(p.getName()+".stats.stat7", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")+2)); - this.plugin.saveAccountsConfig(); - p.sendMessage("You added 1 stat point to base damage! "+ChatColor.BLUE+"You now have +"+this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat7")/2)+" base damage. "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase()+".stats.stat7", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat7")+2)); + //this.plugin.saveAccountsConfig(); + p.sendMessage("You added 1 stat point to base damage! "+ChatColor.BLUE+"You now have +"+this.plugin.getStatBonus(6, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat7")/2)+" base damage. "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); } else { p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 2.)"); } } else if (readvalue==3) { if (statpoints>=2) { - this.plugin.getAccountsConfig().set(p.getName()+".stats.stat8", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")+2)); - this.plugin.saveAccountsConfig(); - p.sendMessage("You added 1 stat point to base health! "+ChatColor.BLUE+"You now have +"+this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")/2)+" base health. "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase()+".stats.stat8", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat8")+2)); + //this.plugin.saveAccountsConfig(); + p.sendMessage("You added 1 stat point to base health! "+ChatColor.BLUE+"You now have +"+this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat8")/2)+" base health. "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); } else { p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 2.)"); } } else if (readvalue==2) { if (statpoints>=1) { - this.plugin.getAccountsConfig().set(p.getName()+".stats.stat9", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")+1)); - this.plugin.saveAccountsConfig(); - p.sendMessage("You added 1 stat point to hunger decay! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9"))+"% less hunger decay "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase()+".stats.stat9", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat9")+1)); + //this.plugin.saveAccountsConfig(); + p.sendMessage("You added 1 stat point to hunger decay! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat9"))+"% less hunger decay "+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); } else { p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 1.)"); } } else if (readvalue==1) { if (statpoints>=1) { - this.plugin.getAccountsConfig().set(p.getName()+".stats.stat10", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat10")+1)); - this.plugin.saveAccountsConfig(); - p.sendMessage("You added 1 stat point to water breathing! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat10"))+" seconds of water breathing. "+ChatColor.WHITE+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase()+".stats.stat10", Integer.valueOf(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat10")+1)); + //this.plugin.saveAccountsConfig(); + p.sendMessage("You added 1 stat point to water breathing! "+ChatColor.BLUE+"You now have "+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".stats.stat10"))+" seconds of water breathing. "+ChatColor.WHITE+((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))+" stat point"+(((this.plugin.getJobTotalLvs(p)/5+1)-this.plugin.getStatPointTotal(p))==1?"":"s")+" left."); //Increase maximum air by 200 ticks. - p.setMaximumAir(300+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName() + ".stats.stat10"))*20); + p.setMaximumAir(300+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase() + ".stats.stat10"))*20); } else { p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 1.)"); } @@ -1336,7 +1336,7 @@ public String convertToItemName(String val) { p.sendMessage(ChatColor.RED+"The inputted slot is not a valid number."); } } - else if (cmd.getName().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("info")) && (p.hasPermission("bankeconomy.info"))) { + else if (cmd.getName().toLowerCase().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("info")) && (p.hasPermission("bankeconomy.info"))) { if (args.length == 1) { if (playerBankBalance <= 1) p.sendMessage(this.prefix + " " + this.cmdInfo + " " + playerBankBalance + currencySingular + "˜a."); @@ -1346,7 +1346,7 @@ public String convertToItemName(String val) { else p.sendMessage(this.invARG); } - else if (cmd.getName().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("check")) && (p.hasPermission("bankeconomy.check"))) { + else if (cmd.getName().toLowerCase().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("check")) && (p.hasPermission("bankeconomy.check"))) { if (args.length == 1) { p.sendMessage(this.prefix + " " + this.usage + " " + this.cmdCheckARG1); } else if (args.length == 2) { @@ -1355,18 +1355,18 @@ public String convertToItemName(String val) { if (target == null) { p.sendMessage(this.prefix + " " + this.offlinePlayer); } else { - int targetBalance = this.plugin.getAccountsConfig().getInt(target.getName() + ".money"); + int targetBalance = this.plugin.getAccountsConfig().getInt(target.getName().toLowerCase() + ".money"); if (targetBalance <= 1) - p.sendMessage(this.prefix + "˜a " + target.getName() + this.cmdCheckReponsePlayer + " " + targetBalance + currencySingular); + p.sendMessage(this.prefix + "˜a " + target.getName().toLowerCase() + this.cmdCheckReponsePlayer + " " + targetBalance + currencySingular); else if (targetBalance > 1) - p.sendMessage(this.prefix + "˜a " + target.getName() + this.cmdCheckReponsePlayer + " " + targetBalance + currencyPlural); + p.sendMessage(this.prefix + "˜a " + target.getName().toLowerCase() + this.cmdCheckReponsePlayer + " " + targetBalance + currencyPlural); } } else { p.sendMessage(this.invARG); } - } else if (cmd.getName().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("reset")) && (p.hasPermission("bankeconomy.reset"))) { + } else if (cmd.getName().toLowerCase().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("reset")) && (p.hasPermission("bankeconomy.reset"))) { if (args.length == 1) { p.sendMessage(this.prefix + " " + this.usage + " " + this.cmdResetARG1); } else if (args.length == 2) { @@ -1375,11 +1375,11 @@ public String convertToItemName(String val) { if (target == null) { p.sendMessage(this.prefix + " " + this.offlinePlayer); } else { - this.plugin.getAccountsConfig().set(target.getName() + ".money", Integer.valueOf(0)); - this.plugin.saveAccountsConfig(); + this.plugin.getAccountsConfig().set(target.getName().toLowerCase() + ".money", Integer.valueOf(0)); + //this.plugin.saveAccountsConfig(); - p.sendMessage(this.prefix + " " + this.cmdResetToPlayer1 + " " + target.getName() + this.cmdResetToPlayer2); - target.sendMessage(this.prefix + " ˜a" + p.getName() + " " + this.cmdResetToTarget); + p.sendMessage(this.prefix + " " + this.cmdResetToPlayer1 + " " + target.getName().toLowerCase() + this.cmdResetToPlayer2); + target.sendMessage(this.prefix + " ˜a" + p.getName().toLowerCase() + " " + this.cmdResetToTarget); } } else { p.sendMessage(this.invARG); @@ -1394,7 +1394,7 @@ public String convertToItemName(String val) { } p.sendMessage(this.invARG); } - else if (cmd.getName().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("transfer")) && (p.hasPermission("bankeconomy.transfer"))) { + else if (cmd.getName().toLowerCase().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("transfer")) && (p.hasPermission("bankeconomy.transfer"))) { if (args.length == 1) { p.sendMessage(this.prefix + " " + this.usage + " " + this.cmdTransferARG1); } else if (args.length == 2) { @@ -1406,25 +1406,25 @@ public String convertToItemName(String val) { if (target == null) { p.sendMessage(this.prefix + " " + this.offlinePlayer); } - else if (target.getName() == p.getName()) { + else if (target.getName().toLowerCase() == p.getName().toLowerCase()) { p.sendMessage(this.prefix + " " + this.cmdTransferSameNick); } else if (amount > playerBankBalance) { p.sendMessage(this.prefix + " " + this.notEnoughMoney); } else if (amount <= playerBankBalance) { double totalWithdraw = playerBankBalance - amount; - double totalDeposit = amount + this.plugin.getAccountsConfig().getInt(target.getName() + ".money"); + double totalDeposit = amount + this.plugin.getAccountsConfig().getInt(target.getName().toLowerCase() + ".money"); - this.plugin.getAccountsConfig().set(p.getName() + ".money", Double.valueOf(totalWithdraw)); - this.plugin.getAccountsConfig().set(target.getName() + ".money", Double.valueOf(totalDeposit)); - this.plugin.saveAccountsConfig(); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".money", Double.valueOf(totalWithdraw)); + this.plugin.getAccountsConfig().set(target.getName().toLowerCase() + ".money", Double.valueOf(totalDeposit)); + //this.plugin.saveAccountsConfig(); if (amount > 1.0D) { - p.sendMessage(this.prefix + " " + this.cmdTransferToPlayer1 + " " + amount + currencyPlural + " " + this.cmdTransferToPlayer2 + " " + target.getName() + "˜a."); - target.sendMessage(this.prefix + " ˜b" + p.getName() + " " + this.cmdTransferToTarget1 + " " + amount + currencyPlural + "˜a."); + p.sendMessage(this.prefix + " " + this.cmdTransferToPlayer1 + " " + amount + currencyPlural + " " + this.cmdTransferToPlayer2 + " " + target.getName().toLowerCase() + "˜a."); + target.sendMessage(this.prefix + " ˜b" + p.getName().toLowerCase() + " " + this.cmdTransferToTarget1 + " " + amount + currencyPlural + "˜a."); } else if (amount <= 1.0D) { - p.sendMessage(this.prefix + " " + this.cmdTransferToPlayer1 + " " + amount + currencySingular + " " + this.cmdTransferToPlayer2 + " " + target.getName() + "˜a."); - target.sendMessage(this.prefix + " ˜b" + p.getName() + " " + this.cmdTransferToTarget1 + " " + amount + currencySingular + "˜a."); + p.sendMessage(this.prefix + " " + this.cmdTransferToPlayer1 + " " + amount + currencySingular + " " + this.cmdTransferToPlayer2 + " " + target.getName().toLowerCase() + "˜a."); + target.sendMessage(this.prefix + " ˜b" + p.getName().toLowerCase() + " " + this.cmdTransferToTarget1 + " " + amount + currencySingular + "˜a."); } } } @@ -1432,7 +1432,7 @@ public String convertToItemName(String val) { { p.sendMessage(this.invARG); } - } else if (cmd.getName().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("edit")) && (p.hasPermission("bankeconomy.edit"))) { + } else if (cmd.getName().toLowerCase().equalsIgnoreCase("bankeconomy") && (args[0].equalsIgnoreCase("edit")) && (p.hasPermission("bankeconomy.edit"))) { if (args.length == 1) { p.sendMessage(this.prefix + " " + this.usage + " " + this.cmdEditARG1); p.sendMessage(this.prefix + " " + this.cmdEditAvaibleActions); @@ -1449,24 +1449,24 @@ public String convertToItemName(String val) { } else if (args[1].equalsIgnoreCase("status")) { if (amount == 1.0D) { - this.plugin.getAccountsConfig().set(target.getName() + ".status", Boolean.valueOf(true)); - this.plugin.saveAccountsConfig(); + this.plugin.getAccountsConfig().set(target.getName().toLowerCase() + ".status", Boolean.valueOf(true)); + //this.plugin.saveAccountsConfig(); - p.sendMessage(this.prefix + " " + this.cmdEditEnableToPlayer1 + " " + p.getName() + this.cmdEditEnableToPlayer2); + p.sendMessage(this.prefix + " " + this.cmdEditEnableToPlayer1 + " " + p.getName().toLowerCase() + this.cmdEditEnableToPlayer2); } else if (amount == 0.0D) { - this.plugin.getAccountsConfig().set(target.getName() + ".status", Boolean.valueOf(false)); - this.plugin.saveAccountsConfig(); + this.plugin.getAccountsConfig().set(target.getName().toLowerCase() + ".status", Boolean.valueOf(false)); + //this.plugin.saveAccountsConfig(); - p.sendMessage(this.prefix + " " + this.cmdEditDisabledToPlayer1 + " " + p.getName() + this.cmdEditDisabledToPlayer2); + p.sendMessage(this.prefix + " " + this.cmdEditDisabledToPlayer1 + " " + p.getName().toLowerCase() + this.cmdEditDisabledToPlayer2); } } else if (args[1].equalsIgnoreCase("balance")) { - this.plugin.getAccountsConfig().set(target.getName() + ".money", Double.valueOf(amount)); - this.plugin.saveAccountsConfig(); + this.plugin.getAccountsConfig().set(target.getName().toLowerCase() + ".money", Double.valueOf(amount)); + //this.plugin.saveAccountsConfig(); if (amount > 1.0D) - p.sendMessage(this.prefix + " " + this.cmdEditAmountSetPlayer1 + " ˜b" + amount + currencyPlural + " " + this.cmdEditAmountSetPlayer2 + " " + target.getName() + this.cmdEditAmountSetPlayer3); + p.sendMessage(this.prefix + " " + this.cmdEditAmountSetPlayer1 + " ˜b" + amount + currencyPlural + " " + this.cmdEditAmountSetPlayer2 + " " + target.getName().toLowerCase() + this.cmdEditAmountSetPlayer3); else if (amount <= 1.0D) - p.sendMessage(this.prefix + " " + this.cmdEditAmountSetPlayer1 + " ˜b" + amount + currencySingular + " " + this.cmdEditAmountSetPlayer2 + " " + target.getName() + this.cmdEditAmountSetPlayer3); + p.sendMessage(this.prefix + " " + this.cmdEditAmountSetPlayer1 + " ˜b" + amount + currencySingular + " " + this.cmdEditAmountSetPlayer2 + " " + target.getName().toLowerCase() + this.cmdEditAmountSetPlayer3); } else { p.sendMessage(this.prefix + " " + this.cmdEditAvaibleActions); @@ -1476,14 +1476,14 @@ public String convertToItemName(String val) { p.sendMessage(this.invARG); } } - else if (cmd.getName().equalsIgnoreCase("revive") && args[0].equalsIgnoreCase("me")) { + else if (cmd.getName().toLowerCase().equalsIgnoreCase("revive") && args[0].equalsIgnoreCase("me")) { DecimalFormat df = new DecimalFormat("#0.00"); - double deathX = this.plugin.getAccountsConfig().getDouble(p.getName() + ".deathpointX"); - double deathY = this.plugin.getAccountsConfig().getDouble(p.getName() + ".deathpointY"); - double deathZ = this.plugin.getAccountsConfig().getDouble(p.getName() + ".deathpointZ"); - String deathWorld = this.plugin.getAccountsConfig().getString(p.getName() + ".deathworld"); + double deathX = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".deathpointX"); + double deathY = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".deathpointY"); + double deathZ = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".deathpointZ"); + String deathWorld = this.plugin.getAccountsConfig().getString(p.getName().toLowerCase().toLowerCase() + ".deathworld"); //p.sendMessage("Got 1."); - if (this.plugin.getAccountsConfig().getBoolean(p.getName() + ".revived")==false && this.plugin.SERVER_TICK_TIME-this.plugin.getAccountsConfig().getLong(p.getName() + ".revivetime")<12000) { + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase().toLowerCase() + ".revived")==false && this.plugin.SERVER_TICK_TIME-this.plugin.getAccountsConfig().getLong(p.getName().toLowerCase().toLowerCase() + ".revivetime")<12000) { double mincost = this.plugin.getConfig().getDouble("revive-cost-rate"); //p.sendMessage("Got 2."); if (p.getBedSpawnLocation()!=null) { @@ -1491,17 +1491,17 @@ public String convertToItemName(String val) { } else { mincost *= Math.abs(p.getWorld().getSpawnLocation().getX()-deathX)+Math.abs(p.getWorld().getSpawnLocation().getY()-deathY)+Math.abs(p.getWorld().getSpawnLocation().getZ()-deathZ); } - double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); + double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = (mincost*this.plugin.getConfig().getDouble("revive-cost-rate")) + (mymoney*this.plugin.getConfig().getDouble("revive-cost-tax")); if (this.plugin.PlayerinJob(p, "Explorer") && this.plugin.getJobLv("Explorer", p)>=20) { finalcost*=0.25; } //p.sendMessage("Got 3."); if (mymoney>=finalcost) { - this.plugin.getAccountsConfig().set(p.getName() + ".revived", Boolean.valueOf(true)); - this.plugin.getAccountsConfig().set(p.getName() + ".money", mymoney-finalcost); - this.plugin.getAccountsConfig().set(p.getName() + ".revivetime", Long.valueOf(0)); - this.plugin.saveAccountsConfig(); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".revived", Boolean.valueOf(true)); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".money", mymoney-finalcost); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".revivetime", Long.valueOf(0)); + //this.plugin.saveAccountsConfig(); //p.sendMessage("Got 4."); p.sendMessage("You spent $"+df.format(finalcost)+" to revive. New Bank Balance: $"+ChatColor.YELLOW+df.format(mymoney-finalcost)); //p.sendMessage("Got 5."); @@ -1540,17 +1540,17 @@ public String convertToItemName(String val) { p2.setMaximumNoDamageTicks(20); } },100); - Bukkit.broadcastMessage(ChatColor.GREEN+p.getName()+ChatColor.WHITE+" decided to revive."); + Bukkit.broadcastMessage(ChatColor.GREEN+p.getName().toLowerCase()+ChatColor.WHITE+" decided to revive."); } else { p.sendMessage("You cannot revive. You need to have $"+df.format(finalcost)+" to do so."); } } else { p.sendMessage("You haven't died. So you cannot revive."); } - this.plugin.saveAccountsConfig(); + //this.plugin.saveAccountsConfig(); return true; } - else if (cmd.getName().equalsIgnoreCase("revive") && (args[0].equalsIgnoreCase("amount"))) { + else if (cmd.getName().toLowerCase().equalsIgnoreCase("revive") && (args[0].equalsIgnoreCase("amount"))) { DecimalFormat df = new DecimalFormat("#0.00"); double deathX = p.getLocation().getX(); double deathY = p.getLocation().getY(); @@ -1561,7 +1561,7 @@ public String convertToItemName(String val) { } else { mincost *= Math.abs(p.getWorld().getSpawnLocation().getX()-deathX)+Math.abs(p.getWorld().getSpawnLocation().getY()-deathY)+Math.abs(p.getWorld().getSpawnLocation().getZ()-deathZ); } - double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); + double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = (mincost*this.plugin.getConfig().getDouble("revive-cost-rate")) + (mymoney*this.plugin.getConfig().getDouble("revive-cost-tax")); if (this.plugin.PlayerinJob(p, "Explorer") && this.plugin.getJobLv("Explorer", p)>=20) { finalcost*=0.25; @@ -1569,9 +1569,9 @@ public String convertToItemName(String val) { p.sendMessage("You need to have $"+df.format(finalcost)+" to revive."); return true; } - else if (cmd.getName().equalsIgnoreCase("tele") && (args[0].equalsIgnoreCase("to"))) { + else if (cmd.getName().toLowerCase().equalsIgnoreCase("tele") && (args[0].equalsIgnoreCase("to"))) { DecimalFormat df = new DecimalFormat("#0.00"); - if (p.getPlayerTime()-this.plugin.getAccountsConfig().getDouble(p.getName() + ".teletime")<400) { + if (p.getPlayerTime()-this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".teletime")<400) { if (args.length==1) { p.sendMessage("Usage: "+ChatColor.RED+"/tele to "+ChatColor.GREEN+" "+ChatColor.WHITE+" - Teleport to a player for a cost."); } else if (args.length==2) { @@ -1586,26 +1586,26 @@ public String convertToItemName(String val) { is_in_vehicle=true; vehicle = p.getVehicle(); } - if (target.getName() == this.plugin.getAccountsConfig().getString(p.getName() + ".teleplayer")) { + if (target.getName().toLowerCase() == this.plugin.getAccountsConfig().getString(p.getName().toLowerCase().toLowerCase() + ".teleplayer")) { //Determine distance of player to other player. double otherx = target.getLocation().getX(); double othery = target.getLocation().getY(); double otherz = target.getLocation().getZ(); - double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); + double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. - this.plugin.getAccountsConfig().set(p.getName() + ".money", mymoney-finalcost); - this.plugin.getAccountsConfig().set(p.getName() + ".teletime", Double.valueOf(0.0d)); - this.plugin.saveAccountsConfig(); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".money", mymoney-finalcost); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teletime", Double.valueOf(0.0d)); + //this.plugin.saveAccountsConfig(); if (this.plugin.PlayerinJob(p, "Support")) { //Give exp for doing so. //this.plugin.gainMoneyExp(p,"Support",0,100); } - p.sendMessage("Teleported to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+" for $"+ChatColor.YELLOW+df.format(finalcost)+ChatColor.WHITE+". New Account balance: $"+df.format(mymoney-finalcost)); - target.sendMessage(ChatColor.GREEN+p.getName()+ChatColor.WHITE+" teleported to your location."); + p.sendMessage("Teleported to "+ChatColor.GREEN+target.getName().toLowerCase()+ChatColor.WHITE+" for $"+ChatColor.YELLOW+df.format(finalcost)+ChatColor.WHITE+". New Account balance: $"+df.format(mymoney-finalcost)); + target.sendMessage(ChatColor.GREEN+p.getName().toLowerCase()+ChatColor.WHITE+" teleported to your location."); if (is_in_vehicle) { vehicle.eject(); p.eject(); @@ -1629,7 +1629,7 @@ public String convertToItemName(String val) { } } } else { - p.sendMessage("You need $"+ChatColor.YELLOW+df.format(finalcost)+" in the bank to teleport to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+"!"); + p.sendMessage("You need $"+ChatColor.YELLOW+df.format(finalcost)+" in the bank to teleport to "+ChatColor.GREEN+target.getName().toLowerCase()+ChatColor.WHITE+"!"); } } else { //Setup another player. @@ -1637,17 +1637,17 @@ public String convertToItemName(String val) { double otherx = target.getLocation().getX(); double othery = target.getLocation().getY(); double otherz = target.getLocation().getZ(); - double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); + double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. - p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". Type the command again to teleport."); - this.plugin.getAccountsConfig().set(p.getName() + ".teletime", Double.valueOf(p.getPlayerTime())); - this.plugin.getAccountsConfig().set(p.getName() + ".teleplayer", String.valueOf(target.getName())); + p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName().toLowerCase()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". Type the command again to teleport."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teletime", Double.valueOf(p.getPlayerTime())); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teleplayer", String.valueOf(target.getName().toLowerCase())); } else { - p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". You do not have enough in the bank for that."); + p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName().toLowerCase()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". You do not have enough in the bank for that."); } } } @@ -1666,54 +1666,54 @@ public String convertToItemName(String val) { double otherx = target.getLocation().getX(); double othery = target.getLocation().getY(); double otherz = target.getLocation().getZ(); - double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); + double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. - p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". Type the command again to teleport."); - this.plugin.getAccountsConfig().set(p.getName() + ".teletime", Double.valueOf(p.getPlayerTime())); - this.plugin.getAccountsConfig().set(p.getName() + ".teleplayer", String.valueOf(target.getName())); + p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName().toLowerCase()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". Type the command again to teleport."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teletime", Double.valueOf(p.getPlayerTime())); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teleplayer", String.valueOf(target.getName().toLowerCase())); } else { - p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". You do not have enough in the bank for that."); + p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName().toLowerCase()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". You do not have enough in the bank for that."); } } } } return true; } else - if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 1 && args[0].equalsIgnoreCase("info")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && args.length == 1 && args[0].equalsIgnoreCase("info")) { p.sendMessage("Usage: "+ChatColor.GREEN+"/jobs info [JobName]"+ChatColor.WHITE+" - Get information about a job."); p.sendMessage("Usage: "+ChatColor.GREEN+"/jobs info [JobName] "+ChatColor.LIGHT_PURPLE+"[lv]"+ChatColor.WHITE+" - Get information about a job at a certain job level."); p.sendMessage(" Type /jobs to see the jobs."); } else - if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 1 && args[0].equalsIgnoreCase("join")) { + 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("leave")) { + 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 - if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 1 && args[0].equalsIgnoreCase("buffs")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && args.length == 1 && args[0].equalsIgnoreCase("buffs")) { p.sendMessage("Usage: "+ChatColor.GREEN+"/jobs buffs [JobName]"+ChatColor.WHITE+" - Get buffs information about a job. Type /jobs to see the jobs."); } else - if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("ultimate")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("ultimate")) { //Attempt to join the job. this.plugin.setUltimate(p,args[1]); } else - if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("boost")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("boost")) { //Attempt to level up the job. this.plugin.levelUpJob(p,args[1]); } else - if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("join")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("join")) { //Attempt to join the job. this.plugin.joinJob(p,args[1]); } else - if (cmd.getName().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("leave")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && args.length == 2 && args[0].equalsIgnoreCase("leave")) { //Attempt to join the job. this.plugin.leaveJob(p,args[1]); } else - if (cmd.getName().equalsIgnoreCase("jobs") && (args.length == 2 || args.length==3) && args[0].equalsIgnoreCase("info")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && (args.length == 2 || args.length==3) && args[0].equalsIgnoreCase("info")) { 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; int matchedjob=0; @@ -1732,7 +1732,7 @@ public String convertToItemName(String val) { } } if (this.plugin.PlayerinJob(p, args[1])) { - Jobsinfo[i].sendOutput(p,this.plugin.getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv")); + Jobsinfo[i].sendOutput(p,this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".jobs.job"+(slot+1)+"lv")); } else { Jobsinfo[i].sendOutput(p); } @@ -1767,7 +1767,7 @@ public String convertToItemName(String val) { } p.sendMessage(""); } else - if (cmd.getName().equalsIgnoreCase("jobs") && (args.length == 2) && args[0].equalsIgnoreCase("buffs")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && (args.length == 2) && args[0].equalsIgnoreCase("buffs")) { 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; int slot=0; @@ -1797,7 +1797,7 @@ public String convertToItemName(String val) { p.sendMessage(ChatColor.ITALIC+"Note that only one ultimate buff can be chosen. And CANNOT BE CHANGED."); } } else - if (cmd.getName().equalsIgnoreCase("jobs") && (args.length == 1 || args.length==2) && args[0].equalsIgnoreCase("stats")) { + if (cmd.getName().toLowerCase().equalsIgnoreCase("jobs") && (args.length == 1 || args.length==2) && args[0].equalsIgnoreCase("stats")) { if (args.length==1) { //Show your stats. p.sendMessage(""); @@ -1805,12 +1805,12 @@ public String convertToItemName(String val) { String[] joblist=this.plugin.getJobs(p); for (int i=0;i=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); + p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".jobs.job"+(i+1)+"exp"))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); } else { - p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(p.getName()+".jobs.job"+(i+1)+"exp"))+"/"+Math.round(this.plugin.getJobExp(joblist[i], this.plugin.getAccountsConfig().getInt(p.getName()+".jobs.job"+(i+1)+"lv")))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); + p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".jobs.job"+(i+1)+"exp"))+"/"+Math.round(this.plugin.getJobExp(joblist[i], this.plugin.getAccountsConfig().getInt(p.getName().toLowerCase().toLowerCase()+".jobs.job"+(i+1)+"lv")))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); } if (joblist[i].equalsIgnoreCase("Explorer") && this.plugin.getJobLv(joblist[i], p)>=10) { @@ -1818,7 +1818,7 @@ public String convertToItemName(String val) { boolean discovered=false; long timeleft=0; for (int j=0;j=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); + p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(Bukkit.getPlayer(args[1]).getName().toLowerCase()+".jobs.job"+(i+1)+"exp"))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); } else { - p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(Bukkit.getPlayer(args[1]).getName()+".jobs.job"+(i+1)+"exp"))+"/"+Math.round(this.plugin.getJobExp(joblist[i], this.plugin.getAccountsConfig().getInt(Bukkit.getPlayer(args[1]).getName()+".jobs.job"+(i+1)+"lv")))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); + p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(Bukkit.getPlayer(args[1]).getName().toLowerCase()+".jobs.job"+(i+1)+"exp"))+"/"+Math.round(this.plugin.getJobExp(joblist[i], this.plugin.getAccountsConfig().getInt(Bukkit.getPlayer(args[1]).getName().toLowerCase()+".jobs.job"+(i+1)+"lv")))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); } if (joblist[i].equalsIgnoreCase("Explorer") && this.plugin.getJobLv(joblist[i], Bukkit.getPlayer(args[1]))>=10) { @@ -1852,7 +1852,7 @@ public String convertToItemName(String val) { boolean discovered=false; long timeleft=0; for (int j=0;j=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); + p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(q.getName().toLowerCase()+".jobs.job"+(i+1)+"exp"))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); } else { - p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(q.getName()+".jobs.job"+(i+1)+"exp"))+"/"+Math.round(this.plugin.getJobExp(joblist[i], this.plugin.getAccountsConfig().getInt(q.getName()+".jobs.job"+(i+1)+"lv")))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); + p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(q.getName().toLowerCase()+".jobs.job"+(i+1)+"exp"))+"/"+Math.round(this.plugin.getJobExp(joblist[i], this.plugin.getAccountsConfig().getInt(q.getName().toLowerCase()+".jobs.job"+(i+1)+"lv")))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":"")); } } - if (joblist[i].equalsIgnoreCase("Explorer") && this.plugin.getJobLv(joblist[i], q.getName())>=10) { + if (joblist[i].equalsIgnoreCase("Explorer") && this.plugin.getJobLv(joblist[i], q.getName().toLowerCase())>=10) { //Check to see if the buff is on cooldown for this player or not. boolean discovered=false; long timeleft=0; for (int j=0;j Date: Tue, 26 Nov 2013 10:47:26 -0700 Subject: [PATCH 04/16] Add in '/jobs members' command. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 51 +++++++++++++------ .../me/kaZep/Commands/commandBankEconomy.java | 51 +++++++++++++++++++ 2 files changed, 86 insertions(+), 16 deletions(-) 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 Date: Tue, 26 Nov 2013 11:17:29 -0700 Subject: [PATCH 05/16] Fixes to '/jobs members' before official release. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 53 ++++++++++++++----- .../me/kaZep/Commands/commandBankEconomy.java | 28 ++++++---- 2 files changed, 57 insertions(+), 24 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 4697c85..71baedc 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -3650,11 +3650,13 @@ public void payDay(int time) } public String[] getJobs(String p) { + p=p.toLowerCase(); String[] string= {getAccountsConfig().getString(p+".jobs.job1"),getAccountsConfig().getString(p+".jobs.job2"),getAccountsConfig().getString(p+".jobs.job3")}; return string; } public boolean PlayerinJob(String p,String job) { + p=p.toLowerCase(); String[] jobs = getJobs(p); for (int i=0;i0) { for (int i=0;i0) { //If it's 0, for some reason it didn't read this name right....Skip it. + if (sorted_players.get(i).toCharArray()[0]0) { + for (int i=0;i Date: Tue, 26 Nov 2013 12:23:33 -0700 Subject: [PATCH 06/16] Fix to /jobs members. Meant to sort by level, not name. --- .../src/me/kaZep/Commands/commandBankEconomy.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index e21e703..411d34d 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -1733,7 +1733,7 @@ public String convertToItemName(String val) { if (this.plugin.getConfig().contains("jobs."+job+"_members")) { p.sendMessage("Players in the "+job_color+job+" job:"); String[] players = this.plugin.getConfig().getString("jobs."+job+"_members").split(", "); - char lowest = 'z'+1; + int lowest = 40; List sorted_players = new ArrayList(); for (int i=0;i0) { for (int i=0;i0) { //If it's 0, for some reason it didn't read this name right....Skip it. - if (sorted_players.get(i).toCharArray()[0]0) { From 65263a474ed225e65fa57ec954781746ea915b85 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 26 Nov 2013 12:31:52 -0700 Subject: [PATCH 07/16] Use offline version of getJobLv(). --- BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 411d34d..4a1de06 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -1744,8 +1744,8 @@ public String convertToItemName(String val) { while (sorted_players.size()>0) { for (int i=0;i0) { //If it's 0, for some reason it didn't read this name right....Skip it. - if (this.plugin.getJobLv(job, p) Date: Tue, 26 Nov 2013 12:41:58 -0700 Subject: [PATCH 08/16] Make Mob Spawners extremely difficult again. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 71baedc..0e5fa35 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -1372,16 +1372,14 @@ public void runTick() { } } if (nearbylist2.size()<5) { - if (Math.random()<=0.2d) { - int l=0; - while (l<5) { - //CreatureSpawner spawner = (CreatureSpawner)Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getState(); - Location testloc = new Location(Bukkit.getWorld("world"),spawner.getLocation().getX()+Math.random()*2-Math.random()*2,spawner.getLocation().getY()+Math.random()*5,spawner.getLocation().getZ()+Math.random()*2-Math.random()*2); - if (p.getNearbyEntities(15, 15, 5).size()<50 && Bukkit.getWorld("world").getBlockAt(testloc).getType()==Material.AIR || Bukkit.getWorld("world").getBlockAt(testloc).getType()==Material.WEB) { - Bukkit.getWorld("world").spawnCreature(testloc,spawner.getCreatureType()); - } - l++; + int l=0; + while (l<5) { + //CreatureSpawner spawner = (CreatureSpawner)Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getState(); + Location testloc = new Location(Bukkit.getWorld("world"),spawner.getLocation().getX()+Math.random()*2-Math.random()*2,spawner.getLocation().getY()+Math.random()*5,spawner.getLocation().getZ()+Math.random()*2-Math.random()*2); + if (p.getNearbyEntities(15, 15, 5).size()<50 && Bukkit.getWorld("world").getBlockAt(testloc).getType()==Material.AIR || Bukkit.getWorld("world").getBlockAt(testloc).getType()==Material.WEB) { + Bukkit.getWorld("world").spawnCreature(testloc,spawner.getCreatureType()); } + l++; } } } From 485bbf930bb1a607c2aa651ea7b18723702858b7 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 26 Nov 2013 13:41:17 -0700 Subject: [PATCH 09/16] Fixed places where toLowerCase() was not needed/ was missing. --- .../src/me/kaZep/Base/PlayerListener.java | 28 +++++++++---------- .../me/kaZep/Commands/commandBankEconomy.java | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 0cca953..d899c8e 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -12642,10 +12642,10 @@ implements Listener //Deposit all the money into their account. val = this.plugin.economy.getBalance(e.getPlayer().getName()); this.plugin.economy.withdrawPlayer(e.getPlayer().getName(), val); - double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); - this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(mymoney+val)); + double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money"); + this.plugin.getAccountsConfig().set(e.getPlayer().getName().toLowerCase() + ".money", Double.valueOf(mymoney+val)); //this.plugin.saveAccountsConfig(); - e.getPlayer().sendMessage(ChatColor.GREEN+"Deposited $" + df.format(val) + " into your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); + e.getPlayer().sendMessage(ChatColor.GREEN+"Deposited $" + df.format(val) + " into your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money"))); this.plugin.last_bank_deposit_use_time=0; } else { try { @@ -12655,10 +12655,10 @@ implements Listener //Deposit the money into their account. //this.plugin.economy.bankDeposit(e.getPlayer().getName(), val); this.plugin.economy.withdrawPlayer(e.getPlayer().getName(), val); - double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); - this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(mymoney+val)); + double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money"); + this.plugin.getAccountsConfig().set(e.getPlayer().getName().toLowerCase() + ".money", Double.valueOf(mymoney+val)); //this.plugin.saveAccountsConfig(); - e.getPlayer().sendMessage(ChatColor.GREEN+"Deposited $" + df.format(val) + " into your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); + e.getPlayer().sendMessage(ChatColor.GREEN+"Deposited $" + df.format(val) + " into your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money"))); this.plugin.last_bank_deposit_use_time=0; } else { e.getPlayer().sendMessage(ChatColor.RED+"You are not holding that much! " + ChatColor.YELLOW +"Enter a value equal to or lower than $" + ChatColor.GREEN+ df.format(this.plugin.economy.getBalance(e.getPlayer().getName())) + "" + ChatColor.GRAY + ChatColor.ITALIC + " (Remember you can also use the word all)"); @@ -12676,27 +12676,27 @@ implements Listener double val=0; if (e.getMessage().equalsIgnoreCase("all")) { //Withdraw all the money in their account. - val = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); - this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(0)); + val = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money"); + this.plugin.getAccountsConfig().set(e.getPlayer().getName().toLowerCase() + ".money", Double.valueOf(0)); //this.plugin.saveAccountsConfig(); this.plugin.economy.depositPlayer(e.getPlayer().getName(), val); - e.getPlayer().sendMessage(ChatColor.GREEN+"Withdrawed $" + df.format(val) + " from your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); + e.getPlayer().sendMessage(ChatColor.GREEN+"Withdrawed $" + df.format(val) + " from your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money"))); this.plugin.last_bank_withdraw_use_time=0; } else { try { val = Double.parseDouble(e.getMessage()); //Make sure the user is holding at least that much money. - if (this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money")>=val && val>0) { + if (this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money")>=val && val>0) { //Deposit the money into their account. //this.plugin.economy.bankDeposit(e.getPlayer().getName(), val); this.plugin.economy.depositPlayer(e.getPlayer().getName(), val); - double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"); - this.plugin.getAccountsConfig().set(e.getPlayer().getName() + ".money", Double.valueOf(mymoney-val)); + double mymoney = this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money"); + this.plugin.getAccountsConfig().set(e.getPlayer().getName().toLowerCase() + ".money", Double.valueOf(mymoney-val)); //this.plugin.saveAccountsConfig(); - e.getPlayer().sendMessage(ChatColor.GREEN+"Withdrawed $" + df.format(val) + " from your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money"))); + e.getPlayer().sendMessage(ChatColor.GREEN+"Withdrawed $" + df.format(val) + " from your account. " + ChatColor.YELLOW + "New Bank Balance: $" + ChatColor.AQUA + df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money"))); this.plugin.last_bank_withdraw_use_time=0; } else { - e.getPlayer().sendMessage(ChatColor.RED+"You do not have that much! " + ChatColor.YELLOW +"Enter a value equal to or lower than $" + ChatColor.GREEN+ df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName() + ".money")) + "" + ChatColor.GRAY + ChatColor.ITALIC + " (Remember you can also use the word all)"); + e.getPlayer().sendMessage(ChatColor.RED+"You do not have that much! " + ChatColor.YELLOW +"Enter a value equal to or lower than $" + ChatColor.GREEN+ df.format(this.plugin.getAccountsConfig().getDouble(e.getPlayer().getName().toLowerCase() + ".money")) + "" + ChatColor.GRAY + ChatColor.ITALIC + " (Remember you can also use the word all)"); this.plugin.last_bank_withdraw_use_time=Main.SERVER_TICK_TIME; } } catch (NumberFormatException ex_e) { diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 4a1de06..d7285bf 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -1586,7 +1586,7 @@ public String convertToItemName(String val) { is_in_vehicle=true; vehicle = p.getVehicle(); } - if (target.getName().toLowerCase() == this.plugin.getAccountsConfig().getString(p.getName().toLowerCase().toLowerCase() + ".teleplayer")) { + if (target.getName() == this.plugin.getAccountsConfig().getString(p.getName().toLowerCase().toLowerCase() + ".teleplayer")) { //Determine distance of player to other player. double otherx = target.getLocation().getX(); double othery = target.getLocation().getY(); From b977e080be6587ae61e3eae2a81e7f4a4522f88e Mon Sep 17 00:00:00 2001 From: Nonoriri Date: Tue, 26 Nov 2013 17:46:41 -0500 Subject: [PATCH 10/16] Added four types of loot chests. Loot chest probabilities slightly increased. Fixed a nullpointerexception caused by a missing toLowerCase() call. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 103 +++++++++++++++++- .../src/me/kaZep/Base/PlayerListener.java | 98 ++++++++++++++--- .../me/kaZep/Commands/commandBankEconomy.java | 16 +-- 3 files changed, 183 insertions(+), 34 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 0e5fa35..ee470cd 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -83,6 +83,7 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; import org.bukkit.enchantments.Enchantment; @@ -2907,7 +2908,13 @@ public void checkJukeboxes() { } } } - list[i].getScoreboard().getTeam(list[i].getName()).setSuffix(healthbar(list[i].getHealth(),list[i].getMaxHealth(),list[i].getFoodLevel())); + list[i].getScoreboard().getTeam(list[i].getName().toLowerCase()).setSuffix(healthbar(list[i].getHealth(),list[i].getMaxHealth(),list[i].getFoodLevel())); + + /* Team t = list[i].getScoreboard().getTeam(list[i].getName()); + double hp = list[i].getHealth(); + double maxhp = list[i].getMaxHealth(); + int food = list[i].getFoodLevel(); + t.setSuffix(healthbar(hp, maxhp, food)); */ } LOGGING_UPDATE_COUNTS++; //3 for (int i=0;i chestlore = new ArrayList(); + double rand = 1; // Randomly generated number determined by fair dice roll. + + if (tier == -1) { + rand = Math.random(); + // No argument, randomize + } + if (tier == 0) { + // Invalid chest, don't return anything + Bukkit.getLogger().warning("Invalid loot chest detected! This should never happen."); + return null; + } + + if (rand < 0.005 || tier == 2) { + // Generate a mythic chest + chest_name.setDisplayName(ChatColor.LIGHT_PURPLE+"Mythic Chest"); + + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"You feel powerful magic"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"emanating from within;"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"it must contain epic"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"equipment!"); + chest_name.setLore(chestlore); + + chest.setItemMeta(chest_name); + } else if (rand < 0.02 || tier == 3) { + // Generate a loaded goods chest + chest_name.setDisplayName(ChatColor.AQUA+"Heavy Chest"); + + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"It is very heavy; there"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"may be lots of loot within!"); + chest_name.setLore(chestlore); + + chest.setItemMeta(chest_name); + } else if (rand < 0.1 || tier == 4) { + // Generate a double chest + chest_name.setDisplayName(ChatColor.YELLOW+"Closed Chest"); + + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"You can feel a variety of"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"items rattling around inside."); + chest_name.setLore(chestlore); + + chest.setItemMeta(chest_name); + } else { + chest_name.setDisplayName(ChatColor.YELLOW+"Closed Chest"); + + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"Something is rattling"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"around inside; it may"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"contain valuables!"); + chest_name.setLore(chestlore); + + chest.setItemMeta(chest_name); + } + + return chest; + } + public PlayerListener.Cube get_ItemCubeType(ItemStack item_cube) { if (item_cube.hasItemMeta() && item_cube.getItemMeta().hasLore()) { //Check to see if the Lore contains anything. diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 0cca953..8cf3299 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -20,6 +20,7 @@ import net.milkbowl.vault.economy.EconomyResponse; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; @@ -5248,6 +5249,70 @@ implements Listener } } } + + public void open_LootChest(int tier, Location loc) { + + // 1 = single item + // 2 = mythic item + // 3 = plentiful items + // 4 = multiple items + switch (tier) { + case 1: { + loc.getWorld().dropItemNaturally(loc, getGoodie(0)); + }break; + case 2: { + loc.getWorld().dropItemNaturally(loc, getGoodie(1)); + }break; + case 3: { + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.LOG, (int)(Math.random() * 64) + 1)); + } else + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.RAW_FISH, (int)(Math.random() * 64) + 1)); + } else + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.BOOKSHELF, (int)(Math.random() * 64) + 1)); + } else + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.CLAY, (int)(Math.random() * 64) + 1)); + } else + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.EXP_BOTTLE, (int)(Math.random() * 64) + 1)); + } else + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.OBSIDIAN, (int)(Math.random() * 64) + 1)); + } else + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.MOSSY_COBBLESTONE, (int)(Math.random() * 64) + 1)); + } else + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.HAY_BLOCK, (int)(Math.random() * 64) + 1)); + } else + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.QUARTZ_BLOCK, (int)(Math.random() * 64) + 1)); + } else + if (Math.random() < 0.1) { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.NETHER_BRICK, (int)(Math.random() * 64) + 1)); + } else { + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.WOOL, (int)(Math.random() * 64) + 1)); + } + }break; + case 4: { + // Drop at least one stack, and five rolls for a 20% chance at an extra stack. + loc.getWorld().dropItemNaturally(loc, getGoodie(0)); + for (int i = 0; i < 5; i++) { + if (Math.random() < 0.2) { + loc.getWorld().dropItemNaturally(loc, getGoodie(0)); + } + + } + }break; + case 5: { + // OMG NOT CODED YET WTF THIS SHOULDN'T HAPPEN + }break; + } + } + public ItemStack getGoodie() { return getGoodie(0); @@ -5989,22 +6054,9 @@ implements Listener f.getType()==EntityType.ENDERMAN) { - if (this.plugin.getConfig().getBoolean("thanksgiving-enabled") && Math.random()<=0.005) { + if (this.plugin.getConfig().getBoolean("thanksgiving-enabled") && Math.random()<=0.01) { // 0.5% chance of loot chest dropping - ItemStack chest = new ItemStack(Material.CHEST); - ItemMeta chest_name = chest.getItemMeta(); - chest_name.setDisplayName(ChatColor.YELLOW+"Closed Chest"); - - List chestlore = new ArrayList(); - chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!"); - chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); - chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"It feels heavy; there"); - chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"might be items inside."); - chest_name.setLore(chestlore); - - chest.setItemMeta(chest_name); - - f.getWorld().dropItemNaturally(f.getLocation(), chest); + f.getWorld().dropItemNaturally(f.getLocation(), this.plugin.generate_LootChest()); } //if (Math.random()<=0.005) { /* @@ -6403,6 +6455,10 @@ implements Listener @EventHandler public void onFishCatch(PlayerFishEvent e) { if (e.getState()==State.CAUGHT_FISH) { + if (this.plugin.getConfig().getBoolean("thanksgiving-enabled") && Math.random() < 0.10) { + // 5% chance of fishing up a loot chest + e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), this.plugin.generate_LootChest()); + } Player p = e.getPlayer(); if (this.plugin.PlayerinJob(p, "Fisherman")) { this.plugin.gainMoneyExp(p,"Fisherman",0.175,3); @@ -9068,13 +9124,17 @@ implements Listener return; } if (this.plugin.is_LootChest(e.getItemInHand())) { + open_LootChest(this.plugin.get_LootChestTier(e.getItemInHand()), e.getBlockPlaced().getLocation()); + + e.setCancelled(true); if (e.getItemInHand().getAmount() > 1) { e.getItemInHand().setAmount(e.getItemInHand().getAmount() - 1); } else { e.getPlayer().setItemInHand(null); } - e.getPlayer().getWorld().dropItemNaturally(e.getBlockPlaced().getLocation(), getGoodie()); + // e.getPlayer().getWorld().dropItemNaturally(e.getBlockPlaced().getLocation(), getGoodie()); + p.sendMessage(ChatColor.GREEN+"You open the chest and find treasure inside!"); p.playSound(p.getLocation(), Sound.ORB_PICKUP, 10, 1); p.updateInventory(); @@ -12978,7 +13038,7 @@ implements Listener //We have to attempt to insert the item in the Item Cube. Cube cube_type = null; int identifier=-1; - if (item_cube.getItemMeta().getLore()!=null) { + if (item_cube.getItemMeta().getLore()!=null && isItemCube(item_cube)) { //Check to see if the Lore contains anything. for (int i=0;i 1) { p.getItemInHand().setAmount(p.getItemInHand().getAmount() - 1); } else { p.setItemInHand(null); } - p.getWorld().dropItemNaturally(p.getLocation(), getGoodie()); + p.sendMessage(ChatColor.GREEN+"You open the chest and find treasure inside!"); p.playSound(p.getLocation(), Sound.ORB_PICKUP, 10, 1); p.updateInventory(); diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 4a1de06..c314c96 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -524,21 +524,7 @@ public String convertToItemName(String val) { this.plugin.saveConfig(); } if (args[0].equalsIgnoreCase("loot")) { - ItemStack chest = new ItemStack(Material.CHEST); - ItemMeta chest_name = chest.getItemMeta(); - chest_name.setDisplayName(ChatColor.YELLOW+"Closed Chest"); - - List chestlore = new ArrayList(); - chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!"); - chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); - chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"It feels heavy; there"); - chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"might be items inside."); - chest_name.setLore(chestlore); - - chest.setItemMeta(chest_name); - - p.getWorld().dropItemNaturally(p.getLocation(), chest); - } + p.getWorld().dropItemNaturally(p.getLocation(), this.plugin.generate_LootChest()); } } else if (cmd.getName().toLowerCase().equalsIgnoreCase("event") && args.length==2 && p.hasPermission("maintenance-mode-admin")) { if (args[0].equalsIgnoreCase("head")) { From bfeb976e89e720e40130a62423a550efaed5e24b Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 26 Nov 2013 16:10:56 -0700 Subject: [PATCH 11/16] Fix teleport issues. --- BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 521ac6e..8ea681f 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -1572,7 +1572,7 @@ public String convertToItemName(String val) { is_in_vehicle=true; vehicle = p.getVehicle(); } - if (target.getName() == this.plugin.getAccountsConfig().getString(p.getName().toLowerCase().toLowerCase() + ".teleplayer")) { + if (target.getName().equalsIgnoreCase(this.plugin.getAccountsConfig().getString(p.getName().toLowerCase() + ".teleplayer"))) { //Determine distance of player to other player. double otherx = target.getLocation().getX(); double othery = target.getLocation().getY(); @@ -1631,7 +1631,7 @@ public String convertToItemName(String val) { //Allow teleport to occur. p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName().toLowerCase()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". Type the command again to teleport."); this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teletime", Double.valueOf(p.getPlayerTime())); - this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teleplayer", String.valueOf(target.getName().toLowerCase())); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teleplayer", String.valueOf(target.getName())); } else { p.sendMessage("Teleporting to "+ChatColor.GREEN+target.getName().toLowerCase()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". You do not have enough in the bank for that."); } From 9819405e9d7242de8d5d805df25876ac52242376 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 26 Nov 2013 17:08:23 -0700 Subject: [PATCH 12/16] Add toLowerCase() to Pick up notifications. --- BankEconomyMod/src/me/kaZep/Base/PlayerListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 32df212..3281539 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -6977,7 +6977,7 @@ implements Listener @EventHandler public void onPlayerPickup(PlayerPickupItemEvent e) { - if (this.plugin.getAccountsConfig().getBoolean(e.getPlayer().getName()+".settings.notify1")) { + if (this.plugin.getAccountsConfig().getBoolean(e.getPlayer().getName().toLowerCase()+".settings.notify1")) { Player p = e.getPlayer(); String temp = e.getItem().getItemStack().getType().name().replace("_", " "); char[] mod = temp.toCharArray(); From 25f10a7a4690a301f247d58285755c4cafe6bf64 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 26 Nov 2013 22:10:22 -0700 Subject: [PATCH 13/16] Fix major crash issue with '/jobs members'. Added Scaling health with the teleporting command. Baby zombies are much less frequent and now drop loot sometimes. --- .../src/me/kaZep/Base/PlayerListener.java | 63 +++++++++++++++---- .../me/kaZep/Commands/commandBankEconomy.java | 16 +++-- 2 files changed, 61 insertions(+), 18 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 3281539..43b7c7c 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -2431,6 +2431,13 @@ implements Listener double levelsmult=1.0; if (totallvs>20*levelsmult) { if (totallvs<40*levelsmult) { + //Can't have baby zombies at this level. + if (e.getEntity().getType()==EntityType.ZOMBIE) { + Zombie z = (Zombie)e.getEntity(); + if (z.isBaby()) { + z.setBaby(false); + } + } //Sometimes wear leather armor. Only for Skeletons and Zombies. if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) { LivingEntity l = (LivingEntity) e.getEntity(); @@ -2449,6 +2456,13 @@ implements Listener } } else if (totallvs<60*levelsmult) { + //Can't have baby zombies at this level. + if (e.getEntity().getType()==EntityType.ZOMBIE) { + Zombie z = (Zombie)e.getEntity(); + if (z.isBaby()) { + z.setBaby(false); + } + } //Wear leather armor a bit more often. Sometimes a chain piece here or there. Include a Wooden sword usually. if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) { LivingEntity l = (LivingEntity) e.getEntity(); @@ -3022,6 +3036,15 @@ implements Listener } } } + + if (e.getEntity() instanceof Zombie) { + Zombie z = (Zombie)e.getEntity(); + if (z.isBaby() && z.getCustomName()!=null) { + //Can't have weird special baby zombies. + z.setBaby(false); + } + } + if (e.getEntity().getType()==EntityType.EXPERIENCE_ORB) { Bukkit.getWorld("world").spawnEntity(e.getEntity().getLocation(),e.getEntity().getType()); } @@ -6046,18 +6069,20 @@ implements Listener || e.getEntity().getType()==EntityType.PIG || e.getEntity().getType()==EntityType.COW || e.getEntity().getType()==EntityType.OCELOT || e.getEntity().getType()==EntityType.WOLF || e.getEntity().getType()==EntityType.MUSHROOM_COW) { LivingEntity f = e.getEntity(); - if (f.getType()==EntityType.ZOMBIE || - f.getType()==EntityType.SKELETON || - f.getType()==EntityType.PIG_ZOMBIE || - f.getType()==EntityType.SPIDER || - f.getType()==EntityType.CREEPER || - f.getType()==EntityType.ENDERMAN) { - - + if (f instanceof Monster) { if (this.plugin.getConfig().getBoolean("thanksgiving-enabled") && Math.random()<=0.01) { // 0.5% chance of loot chest dropping f.getWorld().dropItemNaturally(f.getLocation(), this.plugin.generate_LootChest()); } + if (f instanceof Zombie) { + Zombie z = (Zombie)f; + if (z.isBaby()) { + //Randomly drop a loot chest sometimes. (4.5% of the time.) + if (Math.random() <= 0.045) { + z.getWorld().dropItemNaturally(z.getLocation(), this.plugin.generate_LootChest()); + } + } + } //if (Math.random()<=0.005) { /* if (Math.random()<=0.005) { @@ -9887,6 +9912,17 @@ implements Listener store.setItemMeta(meta); p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!"); } + if (storename.toLowerCase().contains("null")) { + store.setType(Material.DIAMOND_LEGGINGS); + ItemMeta meta = store.getItemMeta(); + meta.setDisplayName(meta.getDisplayName().replace(ChatColor.DARK_GRAY+"[BROKEN] ","")); + List lore = store.getItemMeta().getLore(); + lore.remove(repairline); + lore.remove(repairline-1); + meta.setLore(lore); + store.setItemMeta(meta); + p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!"); + } if (storename.contains("Diamond Helmet")) { store.setType(Material.DIAMOND_HELMET); ItemMeta meta = store.getItemMeta(); @@ -12224,10 +12260,11 @@ implements Listener list[i].playSound(list[i].getLocation(), Sound.NOTE_PLING, 8, 0.7f); } } + /*Makes no sense as to why this is here. if (!this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".revived")) { this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".revived", Boolean.valueOf(true)); //this.plugin.saveAccountsConfig(); - } + }*/ if (this.plugin.getConfig().getBoolean("spleefinsession") && (p.getName().toLowerCase().compareTo(this.plugin.getConfig().getString("spleefrequestaplayer"))==0 || p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestbplayer"))==0)) { //This player was in spleef. End the spleef session as if this player lost. //We lose. Other player wins. @@ -12506,19 +12543,19 @@ implements Listener } } if (!plugin.PlayerinJob(p, "Explorer") || (plugin.PlayerinJob(p, "Explorer") && plugin.getJobLv("Explorer", p)<20)) { - double balance = Main.economy.getBalance(p.getName().toLowerCase()); + double balance = Main.economy.getBalance(p.getName()); double lose = plugin.getConfig().getDouble("losemoney.LoseAmount"); - double loseAmount = Main.economy.getBalance(p.getName().toLowerCase()) / 100.0D * lose; + double loseAmount = Main.economy.getBalance(p.getName()) / 100.0D * lose; String message = "You lost $%amount because you died."; DecimalFormat df = new DecimalFormat("#0.00"); loseAmount = Double.parseDouble(df.format(loseAmount)); if (Main.economy.has(p.getName().toLowerCase(), loseAmount)) { plugin.getLogger().info("Player " + p.getName() + "'s getting withdrawed with " + loseAmount + "$"); - Main.economy.withdrawPlayer(p.getName().toLowerCase(), loseAmount); + Main.economy.withdrawPlayer(p.getName(), loseAmount); message = message.replaceAll("%amount", String.valueOf(loseAmount)); } else { plugin.getLogger().info("Player " + p.getName() + "'s getting withdrawed with " + balance + "$"); - Main.economy.withdrawPlayer(p.getName().toLowerCase(), balance); + Main.economy.withdrawPlayer(p.getName(), balance); message = message.replaceAll("%amount", String.valueOf(balance)); } p.sendMessage(message); diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 8ea681f..b4f4735 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -75,9 +75,9 @@ public class commandBankEconomy String notEnoughMoney = "˜aYou do not own that amount of money."; String succesfullDeposited = "˜aYou have deposited˜b"; String succesfullWithdraw = "˜aYou have withdrawn˜b"; - String cmdTransferToPlayer1 = "˜aYou have transfered˜b"; + String cmdTransferToPlayer1 = "˜aYou have transferred˜b"; String cmdTransferToPlayer2 = "˜ato˜b"; - String cmdTransferToTarget1 = "˜ahas transfered to you˜b"; + String cmdTransferToTarget1 = "˜ahas transferred to you˜b"; String cmdTransferSameNick = "˜aYou can't transfer money to yourself."; String cmdEditAvaibleActions = "˜aAvaible actions: status, balance"; String cmdEditDisabledToPlayer1 = "˜aYou have disabled"; @@ -1580,6 +1580,7 @@ public String convertToItemName(String val) { double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); + finalcost = finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. @@ -1626,6 +1627,7 @@ public String convertToItemName(String val) { double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); + finalcost = finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. @@ -1719,10 +1721,11 @@ public String convertToItemName(String val) { if (this.plugin.getConfig().contains("jobs."+job+"_members")) { p.sendMessage("Players in the "+job_color+job+" job:"); String[] players = this.plugin.getConfig().getString("jobs."+job+"_members").split(", "); - int lowest = 40; + int lowest = 999999; List sorted_players = new ArrayList(); for (int i=0;i sorted_list_players = new ArrayList(); @@ -1740,7 +1743,10 @@ public String convertToItemName(String val) { sorted_list_players.add(sorted_players.get(lowest_slot)); sorted_players.remove(lowest_slot); lowest_slot=-1; - lowest=40; + lowest=999999; + } else { + p.sendMessage(ChatColor.GOLD+"Sorry, something bad happened! Please report this to an administrator. (EC1)"); + break; //Something bad happened. } } if (sorted_list_players.size()>0) { @@ -1752,7 +1758,7 @@ public String convertToItemName(String val) { p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"- No one in this job yet. -"); } } else { - p.sendMessage(ChatColor.GOLD+"Sorry, something bad happened! Please report this to an administrator."); + p.sendMessage(ChatColor.GOLD+"Sorry, something bad happened! Please report this to an administrator. (EC0)"); } } else { p.sendMessage(ChatColor.RED+"Sorry, that is not a valid job!"); From 0d0d08d03cf45116fbd7a54b64c14f3fe2139a7e Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 26 Nov 2013 23:05:41 -0700 Subject: [PATCH 14/16] Minor changes to teleportation formula. Still not solved. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 2 +- .../src/me/kaZep/Commands/commandBankEconomy.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index ee470cd..6616074 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -3741,7 +3741,7 @@ public void payDay(int time) //Level up! Level up! YEAH! getAccountsConfig().set(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"exp", Double.valueOf(getAccountsConfig().getDouble(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"exp")-getJobExp(job,getAccountsConfig().getInt(p.getName().toLowerCase()+".jobs.job"+(slot+1)+"lv")))); 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) { diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index b4f4735..62f2d3b 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -1580,7 +1580,7 @@ public String convertToItemName(String val) { double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); - finalcost = finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); + finalcost += finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. @@ -1591,7 +1591,7 @@ public String convertToItemName(String val) { //Give exp for doing so. //this.plugin.gainMoneyExp(p,"Support",0,100); } - p.sendMessage("Teleported to "+ChatColor.GREEN+target.getName().toLowerCase()+ChatColor.WHITE+" for $"+ChatColor.YELLOW+df.format(finalcost)+ChatColor.WHITE+". New Account balance: $"+df.format(mymoney-finalcost)); + p.sendMessage("Teleported to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+" for $"+ChatColor.YELLOW+df.format(finalcost)+ChatColor.WHITE+". New Account balance: $"+df.format(mymoney-finalcost)); target.sendMessage(ChatColor.GREEN+p.getName().toLowerCase()+ChatColor.WHITE+" teleported to your location."); if (is_in_vehicle) { vehicle.eject(); @@ -1627,7 +1627,7 @@ public String convertToItemName(String val) { double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); - finalcost = finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); + finalcost += finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. From b6a692c058827375df5b16bc402f689fc2bdfc3f Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 26 Nov 2013 23:35:56 -0700 Subject: [PATCH 15/16] Fix to teleportation cost. --- .../src/me/kaZep/Commands/commandBankEconomy.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 62f2d3b..9a98bef 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -1579,8 +1579,11 @@ public String convertToItemName(String val) { double otherz = target.getLocation().getZ(); double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); + //Bukkit.getLogger().info("finalcost1:"+finalcost); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); + //Bukkit.getLogger().info("finalcost2:"+finalcost); finalcost += finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); + //Bukkit.getLogger().info("finalcost3:"+finalcost); //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. @@ -1626,8 +1629,11 @@ public String convertToItemName(String val) { double otherz = target.getLocation().getZ(); double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); + Bukkit.getLogger().info("finalcost1:"+finalcost); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); + Bukkit.getLogger().info("finalcost2:"+finalcost); finalcost += finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); + Bukkit.getLogger().info("finalcost3:"+finalcost); //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. @@ -1656,7 +1662,11 @@ public String convertToItemName(String val) { double otherz = target.getLocation().getZ(); double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); + //Bukkit.getLogger().info("finalcost1:"+finalcost); finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); + //Bukkit.getLogger().info("finalcost2:"+finalcost); + finalcost += finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); + //Bukkit.getLogger().info("finalcost3:"+finalcost); //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); if (mymoney>=finalcost) { //Allow teleport to occur. From bb0060b0ed3521c9c7d0f29cabfd4a9c7ebdb978 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Wed, 27 Nov 2013 07:17:28 -0700 Subject: [PATCH 16/16] Add in ability to teleport to Town spawn locations. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 5 + .../src/me/kaZep/Base/PlayerListener.java | 2 +- .../me/kaZep/Commands/commandBankEconomy.java | 145 +++++++++++++++++- 3 files changed, 146 insertions(+), 6 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 6616074..8930121 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -23,6 +23,7 @@ import java.text.*; import me.kaZep.Commands.JobsDataInfo; import me.kaZep.Commands.commandBankEconomy; +import net.jmhertlein.mctowns.MCTowns; import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; @@ -223,6 +224,10 @@ public class Main extends JavaPlugin cleaned=false; + if (Bukkit.getPluginManager().isPluginEnabled("MCTowns")) { + Bukkit.getLogger().info("MCTowns loaded."); + } + PluginDescriptionFile pdf = getDescription(); System.out.println("[" + getDescription().getName() + "] Status: Activated (mb: kaZep)"); System.out.println("[" + getDescription().getName() + "] PayDay: " + getConfig().getBoolean("payday.enabled")); diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 43b7c7c..544fef8 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -3039,7 +3039,7 @@ implements Listener if (e.getEntity() instanceof Zombie) { Zombie z = (Zombie)e.getEntity(); - if (z.isBaby() && z.getCustomName()!=null) { + if (z.isBaby() && z.getCustomName()!=null && !z.getCustomName().contains("Ninja")) { //Can't have weird special baby zombies. z.setBaby(false); } diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 9a98bef..17ea407 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -4,10 +4,16 @@ import java.io.File; import java.io.IOException; import java.text.DecimalFormat; import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; import java.util.List; import java.util.Map; import me.kaZep.Base.Main; +import net.jmhertlein.mctowns.MCTowns; +import net.jmhertlein.mctowns.MCTownsPlugin; +import net.jmhertlein.mctowns.database.TownManager; +import net.jmhertlein.mctowns.structure.Town; import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; @@ -54,7 +60,7 @@ public class commandBankEconomy String usage = "˜bUsage:"; String invARG = "˜cInvalid argument. Please use ˜2/bankeconomy˜c to see a full list of commands."; String invARGT2 = "˜cInvalid argument or insufficient permissions."; - String offlinePlayer = "˜cPlayer not found."; + String offlinePlayer = "˜cPlayer / Town not found."; String accountDisabled = "˜cYour account is disabled."; String cmdInfo = "˜aYour bank balance is˜b"; @@ -1564,7 +1570,96 @@ public String convertToItemName(String val) { //Teleport. Player target = p.getServer().getPlayer(args[1]); if (target == null) { - p.sendMessage(this.prefix + " " + this.offlinePlayer); + //It could be a town name. Check + TownManager t = MCTownsPlugin.getPlugin().getTownManager(); + Bukkit.getLogger().info("Town Manager started:"+ t.toString()); + Town teleport_town = null; + Collection towns = t.getTownsCollection(); + for (Town towny : towns) { + if (towny!=null) { + if (towny.getTownName().equalsIgnoreCase(args[1])) { + teleport_town = towny; + break; + } else { + Bukkit.getLogger().info("This was town "+towny.getTownName()); + } + } + } + //Iterate through collection, seeing if we can find the town. + if (teleport_town == null) { + p.sendMessage(this.prefix + " " + this.offlinePlayer); + } else { + boolean is_in_vehicle = false; + Entity vehicle = null; + if (p.isInsideVehicle()) { + is_in_vehicle=true; + vehicle = p.getVehicle(); + } + if (teleport_town.getTownName().equalsIgnoreCase(this.plugin.getAccountsConfig().getString(p.getName().toLowerCase() + ".teleplayer"))) { + //Determine distance of player to other player. + double otherx = teleport_town.getSpawn(Bukkit.getServer()).getX(); + double othery = teleport_town.getSpawn(Bukkit.getServer()).getY(); + double otherz = teleport_town.getSpawn(Bukkit.getServer()).getZ(); + double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); + double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); + //Bukkit.getLogger().info("finalcost1:"+finalcost); + finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); + //Bukkit.getLogger().info("finalcost2:"+finalcost); + finalcost += finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); + //Bukkit.getLogger().info("finalcost3:"+finalcost); + //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); + if (mymoney>=finalcost) { + //Allow teleport to occur. + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".money", mymoney-finalcost); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teletime", Double.valueOf(0.0d)); + //this.plugin.saveAccountsConfig(); + if (this.plugin.PlayerinJob(p, "Support")) { + //Give exp for doing so. + //this.plugin.gainMoneyExp(p,"Support",0,100); + } + p.sendMessage("Teleported to "+ChatColor.GREEN+teleport_town.getTownName()+ChatColor.WHITE+" for $"+ChatColor.YELLOW+df.format(finalcost)+ChatColor.WHITE+". New Account balance: $"+df.format(mymoney-finalcost)); + Bukkit.broadcastMessage(ChatColor.GREEN+p.getName()+ChatColor.WHITE+" teleported to "+ChatColor.YELLOW+teleport_town.getTownName()+"."); + if (is_in_vehicle) { + vehicle.eject(); + p.eject(); + final Player p2 = p; + final Town target2 = teleport_town; + Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { + @Override + public void run() { + p2.teleport(target2.getSpawn(Bukkit.getServer())); + } + },5); + } else { + p.teleport(teleport_town.getSpawn(Bukkit.getServer())); + } + } else { + p.sendMessage("You need $"+ChatColor.YELLOW+df.format(finalcost)+" in the bank to teleport to "+ChatColor.GREEN+teleport_town.getTownName()+ChatColor.WHITE+"!"); + } + } else { + //Setup another town. + //Determine distance of player to new town. + double otherx = teleport_town.getSpawn(Bukkit.getServer()).getX(); + double othery = teleport_town.getSpawn(Bukkit.getServer()).getY(); + double otherz = teleport_town.getSpawn(Bukkit.getServer()).getZ(); + double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); + double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); + Bukkit.getLogger().info("finalcost1:"+finalcost); + finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); + Bukkit.getLogger().info("finalcost2:"+finalcost); + finalcost += finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); + Bukkit.getLogger().info("finalcost3:"+finalcost); + //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); + if (mymoney>=finalcost) { + //Allow teleport to occur. + p.sendMessage("Teleporting to "+ChatColor.GREEN+teleport_town.getTownName()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". Type the command again to teleport."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teletime", Double.valueOf(p.getPlayerTime())); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teleplayer", String.valueOf(teleport_town.getTownName())); + } else { + p.sendMessage("Teleporting to "+ChatColor.GREEN+teleport_town.getTownName()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". You do not have enough in the bank for that."); + } + } + } } else { boolean is_in_vehicle = false; Entity vehicle = null; @@ -1595,7 +1690,7 @@ public String convertToItemName(String val) { //this.plugin.gainMoneyExp(p,"Support",0,100); } p.sendMessage("Teleported to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+" for $"+ChatColor.YELLOW+df.format(finalcost)+ChatColor.WHITE+". New Account balance: $"+df.format(mymoney-finalcost)); - target.sendMessage(ChatColor.GREEN+p.getName().toLowerCase()+ChatColor.WHITE+" teleported to your location."); + target.sendMessage(ChatColor.GREEN+p.getName()+ChatColor.WHITE+" teleported to your location."); if (is_in_vehicle) { vehicle.eject(); p.eject(); @@ -1619,7 +1714,7 @@ public String convertToItemName(String val) { } } } else { - p.sendMessage("You need $"+ChatColor.YELLOW+df.format(finalcost)+" in the bank to teleport to "+ChatColor.GREEN+target.getName().toLowerCase()+ChatColor.WHITE+"!"); + p.sendMessage("You need $"+ChatColor.YELLOW+df.format(finalcost)+" in the bank to teleport to "+ChatColor.GREEN+target.getName()+ChatColor.WHITE+"!"); } } else { //Setup another player. @@ -1654,7 +1749,47 @@ public String convertToItemName(String val) { //Teleport. Player target = p.getServer().getPlayer(args[1]); if (target == null) { - p.sendMessage(this.prefix + " " + this.offlinePlayer); + //It could be a town name. Check + TownManager t = MCTownsPlugin.getPlugin().getTownManager(); + Bukkit.getLogger().info("Town Manager started:"+ t.toString()); + Town teleport_town = null; + Collection towns = t.getTownsCollection(); + for (Town towny : towns) { + if (towny!=null) { + if (towny.getTownName().equalsIgnoreCase(args[1])) { + teleport_town = towny; + break; + } else { + Bukkit.getLogger().info("This was town "+towny.getTownName()); + } + } + } + if (teleport_town == null) { + p.sendMessage(this.prefix + " " + this.offlinePlayer); + } else { + //We can attempt to teleport to this town's spawn point. Find out the point and how much it costs. + Location spawn_point = teleport_town.getSpawn(Bukkit.getServer()); + //Determine distance of player to town.. + double otherx = spawn_point.getX(); + double othery = spawn_point.getY(); + double otherz = spawn_point.getZ(); + double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money"); + double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz); + //Bukkit.getLogger().info("finalcost1:"+finalcost); + finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate"); + //Bukkit.getLogger().info("finalcost2:"+finalcost); + finalcost += finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth()); + //Bukkit.getLogger().info("finalcost3:"+finalcost); + //finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax"); + if (mymoney>=finalcost) { + //Allow teleport to occur. + p.sendMessage("Teleporting to "+ChatColor.GREEN+teleport_town.getTownName()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". Type the command again to teleport."); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teletime", Double.valueOf(p.getPlayerTime())); + this.plugin.getAccountsConfig().set(p.getName().toLowerCase().toLowerCase() + ".teleplayer", String.valueOf(teleport_town.getTownName().toLowerCase())); + } else { + p.sendMessage("Teleporting to "+ChatColor.GREEN+teleport_town.getTownName()+ChatColor.WHITE+" costs $"+ChatColor.YELLOW+df.format(finalcost)+". You do not have enough in the bank for that."); + } + } } else { //Determine distance of player to other player. double otherx = target.getLocation().getX();