From 8846e32a31598b953daa888dcfc638454c71eff6 Mon Sep 17 00:00:00 2001 From: Nonoriri Date: Wed, 27 Nov 2013 23:57:20 -0500 Subject: [PATCH] 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 orblore = new ArrayList(); + 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 roselore = new ArrayList(); + 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 data = p.getInventory().getContents()[m].getItemMeta().getLore(); + + for (int i=0;i data = p.getInventory().getContents()[m].getItemMeta().getLore(); + + for (int i=0;i 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();