From a6725ff100fc716512434e03ccff1b352ced2334 Mon Sep 17 00:00:00 2001 From: Nonoriri <imafoodus@gmail.com> Date: Wed, 27 Nov 2013 17:09:59 -0500 Subject: [PATCH 1/5] Fixed comments to be consistent with code, added chaos chests, several fishing changes during event, event XP doubling now occurs. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 27 +++++-- .../src/me/kaZep/Base/PlayerListener.java | 80 ++++++++++++++----- .../me/kaZep/Commands/commandBankEconomy.java | 6 +- 3 files changed, 87 insertions(+), 26 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 8930121..5ff4529 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -3716,7 +3716,7 @@ public void payDay(int time) public void gainMoneyExp(Player p,String job,double amount,double exp) { String[] jobs = getJobs(p); int slot=-1; - if (getConfig().getBoolean("halloween-enabled")) { + if (getConfig().getBoolean("halloween-enabled") || getConfig().getBoolean("thanksgiving-enabled")) { amount*=2; exp*=2; } @@ -3805,7 +3805,7 @@ public void payDay(int time) public void gainMoney(Player p,String job,double amount) { String[] jobs = getJobs(p); int slot=-1; - if (getConfig().getBoolean("halloween-enabled")) { + if (getConfig().getBoolean("halloween-enabled") || getConfig().getBoolean("thanksgiving-enabled")) { amount*=2; } //Add to how much we've earned so far. @@ -4716,6 +4716,9 @@ public void payDay(int time) if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"You can feel a variety of")) { return 4; // Multiloot } + if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"A torrential flow of dark")) { + return 5; // Chaos loot + } } @@ -4767,9 +4770,23 @@ public void payDay(int time) 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"); + } else if (rand < 0.04 || tier == 5) { + // Generate a chaos chest + chest_name.setDisplayName(ChatColor.RED+"Chaos Chest"); + + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A torrential flow of dark"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"energy causes the chest to"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"shake uncontrollably! You"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"have absolutely zero idea"); + chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"what may be inside."); + chest_name.setLore(chestlore); + + chest.setItemMeta(chest_name); + } else if (rand < 0.12 || tier == 4) { + // Generate a loaded chest + chest_name.setDisplayName(ChatColor.YELLOW+"Loaded Chest"); chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!"); chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 7de3af4..5d3e4c3 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -21,6 +21,7 @@ import net.milkbowl.vault.economy.EconomyResponse; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; @@ -178,6 +179,8 @@ import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; import org.bukkit.potion.Potion; +import sig.ItemSets.DiabloDropsHook; + import com.google.common.base.Objects; import com.sk89q.worldedit.CuboidClipboard; import com.sk89q.worldedit.EditSession; @@ -319,7 +322,7 @@ implements Listener if (this.plugin.PlayerinJob(p, "Enchanter") && this.plugin.getJobLv("Enchanter", p)>=5) { e.setAmount(e.getAmount()*2); } - if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) { + if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled") || this.plugin.getConfig().getBoolean("thanksgiving-enabled")) { e.setAmount(e.getAmount()*2); } if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify3")) { @@ -5279,6 +5282,8 @@ implements Listener // 2 = mythic item // 3 = plentiful items // 4 = multiple items + // 5 = chaos items (diablodrops items) + // 999 = Survivor's kit switch (tier) { case 1: { loc.getWorld().dropItemNaturally(loc, getGoodie(0)); @@ -5288,13 +5293,13 @@ implements Listener }break; case 3: { if (Math.random() < 0.1) { - loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.LOG, (int)(Math.random() * 64) + 1)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.NETHER_BRICK, (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)); + 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.CLAY, (int)(Math.random() * 64) + 1)); @@ -5303,36 +5308,57 @@ implements Listener 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)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.NOTE_BLOCK, (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)); + 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.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)); + 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.REDSTONE_LAMP_OFF, (int)(Math.random() * 64) + 1)); } else { + // Damn you got unlucky, better try next time 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. + // Drop at least two stacks, and four rolls for a 20% chance at an extra stack. + loc.getWorld().dropItemNaturally(loc, getGoodie(0)); loc.getWorld().dropItemNaturally(loc, getGoodie(0)); - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 4; i++) { + // Averages one extra drop. Can be up to 4. if (Math.random() < 0.2) { loc.getWorld().dropItemNaturally(loc, getGoodie(0)); } - } }break; case 5: { + loc.getWorld().dropItemNaturally(loc, DiabloDropsHook.getRandomItem()); + for (int i = 0; i < 10 && Math.random() < 0.2; i++) { + // 20% for one extra, 4% for two extra, 0.8% for three extra, etc. + loc.getWorld().dropItemNaturally(loc, DiabloDropsHook.getRandomItem()); + } + }break; + case 6: { // OMG NOT CODED YET WTF THIS SHOULDN'T HAPPEN }break; + case 999: { + // Not yet obtainable + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.WORKBENCH)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.FURNACE)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.WOOD, 16)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.COBBLESTONE, 16)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.TORCH, 16)); + loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.BREAD, 16)); + }break; } } @@ -5343,7 +5369,7 @@ implements Listener public ItemStack getGoodie(int rar /*1=Mythical 0=Normal -1=Only an equipment*/) { ItemStack item = null; - if (Math.random()<0.33 || rar==-1) { + if (Math.random()<0.33 || rar==-1 || rar==1) { //Add a weapon/armor piece. int rand = (int)(Math.random()*5); String type = ""; @@ -6225,7 +6251,7 @@ implements Listener } } } - if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) { + if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled") || this.plugin.getConfig().getBoolean("thanksgiving-enabled")) { e.setDroppedExp(e.getDroppedExp()*2); } if (f.getKiller()!=null && f.getKiller().getType()==EntityType.PLAYER) { @@ -6480,9 +6506,23 @@ 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()); + if (this.plugin.getConfig().getBoolean("thanksgiving-enabled")) { + if (Math.random() < 0.50) { + // 50% chance of fishing up a chicken plus feathers + e.setExpToDrop(e.getExpToDrop() * 2); + e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), new ItemStack(Material.RAW_CHICKEN)); + e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), new ItemStack(Material.FEATHER, 1 + (int)(Math.random() * 4))); + } + for (int c = 0; c < 5 && Math.random() < 0.20; c++) { + // 20% chance each of catching additional fish + e.setExpToDrop(e.getExpToDrop() + (int)(Math.random() * 6) + 1); + e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), new ItemStack(Material.RAW_FISH)); + } + if (Math.random() < 0.10) { + // 10% chance of fishing up a loot chest + e.setExpToDrop(e.getExpToDrop() + (int)(Math.random() * 6) + 1); + e.getPlayer().getWorld().dropItemNaturally(e.getPlayer().getLocation(), this.plugin.generate_LootChest()); + } } Player p = e.getPlayer(); if (this.plugin.PlayerinJob(p, "Fisherman")) { @@ -11529,7 +11569,7 @@ implements Listener item = new ItemStack(Material.BROWN_MUSHROOM); }break; case 92:{ - item = new ItemStack(Material.SNOW_BALL); + item = new ItemStack(Material.SNOW_BALL, 1 + (int)(Math.random() * 16)); }break; case 93:{ item = new ItemStack(Material.FENCE); @@ -11697,7 +11737,7 @@ implements Listener item = new ItemStack(Material.DIAMOND); }break; case 3:{ - item = new ItemStack(Material.GOLD_INGOT); + item = new ItemStack(Material.GOLD_INGOT, 1 + (int)(Math.random() * 2)); }break; case 4:{ item = new ItemStack(Material.GOLDEN_APPLE); @@ -11756,7 +11796,7 @@ implements Listener case 1: case 2: case 3:{ - item = new ItemStack(Material.SKULL_ITEM); + item = new ItemStack(Material.SKULL_ITEM, 1 + (int)(Math.random() * 6)); item.setData(new MaterialData(Material.SKULL_ITEM, (byte) 1)); }break; case 4:{ @@ -11774,13 +11814,13 @@ implements Listener } }break; case 107:{ - item = new ItemStack(Material.COOKIE, 8); + item = new ItemStack(Material.COOKIE, 1 + (int)(Math.random() * 8)); }break; case 108:{ - item = new ItemStack(Material.SEEDS, 42); + item = new ItemStack(Material.SEEDS, 1 + (int)(Math.random() * 64)); }break; case 109:{ - item = new ItemStack(Material.PAINTING, 16); + item = new ItemStack(Material.PAINTING, 1 + (int)(Math.random() * 32)); }break; case 110:{ item = getGoodie(0); diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 8211bff..1fac25d 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -559,9 +559,13 @@ public String convertToItemName(String val) { } } if (args[0].equalsIgnoreCase("loot")) { - p.getWorld().dropItemNaturally(p.getLocation(), this.plugin.generate_LootChest()); } + 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("loot")) { + p.getWorld().dropItemNaturally(p.getLocation(), this.plugin.generate_LootChest(Integer.valueOf(args[1]))); + } if (args[0].equalsIgnoreCase("head")) { ItemStack m = new ItemStack(Material.SKULL_ITEM, 64, (short)SkullType.PLAYER.ordinal()); SkullMeta skullMeta = (SkullMeta) m.getItemMeta(); From 8846e32a31598b953daa888dcfc638454c71eff6 Mon Sep 17 00:00:00 2001 From: Nonoriri <imafoodus@gmail.com> Date: Wed, 27 Nov 2013 23:57:20 -0500 Subject: [PATCH 2/5] Added witherless rose recipe. For each rose you own, wither damage taken is halved. Orb of Distortion is also added to allow players some privacy. Hold onto the item and other players cannot telport to them. Thanksgiving event finalized. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 88 ++++++++++++++++++- .../src/me/kaZep/Base/PlayerListener.java | 3 + .../me/kaZep/Commands/commandBankEconomy.java | 6 +- 3 files changed, 95 insertions(+), 2 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 5ff4529..00ba7a9 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -328,7 +328,7 @@ public class Main extends JavaPlugin nether_star.setIngredient('d', Material.DIAMOND); Bukkit.addRecipe(nether_star); - //Add Recipe for water source crafting. + //Add Recipe for water source crafting. ItemStack water = new ItemStack(Material.WATER, 8); ItemMeta water_name = water.getItemMeta(); @@ -351,6 +351,56 @@ public class Main extends JavaPlugin Bukkit.addRecipe(nether_water); + //Add Recipe for orb of distortion + ItemStack orb = new ItemStack(Material.SLIME_BALL, 1); + ItemMeta orb_name = orb.getItemMeta(); + + List<String> orblore = new ArrayList<String>(); + orblore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); + orblore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"This orb distorts space-time"); + orblore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"around it, preventing anyone"); + orblore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"from teleporting to its carrier."); + orb_name.setLore(orblore); + orb_name.setDisplayName(ChatColor.AQUA+"Orb of Distortion"); + + orb.setItemMeta(orb_name); + orb.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1); + + ShapedRecipe distortion_orb = new ShapedRecipe(orb); + + distortion_orb.shape("aaa", "aba", "aaa"); + distortion_orb.setIngredient('a', Material.ENDER_PEARL); + distortion_orb.setIngredient('b', Material.ENDER_STONE); + + Bukkit.addRecipe(distortion_orb); + + //Add Recipe for rose of distortion + ItemStack rose = new ItemStack(Material.RED_ROSE, 1); + ItemMeta rose_name = rose.getItemMeta(); + + List<String> roselore = new ArrayList<String>(); + roselore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); + roselore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"This flower is infused with"); + roselore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"overwhelming magical power,"); + roselore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"causing it to never wilt."); + roselore.add(ChatColor.GRAY+""+ChatColor.ITALIC+""); + roselore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"The holder of this flower"); + roselore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"will also be resistant to"); + roselore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"any "+ChatColor.RESET+"WITHER"+ChatColor.GRAY+""+ChatColor.ITALIC+" effects."); + rose_name.setLore(roselore); + rose_name.setDisplayName(ChatColor.AQUA+"Unwilting Flower"); + + rose.setItemMeta(rose_name); + rose.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 1); + + ShapedRecipe witherless_rose = new ShapedRecipe(rose); + + witherless_rose.shape(" a ", "aba", " a "); + witherless_rose.setIngredient('a', Material.NETHER_STAR); + witherless_rose.setIngredient('b', Material.RED_ROSE); + + Bukkit.addRecipe(witherless_rose); + //Add Recipe for pocket crafting table ItemStack table = new ItemStack(Material.WORKBENCH); ItemMeta table_name = table.getItemMeta(); @@ -4866,6 +4916,42 @@ public void payDay(int time) } } + public boolean hasDistortionOrb(Player p) { + for (int m=0;m<p.getInventory().getContents().length;m++) { + if (p.getInventory().getContents()[m]!=null && p.getInventory().getContents()[m].getType()==Material.SLIME_BALL) { + // See if lore matches distortion orb + if (p.getInventory().getContents()[m].getItemMeta().getLore()!=null) { + List<String> data = p.getInventory().getContents()[m].getItemMeta().getLore(); + + for (int i=0;i<data.size();i++) { + if (data.get(i).contains("This orb distorts space-time")) { + return true; + } + } + } + } + } + return false; + } + + public int getWitherlessRoseCount(Player p) { + int count = 0; + for (int m=0;m<p.getInventory().getContents().length;m++) { + if (p.getInventory().getContents()[m]!=null && p.getInventory().getContents()[m].getType()==Material.RED_ROSE) { + // See if lore matches distortion orb + if (p.getInventory().getContents()[m].getItemMeta().getLore()!=null) { + List<String> data = p.getInventory().getContents()[m].getItemMeta().getLore(); + + for (int i=0;i<data.size();i++) { + if (data.get(i).contains("This flower is infused with")) { + count += p.getInventory().getContents()[m].getAmount(); + } + } + } + } + } + return count; + } private static Method getMethod(Class<?> cl, String method) { diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index c4ddb4d..0efde07 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -6947,6 +6947,9 @@ implements Listener if (e.getCause()==DamageCause.ENTITY_EXPLOSION || e.getCause()==DamageCause.BLOCK_EXPLOSION) { e.setDamage(e.getDamage()*2); } + if (e.getCause()==DamageCause.WITHER) { + e.setDamage(e.getDamage()*Math.pow(0.5, this.plugin.getWitherlessRoseCount(p))); + } Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { @Override public void run() { diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java index 1fac25d..2615c7b 100644 --- a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -24,6 +24,7 @@ import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.Server; import org.bukkit.SkullType; +import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.block.Skull; import org.bukkit.command.Command; @@ -1700,7 +1701,10 @@ public String convertToItemName(String val) { is_in_vehicle=true; vehicle = p.getVehicle(); } - if (target.getName().equalsIgnoreCase(this.plugin.getAccountsConfig().getString(p.getName().toLowerCase() + ".teleplayer"))) { + if (this.plugin.hasDistortionOrb(target)) { + p.getWorld().playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 0.9f, 1); + p.sendMessage(ChatColor.YELLOW + "A strange force prevents you from teleporting!"); + } else 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(); From a901466361999bf9eafbfdbd66a264468b47e175 Mon Sep 17 00:00:00 2001 From: sigonasr2 <sigonasr2@gmail.com> Date: Thu, 28 Nov 2013 21:08:30 -0700 Subject: [PATCH 3/5] Fix Mythical drop rate. Added in toString() debug output command for PlayerBuffData. Added debug output to PlayerBuffData.txt every time it updates. --- BankEconomyMod/src/me/kaZep/Base/Main.java | 17 +++++++++++++++++ .../src/me/kaZep/Base/PlayerBuffData.java | 10 ++++++++++ .../src/me/kaZep/Base/PlayerListener.java | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index 00ba7a9..ca7a7b8 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -2698,6 +2698,23 @@ public void checkJukeboxes() { LOGGING_UPDATE_COUNTS=0; for (int i=0;i<SPEED_CONTROL.size();i++) { SPEED_CONTROL.get(i).updatePlayerSpd(); + try + { + String filename= "PlayerBuffData.txt"; + FileWriter fw = new FileWriter(filename,true); //the true will append the new data + fw.write("["+SERVER_TICK_TIME+"]"+"PlayerBuffData for "+SPEED_CONTROL.get(i).p.getName()+": "+SPEED_CONTROL.get(i).toString()+"\n");//appends the string to the file + if (i+1==SPEED_CONTROL.size()) { + fw.write("========\n"); + } + fw.close(); + } + catch(IOException ioe) + { + System.err.println("IOException: " + ioe.getMessage()); + } + } + if (SPEED_CONTROL.size()!=Bukkit.getOnlinePlayers().length) { + Bukkit.getLogger().warning("["+SERVER_TICK_TIME+"]SPEED_CONTROL and ONLINE PLAYERS list length don't match! ("+SPEED_CONTROL.size()+"/"+Bukkit.getOnlinePlayers().length+")"); } LOGGING_UPDATE_COUNTS++; //1 for (int i=0;i<explorers.size();i++) { diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java index e8729d5..8ec42b2 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java @@ -30,6 +30,16 @@ public class PlayerBuffData { double money_gained=0; long last_money_report_time=0; public Main plugin; + + public String toString() { + //A method that outputs this class as a string. + return ((java.lang.Object)this).toString()+"{p = "+p.toString()+", base_spdlv = "+base_spdlv+", base_armorlv = "+base_armorlv+", armorbufflist = "+ + armorbufflist.toString()+", base_hplv = "+base_hplv+", hpbufflist = "+hpbufflist.toString()+", helmet_durability = "+ + helmet_durability+", chestplate_durability = "+chestplate_durability+", leggings_durability = "+leggings_durability+"," + + " boots_durability = "+boots_durability+", potion_spdlv = "+potion_spdlv+", potion_time = "+potion_time+", hpbuff_time = "+ + hpbuff_time+", extra_hp = "+extra_hp+", money_gained = "+money_gained+", last_money_report_time = "+last_money_report_time+"," + + "plugin = "+plugin.toString()+"}"; + } public String healthbar(double curHP,double maxHP) { //笆�笆� diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 0efde07..2c98614 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -11354,7 +11354,7 @@ implements Listener Location loc = e.getEntity().getLocation(); ItemStack item = null; - switch ((int)(Math.random()*112)) { + switch ((int)(Math.random()*111.01)) { case 0:{ item = new ItemStack(Material.WOOD_HOE); }break; From 4bc85772da5f20227a648e792869b72cb75bc8e1 Mon Sep 17 00:00:00 2001 From: sigonasr2 <sigonasr2@gmail.com> Date: Thu, 28 Nov 2013 22:52:37 -0700 Subject: [PATCH 4/5] Minor fixes to crafting recipes. --- .../src/me/kaZep/Base/PlayerBuffData.java | 8 ++++---- .../src/me/kaZep/Base/PlayerListener.java | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java index 8ec42b2..cc0906a 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java @@ -33,12 +33,12 @@ public class PlayerBuffData { public String toString() { //A method that outputs this class as a string. - return ((java.lang.Object)this).toString()+"{p = "+p.toString()+", base_spdlv = "+base_spdlv+", base_armorlv = "+base_armorlv+", armorbufflist = "+ - armorbufflist.toString()+", base_hplv = "+base_hplv+", hpbufflist = "+hpbufflist.toString()+", helmet_durability = "+ - helmet_durability+", chestplate_durability = "+chestplate_durability+", leggings_durability = "+leggings_durability+"," + + return "PlayerBuffData@{p = "+((p!=null)?p.toString():"null")+", base_spdlv = "+base_spdlv+", base_armorlv = "+base_armorlv+", armorbufflist = "+ + ((armorbufflist!=null)?armorbufflist.toString():"null")+", base_hplv = "+base_hplv+", hpbufflist = "+((hpbufflist!=null)?hpbufflist.toString():"null")+", helmet_durability = "+ + helmet_durability+", chestplate_durability = "+chestplate_durability+", leggings_durability = "+leggings_durability+"," + " boots_durability = "+boots_durability+", potion_spdlv = "+potion_spdlv+", potion_time = "+potion_time+", hpbuff_time = "+ hpbuff_time+", extra_hp = "+extra_hp+", money_gained = "+money_gained+", last_money_report_time = "+last_money_report_time+"," + - "plugin = "+plugin.toString()+"}"; + "plugin = "+((plugin!=null)?plugin.toString():"null")+"}"; } public String healthbar(double curHP,double maxHP) { diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 2c98614..89d0c52 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -4101,14 +4101,26 @@ implements Listener } if (result.getResult().getType()==Material.WOOL && result.getResult().getAmount() == 1) { - result.setResult(new ItemStack(Material.AIR)); - return; + //Make sure the crafting matrix only contains three string. + int stringcount=0; + for (int i=0;i<result.getMatrix().length;i++) { + if (result.getMatrix()[i]!=null && result.getMatrix()[i].getType()==Material.STRING) { + stringcount++; + } + } + if (stringcount!=4) { + result.setResult(new ItemStack(Material.AIR)); + return; + } } // Increase stairs recipe efficiency if (result.getResult().getType()==Material.WOOD_STAIRS) { result.setResult(new ItemStack(Material.WOOD_STAIRS, 8)); } + if (result.getResult().getType()==Material.COBBLESTONE_STAIRS) { + result.setResult(new ItemStack(Material.COBBLESTONE_STAIRS, 8)); + } if (result.getResult().getType()==Material.BIRCH_WOOD_STAIRS) { result.setResult(new ItemStack(Material.BIRCH_WOOD_STAIRS, 8)); } From 8a362a0e6af00e659b1a9e866d8c7974c89c324e Mon Sep 17 00:00:00 2001 From: sigonasr2 <sigonasr2@gmail.com> Date: Thu, 28 Nov 2013 23:09:43 -0700 Subject: [PATCH 5/5] Fix PlayerBuffData entry removal. (toLowerCase() mismatch issue) --- 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 89d0c52..ad0e316 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -12303,7 +12303,7 @@ implements Listener p.closeInventory(); } for (int i=0;i<this.plugin.SPEED_CONTROL.size();i++) { - if (this.plugin.SPEED_CONTROL.get(i).p.getName().compareTo(p.getName().toLowerCase())==0) { + if (this.plugin.SPEED_CONTROL.get(i).p.getName().toLowerCase().compareTo(p.getName().toLowerCase())==0) { p.removePotionEffect(PotionEffectType.SPEED); //If they have a "speed" potion, give it back. p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, (int) ((this.plugin.SPEED_CONTROL.get(i).potion_time-Main.SERVER_TICK_TIME)*2), this.plugin.SPEED_CONTROL.get(i).potion_spdlv, true));