commit 7a2e0f9f7488f5896a8473445933485576b8e8bf Author: sigonasr2 Date: Fri Nov 1 23:28:39 2013 -0700 First Commit diff --git a/BankEconomyMod/.classpath b/BankEconomyMod/.classpath new file mode 100644 index 0000000..1b6ee66 --- /dev/null +++ b/BankEconomyMod/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/BankEconomyMod/.project b/BankEconomyMod/.project new file mode 100644 index 0000000..9dbae4b --- /dev/null +++ b/BankEconomyMod/.project @@ -0,0 +1,23 @@ + + + BankEconomyMod + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/BankEconomyMod/.settings/org.eclipse.core.resources.prefs b/BankEconomyMod/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..cfed1fd --- /dev/null +++ b/BankEconomyMod/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/me/kaZep/Base/Main.java=UTF-8 +encoding//src/me/kaZep/Base/PlayerBuffData.java=UTF-8 +encoding//src/me/kaZep/Base/PlayerListener.java=UTF-8 diff --git a/BankEconomyMod/.settings/org.eclipse.jdt.core.prefs b/BankEconomyMod/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..54e493c --- /dev/null +++ b/BankEconomyMod/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/BankEconomyMod/.settings/org.eclipse.wst.common.project.facet.core.xml b/BankEconomyMod/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..4b45bbe --- /dev/null +++ b/BankEconomyMod/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/BankEconomyMod/accounts.yml b/BankEconomyMod/accounts.yml new file mode 100644 index 0000000..e69de29 diff --git a/BankEconomyMod/bin/me/kaZep/Base/ArrowShooter.class b/BankEconomyMod/bin/me/kaZep/Base/ArrowShooter.class new file mode 100644 index 0000000..4311ff3 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/ArrowShooter.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/BrewingStandData.class b/BankEconomyMod/bin/me/kaZep/Base/BrewingStandData.class new file mode 100644 index 0000000..fafc288 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/BrewingStandData.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/DamageAPI.class b/BankEconomyMod/bin/me/kaZep/Base/DamageAPI.class new file mode 100644 index 0000000..d7a7951 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/DamageAPI.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/EnchantLevelDatabase.class b/BankEconomyMod/bin/me/kaZep/Base/EnchantLevelDatabase.class new file mode 100644 index 0000000..8922453 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/EnchantLevelDatabase.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/EntityHitData.class b/BankEconomyMod/bin/me/kaZep/Base/EntityHitData.class new file mode 100644 index 0000000..1ad9dc6 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/EntityHitData.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/EntityInteractData.class b/BankEconomyMod/bin/me/kaZep/Base/EntityInteractData.class new file mode 100644 index 0000000..71eefc1 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/EntityInteractData.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/ExplorerData.class b/BankEconomyMod/bin/me/kaZep/Base/ExplorerData.class new file mode 100644 index 0000000..585840c Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/ExplorerData.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/FurnaceData.class b/BankEconomyMod/bin/me/kaZep/Base/FurnaceData.class new file mode 100644 index 0000000..4a2fc65 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/FurnaceData.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/InvisibilityData.class b/BankEconomyMod/bin/me/kaZep/Base/InvisibilityData.class new file mode 100644 index 0000000..0dfac3c Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/InvisibilityData.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/JukeboxData.class b/BankEconomyMod/bin/me/kaZep/Base/JukeboxData.class new file mode 100644 index 0000000..db42c6a Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/JukeboxData.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main$1.class b/BankEconomyMod/bin/me/kaZep/Base/Main$1.class new file mode 100644 index 0000000..ed9bde9 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/Main$1.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main$2.class b/BankEconomyMod/bin/me/kaZep/Base/Main$2.class new file mode 100644 index 0000000..a9280ea Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/Main$2.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main$3.class b/BankEconomyMod/bin/me/kaZep/Base/Main$3.class new file mode 100644 index 0000000..b1db1f1 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/Main$3.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main$4.class b/BankEconomyMod/bin/me/kaZep/Base/Main$4.class new file mode 100644 index 0000000..f80e445 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/Main$4.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Main.class b/BankEconomyMod/bin/me/kaZep/Base/Main.class new file mode 100644 index 0000000..0ed10b9 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/Main.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Metrics$1.class b/BankEconomyMod/bin/me/kaZep/Base/Metrics$1.class new file mode 100644 index 0000000..6b23cdb Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/Metrics$1.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Metrics$Graph.class b/BankEconomyMod/bin/me/kaZep/Base/Metrics$Graph.class new file mode 100644 index 0000000..a409106 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/Metrics$Graph.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Metrics$Plotter.class b/BankEconomyMod/bin/me/kaZep/Base/Metrics$Plotter.class new file mode 100644 index 0000000..ef8a900 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/Metrics$Plotter.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/Metrics.class b/BankEconomyMod/bin/me/kaZep/Base/Metrics.class new file mode 100644 index 0000000..32dc860 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/Metrics.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PersistentExplorerList.class b/BankEconomyMod/bin/me/kaZep/Base/PersistentExplorerList.class new file mode 100644 index 0000000..5e55297 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/PersistentExplorerList.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerBuffData.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerBuffData.class new file mode 100644 index 0000000..bf01e8b Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/PlayerBuffData.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerData.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerData.class new file mode 100644 index 0000000..0d5d70b Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/PlayerData.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class new file mode 100644 index 0000000..1d90f7a Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$2.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$2.class new file mode 100644 index 0000000..ce28251 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$2.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$3.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$3.class new file mode 100644 index 0000000..82ebacb Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$3.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$4.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$4.class new file mode 100644 index 0000000..73c834e Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$4.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$5.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$5.class new file mode 100644 index 0000000..0914ea4 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$5.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$6.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$6.class new file mode 100644 index 0000000..7752dbb Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener$6.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/PlayerListener.class b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener.class new file mode 100644 index 0000000..b0203c3 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/PlayerListener.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/ReviveInventory.class b/BankEconomyMod/bin/me/kaZep/Base/ReviveInventory.class new file mode 100644 index 0000000..f633f6b Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/ReviveInventory.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/StoreValues.class b/BankEconomyMod/bin/me/kaZep/Base/StoreValues.class new file mode 100644 index 0000000..b161a66 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/StoreValues.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/SupportEntity.class b/BankEconomyMod/bin/me/kaZep/Base/SupportEntity.class new file mode 100644 index 0000000..27b5206 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/SupportEntity.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/SupportPlayer.class b/BankEconomyMod/bin/me/kaZep/Base/SupportPlayer.class new file mode 100644 index 0000000..2ad6864 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/SupportPlayer.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Base/TempWeb.class b/BankEconomyMod/bin/me/kaZep/Base/TempWeb.class new file mode 100644 index 0000000..f4388b9 Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Base/TempWeb.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Commands/JobsDataInfo.class b/BankEconomyMod/bin/me/kaZep/Commands/JobsDataInfo.class new file mode 100644 index 0000000..b6f1c1f Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Commands/JobsDataInfo.class differ diff --git a/BankEconomyMod/bin/me/kaZep/Commands/commandBankEconomy.class b/BankEconomyMod/bin/me/kaZep/Commands/commandBankEconomy.class new file mode 100644 index 0000000..a4fa21e Binary files /dev/null and b/BankEconomyMod/bin/me/kaZep/Commands/commandBankEconomy.class differ diff --git a/BankEconomyMod/config.yml b/BankEconomyMod/config.yml new file mode 100644 index 0000000..e69de29 diff --git a/BankEconomyMod/plugin.yml b/BankEconomyMod/plugin.yml new file mode 100644 index 0000000..cd9c66a --- /dev/null +++ b/BankEconomyMod/plugin.yml @@ -0,0 +1,25 @@ +name: BankEconomy +main: me.kaZep.Base.Main +version: 1.3.0 +description: Bank plugin which stores money. +commands: + bankeconomy: + description: Bank. + revive: + description: Revive. + tele: + description: Teleport. + transfer: + description: Transfer money to another player. + jobs: + description: Jobs. + sp: + description: Modify your allocated stat points. + maintenance: + description: Toggles Server maintenance status. + settings: + description: Modify notification settings. + unenchant: + description: Unenchant your currently held item. + event: + description: Toggles or untoggles events. \ No newline at end of file diff --git a/BankEconomyMod/src/me/kaZep/Base/ArrowShooter.java b/BankEconomyMod/src/me/kaZep/Base/ArrowShooter.java new file mode 100644 index 0000000..8531e12 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/ArrowShooter.java @@ -0,0 +1,20 @@ +package me.kaZep.Base; + +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.bukkit.util.Vector; + +public class ArrowShooter { + public int timer=0; + public int frequency=0; + public Vector spd; + public Location loc; + public LivingEntity shooter; + public ArrowShooter(Vector spd, Location loc, int duration, int frequency, LivingEntity shooter) { + this.spd=spd; + this.loc=loc; + this.frequency=frequency; + this.timer=duration; + this.shooter=shooter; + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/BrewingStandData.java b/BankEconomyMod/src/me/kaZep/Base/BrewingStandData.java new file mode 100644 index 0000000..c60adaa --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/BrewingStandData.java @@ -0,0 +1,104 @@ +package me.kaZep.Base; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BrewingStand; +import org.bukkit.block.Furnace; +import org.bukkit.inventory.BrewerInventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.Potion; +import org.bukkit.potion.PotionType; + +public class BrewingStandData { + + Location pos; + String owner; + long time; + boolean setnewtime; + public BrewingStandData(Location pos, String owner) { + this.pos=pos; + this.owner=owner; + this.time=Bukkit.getWorld("world").getFullTime()+9000; + this.setnewtime=false; + } + + public void setOwner(String owner) { + this.owner=owner; + } + + public void setBrewingTime(int newval) { + if ((BrewingStand)Bukkit.getWorld("world").getBlockAt(pos).getState()!=null) { + BrewingStand brewingstand = (BrewingStand)Bukkit.getWorld("world").getBlockAt(pos).getState(); + brewingstand.setBrewingTime(newval); + } + } + + public int getBrewingTime() { + if ((BrewingStand)Bukkit.getWorld("world").getBlockAt(pos).getState()!=null) { + BrewingStand brewingstand = (BrewingStand)Bukkit.getWorld("world").getBlockAt(pos).getState(); + return brewingstand.getBrewingTime(); + } else { + return 0; + } + } + + public int getBrewingPotions() { + if ((BrewingStand)Bukkit.getWorld("world").getBlockAt(pos).getState()!=null) { + BrewingStand brewingstand = (BrewingStand)Bukkit.getWorld("world").getBlockAt(pos).getState(); + ItemStack[] b = brewingstand.getInventory().getContents(); + int potioncount=0; + for (int i=0;i aEnd) { + aEnd = aStart; + } + long range = (long) aEnd - (long) aStart + 1; + long fraction = (long) (range * random.nextDouble()); + int randomNumber = (int) (fraction + aStart); + return randomNumber; + } + + public void toggleRandom(boolean toggle) { + randomness = toggle; + } + + public double getDamage(ItemStack helmet, ItemStack chestplate, + ItemStack leggings, ItemStack boots, Double dmg, DamageCause cause, boolean blocking) { + ItemStack[] items = { helmet, chestplate, leggings, boots }; + int[] armReduce = getArmorReduce(items, cause); + int[] encReduce = getEnchantmentsReducement(items, cause); + double armour = 0; + double damage = dmg; + double enc = 0; + for (int in : armReduce) + armour = armour + in; + for (int in : encReduce) + enc = enc + in; + if (enc > 25) + enc = 25; + damage = damage - (damage * armour / 25); + if (randomness == true) + enc = Math.ceil(returnChance((int) ((enc) / 2) * 10, (int) (enc) * 10)); + if (enc > 20) + enc = 20; + enc = enc * 4; + damage = damage - (damage * enc / 100); + if (blocking == true) + damage = damage/2; + return damage; + } + + public double getDamage(Player player, Double damage, DamageCause cause) { + return getDamage(player.getInventory().getHelmet(), player.getInventory() + .getChestplate(), player.getInventory().getLeggings(), player + .getInventory().getBoots(), damage, cause, player.isBlocking()); + } + + private int[] getArmorReduce(ItemStack[] item, DamageCause dmg) { + int[] damage = { 0, 0, 0, 0 }; + if (dmg.equals(DamageCause.ENTITY_ATTACK) || dmg.equals(DamageCause.FIRE) + || dmg.equals(DamageCause.ENTITY_EXPLOSION) + || dmg.equals(DamageCause.BLOCK_EXPLOSION) + || dmg.equals(DamageCause.CONTACT) || dmg.equals(DamageCause.LAVA) + || dmg.equals(DamageCause.PROJECTILE)) { + int cur = 0; + for (ItemStack stack : item) { + if (stack != null) + damage[cur] = getArmorValue(stack); + cur = cur + 1; + } + } + return damage; + } + + private static int[] getEnchantmentsReducement(ItemStack[] item, + DamageCause dmg) { + int[] damage = { 0, 0, 0, 0 }; + int cur = 0; + for (ItemStack stack : item) { + if (stack != null) { + Map enchants = new HashMap( + stack.getEnchantments()); + for (Enchantment enchant : enchants.keySet()) { + if ((dmg.equals(DamageCause.BLOCK_EXPLOSION) || dmg + .equals(DamageCause.ENTITY_EXPLOSION) + && enchant.equals(Enchantment.PROTECTION_EXPLOSIONS))) + damage[cur] = damage[cur] + + (int) Math.floor((6 + enchants.get(enchant) + * enchants.get(enchant)) / 2); + if (dmg.equals(DamageCause.FALL) + && enchant.equals(Enchantment.PROTECTION_FALL)) + damage[cur] = damage[cur] + enchants.get(enchant) * 2; + if (dmg.equals(DamageCause.PROJECTILE) + && enchant.equals(Enchantment.PROTECTION_PROJECTILE)) + damage[cur] = damage[cur] + + (int) Math.floor((6 + enchants.get(enchant) + * enchants.get(enchant)) / 2); + if ((dmg.equals(DamageCause.LAVA) + || dmg.equals(DamageCause.LIGHTNING) + || dmg.equals(DamageCause.FIRE) || dmg.equals(DamageCause.LAVA)) + && enchant.equals(Enchantment.PROTECTION_FIRE)) + damage[cur] = damage[cur] + + (int) Math.floor((6 + enchants.get(enchant) + * enchants.get(enchant)) / 2); + if (enchant.equals(Enchantment.PROTECTION_ENVIRONMENTAL)) + damage[cur] = damage[cur] + + (int) Math.floor((6 + enchants.get(enchant) + * enchants.get(enchant)) / 2); + } + } + } + return damage; + } + + private int getArmorValue(ItemStack armor) { + Material mat = armor.getType(); + if (mat == Material.LEATHER_HELMET || mat == Material.LEATHER_BOOTS + || mat == Material.GOLD_BOOTS || mat == Material.CHAINMAIL_BOOTS) + return 1; + if (mat == Material.LEATHER_LEGGINGS || mat == Material.GOLD_HELMET + || mat == Material.CHAINMAIL_HELMET || mat == Material.IRON_HELMET + || mat == Material.IRON_BOOTS) + return 2; + if (mat == Material.LEATHER_CHESTPLATE || mat == Material.GOLD_LEGGINGS + || mat == Material.DIAMOND_BOOTS || mat == Material.DIAMOND_HELMET) + return 3; + if (mat == Material.CHAINMAIL_LEGGINGS) + return 4; + if (mat == Material.GOLD_CHESTPLATE || mat == Material.CHAINMAIL_CHESTPLATE + || mat == Material.IRON_LEGGINGS) + return 5; + if (mat == Material.IRON_LEGGINGS || mat == Material.DIAMOND_LEGGINGS) + return 6; + if (mat == Material.DIAMOND_CHESTPLATE) + return 8; + return 0; + } + +} \ No newline at end of file diff --git a/BankEconomyMod/src/me/kaZep/Base/EnchantLevelDatabase.java b/BankEconomyMod/src/me/kaZep/Base/EnchantLevelDatabase.java new file mode 100644 index 0000000..b441a8b --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/EnchantLevelDatabase.java @@ -0,0 +1,385 @@ +package me.kaZep.Base; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.enchantments.Enchantment; + + +public class EnchantLevelDatabase { + public List stone_hoe = new ArrayList(); + public List stone_shovel = new ArrayList(); + public List stone_pickaxe = new ArrayList(); + public List leather_boots = new ArrayList(); + public List leather_cap = new ArrayList(); + public List leather_pants = new ArrayList(); + public List leather_tunic = new ArrayList(); + public List iron_shovel = new ArrayList(); + public List iron_boots = new ArrayList(); + public List iron_pickaxe = new ArrayList(); + public List iron_helmet = new ArrayList(); + public List golden_shovel = new ArrayList(); + public List iron_leggings = new ArrayList(); + public List diamond_shovel = new ArrayList(); + public List diamond_hoe = new ArrayList(); + public List golden_boots = new ArrayList(); + public List iron_chestplate = new ArrayList(); + public List golden_helmet = new ArrayList(); + public List diamond_pickaxe = new ArrayList(); + public List diamond_boots = new ArrayList(); + public List golden_leggings = new ArrayList(); + public List golden_chestplate = new ArrayList(); + public List diamond_helmet = new ArrayList(); + public List diamond_leggings = new ArrayList(); + public List diamond_chestplate = new ArrayList(); + public List wood_sword = new ArrayList(); + public List bow = new ArrayList(); + public List iron_sword = new ArrayList(); + public List gold_sword = new ArrayList(); + public List diamond_sword = new ArrayList(); + public EnchantLevelDatabase() { + stone_hoe.add(new StoreValues(0.359,Enchantment.DURABILITY,1,5)); + stone_shovel.add(new StoreValues(0.636,Enchantment.DIG_SPEED,1,5)); + stone_shovel.add(new StoreValues(0.359,Enchantment.DURABILITY,1,5)); + stone_pickaxe.add(new StoreValues(0.636,Enchantment.DIG_SPEED,1,5)); + stone_pickaxe.add(new StoreValues(0.359,Enchantment.DURABILITY,1,5)); // OOPS ^.^ + leather_boots.add(new StoreValues(0.359,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + leather_boots.add(new StoreValues(0.212,Enchantment.PROTECTION_FALL,1,5)); + leather_boots.add(new StoreValues(0.113,Enchantment.PROTECTION_PROJECTILE,2,5)); + leather_boots.add(new StoreValues(0.084,Enchantment.PROTECTION_PROJECTILE,1,5)); + leather_boots.add(new StoreValues(0.081,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + leather_boots.add(new StoreValues(0.065,Enchantment.PROTECTION_FIRE,1,5)); + leather_boots.add(new StoreValues(0.052,Enchantment.PROTECTION_FALL,2,5)); + leather_boots.add(new StoreValues(0.025,Enchantment.PROTECTION_ENVIRONMENTAL,2,5)); + leather_boots.add(new StoreValues(0.001,Enchantment.PROTECTION_EXPLOSIONS,2,5)); + leather_cap.add(new StoreValues(0.405,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + leather_cap.add(new StoreValues(0.146,Enchantment.WATER_WORKER,1,5)); + leather_cap.add(new StoreValues(0.119,Enchantment.PROTECTION_PROJECTILE,2,5)); + leather_cap.add(new StoreValues(0.094,Enchantment.PROTECTION_PROJECTILE,1,5)); + leather_cap.add(new StoreValues(0.082,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + leather_cap.add(new StoreValues(0.069,Enchantment.PROTECTION_FIRE,1,5)); + leather_cap.add(new StoreValues(0.048,Enchantment.OXYGEN,1,5)); + leather_cap.add(new StoreValues(0.029,Enchantment.PROTECTION_ENVIRONMENTAL,2,5)); + leather_cap.add(new StoreValues(0.0001,Enchantment.PROTECTION_EXPLOSIONS,2,5)); + leather_pants.add(new StoreValues(0.451,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + leather_pants.add(new StoreValues(0.135,Enchantment.PROTECTION_PROJECTILE,2,5)); + leather_pants.add(new StoreValues(0.104,Enchantment.PROTECTION_PROJECTILE,1,5)); + leather_pants.add(new StoreValues(0.100,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + leather_pants.add(new StoreValues(0.079,Enchantment.PROTECTION_FIRE,1,5)); + leather_pants.add(new StoreValues(0.032,Enchantment.PROTECTION_ENVIRONMENTAL,2,5)); + leather_pants.add(new StoreValues(0.0001,Enchantment.PROTECTION_EXPLOSIONS,2,5)); + leather_tunic.add(new StoreValues(0.442,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + leather_tunic.add(new StoreValues(0.140,Enchantment.PROTECTION_PROJECTILE,2,5)); + leather_tunic.add(new StoreValues(0.102,Enchantment.PROTECTION_PROJECTILE,1,5)); + leather_tunic.add(new StoreValues(0.094,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + leather_tunic.add(new StoreValues(0.079,Enchantment.PROTECTION_FIRE,1,5)); + leather_tunic.add(new StoreValues(0.053,Enchantment.THORNS,1,5)); + leather_tunic.add(new StoreValues(0.028,Enchantment.PROTECTION_ENVIRONMENTAL,2,5)); + leather_tunic.add(new StoreValues(0.001,Enchantment.PROTECTION_EXPLOSIONS,2,5)); + iron_shovel.add(new StoreValues(0.506,Enchantment.DIG_SPEED,1,5)); + iron_shovel.add(new StoreValues(0.355,Enchantment.DURABILITY,1,5)); + iron_shovel.add(new StoreValues(0.126,Enchantment.DIG_SPEED,2,5)); + iron_shovel.add(new StoreValues(0.06,Enchantment.DURABILITY,2,5)); + iron_boots.add(new StoreValues(0.41,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + iron_boots.add(new StoreValues(0.265,Enchantment.PROTECTION_FALL,1,5)); + iron_boots.add(new StoreValues(0.143,Enchantment.PROTECTION_PROJECTILE,1,5)); + iron_boots.add(new StoreValues(0.082,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + iron_boots.add(new StoreValues(0.065,Enchantment.PROTECTION_PROJECTILE,2,5)); + iron_boots.add(new StoreValues(0.022,Enchantment.PROTECTION_FIRE,1,5)); + iron_boots.add(new StoreValues(0.006,Enchantment.PROTECTION_FALL,2,5)); + iron_pickaxe.add(new StoreValues(0.504,Enchantment.DIG_SPEED,1,5)); + iron_pickaxe.add(new StoreValues(0.354,Enchantment.DURABILITY,1,5)); + iron_pickaxe.add(new StoreValues(0.129,Enchantment.DIG_SPEED,2,5)); + iron_pickaxe.add(new StoreValues(0.06,Enchantment.DURABILITY,2,5)); + iron_helmet.add(new StoreValues(0.471,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + iron_helmet.add(new StoreValues(0.161,Enchantment.WATER_WORKER,1,5)); + iron_helmet.add(new StoreValues(0.16,Enchantment.PROTECTION_PROJECTILE,1,5)); + iron_helmet.add(new StoreValues(0.092,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + iron_helmet.add(new StoreValues(0.072,Enchantment.PROTECTION_PROJECTILE,2,5)); + iron_helmet.add(new StoreValues(0.022,Enchantment.PROTECTION_FIRE,1,5)); + iron_helmet.add(new StoreValues(0.015,Enchantment.OXYGEN,1,5)); + golden_shovel.add(new StoreValues(0.364,Enchantment.DIG_SPEED,2,5)); + golden_shovel.add(new StoreValues(0.256,Enchantment.DIG_SPEED,1,5)); + golden_shovel.add(new StoreValues(0.253,Enchantment.DURABILITY,1,5)); + golden_shovel.add(new StoreValues(0.101,Enchantment.DURABILITY,2,5)); + golden_shovel.add(new StoreValues(0.01,Enchantment.LOOT_BONUS_BLOCKS,1,5)); + golden_shovel.add(new StoreValues(0.006,Enchantment.SILK_TOUCH,1,5)); + iron_leggings.add(new StoreValues(0.523,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + iron_leggings.add(new StoreValues(0.178,Enchantment.PROTECTION_PROJECTILE,1,5)); + iron_leggings.add(new StoreValues(0.101,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + iron_leggings.add(new StoreValues(0.083,Enchantment.PROTECTION_PROJECTILE,2,5)); + iron_leggings.add(new StoreValues(0.025,Enchantment.PROTECTION_FIRE,1,5)); + diamond_shovel.add(new StoreValues(0.623,Enchantment.DIG_SPEED,1,5)); + diamond_shovel.add(new StoreValues(0.356,Enchantment.DURABILITY,1,5)); + diamond_shovel.add(new StoreValues(0.014,Enchantment.DIG_SPEED,2,5)); + golden_boots.add(new StoreValues(0.187,Enchantment.PROTECTION_ENVIRONMENTAL,2,5)); + golden_boots.add(new StoreValues(0.158,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + golden_boots.add(new StoreValues(0.155,Enchantment.PROTECTION_FALL,2,5)); + golden_boots.add(new StoreValues(0.131,Enchantment.PROTECTION_FIRE,1,5)); + golden_boots.add(new StoreValues(0.112,Enchantment.PROTECTION_PROJECTILE,2,5)); + golden_boots.add(new StoreValues(0.082,Enchantment.PROTECTION_FALL,1,5)); + golden_boots.add(new StoreValues(0.042,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + golden_boots.add(new StoreValues(0.033,Enchantment.PROTECTION_PROJECTILE,3,5)); + golden_boots.add(new StoreValues(0.030,Enchantment.PROTECTION_EXPLOSIONS,2,5)); + golden_boots.add(new StoreValues(0.026,Enchantment.PROTECTION_PROJECTILE,1,5)); + golden_boots.add(new StoreValues(0.023,Enchantment.PROTECTION_FALL,3,5)); + golden_boots.add(new StoreValues(0.005,Enchantment.PROTECTION_FIRE,2,5)); + iron_chestplate.add(new StoreValues(0.525,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + iron_chestplate.add(new StoreValues(0.172,Enchantment.PROTECTION_PROJECTILE,1,5)); + iron_chestplate.add(new StoreValues(0.10,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + iron_chestplate.add(new StoreValues(0.083,Enchantment.PROTECTION_PROJECTILE,2,5)); + iron_chestplate.add(new StoreValues(0.025,Enchantment.PROTECTION_FIRE,1,5)); + iron_chestplate.add(new StoreValues(0.019,Enchantment.THORNS,1,5)); + golden_helmet.add(new StoreValues(0.189,Enchantment.PROTECTION_ENVIRONMENTAL,2,5)); + golden_helmet.add(new StoreValues(0.175,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + golden_helmet.add(new StoreValues(0.134,Enchantment.WATER_WORKER,1,5)); + golden_helmet.add(new StoreValues(0.132,Enchantment.PROTECTION_FIRE,1,5)); + golden_helmet.add(new StoreValues(0.118,Enchantment.PROTECTION_PROJECTILE,2,5)); + golden_helmet.add(new StoreValues(0.101,Enchantment.OXYGEN,1,5)); + golden_helmet.add(new StoreValues(0.042,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + golden_helmet.add(new StoreValues(0.038,Enchantment.PROTECTION_PROJECTILE,3,5)); + golden_helmet.add(new StoreValues(0.03,Enchantment.PROTECTION_PROJECTILE,2,5)); + golden_helmet.add(new StoreValues(0.028,Enchantment.PROTECTION_EXPLOSIONS,2,5)); + golden_helmet.add(new StoreValues(0.004,Enchantment.PROTECTION_FIRE,2,5)); + golden_helmet.add(new StoreValues(0.001,Enchantment.OXYGEN,2,5)); + diamond_pickaxe.add(new StoreValues(0.618,Enchantment.DIG_SPEED,1,5)); + diamond_pickaxe.add(new StoreValues(0.361,Enchantment.DURABILITY,1,5)); + diamond_pickaxe.add(new StoreValues(0.16,Enchantment.DIG_SPEED,2,5)); + diamond_boots.add(new StoreValues(0.413,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + diamond_boots.add(new StoreValues(0.264,Enchantment.PROTECTION_FALL,1,5)); + diamond_boots.add(new StoreValues(0.137,Enchantment.PROTECTION_PROJECTILE,1,5)); + diamond_boots.add(new StoreValues(0.081,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + diamond_boots.add(new StoreValues(0.069,Enchantment.PROTECTION_PROJECTILE,2,5)); + diamond_boots.add(new StoreValues(0.021,Enchantment.PROTECTION_FIRE,1,5)); + diamond_boots.add(new StoreValues(0.007,Enchantment.PROTECTION_FALL,2,5)); + golden_leggings.add(new StoreValues(0.231,Enchantment.PROTECTION_ENVIRONMENTAL,2,5)); + golden_leggings.add(new StoreValues(0.199,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + golden_leggings.add(new StoreValues(0.151,Enchantment.PROTECTION_FIRE,1,5)); + golden_leggings.add(new StoreValues(0.138,Enchantment.PROTECTION_PROJECTILE,2,5)); + golden_leggings.add(new StoreValues(0.05,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + golden_leggings.add(new StoreValues(0.042,Enchantment.PROTECTION_PROJECTILE,3,5)); + golden_leggings.add(new StoreValues(0.041,Enchantment.PROTECTION_PROJECTILE,1,5)); + golden_leggings.add(new StoreValues(0.029,Enchantment.PROTECTION_EXPLOSIONS,2,5)); + golden_leggings.add(new StoreValues(0.006,Enchantment.PROTECTION_FIRE,2,5)); + golden_chestplate.add(new StoreValues(0.211,Enchantment.PROTECTION_ENVIRONMENTAL,2,5)); + golden_chestplate.add(new StoreValues(0.192,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + golden_chestplate.add(new StoreValues(0.147,Enchantment.PROTECTION_FIRE,1,5)); + golden_chestplate.add(new StoreValues(0.129,Enchantment.PROTECTION_PROJECTILE,2,5)); + golden_chestplate.add(new StoreValues(0.129,Enchantment.THORNS,1,5)); + golden_chestplate.add(new StoreValues(0.049,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + golden_chestplate.add(new StoreValues(0.042,Enchantment.PROTECTION_PROJECTILE,3,5)); + golden_chestplate.add(new StoreValues(0.034,Enchantment.PROTECTION_EXPLOSIONS,2,5)); + golden_chestplate.add(new StoreValues(0.032,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + golden_chestplate.add(new StoreValues(0.005,Enchantment.PROTECTION_FIRE,2,5)); + diamond_helmet.add(new StoreValues(0.471,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + diamond_helmet.add(new StoreValues(0.158,Enchantment.WATER_WORKER,1,5)); + diamond_helmet.add(new StoreValues(0.153,Enchantment.PROTECTION_PROJECTILE,1,5)); + diamond_helmet.add(new StoreValues(0.096,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + diamond_helmet.add(new StoreValues(0.076,Enchantment.PROTECTION_PROJECTILE,2,5)); + diamond_helmet.add(new StoreValues(0.023,Enchantment.PROTECTION_FIRE,1,5)); + diamond_helmet.add(new StoreValues(0.015,Enchantment.OXYGEN,1,5)); + diamond_leggings.add(new StoreValues(0.519,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + diamond_leggings.add(new StoreValues(0.178,Enchantment.PROTECTION_PROJECTILE,1,5)); + diamond_leggings.add(new StoreValues(0.102,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + diamond_leggings.add(new StoreValues(0.087,Enchantment.PROTECTION_PROJECTILE,2,5)); + diamond_leggings.add(new StoreValues(0.024,Enchantment.PROTECTION_FIRE,1,5)); + diamond_chestplate.add(new StoreValues(0.512,Enchantment.PROTECTION_ENVIRONMENTAL,1,5)); + diamond_chestplate.add(new StoreValues(0.176,Enchantment.PROTECTION_PROJECTILE,1,5)); + diamond_chestplate.add(new StoreValues(0.104,Enchantment.PROTECTION_EXPLOSIONS,1,5)); + diamond_chestplate.add(new StoreValues(0.081,Enchantment.PROTECTION_PROJECTILE,2,5)); + diamond_chestplate.add(new StoreValues(0.026,Enchantment.PROTECTION_FIRE,1,5)); + diamond_chestplate.add(new StoreValues(0.021,Enchantment.THORNS,1,5)); + wood_sword.add(new StoreValues(0.333,Enchantment.DAMAGE_ALL,1,5)); + wood_sword.add(new StoreValues(0.241,Enchantment.KNOCKBACK,1,5)); + wood_sword.add(new StoreValues(0.180,Enchantment.DAMAGE_ARTHROPODS,1,5)); + wood_sword.add(new StoreValues(0.173,Enchantment.DAMAGE_UNDEAD,1,5)); + wood_sword.add(new StoreValues(0.035,Enchantment.FIRE_ASPECT,1,5)); + wood_sword.add(new StoreValues(0.026,Enchantment.DAMAGE_ALL,2,5)); + wood_sword.add(new StoreValues(0.003,Enchantment.DAMAGE_ARTHROPODS,2,5)); + wood_sword.add(new StoreValues(0.002,Enchantment.DAMAGE_UNDEAD,2,5)); + bow.add(new StoreValues(0.926,Enchantment.ARROW_DAMAGE,1,5)); + iron_sword.add(new StoreValues(0.333,Enchantment.DAMAGE_ALL,1,5)); + iron_sword.add(new StoreValues(0.241,Enchantment.KNOCKBACK,1,5)); + iron_sword.add(new StoreValues(0.180,Enchantment.DAMAGE_ARTHROPODS,1,5)); + iron_sword.add(new StoreValues(0.173,Enchantment.DAMAGE_UNDEAD,1,5)); + iron_sword.add(new StoreValues(0.035,Enchantment.FIRE_ASPECT,1,5)); + iron_sword.add(new StoreValues(0.026,Enchantment.DAMAGE_ALL,2,5)); + iron_sword.add(new StoreValues(0.003,Enchantment.DAMAGE_ARTHROPODS,2,5)); + iron_sword.add(new StoreValues(0.002,Enchantment.DAMAGE_UNDEAD,2,5)); + gold_sword.add(new StoreValues(0.333,Enchantment.KNOCKBACK,1,5)); + gold_sword.add(new StoreValues(0.241,Enchantment.DAMAGE_ALL,1,5)); + gold_sword.add(new StoreValues(0.180,Enchantment.DAMAGE_ALL,2,5)); + gold_sword.add(new StoreValues(0.173,Enchantment.DAMAGE_ARTHROPODS,1,5)); + gold_sword.add(new StoreValues(0.035,Enchantment.DAMAGE_UNDEAD,1,5)); + gold_sword.add(new StoreValues(0.026,Enchantment.FIRE_ASPECT,1,5)); + gold_sword.add(new StoreValues(0.003,Enchantment.DAMAGE_UNDEAD,2,5)); + gold_sword.add(new StoreValues(0.002,Enchantment.DAMAGE_ARTHROPODS,2,5)); + gold_sword.add(new StoreValues(0.002,Enchantment.LOOT_BONUS_MOBS,1,5)); + diamond_sword.add(new StoreValues(0.365,Enchantment.DAMAGE_ALL,1,5)); + diamond_sword.add(new StoreValues(0.247,Enchantment.KNOCKBACK,1,5)); + diamond_sword.add(new StoreValues(0.187,Enchantment.DAMAGE_ARTHROPODS,1,5)); + diamond_sword.add(new StoreValues(0.185,Enchantment.DAMAGE_UNDEAD,1,5)); + diamond_sword.add(new StoreValues(0.01,Enchantment.FIRE_ASPECT,1,5)); + stone_hoe.add(new StoreValues(0.359,Enchantment.DURABILITY,2,10)); + stone_shovel.add(new StoreValues(0.575,Enchantment.DIG_SPEED,2,10)); + stone_shovel.add(new StoreValues(0.255,Enchantment.DURABILITY,1,10)); + stone_shovel.add(new StoreValues(0.118,Enchantment.DURABILITY,2,10)); + stone_shovel.add(new StoreValues(0.04,Enchantment.DIG_SPEED,1,10)); + stone_shovel.add(new StoreValues(0.01,Enchantment.LOOT_BONUS_BLOCKS,1,10)); + stone_shovel.add(new StoreValues(0.01,Enchantment.SILK_TOUCH,1,10)); + stone_pickaxe.add(new StoreValues(0.575,Enchantment.DIG_SPEED,2,10)); + stone_pickaxe.add(new StoreValues(0.255,Enchantment.DURABILITY,1,10)); + stone_pickaxe.add(new StoreValues(0.118,Enchantment.DURABILITY,2,10)); + stone_pickaxe.add(new StoreValues(0.04,Enchantment.DIG_SPEED,1,10)); + stone_pickaxe.add(new StoreValues(0.01,Enchantment.LOOT_BONUS_BLOCKS,1,10)); + stone_pickaxe.add(new StoreValues(0.01,Enchantment.SILK_TOUCH,1,10)); + leather_boots.add(new StoreValues(0.305,Enchantment.PROTECTION_ENVIRONMENTAL,2,10)); + leather_boots.add(new StoreValues(0.237,Enchantment.PROTECTION_FALL,2,10)); + leather_boots.add(new StoreValues(0.152,Enchantment.PROTECTION_FIRE,1,10)); + leather_boots.add(new StoreValues(0.104,Enchantment.PROTECTION_PROJECTILE,2,10)); + leather_boots.add(new StoreValues(0.062,Enchantment.PROTECTION_PROJECTILE,3,10)); + leather_boots.add(new StoreValues(0.05,Enchantment.PROTECTION_EXPLOSIONS,2,10)); + leather_boots.add(new StoreValues(0.027,Enchantment.PROTECTION_FALL,3,10)); + leather_boots.add(new StoreValues(0.025,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + leather_boots.add(new StoreValues(0.013,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + leather_boots.add(new StoreValues(0.004,Enchantment.PROTECTION_FIRE,2,10)); + leather_boots.add(new StoreValues(0.003,Enchantment.PROTECTION_FALL,1,10)); + leather_cap.add(new StoreValues(0.405,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + leather_cap.add(new StoreValues(0.146,Enchantment.WATER_WORKER,1,10)); + leather_cap.add(new StoreValues(0.119,Enchantment.PROTECTION_PROJECTILE,2,10)); + leather_cap.add(new StoreValues(0.094,Enchantment.PROTECTION_PROJECTILE,1,10)); + leather_cap.add(new StoreValues(0.082,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + leather_cap.add(new StoreValues(0.069,Enchantment.PROTECTION_FIRE,1,10)); + leather_cap.add(new StoreValues(0.048,Enchantment.OXYGEN,1,10)); + leather_cap.add(new StoreValues(0.029,Enchantment.PROTECTION_ENVIRONMENTAL,2,10)); + leather_cap.add(new StoreValues(0.0001,Enchantment.PROTECTION_EXPLOSIONS,2,10)); + leather_pants.add(new StoreValues(0.451,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + leather_pants.add(new StoreValues(0.135,Enchantment.PROTECTION_PROJECTILE,2,10)); + leather_pants.add(new StoreValues(0.104,Enchantment.PROTECTION_PROJECTILE,1,10)); + leather_pants.add(new StoreValues(0.100,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + leather_pants.add(new StoreValues(0.079,Enchantment.PROTECTION_FIRE,1,10)); + leather_pants.add(new StoreValues(0.032,Enchantment.PROTECTION_ENVIRONMENTAL,2,10)); + leather_pants.add(new StoreValues(0.0001,Enchantment.PROTECTION_EXPLOSIONS,2,10)); + leather_tunic.add(new StoreValues(0.442,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + leather_tunic.add(new StoreValues(0.140,Enchantment.PROTECTION_PROJECTILE,2,10)); + leather_tunic.add(new StoreValues(0.102,Enchantment.PROTECTION_PROJECTILE,1,10)); + leather_tunic.add(new StoreValues(0.094,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + leather_tunic.add(new StoreValues(0.079,Enchantment.PROTECTION_FIRE,1,10)); + leather_tunic.add(new StoreValues(0.053,Enchantment.THORNS,1,10)); + leather_tunic.add(new StoreValues(0.028,Enchantment.PROTECTION_ENVIRONMENTAL,2,10)); + leather_tunic.add(new StoreValues(0.001,Enchantment.PROTECTION_EXPLOSIONS,2,10)); + iron_shovel.add(new StoreValues(0.506,Enchantment.DIG_SPEED,1,10)); + iron_shovel.add(new StoreValues(0.355,Enchantment.DURABILITY,1,10)); + iron_shovel.add(new StoreValues(0.126,Enchantment.DIG_SPEED,2,10)); + iron_shovel.add(new StoreValues(0.06,Enchantment.DURABILITY,2,10)); + iron_boots.add(new StoreValues(0.41,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + iron_boots.add(new StoreValues(0.265,Enchantment.PROTECTION_FALL,1,10)); + iron_boots.add(new StoreValues(0.143,Enchantment.PROTECTION_PROJECTILE,1,10)); + iron_boots.add(new StoreValues(0.082,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + iron_boots.add(new StoreValues(0.065,Enchantment.PROTECTION_PROJECTILE,2,10)); + iron_boots.add(new StoreValues(0.022,Enchantment.PROTECTION_FIRE,1,10)); + iron_boots.add(new StoreValues(0.006,Enchantment.PROTECTION_FALL,2,10)); + iron_pickaxe.add(new StoreValues(0.504,Enchantment.DIG_SPEED,1,10)); + iron_pickaxe.add(new StoreValues(0.354,Enchantment.DURABILITY,1,10)); + iron_pickaxe.add(new StoreValues(0.129,Enchantment.DIG_SPEED,2,10)); + iron_pickaxe.add(new StoreValues(0.06,Enchantment.DURABILITY,2,10)); + iron_helmet.add(new StoreValues(0.471,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + iron_helmet.add(new StoreValues(0.161,Enchantment.WATER_WORKER,1,10)); + iron_helmet.add(new StoreValues(0.16,Enchantment.PROTECTION_PROJECTILE,1,10)); + iron_helmet.add(new StoreValues(0.092,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + iron_helmet.add(new StoreValues(0.072,Enchantment.PROTECTION_PROJECTILE,2,10)); + iron_helmet.add(new StoreValues(0.022,Enchantment.PROTECTION_FIRE,1,10)); + iron_helmet.add(new StoreValues(0.015,Enchantment.OXYGEN,1,10)); + golden_shovel.add(new StoreValues(0.364,Enchantment.DIG_SPEED,2,10)); + golden_shovel.add(new StoreValues(0.256,Enchantment.DIG_SPEED,1,10)); + golden_shovel.add(new StoreValues(0.253,Enchantment.DURABILITY,1,10)); + golden_shovel.add(new StoreValues(0.101,Enchantment.DURABILITY,2,10)); + golden_shovel.add(new StoreValues(0.01,Enchantment.LOOT_BONUS_BLOCKS,1,10)); + golden_shovel.add(new StoreValues(0.006,Enchantment.SILK_TOUCH,1,10)); + iron_leggings.add(new StoreValues(0.523,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + iron_leggings.add(new StoreValues(0.178,Enchantment.PROTECTION_PROJECTILE,1,10)); + iron_leggings.add(new StoreValues(0.101,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + iron_leggings.add(new StoreValues(0.083,Enchantment.PROTECTION_PROJECTILE,2,10)); + iron_leggings.add(new StoreValues(0.025,Enchantment.PROTECTION_FIRE,1,10)); + diamond_shovel.add(new StoreValues(0.623,Enchantment.DIG_SPEED,1,10)); + diamond_shovel.add(new StoreValues(0.356,Enchantment.DURABILITY,1,10)); + diamond_shovel.add(new StoreValues(0.014,Enchantment.DIG_SPEED,2,10)); + golden_boots.add(new StoreValues(0.187,Enchantment.PROTECTION_ENVIRONMENTAL,2,10)); + golden_boots.add(new StoreValues(0.158,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + golden_boots.add(new StoreValues(0.155,Enchantment.PROTECTION_FALL,2,10)); + golden_boots.add(new StoreValues(0.131,Enchantment.PROTECTION_FIRE,1,10)); + golden_boots.add(new StoreValues(0.112,Enchantment.PROTECTION_PROJECTILE,2,10)); + golden_boots.add(new StoreValues(0.082,Enchantment.PROTECTION_FALL,1,10)); + golden_boots.add(new StoreValues(0.042,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + golden_boots.add(new StoreValues(0.033,Enchantment.PROTECTION_PROJECTILE,3,10)); + golden_boots.add(new StoreValues(0.030,Enchantment.PROTECTION_EXPLOSIONS,2,10)); + golden_boots.add(new StoreValues(0.026,Enchantment.PROTECTION_PROJECTILE,1,10)); + golden_boots.add(new StoreValues(0.023,Enchantment.PROTECTION_FALL,3,10)); + golden_boots.add(new StoreValues(0.005,Enchantment.PROTECTION_FIRE,2,10)); + iron_chestplate.add(new StoreValues(0.525,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + iron_chestplate.add(new StoreValues(0.172,Enchantment.PROTECTION_PROJECTILE,1,10)); + iron_chestplate.add(new StoreValues(0.10,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + iron_chestplate.add(new StoreValues(0.083,Enchantment.PROTECTION_PROJECTILE,2,10)); + iron_chestplate.add(new StoreValues(0.025,Enchantment.PROTECTION_FIRE,1,10)); + iron_chestplate.add(new StoreValues(0.019,Enchantment.THORNS,1,10)); + golden_helmet.add(new StoreValues(0.189,Enchantment.PROTECTION_ENVIRONMENTAL,2,10)); + golden_helmet.add(new StoreValues(0.175,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + golden_helmet.add(new StoreValues(0.134,Enchantment.WATER_WORKER,1,10)); + golden_helmet.add(new StoreValues(0.132,Enchantment.PROTECTION_FIRE,1,10)); + golden_helmet.add(new StoreValues(0.118,Enchantment.PROTECTION_PROJECTILE,2,10)); + golden_helmet.add(new StoreValues(0.101,Enchantment.OXYGEN,1,10)); + golden_helmet.add(new StoreValues(0.042,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + golden_helmet.add(new StoreValues(0.038,Enchantment.PROTECTION_PROJECTILE,3,10)); + golden_helmet.add(new StoreValues(0.03,Enchantment.PROTECTION_PROJECTILE,2,10)); + golden_helmet.add(new StoreValues(0.028,Enchantment.PROTECTION_EXPLOSIONS,2,10)); + golden_helmet.add(new StoreValues(0.004,Enchantment.PROTECTION_FIRE,2,10)); + golden_helmet.add(new StoreValues(0.001,Enchantment.OXYGEN,2,10)); + diamond_pickaxe.add(new StoreValues(0.618,Enchantment.DIG_SPEED,1,10)); + diamond_pickaxe.add(new StoreValues(0.361,Enchantment.DURABILITY,1,10)); + diamond_pickaxe.add(new StoreValues(0.16,Enchantment.DIG_SPEED,2,10)); + diamond_boots.add(new StoreValues(0.413,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + diamond_boots.add(new StoreValues(0.264,Enchantment.PROTECTION_FALL,1,10)); + diamond_boots.add(new StoreValues(0.137,Enchantment.PROTECTION_PROJECTILE,1,10)); + diamond_boots.add(new StoreValues(0.081,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + diamond_boots.add(new StoreValues(0.069,Enchantment.PROTECTION_PROJECTILE,2,10)); + diamond_boots.add(new StoreValues(0.021,Enchantment.PROTECTION_FIRE,1,10)); + diamond_boots.add(new StoreValues(0.007,Enchantment.PROTECTION_FALL,2,10)); + golden_leggings.add(new StoreValues(0.231,Enchantment.PROTECTION_ENVIRONMENTAL,2,10)); + golden_leggings.add(new StoreValues(0.199,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + golden_leggings.add(new StoreValues(0.151,Enchantment.PROTECTION_FIRE,1,10)); + golden_leggings.add(new StoreValues(0.138,Enchantment.PROTECTION_PROJECTILE,2,10)); + golden_leggings.add(new StoreValues(0.05,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + golden_leggings.add(new StoreValues(0.042,Enchantment.PROTECTION_PROJECTILE,3,10)); + golden_leggings.add(new StoreValues(0.041,Enchantment.PROTECTION_PROJECTILE,1,10)); + golden_leggings.add(new StoreValues(0.029,Enchantment.PROTECTION_EXPLOSIONS,2,10)); + golden_leggings.add(new StoreValues(0.006,Enchantment.PROTECTION_FIRE,2,10)); + golden_chestplate.add(new StoreValues(0.211,Enchantment.PROTECTION_ENVIRONMENTAL,2,10)); + golden_chestplate.add(new StoreValues(0.192,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + golden_chestplate.add(new StoreValues(0.147,Enchantment.PROTECTION_FIRE,1,10)); + golden_chestplate.add(new StoreValues(0.129,Enchantment.PROTECTION_PROJECTILE,2,10)); + golden_chestplate.add(new StoreValues(0.129,Enchantment.THORNS,1,10)); + golden_chestplate.add(new StoreValues(0.049,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + golden_chestplate.add(new StoreValues(0.042,Enchantment.PROTECTION_PROJECTILE,3,10)); + golden_chestplate.add(new StoreValues(0.034,Enchantment.PROTECTION_EXPLOSIONS,2,10)); + golden_chestplate.add(new StoreValues(0.032,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + golden_chestplate.add(new StoreValues(0.005,Enchantment.PROTECTION_FIRE,2,10)); + diamond_helmet.add(new StoreValues(0.471,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + diamond_helmet.add(new StoreValues(0.158,Enchantment.WATER_WORKER,1,10)); + diamond_helmet.add(new StoreValues(0.153,Enchantment.PROTECTION_PROJECTILE,1,10)); + diamond_helmet.add(new StoreValues(0.096,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + diamond_helmet.add(new StoreValues(0.076,Enchantment.PROTECTION_PROJECTILE,2,10)); + diamond_helmet.add(new StoreValues(0.023,Enchantment.PROTECTION_FIRE,1,10)); + diamond_helmet.add(new StoreValues(0.015,Enchantment.OXYGEN,1,10)); + diamond_leggings.add(new StoreValues(0.519,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + diamond_leggings.add(new StoreValues(0.178,Enchantment.PROTECTION_PROJECTILE,1,10)); + diamond_leggings.add(new StoreValues(0.102,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + diamond_leggings.add(new StoreValues(0.087,Enchantment.PROTECTION_PROJECTILE,2,10)); + diamond_leggings.add(new StoreValues(0.024,Enchantment.PROTECTION_FIRE,1,10)); + diamond_chestplate.add(new StoreValues(0.512,Enchantment.PROTECTION_ENVIRONMENTAL,1,10)); + diamond_chestplate.add(new StoreValues(0.176,Enchantment.PROTECTION_PROJECTILE,1,10)); + diamond_chestplate.add(new StoreValues(0.104,Enchantment.PROTECTION_EXPLOSIONS,1,10)); + diamond_chestplate.add(new StoreValues(0.081,Enchantment.PROTECTION_PROJECTILE,2,10)); + diamond_chestplate.add(new StoreValues(0.026,Enchantment.PROTECTION_FIRE,1,10)); + diamond_chestplate.add(new StoreValues(0.021,Enchantment.THORNS,1,10)); + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/EntityHitData.java b/BankEconomyMod/src/me/kaZep/Base/EntityHitData.java new file mode 100644 index 0000000..d8d54de --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/EntityHitData.java @@ -0,0 +1,26 @@ +package me.kaZep.Base; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +public class EntityHitData { + public List id; + Player p; + public long registeredtime; + public EntityHitData(Player p) { + this.p=p; + id = new ArrayList(); + registeredtime = Bukkit.getWorld("world").getFullTime()+1200; + } + public List getEntities() { + return id; + } + public Player getPlayer() { + return p; + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/EntityInteractData.java b/BankEconomyMod/src/me/kaZep/Base/EntityInteractData.java new file mode 100644 index 0000000..7d2f47c --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/EntityInteractData.java @@ -0,0 +1,29 @@ +package me.kaZep.Base; + +import java.util.UUID; + +import org.bukkit.Bukkit; + +public class EntityInteractData { + UUID entityid; + String entityowner; + long removetime; + public EntityInteractData(UUID id, String owner) { + this.entityid=id; + this.entityowner=owner; + removetime=Bukkit.getWorld("world").getFullTime()+3000; + } + public long getTime() { + return removetime; + } + public String getOwner() { + return entityowner; + } + public UUID getID() { + return entityid; + } + public void setOwner(String owner) { + this.entityowner=owner; + removetime=Bukkit.getWorld("world").getFullTime()+3000; + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/ExplorerData.java b/BankEconomyMod/src/me/kaZep/Base/ExplorerData.java new file mode 100644 index 0000000..7626625 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/ExplorerData.java @@ -0,0 +1,36 @@ +package me.kaZep.Base; + +import org.bukkit.Bukkit; +import org.bukkit.Material; + +public class ExplorerData { + String player; + double xprevious,zprevious; + double xlookprevious,zlookprevious; + Material lasttype; + Material lastinteract, awardinteract; + int villagecriteria,templecriteria,cavecriteria,undergroundcriteria,nethercriteria; + int lastmap; + int lastmapemptycount; + float expamt; + int explv; + boolean wedied; + public ExplorerData(String playername, double xpos, double zpos) { + this.player=playername; + this.xprevious=xpos; + this.zprevious=zpos; + this.xlookprevious=xpos; + this.zlookprevious=zpos; + lasttype=Material.DIRT; + lastinteract=Material.DIRT; + awardinteract=Material.DIRT; + villagecriteria=100; + templecriteria=100; + cavecriteria=100; + undergroundcriteria=100; + nethercriteria=100; + this.expamt=Bukkit.getPlayer(playername).getExp(); + this.explv=Bukkit.getPlayer(playername).getLevel(); + this.wedied=false; + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/FurnaceData.java b/BankEconomyMod/src/me/kaZep/Base/FurnaceData.java new file mode 100644 index 0000000..20e0ac7 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/FurnaceData.java @@ -0,0 +1,42 @@ +package me.kaZep.Base; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.block.Furnace; + +public class FurnaceData { + + Location pos; + String owner; + long time; + public FurnaceData(Location pos, String owner) { + this.pos=pos; + this.owner=owner; + this.time=Bukkit.getWorld("world").getFullTime()+9000; + } + + public void setOwner(String owner) { + this.owner=owner; + } + + public short getBurnTime() { + if ((Furnace)Bukkit.getWorld("world").getBlockAt(pos)!=null) { + Furnace furnace = (Furnace)Bukkit.getWorld("world").getBlockAt(pos).getState(); + return furnace.getBurnTime(); + } else { + return 0; + } + } + + public Location getLoc() { + return pos; + } + + public long getTime() { + return time; + } + public void resetTime() { + this.time=Bukkit.getWorld("world").getFullTime()+9000; + } + +} diff --git a/BankEconomyMod/src/me/kaZep/Base/InvisibilityData.java b/BankEconomyMod/src/me/kaZep/Base/InvisibilityData.java new file mode 100644 index 0000000..0896d03 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/InvisibilityData.java @@ -0,0 +1,12 @@ +package me.kaZep.Base; + +import java.util.UUID; + +public class InvisibilityData { + public UUID val = null; + public long resettime = 0; + public InvisibilityData(UUID id, long resettime) { + this.val=id; + this.resettime=resettime; + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/JukeboxData.java b/BankEconomyMod/src/me/kaZep/Base/JukeboxData.java new file mode 100644 index 0000000..cc2c2f2 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/JukeboxData.java @@ -0,0 +1,75 @@ +package me.kaZep.Base; + +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.Jukebox; +import org.bukkit.entity.Player; + +public class JukeboxData { + Block jukebox; + Material disk; + int repeat; + int songduration; + long songtickstart; + double closestplayer=0; + public JukeboxData(Block box, Material disk, int loopamount, int duration, long currenttime) { + this.jukebox=box; + this.disk=disk; + this.repeat=loopamount; + this.songduration=duration; + this.songtickstart=currenttime; + } + public boolean Restart() { + this.songtickstart=Bukkit.getWorld("world").getFullTime(); + if (jukebox!=null) { + ((Jukebox)jukebox.getState()).setPlaying(disk); + } else { + this.repeat=0; + } + this.repeat--; + if (this.repeat<=0) { + return false; + } else { + return true; + } + } + public void updateClosestPlayer() { + closestplayer=999999999; + List onlineplayers = Bukkit.getWorld("world").getPlayers(); + for (int k=0;k LOGGING_LOGS; + + public boolean cleaned=false; + + public JobsDataInfo Woodcutter_job = new JobsDataInfo(); + public JobsDataInfo Builder_job = new JobsDataInfo(); + public JobsDataInfo Miner_job = new JobsDataInfo(); + public JobsDataInfo Digger_job = new JobsDataInfo(); + public JobsDataInfo Farmer_job = new JobsDataInfo(); + public JobsDataInfo Hunter_job = new JobsDataInfo(); + public JobsDataInfo Fisherman_job = new JobsDataInfo(); + public JobsDataInfo Weaponsmith_job = new JobsDataInfo(); + public JobsDataInfo Blacksmith_job = new JobsDataInfo(); + public JobsDataInfo Cook_job = new JobsDataInfo(); + public JobsDataInfo Brewer_job = new JobsDataInfo(); + public JobsDataInfo Enchanter_job = new JobsDataInfo(); + public JobsDataInfo Breeder_job = new JobsDataInfo(); + public JobsDataInfo Explorer_job = new JobsDataInfo(); + public JobsDataInfo Support_job = new JobsDataInfo(); + public List jukeboxlist = null; + public List furnacelist = null; + public List brewingstandlist = null; + public List animallist = null; + public List explorerlist = null; + public List supportstackslist = null; + public List supportmoblist = null; + public List hitmoblist = null; + public List SPEED_CONTROL = null; + public List supportplayers = null; + public List hunterplayers = null; + public List explorers = null; + public List ARROW_SHOOTERS = null; + public List TEMP_WEBS = null; + public List playerdata_list = null; + public List ninjavisible_list = null; + public List revive_inventory_list = null; + public DamageAPI DMGCALC = null; + + + public FileWriter outputStream = null; + + public EnchantLevelDatabase ENCHANTMENT_DATA; + File f; + + public Material[] RARE_BLOCKS = {Material.BEACON,Material.ANVIL,Material.ACTIVATOR_RAIL,Material.BEDROCK,Material.BOOKSHELF,Material.DAYLIGHT_DETECTOR,Material.COAL_ORE,Material.CLAY,Material.DIAMOND_ORE,Material.IRON_ORE,Material.REDSTONE_ORE,Material.EMERALD_ORE,Material.GOLD_ORE,Material.LAPIS_ORE,Material.OBSIDIAN,Material.MOSSY_COBBLESTONE,Material.MOB_SPAWNER,Material.NETHER_BRICK,Material.NETHER_FENCE,Material.JUKEBOX,Material.QUARTZ_ORE,Material.PORTAL,Material.PISTON_BASE,Material.REDSTONE_WIRE,Material.DISPENSER,Material.LOG,Material.MYCEL,Material.HUGE_MUSHROOM_1,Material.HUGE_MUSHROOM_2}; + long GLOBAL_villagetimer=0,GLOBAL_templetimer=0,GLOBAL_cavetimer=0,GLOBAL_undergroundtimer=0,GLOBAL_nethertimer=0; + + + public String[] ValidJobs = {"Woodcutter","Miner","Builder","Digger","Farmer","Hunter","Fisherman","Weaponsmith","Blacksmith","Cook","Brewer","Enchanter","Breeder","Explorer","Support"}; + public ChatColor[] JobColors = {ChatColor.GREEN,ChatColor.GRAY,ChatColor.WHITE,ChatColor.GOLD,ChatColor.BLUE,ChatColor.RED,ChatColor.AQUA,ChatColor.DARK_PURPLE,ChatColor.GOLD, + ChatColor.YELLOW,ChatColor.LIGHT_PURPLE,ChatColor.DARK_BLUE,ChatColor.DARK_GREEN,ChatColor.WHITE,ChatColor.DARK_RED}; + + private FileConfiguration accountsConfig = null; + private File accountsConfigFile = null; + + public final PlayerListener pl = new PlayerListener(this); + + String pluginPrefix = "§2[BankEconomy]"; + + public void onEnable() + { + getServer().getPluginManager().registerEvents(this.pl, this); + + cleaned=false; + + PluginDescriptionFile pdf = getDescription(); + System.out.println("[" + getDescription().getName() + "] Status: Activated (mb: kaZep)"); + System.out.println("[" + getDescription().getName() + "] PayDay: " + getConfig().getBoolean("payday.enabled")); + System.out.println("[" + getDescription().getName() + "] Version: " + pdf.getVersion()); + + getCommand("bankeconomy").setExecutor(new commandBankEconomy(this)); + getCommand("revive").setExecutor(new commandBankEconomy(this)); + getCommand("tele").setExecutor(new commandBankEconomy(this)); + getCommand("jobs").setExecutor(new commandBankEconomy(this)); + getCommand("unenchant").setExecutor(new commandBankEconomy(this)); + getCommand("sp").setExecutor(new commandBankEconomy(this)); + getCommand("transfer").setExecutor(new commandBankEconomy(this)); + getCommand("settings").setExecutor(new commandBankEconomy(this)); + getCommand("maintenance").setExecutor(new commandBankEconomy(this)); + getCommand("event").setExecutor(new commandBankEconomy(this)); + + setupEconomy(); + + getConfig().options().copyDefaults(true); + getConfig().addDefault("start-balance", Integer.valueOf(0)); + getConfig().addDefault("payday.enabled", Boolean.valueOf(false)); + getConfig().addDefault("payday.time", Integer.valueOf(60)); + getConfig().addDefault("payday.amount", Integer.valueOf(0)); + getConfig().addDefault("fed.mobs", String.valueOf("")); + getConfig().addDefault("maintenance-mode", Boolean.valueOf(false)); + getConfig().addDefault("halloween-enabled", Boolean.valueOf(true)); + getConfig().addDefault("item-cube-numb", Integer.valueOf(0)); + saveConfig(); + + getAccountsConfig().options().copyDefaults(true); + saveAccountsConfig(); + + getConfig().set("spleefrequestatime", Integer.valueOf(0)); + getConfig().set("spleefrequestbtime", Integer.valueOf(0)); + getConfig().set("spleeflastrequesttime", Integer.valueOf(0)); + getConfig().set("spleef4insession", Boolean.valueOf(false)); + getConfig().set("spleefinsession", Boolean.valueOf(false)); + + jukeboxlist = new ArrayList(); + furnacelist = new ArrayList(); + brewingstandlist = new ArrayList(); + animallist = new ArrayList(); + explorerlist = new ArrayList(); + supportstackslist = new ArrayList(); + supportmoblist = new ArrayList(); + hitmoblist = new ArrayList(); + ENCHANTMENT_DATA = new EnchantLevelDatabase(); + SPEED_CONTROL = new ArrayList(); + supportplayers = new ArrayList(); + hunterplayers = new ArrayList(); + explorers = new ArrayList(); + LOGGING_LOGS = new ArrayList(); + ARROW_SHOOTERS = new ArrayList(); + TEMP_WEBS = new ArrayList(); + playerdata_list = new ArrayList(); + ninjavisible_list = new ArrayList(); + revive_inventory_list = new ArrayList(); + + //Add Recipes for new Block armor crafting. + ShapedRecipe iron_helmet = new ShapedRecipe(new ItemStack(Material.IRON_HELMET)); + iron_helmet.shape("aaa","a a"); + iron_helmet.setIngredient('a', Material.IRON_BLOCK); + Bukkit.addRecipe(iron_helmet); + ShapedRecipe iron_chestplate = new ShapedRecipe(new ItemStack(Material.IRON_CHESTPLATE)); + iron_chestplate.shape("a a","aaa","aaa"); + iron_chestplate.setIngredient('a', Material.IRON_BLOCK); + Bukkit.addRecipe(iron_chestplate); + ShapedRecipe iron_leggings = new ShapedRecipe(new ItemStack(Material.IRON_LEGGINGS)); + iron_leggings.shape("aaa","a a","a a"); + iron_leggings.setIngredient('a', Material.IRON_BLOCK); + Bukkit.addRecipe(iron_leggings); + ShapedRecipe iron_boots = new ShapedRecipe(new ItemStack(Material.IRON_BOOTS)); + iron_boots.shape("a a","a a"); + iron_boots.setIngredient('a', Material.IRON_BLOCK); + Bukkit.addRecipe(iron_boots); + ShapedRecipe gold_helmet = new ShapedRecipe(new ItemStack(Material.GOLD_HELMET)); + gold_helmet.shape("aaa","a a"); + gold_helmet.setIngredient('a', Material.GOLD_BLOCK); + Bukkit.addRecipe(gold_helmet); + ShapedRecipe gold_chestplate = new ShapedRecipe(new ItemStack(Material.GOLD_CHESTPLATE)); + gold_chestplate.shape("a a","aaa","aaa"); + gold_chestplate.setIngredient('a', Material.GOLD_BLOCK); + Bukkit.addRecipe(gold_chestplate); + ShapedRecipe gold_leggings = new ShapedRecipe(new ItemStack(Material.GOLD_LEGGINGS)); + gold_leggings.shape("aaa","a a","a a"); + gold_leggings.setIngredient('a', Material.GOLD_BLOCK); + Bukkit.addRecipe(gold_leggings); + ShapedRecipe gold_boots = new ShapedRecipe(new ItemStack(Material.GOLD_BOOTS)); + gold_boots.shape("a a","a a"); + gold_boots.setIngredient('a', Material.GOLD_BLOCK); + Bukkit.addRecipe(gold_boots); + ShapedRecipe diamond_helmet = new ShapedRecipe(new ItemStack(Material.DIAMOND_HELMET)); + diamond_helmet.shape("aaa","a a"); + diamond_helmet.setIngredient('a', Material.DIAMOND_BLOCK); + Bukkit.addRecipe(diamond_helmet); + ShapedRecipe diamond_chestplate = new ShapedRecipe(new ItemStack(Material.DIAMOND_CHESTPLATE)); + diamond_chestplate.shape("a a","aaa","aaa"); + diamond_chestplate.setIngredient('a', Material.DIAMOND_BLOCK); + Bukkit.addRecipe(diamond_chestplate); + ShapedRecipe diamond_leggings = new ShapedRecipe(new ItemStack(Material.DIAMOND_LEGGINGS)); + diamond_leggings.shape("aaa","a a","a a"); + diamond_leggings.setIngredient('a', Material.DIAMOND_BLOCK); + Bukkit.addRecipe(diamond_leggings); + ShapedRecipe diamond_boots = new ShapedRecipe(new ItemStack(Material.DIAMOND_BOOTS)); + diamond_boots.shape("a a","a a"); + diamond_boots.setIngredient('a', Material.DIAMOND_BLOCK); + Bukkit.addRecipe(diamond_boots); + ItemStack temp = new ItemStack(Material.CHEST); + ItemMeta tempmeta = temp.getItemMeta(); + tempmeta.setDisplayName(ChatColor.YELLOW+"Item Cube"); + List templore = new ArrayList(); + templore.add(ChatColor.AQUA+"Contains 9 item slots."); + templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"Click on an item and then"); + templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"click the Item Cube to store"); + templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"it inside. Right-Click the"); + templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"Item Cube to view its contents."); + tempmeta.setLore(templore); + temp.setItemMeta(tempmeta); + ShapedRecipe item_cube = new ShapedRecipe(temp); + item_cube.shape("aaa","aba","aaa"); + item_cube.setIngredient('a', Material.CHEST); + item_cube.setIngredient('b', Material.HOPPER); + Bukkit.addRecipe(item_cube); + temp = new ItemStack(Material.TRAPPED_CHEST); + tempmeta = temp.getItemMeta(); + tempmeta.setDisplayName(ChatColor.LIGHT_PURPLE+"Large Item Cube"); + templore = new ArrayList(); + templore.add(ChatColor.AQUA+"Contains 54 item slots."); + templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"Click on an item and then"); + templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"click the Item Cube to store"); + templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"it inside. Right-Click the"); + templore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"Item Cube to view its contents."); + tempmeta.setLore(templore); + temp.setItemMeta(tempmeta); + item_cube = new ShapedRecipe(temp); + item_cube.shape("cac","aba","cac"); + item_cube.setIngredient('a', Material.ENDER_CHEST); + item_cube.setIngredient('b', Material.HOPPER); + item_cube.setIngredient('c', Material.DIAMOND_BLOCK); + Bukkit.addRecipe(item_cube); + + DMGCALC = new DamageAPI(); + //System.out.println("Running BankEconomy in "+this.getDataFolder().getAbsolutePath()); + //System.out.println("File size: "+f.length()); + checkJukeboxes(); + updateTime(); + runTick(); + + if (!getConfig().getBoolean("payday.enabled")) + return; + if (getConfig().getBoolean("payday.enabled")) { + payDay(getConfig().getInt("payday.time")); + } else { + System.out.println("[BANKECONOMY ALERT] Error caused at 'payday.enabled'. Changed boolean to false."); + getConfig().set("payday.enabled", Boolean.valueOf(false)); + saveConfig(); + } + try + { + Metrics metrics = new Metrics(this); + metrics.start(); + } catch (IOException e) { + System.out.println("[WARNING] " + getDescription().getName() + " didn't connect to McStats.org ! Please check your metrics settings."); + } + + Woodcutter_job.setJobName("Woodcutter"); + Woodcutter_job.setJobDescription("A woodcutter's job is to cut down and replenish the supplies of trees constantly in order to keep getting income."); + Woodcutter_job.setAction(0, "BREAK"); + Woodcutter_job.setExp(40, 10, 20, 1.03); + Woodcutter_job.addData("WOOD", 0.01, 1, 0); + Woodcutter_job.addData("WOOD W/ AXE", 0.025, 2, 0); + Woodcutter_job.setAction(1, "PLACE"); + Woodcutter_job.addData("SAPLINGS", 0.015, 1, 1); + Woodcutter_job.addData("WOOD", 0.01, 0.25, 1); + Woodcutter_job.addData("WOODEN PLANK", 0.00, 0.10, 1); + Woodcutter_job.setBuffData("Saplings have a higher chance of dropping from tree leaves. (+40%)", + "Axes used gain Efficiency +1 (Speed+30%)", + "Saplings have a higher chance of dropping from tree leaves. (+60%), Axes used gain Efficiency +2 (Speed+60%).", + "Axes that you use never break. Axes used gain Efficiency +3 (Speed+90%) 2-5 wood is dropped from each log. Saplings around you have a higher chance of growing quickly."); + + Miner_job.setJobName("Miner"); + Miner_job.setJobDescription("A miner's job is to venture into caves and collect precious minerals from within, eventually coming out with such treasures for use in other production."); + Miner_job.setAction(0, "BREAK"); + Miner_job.setExp(60, 100, 65, 1.02); + Miner_job.addData("STONE", 0.0025, 1, 0); + Miner_job.addData("NETHERRACK", 0.005, 1, 0); + Miner_job.addData("COAL", 0.0125, 3, 0); + Miner_job.addData("GLOWSTONE", 0.015, 3, 0); + Miner_job.addData("SANDSTONE", 0.015, 4, 0); + Miner_job.addData("NETHER BRICK", 0.02, 3, 0); + Miner_job.addData("QUARTZ ORE", 0.025, 4, 0); + Miner_job.addData("LAPIS LAZULI ORE", 0.03, 5, 0); + Miner_job.addData("MOSSY COBBLESTONE", 0.0375, 8, 0); + Miner_job.addData("IRON ORE", 0.0375, 6, 0); + Miner_job.addData("REDSTONE ORE", 0.05, 9, 0); + Miner_job.addData("OBSIDIAN", 0.0625, 10, 0); + Miner_job.addData("GOLD ORE", 0.0975, 12, 0); + Miner_job.addData("DIAMOND ORE", 0.3125, 60, 0); + Miner_job.addData("EMERALD ORE", 0.7625, 160, 0); + Miner_job.setBuffData("Pickaxes used gain Efficiency +1 (Speed+30%)", + "Pickaxes have double the durability.", + "Pickaxes used gain Efficiency +2 (Speed+60%)", + "Pickaxes used give 240% more items from ore, have quadruple the durability, Efficiency +3 (Speed+90%). Minecart riding speed increased by 40%."); + + Builder_job.setJobName("Builder"); + Builder_job.setJobDescription("A builder's job is to use blocks in order to create and invent new buildings using materials that look nice."); + Builder_job.setAction(0, "PLACE"); + Builder_job.setExp(80, 150, 50, 1.02); + Builder_job.addData("COBBLESTONE", 0.005, 1, 0); + Builder_job.addData("WOODEN PLANK", 0.005, 2, 0); + Builder_job.addData("WOOD", 0.01, 3, 0); + Builder_job.addData("COBBLESTONE SLAB", 0.015, 3, 0); + Builder_job.addData("COBBLESTONE STAIRS", 0.015, 3, 0); + Builder_job.addData("STONE", 0.015, 4, 0); + Builder_job.addData("WOODEN FENCE", 0.015, 3, 0); + Builder_job.addData("WOODEN SLAB", 0.015, 3, 0); + Builder_job.addData("STONE SLAB", 0.02, 4, 0); + Builder_job.addData("WOODEN STAIRS", 0.02, 4, 0); + Builder_job.addData("LAPIS BLOCK", 0.02, 3, 0); + Builder_job.addData("SANDSTONE SLAB", 0.025, 4, 0); + Builder_job.addData("NETHER BRICK STAIRS", 0.025, 5, 0); + Builder_job.addData("NETHER BRICK", 0.03, 5, 0); + Builder_job.addData("NETHER BRICK SLAB", 0.03, 5, 0); + Builder_job.addData("NETHER BRICK FENCE", 0.03, 6, 0); + Builder_job.addData("STONE BRICK SLAB", 0.03, 5, 0); + Builder_job.addData("WOOL", 0.035, 7, 0); + Builder_job.addData("STONE BRICK STAIRS", 0.04, 8, 0); + Builder_job.addData("STONE BRICK", 0.04, 8, 0); + Builder_job.addData("GLASS", 0.04, 8, 0); + Builder_job.addData("QUARTZ SLAB", 0.05, 9, 0); + Builder_job.addData("BRICKS SLAB", 0.05, 9, 0); + Builder_job.addData("GLOWSTONE", 0.05, 10, 0); + Builder_job.addData("HARDENED CLAY", 0.05, 10, 0); + Builder_job.addData("STAINED CLAY", 0.05, 10, 0); + Builder_job.addData("SANDSTONE STAIRS", 0.06, 10, 0); + Builder_job.addData("SANDSTONE", 0.06, 10, 0); + Builder_job.addData("QUARTZ STAIRS", 0.06, 12, 0); + Builder_job.addData("BRICK STAIRS", 0.065, 9, 0); + Builder_job.addData("QUARTZ BLOCK", 0.07, 14, 0); + Builder_job.addData("BRICK", 0.075, 11, 0); + Builder_job.setBuffData("Every 5XP gives you one torch.", + "1% of blocks placed will be replenished to your inventory.", + "5% of blocks placed will be replenished to your inventory.", + "Placing blocks gives you experience orbs. 50% of blocks placed will be replenished to your inventory."); + + Digger_job.setJobName("Digger"); + Digger_job.setJobDescription("A digger's job is to collect blocks from the ground that are collectible with a shovel. The digger may also convert some blocks to other types for more XP and money."); + Digger_job.setAction(0, "BREAK"); + Digger_job.setAction(1, "CRAFT"); + Digger_job.setAction(2, "SMELT"); + Digger_job.setExp(150, 100, 30, 1.02); + Digger_job.addData("DIRT", 0.005, 1, 0); + Digger_job.addData("GRASS", 0.005, 2, 0); + Digger_job.addData("SAND", 0.01, 2, 0); + Digger_job.addData("GRAVEL", 0.02, 5, 0); + Digger_job.addData("SOUL SAND", 0.04, 8, 0); + Digger_job.addData("CLAY", 0.05, 10, 0); + Digger_job.addData("SANDSTONE", 0.02, 6, 1); + Digger_job.addData("SMOOTH SANDSTONE", 0.02, 6, 1); + Digger_job.addData("CHISELED SANDSTONE", 0.025, 7, 1); + Digger_job.addData("BRICKS", 0.04, 8, 1); + Digger_job.addData("GLASS", 0.015, 3, 2); + Digger_job.addData("BRICK", 0.04, 8, 2); + Digger_job.setBuffData("Shovels used gain Efficiency +1 (Speed+30%)", + "Shovels have double the durability.", + "Shovels used gain Efficiency +2 (Speed+60%), Shovels have triple the durability.", + "Shovels have quadruple the durability. Blocks dug up are doubled in quantity. Shovels have Efficiency +4 (Speed+120%)."); + + Farmer_job.setJobName("Farmer"); + Farmer_job.setJobDescription("A farmer's job is to sustain and continue to replenish what nature provides to turn them into sustainable food items and other useful things."); + Farmer_job.setAction(0, "BREAK"); + Farmer_job.setAction(1, "PLACE"); + Farmer_job.setExp(150, 100, 20, 1.02); + Farmer_job.addData("SUGAR CANE", 0.00, 1, 0); + Farmer_job.addData("CACTUS", 0.00, 3, 0); + Farmer_job.addData("BROWN MUSHROOM", 0.00, 3, 0); + Farmer_job.addData("RED MUSHROOM", 0.00, 3, 0); + Farmer_job.addData("WHEAT", 0.01, 2, 0); + Farmer_job.addData("CARROT", 0.01, 2, 0); + Farmer_job.addData("POTATO", 0.03, 3, 0); + Farmer_job.addData("NETHER WART", 0.03, 3, 0); + //Farmer_job.addData("PUMPKIN SEEDS", 0.02, 4, 0); + //Farmer_job.addData("PUMPKIN", 0.04, 8, 0); + Farmer_job.addData("MELON", 0.10, 10, 0); + Farmer_job.addData("SEEDS", 0.005, 1, 1); + Farmer_job.addData("PUMPKIN SEEDS", 0.01, 2, 1); + Farmer_job.addData("MELON SEEDS", 0.01, 2, 1); + //Farmer_job.addData("PUMPKIN", 0.00, -16, 1); + Farmer_job.setBuffData("Hoes do not lose durability when used.", + "Killing skeletons yields triple the amount of bones.", + "Nearby crops grow 30% faster.", + "Nearby crops grow 200% faster. Bonemeal grows things instantly. (Just like before the bonemeal nerf) in one use."); + + Hunter_job.setJobName("Hunter"); + Hunter_job.setJobDescription("A hunter's job is to take care of the threats at night and protect others who may be in danger. Hunters that kill innocent creatures will be punished, thus they must resort to other methods for food."); + Hunter_job.setAction(0, "HURT"); + Hunter_job.setAction(1, "KILL"); + Hunter_job.setExp(300, 250, 35, 1.01); + Hunter_job.addData("SQUID", 0.00, 1, 0); + Hunter_job.addData("SLIME", 0.005, 1, 0); + Hunter_job.addData("ZOMBIE", 0.01, 2, 0); + Hunter_job.addData("SPIDER", 0.01, 2, 0); + Hunter_job.addData("SKELETON", 0.015, 3, 0); + Hunter_job.addData("CREEPER", 0.025, 5, 0); + Hunter_job.addData("PIG ZOMBIE", 0.03, 6, 0); + Hunter_job.addData("GHAST", 0.04, 8, 0); + Hunter_job.addData("ENDERMAN", 0.04, 8, 0); + Hunter_job.addData("BLAZE", 0.05, 10, 0); + Hunter_job.addData("ENDER DRAGON", 12.50, 250, 0); + Hunter_job.addData("WITHER", 22.50, 450, 0); + Hunter_job.addData("CHICKEN", 0.00, -2, 0); + Hunter_job.addData("SHEEP", 0.00, -3, 0); + Hunter_job.addData("PIG", 0.00, -4, 0); + Hunter_job.addData("COW", 0.00, -6, 0); + Hunter_job.addData("OCELOT", 0.00, -9, 0); + Hunter_job.addData("WOLF", 0.00, -12, 0); + Hunter_job.addData("MUSHROOM COW", 0.00, -20, 0); + Hunter_job.addData("SQUID", 0.00, 0, 1); + Hunter_job.addData("SLIME", 0.00, 0, 1); + Hunter_job.addData("SPIDER", 0.02, 4, 1); + Hunter_job.addData("ZOMBIE", 0.025, 5, 1); + Hunter_job.addData("SKELETON", 0.035, 7, 1); + Hunter_job.addData("CREEPER", 0.05, 10, 1); + Hunter_job.addData("PIG ZOMBIE", 0.08, 16, 1); + Hunter_job.addData("GHAST", 0.10, 12, 1); + Hunter_job.addData("ENDERMAN", 0.125, 16, 1); + Hunter_job.addData("BLAZE", 0.15, 20, 1); + Hunter_job.addData("ENDER DRAGON", 100.00, 3000, 1); + Hunter_job.addData("WITHER", 550.00, 7800, 1); + Hunter_job.setBuffData("Damage dealt increased by 2.", + "Sneaking gives you invisibility.", + "Swords gain Fire Aspect II. Movement speed increased by 20%.", + "Damage dealt increased by 4, damage taken decreased by 30%, at night you are invisible. Health increased by 20."); + + Fisherman_job.setJobName("Fisherman"); + Fisherman_job.setJobDescription("A fisherman's job is to catch fish. And more fish. And cook them."); + Fisherman_job.setAction(0, "CATCH"); + Fisherman_job.setAction(1, "SMELT"); + Fisherman_job.setExp(30, 40, 6, 1.04); + Fisherman_job.addData("RAW FISH", 0.175, 3, 0); + Fisherman_job.addData("COOKED FISH", 0.125, 2, 1); + Fisherman_job.setBuffData("Fishing rods have double the durability.", + "Fish give double the exp orbs, two fish can be caught at the same time (25% chance)", + "Up to four fish can be caught at one time. Sometimes fish will be automatically cooked. (Will gain exp and money for the cooked ones as well)", + "Fishing rods do 10 damage when hooking an enemy mob. Fishing rods do not run out of durability. Chance of catching fish increased by 50%. Holding a fishing rod gives the ability to fly for 5 seconds at a time."); + + Weaponsmith_job.setJobName("Weaponsmith"); + Weaponsmith_job.setJobDescription("A weaponsmith's job is to craft weapons for others and themselves."); + Weaponsmith_job.setAction(0, "CRAFT"); + Weaponsmith_job.setExp(100, 100, 30, 1.05); + Weaponsmith_job.addData("ARROW", 0.025, 4, 0); + Weaponsmith_job.addData("WOODEN SWORD", 0.05, 10, 0); + Weaponsmith_job.addData("FLINT AND STEEL", 0.06, 12, 0); + Weaponsmith_job.addData("BOW", 0.075, 12, 0); + Weaponsmith_job.addData("IRON SWORD", 0.375, 75, 0); + Weaponsmith_job.addData("GOLD SWORD", 0.50, 100, 0); + Weaponsmith_job.addData("DIAMOND SWORD", 0.975, 175, 0); + Weaponsmith_job.setBuffData("Materials used in crafting have a 10% chance of being preserved.", + "Weapons crafted gain a free level 5 enchantment.", + "Materials used in crafting have a 25% chance of being preserved.", + "Weapons crafted gain free level 25 enchantments. Materials used in crafting have a 50% chance of being preserved. Weapons crafted have a 30% chance of stacking (duplicated), and 30% chance for every extra addition to the weapon stack."); + + Blacksmith_job.setJobName("Blacksmith"); + Blacksmith_job.setJobDescription("A blacksmith's job is to provide tools, armor, and other crafted materials to others and themselves to protect them."); + Blacksmith_job.setAction(0, "CRAFT"); + Blacksmith_job.setExp(250, 150, 37, 1.03); + Blacksmith_job.addData("STONE HOE", 0.04, 7, 0); + Blacksmith_job.addData("STONE SHOVEL", 0.05, 8, 0); + Blacksmith_job.addData("STONE PICKAXE", 0.075, 15, 0); + Blacksmith_job.addData("LEATHER BOOTS", 0.125, 8, 0); + Blacksmith_job.addData("LEATHER CAP", 0.15, 14, 0); + Blacksmith_job.addData("LEATHER PANTS", 0.175, 15, 0); + Blacksmith_job.addData("LEATHER TUNIC", 0.20, 18, 0); + Blacksmith_job.addData("IRON SHOVEL", 0.25, 18, 0); + Blacksmith_job.addData("IRON HOE", 0.325, 24, 0); + Blacksmith_job.addData("WEAK IRON BOOTS", 0.375, 27, 0); + Blacksmith_job.addData("IRON PICKAXE", 0.40, 30, 0); + Blacksmith_job.addData("WEAK IRON HELMET", 0.50, 45, 0); + Blacksmith_job.addData("GOLDEN SHOVEL", 0.625, 55, 0); + Blacksmith_job.addData("GOLDEN HOE", 0.65, 60, 0); + Blacksmith_job.addData("WEAK IRON LEGGINGS", 0.725, 60, 0); + Blacksmith_job.addData("DIAMOND SHOVEL", 0.75, 65, 0); + Blacksmith_job.addData("DIAMOND HOE", 0.8, 70, 0); + Blacksmith_job.addData("WEAK GOLDEN BOOTS", 0.825, 50, 0); + Blacksmith_job.addData("WEAK IRON CHESTPLATE", 0.875, 70, 0); + Blacksmith_job.addData("WEAK GOLDEN HELMET", 0.925, 80, 0); + Blacksmith_job.addData("DIAMOND PICKAXE", 0.925, 80, 0); + Blacksmith_job.addData("WEAK DIAMOND BOOTS", 1.0, 85, 0); + Blacksmith_job.addData("WEAK GOLDEN LEGGINGS", 1.025, 100, 0); + Blacksmith_job.addData("WEAK GOLDEN CHESTPLATE", 1.15, 130, 0); + Blacksmith_job.addData("WEAK DIAMOND HELMET", 1.15, 125, 0); + Blacksmith_job.addData("WEAK DIAMOND LEGGINGS", 1.325, 145, 0); + Blacksmith_job.addData("WEAK DIAMOND CHESTPLATE", 1.50, 175, 0); + Blacksmith_job.addData("IRON BOOTS", 0.375*8, 27*8, 0); + Blacksmith_job.addData("IRON HELMET", 0.50*8, 45*8, 0); + Blacksmith_job.addData("IRON LEGGINGS", 0.725*8, 60*8, 0); + Blacksmith_job.addData("GOLDEN BOOTS", 0.825*8, 50*8, 0); + Blacksmith_job.addData("IRON CHESTPLATE", 0.875*8, 70*8, 0); + Blacksmith_job.addData("GOLDEN HELMET", 0.925*8, 80*8, 0); + Blacksmith_job.addData("DIAMOND BOOTS", 1.0*8, 85*8, 0); + Blacksmith_job.addData("GOLDEN LEGGINGS", 1.025*8, 100*8, 0); + Blacksmith_job.addData("GOLDEN CHESTPLATE", 1.15*8, 130*8, 0); + Blacksmith_job.addData("DIAMOND HELMET", 1.15*8, 125*8, 0); + Blacksmith_job.addData("DIAMOND LEGGINGS", 1.325*8, 145*8, 0); + Blacksmith_job.addData("DIAMOND CHESTPLATE", 1.50*8, 175*8, 0); + Blacksmith_job.setBuffData("All crafted items are buffed with a Lv5 enchantment.", + "All crafted items are buffed with a Lv10 enchantment.", + "Crafting materials have a 30% chance of being preserved.", + "All crafted Blacksmith items stack between 2 and 5 of the same item, effectively multiplying the amount you craft. Items are buffed with a Lv20 enchantment and have a 50% chance to be enchanted with a level 30 enchantment."); + + Cook_job.setJobName("Cook"); + Cook_job.setJobDescription("A cook's job is to provide food for others and themselves through cooking and crafting together ingredients."); + Cook_job.setAction(0, "CRAFT"); + Cook_job.setAction(1, "SMELT"); + Cook_job.setExp(250, 200, 40, 1.04); + Cook_job.addData("BREAD", 0.0125, 5, 0); + Cook_job.addData("MUSHROOM SOUP", 0.0375, 15, 0); + Cook_job.addData("COOKIE", 0.0675, 25, 0); + Cook_job.addData("GOLDEN CARROT", 0.0875, 35, 0); + Cook_job.addData("GOLDEN APPLE", 0.1125, 45, 0); + Cook_job.addData("PUMPKIN PIE", 0.15, 60, 0); + Cook_job.addData("CAKE", 0.2125, 85, 0); + Cook_job.addData("COOKED FISH", 0.03, 12, 1); + Cook_job.addData("BAKED POTATO", 0.04, 16, 1); + Cook_job.addData("COOKED CHICKEN", 0.045, 18, 1); + Cook_job.addData("GRILLED PORK", 0.06, 24, 1); + Cook_job.addData("COOKED BEEF", 0.10, 40, 1); + Cook_job.setBuffData("Double the amount of cooking time with one fuel item in the furnace.", + "Results of crafting food is double the normal amount.", + "Results of cooking food is double the normal amount.", + "Cooking and crafting food gives 4x the normal amount. Cooking and crafting food gives exp orbs and has a chance of giving Golden Apples and Golden Carrots sometimes. (15% per crafted/cooked item.)"); + + Brewer_job.setJobName("Brewer"); + Brewer_job.setJobDescription("A brewer's job is to create potions for others and themselves in order to change the outcome of situations."); + Brewer_job.setAction(0, "BREW"); + Brewer_job.setExp(100, 55, 3, 1.05); + Brewer_job.addData("SUGAR", 0.01, 2, 0); + Brewer_job.addData("SPIDER EYE", 0.015, 2, 0); + Brewer_job.addData("REDSTONE", 0.025, 2, 0); + Brewer_job.addData("GLOWSTONE DUST", 0.025, 2, 0); + Brewer_job.addData("GUNPOWDER", 0.03, 2, 0); + Brewer_job.addData("FERMENTED SPIDER EYE", 0.035, 4, 0); + Brewer_job.addData("GLISTERING MELON", 0.035, 4, 0); + Brewer_job.addData("NETHER WART", 0.04, 4, 0); + Brewer_job.addData("GOLDEN CARROT", 0.05, 5, 0); + Brewer_job.addData("BLAZE POWDER", 0.05, 6, 0); + Brewer_job.addData("MAGMA CREAM", 0.075, 8, 0); + Brewer_job.addData("GHAST TEAR", 0.30, 20, 0); + Brewer_job.setBuffData("Decrease brewing wait time by half.", + "Potions obtained are doubled. (Stacks of two)", + "Potions created by you have double the duration.", + "Potions created by you last for 30 minutes. Potions automatically stack up together in your inventory when grabbed. Splash potions provide full power regardless of how far from the splash the affected entities are. Potions obtained are quadrupled. Brewing wait time decreased by 4x the normal time."); + + Enchanter_job.setJobName("Enchanter"); + Enchanter_job.setJobDescription("An enchanter's job is to enchant items in order to make them more powerful and useful for everyday tasks."); + Enchanter_job.setAction(0, "ENCHANT"); + Enchanter_job.setExp(30, 30, 3, 1.04); + Enchanter_job.addExtraData("Each level of enchantment multiplies your income and exp gain."); + Enchanter_job.addExtraData("Ex. If PROTECTION gives $0.04 and 2XP, PROTECTION III would give you $0.12 and 6XP."); + Enchanter_job.addData("PROTECTION", 0.04, 2, 0); + Enchanter_job.addData("SMITE", 0.05, 4, 0); + Enchanter_job.addData("FIRE PROTECTION", 0.05, 3, 0); + Enchanter_job.addData("BANE OF ARTHROPODS", 0.06, 4, 0); + Enchanter_job.addData("FEATHER FALLING", 0.07, 5, 0); + Enchanter_job.addData("SHARPNESS", 0.075, 7, 0); + Enchanter_job.addData("POWER", 0.075, 7, 0); + Enchanter_job.addData("EFFICIENCY", 0.075, 7, 0); + Enchanter_job.addData("BLAST PROTECTION", 0.10, 8, 0); + Enchanter_job.addData("THORNS", 0.10, 8, 0); + Enchanter_job.addData("KNOCKBACK", 0.10, 9, 0); + Enchanter_job.addData("PUNCH", 0.10, 9, 0); + Enchanter_job.addData("FIRE ASPECT", 0.11, 10, 0); + Enchanter_job.addData("FLAME", 0.11, 10, 0); + Enchanter_job.addData("AQUA AFFINITY", 0.125, 8, 0); + Enchanter_job.addData("RESPIRATION", 0.15, 10, 0); + Enchanter_job.addData("UNBREAKING", 0.175, 12, 0); + Enchanter_job.addData("INFINITY", 0.20, 20, 0); + Enchanter_job.addData("LOOTING", 0.20, 15, 0); + Enchanter_job.addData("FORTUNE", 0.225, 20, 0); + Enchanter_job.addData("SILK TOUCH", 0.25, 20, 0); + Enchanter_job.setBuffData("Whenever you gain experience, the amount you gain is doubled.", + "Enchantments consume 25% less of your exp. (Lv20 enchantment costs 15 levels) Enchantments gain an extra stat enchantment bonus.", + "Enchantments are more potent. (Gain extra enchantments, bonus enchantments, and higher levels than normal.)", + "Enchanters receive quadruple the amount of experience from orbs. Enchanting consumes 75% less of your exp. (Lv20 enchantment costs 5 levels) Enchantments are at least level 5 or higher. Extra bonus enchantments are very likely, and super enchantments are added as well."); + + Breeder_job.setJobName("Breeder"); + Breeder_job.setJobDescription("A breeder's job is to populate and continue to grow animals and make sure there's plenty of animals in the area."); + Breeder_job.setAction(0, "BREED"); + Breeder_job.setAction(1, "DYE"); + Breeder_job.setAction(2, "SHEAR"); + Breeder_job.setExp(70, 50, 5, 1.02); + Breeder_job.addExtraData("In areas where there are little to no animals, breeders get 10x the amount of money and xp."); + Breeder_job.addData("CHICKEN", 0.005, 1, 0); + Breeder_job.addData("PIG", 0.01, 2, 0); + Breeder_job.addData("SHEEP", 0.01, 2, 0); + Breeder_job.addData("COW", 0.015, 2, 0); + Breeder_job.addData("OCELOT", 0.02, 4, 0); + Breeder_job.addData("WOLF", 0.03, 5, 0); + Breeder_job.addData("MUSHROOM COW", 0.15, 20, 0); + Breeder_job.addData("HORSE", 1.20, 50, 0); + Breeder_job.addData("SHEEP", 0.01, 1, 1); + Breeder_job.addData("SHEEP", 0.001, 0.1, 2); + Breeder_job.addData("MUSHROOM COW", 0.005, 0.5, 2); + Breeder_job.setBuffData("Nearby Sheep and Chickens reproduce wool and eggs at double the rate.", + "Breeding animals may yield twins and triplets half the time.", + "Feeding animals will give you the item back half the time.", + "Breeding animals will give between 2-5 of that animal, all of them will be grown up. Sheep will always regrow their wool instantly after shearing them, shears do not break. Chickens will give 64 eggs if you kill one. Cows and Pigs drop a stack of meat when killing them. Feeding pigs will give them a saddle."); + + Explorer_job.setJobName("Explorer"); + Explorer_job.setJobDescription("An explorer's job is to explore the whole world looking for new things and checking out places that are unusual."); + Explorer_job.setAction(0, "TASKS"); + Explorer_job.setExp(400, 80, 20, 1.01); + Explorer_job.addExtraData("You gain variable amounts of EXP and money for doing various tasks:"); + Explorer_job.addData("Walking Around: ", 0.005, 1, 0); + Explorer_job.addData("Looking around and being aware of your surroundings: ", 0.01, 2, 0); + Explorer_job.addData("Interacting with unusual blocks: ", 0.05, 25, 0); + Explorer_job.addData("Checking out villages, temples, caves, underground areas, the nether: ", 0.50, 50, 0); + Explorer_job.addData("Load a new region:", 0.00, 6, 0); + Explorer_job.addData("Creating maps and uncovering new areas on them (Underground rewards more!): ", 0.01, 8, 0); + Explorer_job.setBuffData("Movement speed increased by 20%.", + "Players lose no exp on death. When taking fatal damage, you will regain all health. This effect can be used once every hour.", + "Don't lose any money on death. Reviving costs 75% less.", + "When dying, you only lose 25% of your items. The rest stay in your inventory. Reviving costs 90% less. Teleporting to players costs 75% less. Movement speed increased by 40%. When dying, you will be placed back where you just died. This effect can be used once every hour."); + + Support_job.setJobName("Support"); + Support_job.setJobDescription("A support's job is to provide assistance and keep others alive by providing potions to heal, materials to allow others to craft things, and being useful overall."); + Support_job.setAction(0, "GIVE"); + Support_job.setAction(1, "CRAFT"); + Support_job.setAction(2, "SPLASH"); + Support_job.setAction(3, "Supporting Situations"); + Support_job.setExp(100, 100, 5, 1.03); + Support_job.addExtraData("Simply give players items to earn some money. Note that if they give it back you lose the xp you gained from it."); + Support_job.addData("TORCH", 0.005, 1, 0); + Support_job.addData("WOOD", 0.005, 1, 0); + Support_job.addData("COAL", 0.005, 1, 0); + Support_job.addData("IRON", 0.005, 1, 0); + Support_job.addData("POTIONS", 0.005, 1, 0); + Support_job.addData("FOOD", 0.005, 1, 0); + Support_job.addData("ARMOR", 0.005, 1, 0); + Support_job.addData("WEAPONS", 0.005, 1, 0); + Support_job.addData("FOOD", 0.015, 2, 1); + Support_job.addData("IRON SWORD", 0.015, 3, 1); + Support_job.addData("IRON ARMOR", 0.025, 5, 1); + Support_job.addData("DIAMOND SWORD", 0.075, 8, 1); + Support_job.addData("POTIONS, SPLASH POTIONS", 0.10, 5, 1); + Support_job.addData("DIAMOND ARMOR", 0.20, 20, 1); + Support_job.addData("NIGHT VISION", 0.10, 5, 2); + Support_job.addData("SPEED", 0.15, 6, 2); + Support_job.addData("STRENGTH", 0.40, 9, 2); + Support_job.addData("FIRE RESISTANCE", 0.50, 12, 2); + Support_job.addData("HEALING", 0.30, 14, 2); + Support_job.addData("-Light up dark areas.", 0.00, 1, 3); + Support_job.addData("-Help kill things with others.", 0.025, 3, 3); + Support_job.addData("-Clear out lava areas to allow for safe passage.", 0.05, 10, 3); + Support_job.addData("-Providing materials that someone ran out of.", 0.35, 30, 3); + Support_job.addData("-Healing someone when they are low in health.", 0.80, 40, 3); + Support_job.addData("-Dousing or using a fire resistance potion on someone burning.", 1.20, 60, 3); + Support_job.addData("-Teleport to others who need help.", 0.00, 100, 3); + Support_job.setBuffData("Everyone around you gains +2 Armor.", + "Everyone around you gains +10 more Maximum Health.", + "Everyone around you gains +4 Armor. Everyone's hunger degrades at half the speed. Players with 8 HP or less take half the damage from hits.", + "Everyone around you gains Regeneration. You gain +10 Armor. Everyone around you gains +20 more Maximum Health. You gain +50 more maximum health. Everyone around you including yourself moves 20% faster."); + } + + public void onDisable() + { + PluginDescriptionFile pdf = getDescription(); + System.out.println("[" + pdf.getName() + "] The plugin has been disabled succesfully."); + } + + + public void updateTopSPLEEFSigns() { + String name[] = {"","",""}; + int rating[] = {-9999,-9999,-9999}, wins[] = {0,0,0}, losses[] = {0,0,0}; + //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]) { + //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"); + } else + if (getAccountsConfig().getDouble(playerlist[i].getName()+".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"); + } else + if (getAccountsConfig().getDouble(playerlist[i].getName()+".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"); + } + } + } + } + Sign sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,85,42).getState(); + sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); + sign.setLine(1, ChatColor.BOLD+name[0]); + sign.update(); + sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,84,43).getState(); + sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); + sign.setLine(1, ChatColor.BOLD+"Wins: "+ChatColor.DARK_GREEN+wins[0]); + sign.update(); + sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,84,41).getState(); + sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); + sign.setLine(1, ChatColor.BOLD+"Losses: "+ChatColor.DARK_GREEN+losses[0]); + sign.update(); + sign = (Sign)Bukkit.getWorld("world").getBlockAt(1612,84,42).getState(); + sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); + sign.setLine(1, ChatColor.BOLD+"RATING: "+ChatColor.DARK_GREEN+rating[0]/10); + sign.update(); + + sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,85,39).getState(); + sign.setLine(0, ChatColor.BOLD+name[1]); + sign.setLine(1, "Rating: "+rating[1]/10); + sign.setLine(2, ChatColor.ITALIC+"Wins: "+wins[1]); + sign.setLine(3, ChatColor.ITALIC+"Losses: "+losses[1]); + sign.update(); + + sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,84,37).getState(); + sign.setLine(0, ChatColor.BOLD+name[2]); + sign.setLine(1, "Rating: "+rating[2]/10); + sign.setLine(2, ChatColor.ITALIC+"Wins: "+wins[2]); + sign.setLine(3, ChatColor.ITALIC+"Losses: "+losses[2]); + sign.update(); + } + +public void runTick() { + this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ + public void run(){ + for (int i=0;i arrows = Bukkit.getWorld("world").getEntities(); + for (int j=0;j60) { + //Remove old arrows that have existed long enough. (2 seconds) + arrows.get(j).remove(); + } + } + } + if (shooter.timer<=0) { + ARROW_SHOOTERS.remove(i); + i--; + } + } + for (int i=0;ininjavisible_list.get(i).resettime) { + //Recloak this ninja if it's still alive. + List entities = Bukkit.getWorld("world").getEntities(); + for (int j=0;j0) { + if (BOSS_DEFEAT%4==0) { + Bukkit.getWorld("world").playEffect(BOSS_DEFEAT_LOC.add(Math.random()*5-Math.random()*5, BOSS_DEFEAT/20, Math.random()*5-Math.random()*5), Effect.SMOKE, 0); + } + if (BOSS_DEFEAT==1) { + Bukkit.getWorld("world").playEffect(BOSS_DEFEAT_LOC, Effect.ZOMBIE_DESTROY_DOOR, 0); + } + BOSS_DEFEAT--; + } + if (REVIVE_EFFECT>0) { + switch (REVIVE_EFFECT) { //starts at 90. + case 90: + case 88: + case 86: + case 84: + case 82: + case 80: { + Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX(),REVIVE_EFFECT_LOC.getY()+(90-REVIVE_EFFECT)/2,REVIVE_EFFECT_LOC.getZ()), Effect.MOBSPAWNER_FLAMES, 0); + }break; + case 89: + case 85: + case 79: + case 75: + case 70: + case 65: + case 60: + case 55: + case 50: + case 45: + case 40: + case 35: + case 30: + case 25: + case 20: + case 15: + case 10: + case 5:{ + Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX()+(Math.random()-Math.random())*2,REVIVE_EFFECT_LOC.getY(),REVIVE_EFFECT_LOC.getZ()+(Math.random()-Math.random())*2), Effect.EXTINGUISH, 0); + }break; + case 87: + case 83: + case 77: + case 72: + case 67: + case 62: + case 57: + case 52: + case 47: + case 42: + case 37: + case 32: + case 27: + case 22: + case 17: + case 12: + case 7: { + Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX()+(Math.random()-Math.random())*2,REVIVE_EFFECT_LOC.getY()+(Math.random())*2,REVIVE_EFFECT_LOC.getZ()+(Math.random()-Math.random())*2), Effect.SMOKE, (int)(Math.random()*9)); + }break; + } + Bukkit.getWorld("world").playEffect(new Location(REVIVE_EFFECT_LOC.getWorld(),REVIVE_EFFECT_LOC.getX()+(Math.random()-Math.random())*2,REVIVE_EFFECT_LOC.getY()+(Math.random())*2,REVIVE_EFFECT_LOC.getZ()+(Math.random()-Math.random())*2), Effect.STEP_SOUND, Material.BEACON); + REVIVE_EFFECT--; + //Bukkit.getPlayer("sigonasr2").sendMessage(REVIVE_EFFECT+""); + } + for (int zx=0;zx2) { + Bukkit.getPlayer("sigonasr2").sendMessage("Previous Time: "+Bukkit.getWorld("world").getTime()); + Bukkit.getWorld("world").setTime((long) (Bukkit.getWorld("world").getTime()-((Bukkit.getWorld("world").getTime()-last_world_time)/2.0d))); + last_world_time = Bukkit.getWorld("world").getTime(); + Bukkit.getPlayer("sigonasr2").sendMessage("New Time: "+Bukkit.getWorld("world").getTime()); + } + }*/ + //last_world_time = Bukkit.getWorld("world").getFullTime(); + if (p.getWorld().getName().compareTo("world")==0) { + //Bukkit.getWorld("world").spawnEntity(p.getLocation(), EntityType.EXPERIENCE_ORB); + //Bukkit.getWorld("world").dropItemNaturally(p.getLocation(), new ItemStack(Material.DIRT)); + if (getConfig().getBoolean("halloween-enabled") && Bukkit.getWorld("world").getFullTime()%10==0) { + //1551,69,275 + Location testloc = new Location(p.getWorld(),1551,69,-275); + if (p.getLocation().distanceSquared(testloc)<900) { + //p.sendMessage("In range."); + //We are close enough to the sheep pen. Check out the sheep. + List ents = p.getNearbyEntities(15, 15, 15); + for (int i=0;i nearbylist = p.getNearbyEntities(15, 15, 5); + List nearbylist2 = p.getNearbyEntities(3, 3, 5); + for (int l=0;l10) { + for (int l=0;l nearby = p.getNearbyEntities(30, 30, 30); + boolean exists=false; + for (int m=0;m e_list = Bukkit.getWorld("world").getEntitiesByClass(EnderDragon.class).iterator(); + boolean first=false; + while (e_list.hasNext()) { + //p.sendMessage("Moving Enderdragon to "+new Location(p.getWorld(),p.getLocation().getBlockX()+i,-50,p.getLocation().getBlockZ()+j)); + EnderDragon next = e_list.next(); + if (!first) { + first=true; + } else { + next.remove(); + } + } + } + } + } + } + } + } + if (Bukkit.getWorld("world").getFullTime()%20==0) { + List nearby = p.getNearbyEntities(20, 12, 20); + //List nearby2 = p.getNearbyEntities(10, 6, 10); + for (int i=0;i=96) { + heightmodifier=126; + } else { + heightmodifier=63; + } + if (nearby.get(i).getType()==EntityType.CREEPER) { + LivingEntity l = (LivingEntity)nearby.get(i); + if (l.getCustomName()==null && l.getTicksLived()<6400 && !l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + if (l.getLocation().getY()<=40 && Math.random()<=0.08+((heightmodifier-l.getLocation().getY())*0.01d)) { + if (Math.random()<=0.35) { + l.setCustomName(ChatColor.YELLOW+"Explosive Creeper"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()*1.25d); + } else + if (Math.random()<=0.15) { + l.setCustomName(ChatColor.GOLD+"Explosive Creeper II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()*1.75d); + } else + if (Math.random()<=0.35) { + l.setCustomName(ChatColor.YELLOW+"Destructive Creeper"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()*1.25d); + } else { + l.setCustomName(ChatColor.GOLD+"Destructive Creeper II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()*1.75d); + } + l.setHealth(l.getMaxHealth()); + } + l.setTicksLived(6400); + } + } else + if (nearby.get(i).getType()==EntityType.SPIDER) { + LivingEntity l = (LivingEntity)nearby.get(i); + if (l.getCustomName()==null && l.getTicksLived()<6400 && !l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + if (Math.random()<=0.08+((heightmodifier-l.getLocation().getY())*0.01d)) { + if (Math.random()<=0.35) { + l.setCustomName(ChatColor.YELLOW+"Venomous Spider"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()); + } else + if (Math.random()<=0.15) { + l.setCustomName(ChatColor.GOLD+"Venomous Spider II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()*2); + } else + if (Math.random()<=0.35) { + l.setCustomName(ChatColor.YELLOW+"Snaring Spider"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()*2); + } else { + l.setCustomName(ChatColor.GOLD+"Snaring Spider II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()*4); + } + l.setHealth(l.getMaxHealth()); + } + l.setTicksLived(6400); + } + } else + if (nearby.get(i).getType()==EntityType.SKELETON) { + LivingEntity l = (LivingEntity)nearby.get(i); + if (l.getCustomName()==null && l.getTicksLived()<6400 && !l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) { + if (Math.random()<=0.85) { + l.setCustomName(ChatColor.YELLOW+"Sniper"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()/2); + } else { + l.setCustomName(ChatColor.GOLD+"Sniper II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()/4); + } + l.setHealth(l.getMaxHealth()); + } + l.setTicksLived(6400); + } + } else + if (nearby.get(i).getType()==EntityType.ZOMBIE) { + LivingEntity l = (LivingEntity)nearby.get(i); + if (l.getCustomName()==null && l.getTicksLived()<6400 && !l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + if (l.getLocation().getY()<=35 && Math.random()<=0.15) { + if (Math.random()<=0.85) { + l.setCustomName(ChatColor.YELLOW+"Charge Zombie"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()+20); + } else { + l.setCustomName(ChatColor.GOLD+"Charge Zombie II"); + l.setCustomNameVisible(false); + //l.setCustomNameVisible(true); + l.setMaxHealth(l.getMaxHealth()+60); + } + l.setHealth(l.getMaxHealth()); + } else { + if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) { + if (Math.random()<=0.25) { + l.setCustomName(ChatColor.GRAY+"Zombie Ninja"); + l.setCustomNameVisible(false); + l.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 999999, 0, true)); + l.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 2, true)); + //l.setCustomNameVisible(true); + //A Zombie Ninja will not wear armor to stay hidden. But may carry a sword. + l.getEquipment().setChestplate(new ItemStack(Material.AIR)); + l.getEquipment().setBoots(new ItemStack(Material.AIR)); + l.getEquipment().setLeggings(new ItemStack(Material.AIR)); + l.getEquipment().setHelmet(new ItemStack(Material.AIR)); + Zombie g = (Zombie)l; + g.setBaby(true); + l.setMaxHealth(l.getMaxHealth()+20); + } + } + } + l.setTicksLived(6400); + } else { + if (l.getCustomName()!=null && (l.getCustomName().compareTo(ChatColor.YELLOW+"Charge Zombie")==0 || l.getCustomName().compareTo(ChatColor.GOLD+"Charge Zombie II")==0 || l.getCustomName().compareTo(ChatColor.DARK_PURPLE+"Charge Zombie III")==0)) { + //Destroy blocks around it. + + boolean doit=true; + if (l.getKiller()!=null && l.getKiller().getLocation().getY()>l.getLocation().getY()) { + doit=false; + } + if (l.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + l.removePotionEffect(PotionEffectType.INVISIBILITY); + } + if (doit) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Charge Zombie!"); + if (l.getCustomName().compareTo(ChatColor.DARK_PURPLE+"Charge Zombie III")==0) { + /*//OLD CHARGE ZOMBIE BEHAVIOR. Charge Zombie II now does this weak block destruction. + for (int k=-1;k<2;k++) { + for (int j=-1;j<2;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + } + }*/ + for (int k=-1;k<2;k++) { + for (int j=-1;j<2;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,-1,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + } + } + } else { + /* + for (int k=-1;k<2;k++) { + for (int j=-1;j<2;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + } + }*/ //Charge Zombie II's now only break blocks when YOU get hit by them. + /*//OLD CHARGE ZOMBIE II BEHAVIOR. + for (int k=-2;k<3;k++) { + for (int j=-2;j<3;j++) { + Location checkloc = l.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = l.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL) { + bl.breakNaturally(); + } + } + }*/ + } + } + } + } + } + } + } + } + if (p.getWorld().getName().compareTo("world_nether")==0) { + if (Bukkit.getWorld("world").getFullTime()%60==0) { + for (int i=-15;i<=15;i++) { + for (int j=-15;j<=15;j++) { + for (int k=-5;k<=5;k++) { + if (Bukkit.getWorld("world_nether").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getType()==Material.MOB_SPAWNER) { + if (Math.random()<=0.5) { + CreatureSpawner spawner = (CreatureSpawner)Bukkit.getWorld("world_nether").getBlockAt(p.getLocation().getBlockX()+i,p.getLocation().getBlockY()+k,p.getLocation().getBlockZ()+j).getState(); + Location testloc = new Location(Bukkit.getWorld("world_nether"),spawner.getLocation().getX()+Math.random()*5,spawner.getLocation().getY()+Math.random()*3,spawner.getLocation().getZ()+Math.random()*5); + if (Bukkit.getWorld("world_nether").getBlockAt(testloc).getType()==Material.AIR && Bukkit.getWorld("world_nether").getBlockAt(testloc.add(0,1,0)).getType()==Material.AIR) { + Bukkit.getWorld("world_nether").spawnCreature(testloc,spawner.getCreatureType()); + } + Bukkit.getWorld("world_nether").spawnCreature(spawner.getLocation(),spawner.getCreatureType()); + } + + } + } + } + } + List nearby = p.getNearbyEntities(30, 30, 30); + try { + for (int i=0;i13000) { + //Bukkit.getPlayer("sigonasr2").sendMessage("It's night now..."); + turnedon=true; + for (int x=1562;x<1645;x++) { + for (int y=64;y<80;y++) { + for (int z=-357;z<-211;z++) { + Block theblock=Bukkit.getWorld("world").getBlockAt(x,y,z); + if (theblock.getType()==Material.REDSTONE_LAMP_OFF) { + theblock.setType(Material.REDSTONE_LAMP_ON); + } + } + } + } + } + if (turnedon==true && Bukkit.getWorld("world").getTime()<13000) { + turnedon=false; + //Bukkit.getPlayer("sigonasr2").sendMessage("It's day now..."); + for (int x=1562;x<1645;x++) { + for (int y=64;y<80;y++) { + for (int z=-357;z<-211;z++) { + Block theblock=Bukkit.getWorld("world").getBlockAt(x,y,z); + if (theblock.getType()==Material.REDSTONE_LAMP_ON) { + theblock.setType(Material.REDSTONE_LAMP_OFF); + } + } + } + } + } + } + if (Bukkit.getWorld("world").getFullTime()%10==0) { + 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().compareTo(getConfig().getString("spleefrequestc4player"))==0 || p.getName().compareTo(getConfig().getString("spleefrequestd4player"))==0))) { + //You lose. + //See if we're the winner. + int countdead=0; //We're looking for 3. + + + Player winningplayer = p,losingplayer = p; + if (getConfig().getString("spleefrequesta4player").compareTo("none")==0) { + countdead++; + } else { + if (getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { + losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequesta4player")); + } else { + winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequesta4player")); + } + } + if (getConfig().getString("spleefrequestb4player").compareTo("none")==0) { + countdead++; + } else { + if (getConfig().getString("spleefrequestb4player").compareTo(p.getName())==0) { + losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestb4player")); + } else { + winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestb4player")); + } + } + if (getConfig().getString("spleefrequestc4player").compareTo("none")==0) { + countdead++; + } else { + if (getConfig().getString("spleefrequestc4player").compareTo(p.getName())==0) { + losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestc4player")); + } else { + winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestc4player")); + } + } + if (getConfig().getString("spleefrequestd4player").compareTo("none")==0) { + countdead++; + } else { + if (getConfig().getString("spleefrequestd4player").compareTo(p.getName())==0) { + losingplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestd4player")); + } else { + winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestd4player")); + } + } + if (countdead==2) { + getConfig().set("spleef4insession", Boolean.valueOf(false)); + + + + + + //Stand someplace else when you win. + + + //Losing player has losing player stuff happen. + //This was a player that lost. + //Move them out, give them back their stuff. + Location newloc = p.getLocation(); + //Look for the special shovel for the sake of storing it. + /* + ItemStack[] shovelstack = p.getInventory().getContents(); + boolean shovelfound=false; + ItemStack shovel = shovelstack[0]; + for (int i=0;i=400) { + //WE have come to a standstill. Pick winner based on who has more blocks. + int player_a_blocks=0,player_b_blocks=0; + for (int i=Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")).getLocation().getBlockX()-4;iplayer_b_blocks) { + blockwinner=1; + } else { + blockwinner=2; + } + } else + if ((p.getLocation().getY()<86.5d || p.getLocation().getZ()<52.0d || p.getLocation().getZ()>65.0d || p.getLocation().getX()>1628.0d || p.getLocation().getX()<1615.0d) || blockwinner!=0) { + //We lose. Other player wins. + getConfig().set("spleefinsession", Boolean.valueOf(false)); + //Find out if we're player A, or player B. + Player winningplayer,losingplayer; + if (p.getName().compareTo(getConfig().getString("spleefrequestaplayer"))==0 || blockwinner==2) { + //We're player A. + //Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+getConfig().getString("spleefrequestbplayer")+" is the winner of this spleef game! "+getConfig().getString("spleefrequestaplayer")+" loses."); + losingplayer=p; + winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestbplayer")); + + double val1,val2,value,newval1,newval2; + if (getAccountsConfig().contains(winningplayer.getName()+".spleefrating")) { + val1 = getAccountsConfig().getDouble(winningplayer.getName()+".spleefrating"); + } else { + val1 = 1000.0d; + } + if (getAccountsConfig().contains(losingplayer.getName()+".spleefrating")) { + val2 = getAccountsConfig().getDouble(losingplayer.getName()+".spleefrating"); + } else { + val2 = 1000.0d; + } + value = 1.0d/(1.0d+Math.pow(10.0d, ((val2-val1)/400.0d))); + if (getAccountsConfig().contains(winningplayer.getName()+".spleefwins")) { + getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(getAccountsConfig().getInt(winningplayer.getName()+".spleefwins")+1)); + } else { + getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(1)); + } + if (getAccountsConfig().contains(winningplayer.getName()+".spleeflosses")) { + getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(getAccountsConfig().getInt(winningplayer.getName()+".spleeflosses"))); + } else { + getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(0)); + } + if (getAccountsConfig().contains(losingplayer.getName()+".spleefwins")) { + getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(getAccountsConfig().getInt(losingplayer.getName()+".spleefwins"))); + } else { + getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(0)); + } + if (getAccountsConfig().contains(losingplayer.getName()+".spleeflosses")) { + getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(getAccountsConfig().getInt(losingplayer.getName()+".spleeflosses")+1)); + } else { + getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(1)); + } + newval1 = (val1+Math.round(((50.0d/((getAccountsConfig().getDouble(winningplayer.getName()+".spleefwins")+getAccountsConfig().getDouble(winningplayer.getName()+".spleeflosses"))/20.0d))*(1.0d-value)))); + newval2 = (val2+Math.round(((50.0d/((getAccountsConfig().getDouble(losingplayer.getName()+".spleefwins")+getAccountsConfig().getDouble(losingplayer.getName()+".spleeflosses"))/20.0d))*(0.0d-value)))); + getAccountsConfig().set(winningplayer.getName()+".spleefrating",Double.valueOf(newval1)); + getAccountsConfig().set(losingplayer.getName()+".spleefrating",Double.valueOf(newval2)); + Location newloc = winningplayer.getLocation(); + + Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+getConfig().getString("spleefrequestbplayer")+"["+(int)newval1/10+"] is the winner of this spleef game! "+getConfig().getString("spleefrequestaplayer")+"["+(int)newval2/10+"] loses."); + newloc.setX(1622.5d); + newloc.setY(87.0d); + newloc.setZ(51.65d); + winningplayer.teleport(newloc); + updateTopSPLEEFSigns(); + saveAccountsConfig(); + } else { + //We're player B. + //Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+getConfig().getString("spleefrequestaplayer")+" is the winner of this spleef game! "+getConfig().getString("spleefrequestbplayer")+" loses."); + losingplayer=p; + winningplayer=Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")); + double val1,val2,value,newval1,newval2; + if (getAccountsConfig().contains(winningplayer.getName()+".spleefrating")) { + val1 = getAccountsConfig().getDouble(winningplayer.getName()+".spleefrating"); + } else { + val1 = 1000.0d; + } + if (getAccountsConfig().contains(losingplayer.getName()+".spleefrating")) { + val2 = getAccountsConfig().getDouble(losingplayer.getName()+".spleefrating"); + } else { + val2 = 1000.0d; + } + value = 1.0d/(1.0d+Math.pow(10.0d, ((val2-val1)/400.0d))); + if (getAccountsConfig().contains(winningplayer.getName()+".spleefwins")) { + getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(getAccountsConfig().getInt(winningplayer.getName()+".spleefwins")+1)); + } else { + getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(1)); + } + if (getAccountsConfig().contains(winningplayer.getName()+".spleeflosses")) { + getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(getAccountsConfig().getInt(winningplayer.getName()+".spleeflosses"))); + } else { + getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(0)); + } + if (getAccountsConfig().contains(losingplayer.getName()+".spleefwins")) { + getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(getAccountsConfig().getInt(losingplayer.getName()+".spleefwins"))); + } else { + getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(0)); + } + if (getAccountsConfig().contains(losingplayer.getName()+".spleeflosses")) { + getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(getAccountsConfig().getInt(losingplayer.getName()+".spleeflosses")+1)); + } else { + getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(1)); + } + newval1 = ((val1+Math.round((50.0d/((getAccountsConfig().getDouble(winningplayer.getName()+".spleefwins")+getAccountsConfig().getDouble(winningplayer.getName()+".spleeflosses"))/20.0d))*(1.0d-value)))); + newval2 = ((val2+Math.round((50.0d/((getAccountsConfig().getDouble(losingplayer.getName()+".spleefwins")+getAccountsConfig().getDouble(losingplayer.getName()+".spleeflosses"))/20.0d))*(0.0d-value)))); + getAccountsConfig().set(winningplayer.getName()+".spleefrating",Double.valueOf(newval1)); + getAccountsConfig().set(losingplayer.getName()+".spleefrating",Double.valueOf(newval2)); + Location newloc = winningplayer.getLocation(); + + Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+getConfig().getString("spleefrequestaplayer")+"["+(int)newval1/10+"] is the winner of this spleef game! "+getConfig().getString("spleefrequestbplayer")+"["+(int)newval2/10+"] loses."); + newloc.setX(1622.5d); + newloc.setY(87.0d); + newloc.setZ(51.65d); + winningplayer.teleport(newloc); + updateTopSPLEEFSigns(); + saveAccountsConfig(); + } + //Look for the special shovel. + /* + ItemStack[] shovelstack = Bukkit.getPlayer(getConfig().getString("spleefrequestaplayer")).getInventory().getContents(); + boolean shovelfound=false; + ItemStack shovel = shovelstack[0]; + Bukkit.getPlayer("sigonasr2").sendMessage("Starting shovel check."); + 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); + newloc.setY(87.0d); + newloc.setZ(51.65d); + p.teleport(newloc); + p.sendMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+"You are a spectator! What are you thinking?!"); + } + } + } + } + } + } + }, 1l, 1l); +} + +public String healthbar(double curHP,double maxHP) { + //█ ▌ + int bits=(int)(Math.ceil(curHP/maxHP*10)); + String bar=" "; + if (bits>6) { + bar+=ChatColor.GREEN+""; + } else + if (bits>3) { + bar+=ChatColor.YELLOW+""; + } else + { + bar+=ChatColor.RED+""; + } + for (int i=0;i=10) { + PersistentExplorerList eve = new PersistentExplorerList(p.getName()); + eve.event=1; + eve.data=p.getExp(); + eve.data2=p.getLevel(); + eve.expiretime=Bukkit.getWorld("world").getFullTime()+1200; + explorers.add(eve); + } + } + if (explorers.get(i).event==1 && explorers.get(i).name.compareTo(p.getName())==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) { + deadpoint=i; + } + if (exppoint!=-1 && deadpoint!=-1) { + p.setExp(explorers.get(exppoint).data); + p.setLevel((int)explorers.get(exppoint).data2); + explorers.get(exppoint).event=-1; + explorers.get(deadpoint).event=-1; + exppoint=-1; + deadpoint=-1; + } + */ + if (explorers.get(i).event==-1 || explorers.get(i).expiretime=5) { + List entities = list[i].getNearbyEntities(10, 10, 10); + for (int j=0;j7 && (unmatched/9610.0d*100)<8.35 && (last_boss_dungeon_time==0 || last_boss_dungeon_time nearby = list[i].getNearbyEntities(20, 5, 20); + for (int j=0;j-6;j--) { + for (int k=2;k>-1;k--) { + for (int l=5;l>-6;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k,spread+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { + torch1=true; + } + } + } + } + if (!torch1) { + int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; + for (int j=lb1;j>ub1;j--) { + for (int k=2;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k,spread+l)); + if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + e1 = Bukkit.getWorld("world").spawnEntity(list[i].getLocation().add(20,0,spread), EntityType.ZOMBIE); + } + torch2=false; + spread = (int)(Math.random()*10)+10; + for (int j=5;j>-6;j--) { + for (int k=2;k>-1;k--) { + for (int l=5;l>-6;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(-20+j,k,spread+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { + torch2=true; + } + } + } + } + if (!torch2) { + int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; + for (int j=lb1;j>ub1;j--) { + for (int k=2;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(-20+j,k,spread+l)); + if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + e2 = Bukkit.getWorld("world").spawnEntity(list[i].getLocation().add(-20,0,spread), EntityType.ZOMBIE); + } + spread = (int)(Math.random()*10)+10; + for (int j=5;j>-6;j--) { + for (int k=2;k>-1;k--) { + for (int l=5;l>-6;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k,20+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { + torch3=true; + } + } + } + } + if (!torch3) { + int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; + for (int j=lb1;j>ub1;j--) { + for (int k=2;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k,20+l)); + if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + e3 = Bukkit.getWorld("world").spawnEntity(list[i].getLocation().add(spread,0,20), EntityType.ZOMBIE); + } + spread = (int)(Math.random()*10)+10; + for (int j=5;j>-6;j--) { + for (int k=2;k>-1;k--) { + for (int l=5;l>-6;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k,-20+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { + torch4=true; + } + } + } + } + if (!torch4) { + int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; + for (int j=lb1;j>ub1;j--) { + for (int k=2;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k,-20+l)); + if (Math.random()<=0.75 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + e4 = Bukkit.getWorld("world").spawnEntity(list[i].getLocation().add(spread,0,-20), EntityType.ZOMBIE); + } + } + /* + torch1=false; + torch2=false; + torch3=false; + torch4=false; + spread = (int)(Math.random()*20)+20; + int randomheight=(int)(Math.random()*5)-(int)(Math.random()*5); + for (int j=10;j>-11;j--) { + for (int k=4;k>-2;k--) { + for (int l=10;l>-11;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(30+j,k+randomheight,spread+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE) { + torch1=true; + } + } + } + } + if (!torch1) { + int lb1=(int)(Math.random()*5)+10,lb2=(int)(Math.random()*5)+10,ub1=-(int)(Math.random()*6)+10,ub2=-(int)(Math.random()*6)+10; + for (int j=lb1;j>ub1;j--) { + for (int k=(int)(Math.random()*4)+1;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k+randomheight,spread+l)); + if (Math.random()<=0.75-k*0.10 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + } + torch2=false; + spread = (int)(Math.random()*20)+20; + randomheight=(int)(Math.random()*5)-(int)(Math.random()*5); + for (int j=10;j>-11;j--) { + for (int k=4;k>-2;k--) { + for (int l=10;l>-11;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(-20+j,k+randomheight,spread+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE) { + torch2=true; + } + } + } + } + if (!torch2) { + int lb1=(int)(Math.random()*5)+10,lb2=(int)(Math.random()*5)+10,ub1=-(int)(Math.random()*6)+10,ub2=-(int)(Math.random()*6)+10; + for (int j=lb1;j>ub1;j--) { + for (int k=(int)(Math.random()*4)+1;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k+randomheight,spread+l)); + if (Math.random()<=0.75-k*0.10 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + } + spread = (int)(Math.random()*20)+20; + for (int j=10;j>-11;j--) { + for (int k=4;k>-2;k--) { + for (int l=10;l>-11;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k+randomheight,20+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE) { + torch3=true; + } + } + } + } + if (!torch3) { + int lb1=(int)(Math.random()*5)+10,lb2=(int)(Math.random()*5)+10,ub1=-(int)(Math.random()*6)+10,ub2=-(int)(Math.random()*6)+10; + for (int j=lb1;j>ub1;j--) { + for (int k=(int)(Math.random()*4)+1;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k+randomheight,spread+l)); + if (Math.random()<=0.75-k*0.10 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + } + spread = (int)(Math.random()*20)+20; + for (int j=10;j>-11;j--) { + for (int k=4;k>-2;k--) { + for (int l=10;l>-11;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(spread+j,k+randomheight,-20+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE) { + torch4=true; + } + } + } + } + if (!torch4) { + int lb1=(int)(Math.random()*5)+10,lb2=(int)(Math.random()*5)+10,ub1=-(int)(Math.random()*6)+10,ub2=-(int)(Math.random()*6)+10; + for (int j=lb1;j>ub1;j--) { + for (int k=(int)(Math.random()*4)+1;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(20+j,k+randomheight,spread+l)); + if (Math.random()<=0.75-k*0.10 && b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + } + if (!torch1) { + Zombie z1 = (Zombie)e1; + z1.setCustomName(ChatColor.GOLD+"Charge Zombie II"); + z1.setCustomNameVisible(false); + z1.setTarget(list[i]); + } + if (!torch2) { + Zombie z2 = (Zombie)e2; + z2.setCustomName(ChatColor.GOLD+"Charge Zombie II"); + z2.setCustomNameVisible(false); + z2.setTarget(list[i]); + } + if (!torch3) { + Zombie z3 = (Zombie)e3; + z3.setCustomName(ChatColor.GOLD+"Charge Zombie II"); + z3.setCustomNameVisible(false); + z3.setTarget(list[i]); + } + if (!torch4) { + Zombie z4 = (Zombie)e4; + z4.setCustomName(ChatColor.GOLD+"Charge Zombie II"); + z4.setCustomNameVisible(false); + z4.setTarget(list[i]); + }*/ + } + if (list[i].getWorld().getName().compareTo("world_the_end")==0) { + List ents = Bukkit.getWorld("world_the_end").getEntities(); + int enderdragoncount=0; + for (int j=0;j ents = Bukkit.getWorld("world").getEntities(); + int enderdragoncount=0; + for (int j=0;j loredata = items[j].getItemMeta().getLore(); + for (int m=0;m loredata = items[j].getItemMeta().getLore(); + for (int m=0;m=10) { + if (p.isSneaking()) { + p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 12, 0, false)); + } + } + } + } + } + LOGGING_UPDATE_COUNTS++; //6 + for (int i=0;i nearbyplayers = p.getNearbyEntities(20, 20, 20); + //Bukkit.getPlayer("sigonasr2").sendMessage("Entered 1."); + for (int j=0;j=20) { + if (!p2.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Entered 4."); + p2.sendMessage(ChatColor.YELLOW+"[Aura]"+ChatColor.ITALIC+"Damage reduction buff (40%) from Support "+ChatColor.DARK_RED+p.getName()); + p2.sendMessage(ChatColor.YELLOW+"[Aura]"+ChatColor.ITALIC+"Food Exhaustion buff (50% less food consumption) from Support "+ChatColor.DARK_RED+p.getName()); + p2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 601, 1, false)); + } else { + p2.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); + p2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 601, 1, false)); + } + } else + if (supportlv>=5) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Entered 3."); + //Give them a resistance buff. + if (!p2.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Entered 4."); + p2.sendMessage(ChatColor.YELLOW+"[Aura]"+ChatColor.ITALIC+"Damage reduction buff (20%) from Support "+ChatColor.DARK_RED+p.getName()); + p2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 601, 0, false)); + } else { + p2.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE); + p2.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 601, 0, false)); + } + } + if (supportlv>=10) { + //Set that they have a lv10 hp buff. + for (int k=0;k=10) { + //We store the exp and level too. + if (explorerlist.get(i).wedied) { + p.setExp(explorerlist.get(i).expamt); + p.setLevel(explorerlist.get(i).explv); + explorerlist.get(i).wedied=false; + } else { + explorerlist.get(i).expamt=p.getExp(); + explorerlist.get(i).explv=p.getLevel(); + } + } + //Give money for moving around. + double distance = Math.abs(explorerlist.get(i).xprevious-p.getLocation().getX())+Math.abs(explorerlist.get(i).zprevious-p.getLocation().getZ()); + gainMoneyExp(p,"Explorer",0.005*distance/500.0d,distance/500.0d); + //Bukkit.getPlayer("sigonasr2").sendMessage("+"+distance/500.0d+"xp"); + Block lookat = p.getTargetBlock(null, 50); + + if (distance>2) { + //VILLAGE CRITERIA. + if (lookat.getType()==Material.SAND) { + explorerlist.get(i).villagecriteria--; + } + if (lookat.getType()==Material.SANDSTONE) { + explorerlist.get(i).villagecriteria-=2; + } + if (lookat.getType()==Material.WOOL && lookat.getData()==15) { + explorerlist.get(i).villagecriteria-=3; + } + if (lookat.getType()==Material.DIRT) { + explorerlist.get(i).villagecriteria=100; + } + if (lookat.getType()==Material.LOG || lookat.getType()==Material.WOOD) { + explorerlist.get(i).villagecriteria=100; + } + if (explorerlist.get(i).villagecriteria<40 && GLOBAL_villagetimer lister = p.getNearbyEntities(10, 10, 10); + for (int j=0;j50) { + explorerlist.get(i).cavecriteria=100; + } + if (lookat.getType()==Material.LOG || lookat.getType()==Material.SAND) { + explorerlist.get(i).cavecriteria=100; + } + if (explorerlist.get(i).cavecriteria<=0 && GLOBAL_cavetimer10 && lookat.getLightLevel()<6) { + explorerlist.get(i).undergroundcriteria-=20; + } + if (explorerlist.get(i).undergroundcriteria<=0 && GLOBAL_undergroundtimer50) { + explorerlist.get(i).undergroundcriteria=100; + } + if (lookat.getType()==Material.LOG || lookat.getType()==Material.SAND) { + explorerlist.get(i).undergroundcriteria=100; + } + + //NETHER CRITERIA + if (lookat.getType()==Material.NETHERRACK) { + explorerlist.get(i).nethercriteria-=1; + } + if (lookat.getType()==Material.LAVA) { + explorerlist.get(i).nethercriteria-=5; + } + if (explorerlist.get(i).nethercriteria<=0 && GLOBAL_nethertimercurrentsize) { + //Award this explorer experience for growing the map. + if (p.getLocation().getY()<=60) { + gainMoneyExp(p,"Explorer",0.01,8); + } else { + gainMoneyExp(p,"Explorer",0.001,2); + } + } + } + } + + if (lookat.getType()!=Material.AIR && lookat.getType()!=explorerlist.get(i).lasttype) { + distance = Math.abs(explorerlist.get(i).xlookprevious-lookat.getLocation().getX())+Math.abs(explorerlist.get(i).zlookprevious-lookat.getLocation().getZ()); + int mult=1; + for (int j=0;jjukeboxlist.get(i).getSongDuration()*20+60) { + //Check to see if players are closer to one or the other. + boolean closest=true; + for (int j=0;jjukeboxlist.get(j).getClosestPlayer()) { + closest=false; + } + } + } + if (closest) { + //We have to loop it. + if (!jukeboxlist.get(i).Restart()) { + jukeboxlist.remove(i); + i--; + } else { + //Bukkit.getPlayer("sigonasr2").sendMessage("Restarted Jukebox "+i+" Properties: "+((Jukebox)(jukeboxlist.get(i).getJukebox().getState())).getPlaying()+","+((Jukebox)(jukeboxlist.get(i).getJukebox().getState())).isPlaying()); + } + } + } + } + } else { + jukeboxlist.remove(i); + i--; + } + //Bukkit.getPlayer("sigonasr2").sendMessage("Jukebox "+i+" Properties: "+((Jukebox)(jukeboxlist.get(i).getJukebox().getState())).getPlaying()+","+((Jukebox)(jukeboxlist.get(i).getJukebox().getState())).isPlaying()); + } + LOGGING_UPDATE_COUNTS++; //11 + + LOGGING_UPDATE_COUNTS++; //12 + } + } + , 200, 200); +} + +@SuppressWarnings("deprecation") +public void updateTime() { + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() + { + public void run() { + for (int i=0;i0 && !brewingstandlist.get(i).is_newTimeSet()) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Brewing, time is not set: "+brewingstandlist.get(i).getBrewingTime()); + if (PlayerinJob(brewingstandlist.get(i).owner, "Brewer") && getJobLv("Brewer", brewingstandlist.get(i).owner)>=5) { + brewingstandlist.get(i).set_newTime(true); + //Bukkit.getPlayer("sigonasr2").sendMessage("Old Brewing time: "+brewingstandlist.get(i).getBrewingTime()); + brewingstandlist.get(i).setBrewingTime(brewingstandlist.get(i).getBrewingTime()/2); + //Bukkit.getPlayer("sigonasr2").sendMessage("New Brewing time: "+brewingstandlist.get(i).getBrewingTime()); + } + } + if (brewingstandlist.get(i).getTime()=2) { + last_world_time+=2; + raisecount++; + } + Bukkit.getWorld("world").setFullTime(Bukkit.getWorld("world").getFullTime()-raisecount); + /* + if (Bukkit.getWorld("world").getFullTime()-last_world_time+hold_diff>=2) { + last_world_time = Bukkit.getWorld("world").getFullTime()+((Bukkit.getWorld("world").getFullTime()-last_world_time+(hold_diff/2))/2); + accumulator -= (Bukkit.getWorld("world").getFullTime()-last_world_time+(hold_diff/2))/2; + Bukkit.getWorld("world").setFullTime(last_world_time); + hold_diff=0; + } else { + hold_diff += Bukkit.getWorld("world").getFullTime() - last_world_time; + accumulator += Bukkit.getWorld("world").getFullTime() - last_world_time; + Bukkit.getWorld("world").setFullTime(last_world_time); + } + */ + } + } + } + , 10, 10); +} + + @SuppressWarnings("deprecation") +public void payDay(int time) + { + getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() + { + public void run() + { + for (Player allOnlineP : Bukkit.getOnlinePlayers()) { + allOnlineP.sendMessage("§2<=========[§dInterest§2]=========>"); + DecimalFormat df = new DecimalFormat("#0.00"); + allOnlineP.sendMessage("§6The money interest has been delivered to all players. ("+df.format((double)(Main.this.getConfig().getDouble("payday.amount")*100))+"% interest rate)"); + allOnlineP.sendMessage("§6Your 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("§2<==========================>"); + 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)); + } + 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")))); + } + //Main.economy.depositPlayer(allOnlineP.getName(), (Main.this.getConfig().getDouble("payday.amount")*Main.economy.bankBalance(allOnlineP.getName()).balance)); + } + saveAccountsConfig(); + List expired_uuids = new ArrayList(); + String moblist = getConfig().getString("fed.mobs"); + String finalstring = ""; + int removed_count=0; + if (getConfig().getString("fed.mobs").length()>4) { + String[] mobslist = moblist.split(","); + for (int i=0;iLong.valueOf(mobslist[i+1])) { + expired_uuids.add(UUID.fromString(mobslist[i])); + } else { + //Send this back for holding on until next time. + //Reconstruct the data + if (finalstring.equalsIgnoreCase("")) { + finalstring+=mobslist[i]+","+mobslist[i+1]; + } else { + finalstring+=","+mobslist[i]+","+mobslist[i+1]; + } + } + } + //Check all spawned entities in the world. + List world_entities = Bukkit.getWorld("world").getEntities(); + for (int i=0;i=3) { + p.sendMessage(ChatColor.GOLD+"Sorry, you are already in 3 jobs!"); + return false; + } + Bukkit.getLogger().info("Max Job count checked."); + if (PlayerinJob(p,job)) { + p.sendMessage(ChatColor.GOLD+"Sorry, you are already in this job!"); + return false; + } + Bukkit.getLogger().info("Player's not in job checked."); + 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; + } + Bukkit.getLogger().info("Well, they are allowed to join this job."); + //Add 1 to main config. + getConfig().set("jobs."+ValidJobs[matchedjob], Integer.valueOf(getConfig().getInt("jobs."+ValidJobs[matchedjob])+1)); + saveConfig(); + Bukkit.getLogger().info("Saved the config."); + //We can add them into this new job. + //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")) { + 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())); + } + if (ValidJobs[matchedjob].compareTo("Support")==0) { + supportplayers.add(new SupportPlayer(p)); + } + if (ValidJobs[matchedjob].compareTo("Hunter")==0) { + 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(); + Bukkit.getLogger().info("Set job data."); + Bukkit.broadcastMessage(p.getName()+" 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")}; + return string; + } + + public String[] getJobs(String p) { + 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) { + String[] jobs = getJobs(p); + for (int i=0;i=0) {getAccountsConfig().set(p+".jobs.job"+(slot+1)+"exp", Double.valueOf(getAccountsConfig().getDouble(p+".jobs.job"+(slot+1)+"exp")+exp));} else { + getAccountsConfig().set(p+".jobs.job"+(slot+1)+"exp", Double.valueOf(0)); + } + //Check for lv up. + if (getJobExp(job,getAccountsConfig().getInt(p+".jobs.job"+(slot+1)+"lv"))<=getAccountsConfig().getDouble(p+".jobs.job"+(slot+1)+"exp")) { + //Level up! Level up! YEAH! + getAccountsConfig().set(p+".jobs.job"+(slot+1)+"exp", Double.valueOf(getAccountsConfig().getDouble(p+".jobs.job"+(slot+1)+"exp")-getJobExp(job,getAccountsConfig().getInt(p+".jobs.job"+(slot+1)+"lv")))); + getAccountsConfig().set(p+".jobs.job"+(slot+1)+"lv", Integer.valueOf(getAccountsConfig().getInt(p+".jobs.job"+(slot+1)+"lv")+1)); + Bukkit.broadcastMessage(p+" is now a Level "+getAccountsConfig().getInt(p+".jobs.job"+(slot+1)+"lv")+" "+getJobColor(job)+job+ChatColor.WHITE+"."); + if (getJobTotalLvs(Bukkit.getPlayer(p))%5==0) { + Bukkit.broadcastMessage(ChatColor.GREEN+p+" has reached Level "+getJobTotalLvs(Bukkit.getPlayer(p))+"!"); + if ((((getJobTotalLvs(Bukkit.getPlayer(p))/5+1)-getStatPointTotal(Bukkit.getPlayer(p))))>0) { + Bukkit.getPlayer(p).sendMessage(ChatColor.GOLD+"You have earned 1 stat point! You now have "+(((getJobTotalLvs(Bukkit.getPlayer(p))/5+1)-getStatPointTotal(Bukkit.getPlayer(p))))+" stat point"+((((getJobTotalLvs(Bukkit.getPlayer(p))/5+1)-getStatPointTotal(Bukkit.getPlayer(p))))==1?"":"s")+" to spend. "+ChatColor.ITALIC+ChatColor.BLUE+" Type /sp to spend them!"); + } + } + } + saveAccountsConfig(); + } + + public void gainMoneyExp(Player p,String job,double amount,double exp) { + String[] jobs = getJobs(p); + int slot=-1; + //Add to how much we've earned so far. + for (int i=0;i enchant_data = new ArrayList(); //OMGGGG. forgot to initialize the dang list! + if (item.getType()==Material.STONE_HOE || item.getType()==Material.IRON_HOE || item.getType()==Material.WOOD_HOE || item.getType()==Material.GOLD_HOE || item.getType()==Material.DIAMOND_HOE) { + enchant_data=ENCHANTMENT_DATA.stone_hoe; + } else + //DERP + if (item.getType()==Material.STONE_SPADE) {enchant_data=ENCHANTMENT_DATA.stone_shovel;} else + if (item.getType()==Material.STONE_PICKAXE) {enchant_data=ENCHANTMENT_DATA.stone_pickaxe;} else + if (item.getType()==Material.LEATHER_BOOTS) {enchant_data=ENCHANTMENT_DATA.leather_boots;} else + if (item.getType()==Material.LEATHER_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.leather_pants;} else + if (item.getType()==Material.LEATHER_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.leather_tunic;} else + if (item.getType()==Material.LEATHER_HELMET) {enchant_data=ENCHANTMENT_DATA.leather_cap;} else + if (item.getType()==Material.IRON_SPADE) {enchant_data=ENCHANTMENT_DATA.iron_shovel;} else + if (item.getType()==Material.IRON_BOOTS) {enchant_data=ENCHANTMENT_DATA.iron_boots;} else + if (item.getType()==Material.IRON_PICKAXE) {enchant_data=ENCHANTMENT_DATA.iron_pickaxe;} else + if (item.getType()==Material.IRON_HELMET) {enchant_data=ENCHANTMENT_DATA.iron_helmet;} else + if (item.getType()==Material.GOLD_SPADE) {enchant_data=ENCHANTMENT_DATA.golden_shovel;} else + if (item.getType()==Material.IRON_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.iron_leggings;} else + if (item.getType()==Material.DIAMOND_SPADE) {enchant_data=ENCHANTMENT_DATA.diamond_shovel;} else + if (item.getType()==Material.GOLD_BOOTS) {enchant_data=ENCHANTMENT_DATA.golden_boots;} else + if (item.getType()==Material.IRON_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.iron_chestplate;} else + if (item.getType()==Material.GOLD_HELMET) {enchant_data=ENCHANTMENT_DATA.golden_helmet;} else + if (item.getType()==Material.IRON_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.iron_chestplate;} else + if (item.getType()==Material.DIAMOND_PICKAXE) {enchant_data=ENCHANTMENT_DATA.diamond_pickaxe;} else + if (item.getType()==Material.DIAMOND_BOOTS) {enchant_data=ENCHANTMENT_DATA.diamond_boots;} else + if (item.getType()==Material.GOLD_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.golden_leggings;} else + if (item.getType()==Material.GOLD_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.golden_chestplate;} else + if (item.getType()==Material.DIAMOND_HELMET) {enchant_data=ENCHANTMENT_DATA.diamond_helmet;} else + if (item.getType()==Material.DIAMOND_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.diamond_leggings;} else + if (item.getType()==Material.DIAMOND_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.diamond_chestplate;} + int enchantments=0; + int iterations=0; + while (enchantments==0 && iterations<100) { //Attempt to enchant it, up to 100 tries. + iterations++; + //Bukkit.getPlayer("sigonasr2").sendMessage("Enchant data size is "+enchant_data.size()); + for (int i=0;i graphs = Collections.synchronizedSet(new HashSet()); + + private final Graph defaultGraph = new Graph("Default"); + private final YamlConfiguration configuration; + private final File configurationFile; + private final String guid; + private final Object optOutLock = new Object(); + + private volatile int taskId = -1; + + public Metrics(Plugin plugin) throws IOException { + if (plugin == null) { + throw new IllegalArgumentException("Plugin cannot be null"); + } + + this.plugin = plugin; + + this.configurationFile = new File("plugins/PluginMetrics/config.yml"); + this.configuration = YamlConfiguration.loadConfiguration(this.configurationFile); + + this.configuration.addDefault("opt-out", Boolean.valueOf(false)); + this.configuration.addDefault("guid", UUID.randomUUID().toString()); + + if (this.configuration.get("guid", null) == null) { + this.configuration.options().header("http://mcstats.org").copyDefaults(true); + this.configuration.save(this.configurationFile); + } + + this.guid = this.configuration.getString("guid"); + } + + public Graph createGraph(String name) + { + if (name == null) { + throw new IllegalArgumentException("Graph name cannot be null"); + } + + Graph graph = new Graph(name); + + this.graphs.add(graph); + + return graph; + } + + public void addCustomData(Plotter plotter) + { + if (plotter == null) { + throw new IllegalArgumentException("Plotter cannot be null"); + } + + this.defaultGraph.addPlotter(plotter); + + this.graphs.add(this.defaultGraph); + } + + public boolean start() + { + synchronized (this.optOutLock) + { + if (isOptOut()) { + return false; + } + + if (this.taskId >= 0) { + return true; + } + + this.taskId = this.plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(this.plugin, new Runnable() + { + private boolean firstPost = true; + + public void run() + { + try { + synchronized (Metrics.this.optOutLock) + { + if ((Metrics.this.isOptOut()) && (Metrics.this.taskId > 0)) { + Metrics.this.plugin.getServer().getScheduler().cancelTask(Metrics.this.taskId); + Metrics.this.taskId = -1; + } + + } + + Metrics.this.postPlugin(!this.firstPost); + + this.firstPost = false; + } catch (IOException e) { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); + } + } + } + , 0L, 12000L); + + return true; + } + } + + public boolean isOptOut() + { + synchronized (this.optOutLock) + { + try { + this.configuration.load("plugins/PluginMetrics/config.yml"); + } catch (IOException ex) { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + return true; + } catch (InvalidConfigurationException ex) { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + return true; + } + return this.configuration.getBoolean("opt-out", false); + } + } + + public void enable() + throws IOException + { + synchronized (this.optOutLock) + { + if (isOptOut()) { + this.configuration.set("opt-out", Boolean.valueOf(false)); + this.configuration.save(this.configurationFile); + } + + if (this.taskId < 0) + start(); + } + } + + public void disable() + throws IOException + { + synchronized (this.optOutLock) + { + if (!isOptOut()) { + this.configuration.set("opt-out", Boolean.valueOf(true)); + this.configuration.save(this.configurationFile); + } + + if (this.taskId > 0) { + this.plugin.getServer().getScheduler().cancelTask(this.taskId); + this.taskId = -1; + } + } + } + + private void postPlugin(boolean isPing) + throws IOException + { + PluginDescriptionFile description = this.plugin.getDescription(); + + StringBuilder data = new StringBuilder(); + data.append(encode("guid")).append('=').append(encode(this.guid)); + encodeDataPair(data, "version", description.getVersion()); + encodeDataPair(data, "server", Bukkit.getVersion()); + encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length)); + encodeDataPair(data, "revision", String.valueOf(5)); + + if (isPing) { + encodeDataPair(data, "ping", "true"); + } + + synchronized (this.graphs) { + Iterator iter = this.graphs.iterator(); + Iterator localIterator1; + for (; iter.hasNext(); + localIterator1.hasNext()) + { + Graph graph = (Graph)iter.next(); + + localIterator1 = graph.getPlotters().iterator(); continue; + } + + } + + URL url = new URL("http://mcstats.org" + String.format("/report/%s", new Object[] { encode(this.plugin.getDescription().getName()) })); + URLConnection connection; + if (isMineshafterPresent()) + connection = url.openConnection(Proxy.NO_PROXY); + else { + connection = url.openConnection(); + } + + connection.setDoOutput(true); + + OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); + writer.write(data.toString()); + writer.flush(); + + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String response = reader.readLine(); + + writer.close(); + reader.close(); + + if ((response == null) || (response.startsWith("ERR"))) { + throw new IOException(response); + } + + if (response.contains("OK This is your first update this hour")) + synchronized (this.graphs) { + Iterator iter = this.graphs.iterator(); + Iterator localIterator2; + for (; iter.hasNext(); + localIterator2.hasNext()) + { + Graph graph = (Graph)iter.next(); + + localIterator2 = graph.getPlotters().iterator(); continue; + } + } + } + + private boolean isMineshafterPresent() + { + try + { + Class.forName("mineshafter.MineServer"); + return true; } catch (Exception e) { + } + return false; + } + + private static void encodeDataPair(StringBuilder buffer, String key, String value) + throws UnsupportedEncodingException + { + buffer.append('&').append(encode(key)).append('=').append(encode(value)); + } + + private static String encode(String text) + throws UnsupportedEncodingException + { + return URLEncoder.encode(text, "UTF-8"); + } + + public static class Graph + { + private final String name; + private final Set plotters = new LinkedHashSet(); + + private Graph(String name) { + this.name = name; + } + + public String getName() + { + return this.name; + } + + public void addPlotter(Metrics.Plotter plotter) + { + this.plotters.add(plotter); + } + + public void removePlotter(Metrics.Plotter plotter) + { + this.plotters.remove(plotter); + } + + public Set getPlotters() + { + return Collections.unmodifiableSet(this.plotters); + } + + public int hashCode() + { + return this.name.hashCode(); + } + + public boolean equals(Object object) + { + if (!(object instanceof Graph)) { + return false; + } + + Graph graph = (Graph)object; + return graph.name.equals(this.name); + } + } + + public static abstract class Plotter + { + private final String name; + + public Plotter() + { + this("Default"); + } + + public Plotter(String name) + { + this.name = name; + } + + public abstract int getValue(); + + public String getColumnName() + { + return this.name; + } + + public void reset() + { + } + + public int hashCode() + { + return getColumnName().hashCode() + getValue(); + } + + public boolean equals(Object object) + { + if (!(object instanceof Plotter)) { + return false; + } + + Plotter plotter = (Plotter)object; + return (plotter.name.equals(this.name)) && (plotter.getValue() == getValue()); + } + } +} \ No newline at end of file diff --git a/BankEconomyMod/src/me/kaZep/Base/PersistentExplorerList.java b/BankEconomyMod/src/me/kaZep/Base/PersistentExplorerList.java new file mode 100644 index 0000000..52cb5a6 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/PersistentExplorerList.java @@ -0,0 +1,18 @@ +package me.kaZep.Base; + +import org.bukkit.Bukkit; + +public class PersistentExplorerList { + public String name; + public long expiretime; + public int event; + public float data; + public float data2; + //Event 0: Player used up their "second chance" life. 1 hour wait time. + //Event 1: Stores the EXP value of a player who died. + //Event 2: Simply says if this player has died recently or not. + public PersistentExplorerList(String name) { + this.name=name; + this.expiretime=Bukkit.getWorld("world").getFullTime()+36000; + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java new file mode 100644 index 0000000..837fd5c --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java @@ -0,0 +1,237 @@ +package me.kaZep.Base; + +import java.text.DecimalFormat; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.ConcurrentModificationException; +import java.util.Iterator; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class PlayerBuffData { + Player p; + int base_spdlv; + int base_armorlv; + List armorbufflist; + double base_hplv; + List hpbufflist; + short helmet_durability,chestplate_durability,leggings_durability,boots_durability; + int potion_spdlv; + long potion_time; + long hpbuff_time; + double extra_hp=0; + double money_gained=0; + long last_money_report_time=0; + public Main plugin; + + public String healthbar(double curHP,double maxHP) { + //█ ▌ + int bits=(int)(Math.ceil(curHP/maxHP*10)); + String bar=" "; + if (bits>6) { + bar+=ChatColor.GREEN+""; + } else + if (bits>3) { + bar+=ChatColor.YELLOW+""; + } else + { + bar+=ChatColor.RED+""; + } + for (int i=0;i(); + this.hpbufflist=new ArrayList(); + this.last_money_report_time=Bukkit.getWorld("world").getFullTime(); + this.money_gained=0; + if (p.getInventory().getHelmet()!=null) { + this.helmet_durability=p.getInventory().getHelmet().getDurability(); + } else { + this.helmet_durability=-1; + } + if (p.getInventory().getChestplate()!=null) { + this.chestplate_durability=p.getInventory().getChestplate().getDurability(); + } else { + this.chestplate_durability=-1; + } + if (p.getInventory().getLeggings()!=null) { + this.leggings_durability=p.getInventory().getLeggings().getDurability(); + } else { + this.leggings_durability=-1; + } + if (p.getInventory().getBoots()!=null) { + this.boots_durability=p.getInventory().getBoots().getDurability(); + } else { + this.boots_durability=-1; + } + this.plugin=thisplugin; + try { + Iterator effects = p.getActivePotionEffects().iterator(); + //Figure out potion effects when player joins. + while (effects.hasNext()) { + PotionEffect nexteffect = effects.next(); + if (nexteffect.getType().getName().compareTo(PotionEffectType.SPEED.getName())==0) { + potion_spdlv = nexteffect.getAmplifier(); + //Bukkit.getLogger().info("Speed level is "+nexteffect.getAmplifier()+" and lasts for "+nexteffect.getDuration()+" ticks."); + potion_time = Bukkit.getWorld("world").getFullTime()+nexteffect.getDuration(); + } + effects.remove(); + } + + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible while initializing player speed."); + } + p.removePotionEffect(PotionEffectType.SPEED); + } + public void setBaseSpd(int spd) { + this.base_spdlv=spd; + } + public void updateBaseArmor() { + + + } + public void updatePlayerSpd() { + if (!p.isDead()) { //Don't even try to set things if we're dead. + base_hplv=20; + base_hplv+=hpbufflist.size()*10; + if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")>0) { + base_hplv+=this.plugin.getStatBonus(7, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat8")/2); + } + //Check player equipment to see if an item could possibly have a health buff. + for (int i=0;i effects = p.getActivePotionEffects().iterator(); + //Figure out potion effects when player joins. + while (effects.hasNext()) { + PotionEffect nexteffect = effects.next(); + if (nexteffect.getType().getName().compareTo(PotionEffectType.HEALTH_BOOST.getName())==0) { + base_hplv+=(nexteffect.getAmplifier()+1)*4; + extra_hp=(nexteffect.getAmplifier()+1)*4; + } + if (nexteffect.getType().getName().compareTo(PotionEffectType.ABSORPTION.getName())==0) { + hasabsorption=true; + } + effects.remove(); + } + + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible while finalizing player speed."); + } + if (/*!hasabsorption && */this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat4")>0) { + p.removePotionEffect(PotionEffectType.ABSORPTION); + p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION,3610,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)); + } + if (this.plugin.getAccountsConfig().getInt(p.getName()+".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")/4)/20-1)); + } + //p.sendMessage("Health: "+p.getHealth()+"/"+p.getMaxHealth()+" Base HP Level: "+base_hplv); + if (p.getHealth()>p.getMaxHealth()) { + p.setHealth(p.getMaxHealth()); + //p.sendMessage("Health: "+p.getHealth()+"/"+p.getMaxHealth()+" Set new health: "+p.getMaxHealth()+"+"+extra_hp); + } + if (base_hplv!=p.getMaxHealth()) { + double temphp=0; + if (base_hplvbase_hplv) { + p.setHealth(base_hplv); + //p.sendMessage("Health too high. Lowering to "+p.getMaxHealth()); + }*/ + //Send new speed totals so the player's speed can be manually adjusted. + if (potion_spdlv>0 && potion_time effects = p.getActivePotionEffects().iterator(); + //Figure out potion effects when player joins. + while (effects.hasNext()) { + PotionEffect nexteffect = effects.next(); + if (nexteffect.getType().getName().compareTo(PotionEffectType.INCREASE_DAMAGE.getName())==0) { + if (nexteffect.getAmplifier()>0) { + p.removePotionEffect(PotionEffectType.INCREASE_DAMAGE); + p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,nexteffect.getDuration()*4,0)); + } + } + if (nexteffect.getType().getName().compareTo(PotionEffectType.SPEED.getName())==0) { + if (nexteffect.getDuration()<47479999) { + //This is not a buff we applied via our plugin. + potion_spdlv+=nexteffect.getAmplifier()+1; + //p.sendMessage("Store speed "+nexteffect.getAmplifier()+" for "+nexteffect.getDuration()+" ticks."); + potion_time = Bukkit.getWorld("world").getFullTime()+nexteffect.getDuration(); + } + } + effects.remove(); + } + if (hpbuff_time0) { + hpbufflist.remove(0); + } + } + + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible while finalizing player speed."); + } + + p.removePotionEffect(PotionEffectType.SPEED); + if ((base_spdlv+potion_spdlv)>0) { + //Bukkit.getPlayer("AaMay").sendMessage("Explorer giving speed buff: "+(base_spdlv-1+potion_spdlv)); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 2147479999, base_spdlv-1+potion_spdlv, true)); + } + if (last_money_report_time+72000lastminetime+200) { + //Reset. Too much time has passed. + lastminetime=Bukkit.getWorld("world").getFullTime(); + minestreak=0; + } else { + minestreak++; + lastminetime=Bukkit.getWorld("world").getFullTime(); + if (minestreak>10) { + minestreak=0; + return true; + } + } + return false; + } + public boolean GoodInteract() { + //A good interact is doing their part of the job. + buildamt--; + if (buildamt<=0) { + buildamt=0; + return true; + } else { + if (buildamt>10) { + buildamt=10; //This is the upper bound of this value. + } + return false; + } + //Use this whenever you do a good interaction. Check the return value to see if we are allowed to gain exp from it. + } + public void BadInteract(Material blockType) { + //This method will add to the list of blocks created/destroyed, in an attempt to detect any further attempts to not be allowed to destroy things. + //This event should be called whenever a bad interaction happens. + if (blockType!=this.lastblocktype) { + //We are interacting with a different type of block. Give more lee-way for this block. + buildamt+=1; + this.lastblocktype=blockType; + } else { + //This is a block type we are dealing with from beforehand. We will need to add more to buildamt to make sure we are not cheating the system. + buildamt+=2; + } + } + public Player getPlayer() { + return data; + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java new file mode 100644 index 0000000..36d4189 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -0,0 +1,10131 @@ +package me.kaZep.Base; + +import java.io.File; +import java.io.IOException; +import java.io.PrintStream; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.ConcurrentModificationException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.UUID; + +import net.milkbowl.vault.economy.Economy; +import net.milkbowl.vault.economy.EconomyResponse; +//import net.minecraft.server.v1_4_R1.EntityWolf; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Chunk; +import org.bukkit.Difficulty; +import org.bukkit.DyeColor; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.Sound; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.BrewingStand; +import org.bukkit.block.Chest; +import org.bukkit.block.CreatureSpawner; +import org.bukkit.block.DoubleChest; +import org.bukkit.block.Furnace; +import org.bukkit.block.Jukebox; +import org.bukkit.block.Sign; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.AnimalTamer; +import org.bukkit.entity.Animals; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Creature; +import org.bukkit.entity.CreatureType; +import org.bukkit.entity.EnderDragon; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Horse; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.Item; +import org.bukkit.entity.LightningStrike; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Minecart; +import org.bukkit.entity.MushroomCow; +import org.bukkit.entity.Ocelot; +import org.bukkit.entity.Pig; +import org.bukkit.entity.PigZombie; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Sheep; +import org.bukkit.entity.Wolf; +import org.bukkit.entity.Zombie; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.BlockRedstoneEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.block.SignChangeEvent; +import org.bukkit.event.enchantment.EnchantItemEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ExplosionPrimeEvent; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.ItemDespawnEvent; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.entity.PotionSplashEvent; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.SheepDyeWoolEvent; +import org.bukkit.event.inventory.BrewEvent; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.CraftItemEvent; +import org.bukkit.event.inventory.FurnaceBurnEvent; +import org.bukkit.event.inventory.FurnaceExtractEvent; +import org.bukkit.event.inventory.FurnaceSmeltEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryEvent; +import org.bukkit.event.inventory.InventoryInteractEvent; +import org.bukkit.event.inventory.InventoryMoveItemEvent; +import org.bukkit.event.inventory.InventoryOpenEvent; +import org.bukkit.event.inventory.InventoryPickupItemEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.inventory.PrepareItemCraftEvent; +import org.bukkit.event.inventory.InventoryType.SlotType; +import org.bukkit.event.player.PlayerBedLeaveEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerChatEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerExpChangeEvent; +import org.bukkit.event.player.PlayerFishEvent; +import org.bukkit.event.player.PlayerFishEvent.State; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemBreakEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.event.player.PlayerShearEntityEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.event.vehicle.VehicleEnterEvent; +import org.bukkit.event.vehicle.VehicleExitEvent; +import org.bukkit.event.weather.LightningStrikeEvent; +import org.bukkit.event.world.ChunkLoadEvent; +import org.bukkit.event.world.ChunkPopulateEvent; +import org.bukkit.event.world.WorldEvent; +import org.bukkit.event.world.WorldInitEvent; +import org.bukkit.event.world.WorldLoadEvent; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.EntityEquipment; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; +import org.bukkit.inventory.meta.BookMeta; +import org.bukkit.inventory.meta.EnchantmentStorageMeta; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.material.MaterialData; +import org.bukkit.material.Pumpkin; +import org.bukkit.material.Wool; +import org.bukkit.metadata.FixedMetadataValue; +import org.bukkit.metadata.MetadataValue; +import org.bukkit.plugin.Plugin; +import org.bukkit.potion.Potion; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.potion.PotionType; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Scoreboard; +import org.bukkit.scoreboard.Team; +import org.bukkit.util.Vector; +import org.bukkit.potion.Potion; + +import com.google.common.base.Objects; +import com.sk89q.worldedit.CuboidClipboard; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.MaxChangedBlocksException; +import com.sk89q.worldedit.bukkit.BukkitWorld; +import com.sk89q.worldedit.data.DataException; +import com.sk89q.worldedit.schematic.SchematicFormat; + +import me.kaZep.Base.BrewingStandData; +import me.kaZep.Base.FurnaceData; +import me.kaZep.Base.PlayerBuffData; +import me.kaZep.Base.JukeboxData; +import me.kaZep.Base.ArrowShooter; +import me.kaZep.Base.EntityHitData; +import me.kaZep.Base.EntityInteractData; +import me.kaZep.Base.ExplorerData; +import me.kaZep.Base.InvisibilityData; +import me.kaZep.Base.PersistentExplorerList; +import me.kaZep.Base.PlayerData; +import me.kaZep.Base.SupportEntity; +import me.kaZep.Base.SupportPlayer; + +public class PlayerListener + implements Listener +{ + public Main plugin; + + public PlayerListener(Main plugin) + { + this.plugin = plugin; + } + + public void updateTopSPLEEFSigns() { + String name[] = {"","",""}; + int rating[] = {-9999,-9999,-9999}, wins[] = {0,0,0}, losses[] = {0,0,0}; + //Get list of all players on the server. + OfflinePlayer playerlist[] = Bukkit.getOfflinePlayers(); + for (int i=0;i=20) { + if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".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"); + } else + if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".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"); + } else + if (this.plugin.getAccountsConfig().getDouble(playerlist[i].getName()+".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"); + } + } + } + } + Sign sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,85,42).getState(); + sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); + sign.setLine(1, ChatColor.BOLD+name[0]); + sign.update(); + sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,84,43).getState(); + sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); + sign.setLine(1, ChatColor.BOLD+"Wins: "+ChatColor.DARK_GREEN+wins[0]); + sign.update(); + sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,84,41).getState(); + sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); + sign.setLine(1, ChatColor.BOLD+"Losses: "+ChatColor.DARK_GREEN+losses[0]); + sign.update(); + sign = (Sign)Bukkit.getWorld("world").getBlockAt(1612,84,42).getState(); + sign.setLine(0, "");sign.setLine(2, "");sign.setLine(3, ""); + sign.setLine(1, ChatColor.BOLD+"RATING: "+ChatColor.DARK_GREEN+rating[0]/10); + sign.update(); + + sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,85,39).getState(); + sign.setLine(0, ChatColor.BOLD+name[1]); + sign.setLine(1, "Rating: "+rating[1]/10); + sign.setLine(2, ChatColor.ITALIC+"Wins: "+wins[1]); + sign.setLine(3, ChatColor.ITALIC+"Losses: "+losses[1]); + sign.update(); + + sign = (Sign)Bukkit.getWorld("world").getBlockAt(1611,84,37).getState(); + sign.setLine(0, ChatColor.BOLD+name[2]); + sign.setLine(1, "Rating: "+rating[2]/10); + sign.setLine(2, ChatColor.ITALIC+"Wins: "+wins[2]); + sign.setLine(3, ChatColor.ITALIC+"Losses: "+losses[2]); + sign.update(); + } + + @EventHandler + public void onServerListPing(ServerListPingEvent e) { + e.setMaxPlayers(15); + if (this.plugin.getConfig().getBoolean("maintenance-mode")) { + e.setMotd(ChatColor.RED+"Currently in Maintenance Mode."); + } else { + e.setMotd("Sig's Minecraft - "+ChatColor.BLUE+"Currently Online."); + } + return; + } + + @EventHandler + public void onPlayerGainEXP(PlayerExpChangeEvent e) { + Player p = e.getPlayer(); + if (this.plugin.PlayerinJob(p, "Enchanter") && this.plugin.getJobLv("Enchanter", p)>=5) { + e.setAmount(e.getAmount()*2); + } + if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) { + e.setAmount(e.getAmount()*2); + } + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify3")) { + p.sendMessage(ChatColor.DARK_GREEN+""+ChatColor.ITALIC+"Gained "+e.getAmount()+" exp."); + } + } + + @EventHandler + public void onBrewingStandBrew(BrewEvent e) { + //Look for an owner to this brewingstand. + String owner=""; + int mult=0; + boolean allowed=true; + for (int i=0;i=10) { + ItemStack[] items = e.getContents().getContents(); + for (int i=0;i map = e.getEnchantsToAdd(); + Player p = e.getEnchanter(); + /*e.getEnchanter().sendMessage("Enchantments are:"); + for (Map.Entry entry : map.entrySet()) { + e.getEnchanter().sendMessage(entry.getKey().getName()+" "+entry.getValue()); + }*/ + /* + if (Math.random()<=0.05) { + //5% chance of getting a book when enchanting. + ItemStack book = new ItemStack(Material.WRITTEN_BOOK); + BookMeta bookdata = (BookMeta)book.getItemMeta(); + int choosebook = (int)(Math.random()*9.0d); + switch (choosebook) { + case 0:{ + bookdata.setAuthor("Steve"); + bookdata.setTitle("Dangers of the Nether"); + bookdata.addPage("Dangers of the Nether\n"+ChatColor.ITALIC+" by Steve\n======\n"+ChatColor.RESET+"It didn't take me long to realize where we were. It was dangerous, very hot, and lots of torturous screams could be heard everywhere. I barely had time","to take it all in before a huge fireball was shot in my direction. I quickly looked to my side to find a convenient safe passage and hid there for a few minutes. I guess I was in there longer than I thought, I ended","up falling asleep and waking up to notice there was something scary on the wall.\n\n"+ChatColor.ITALIC+"\"TURN AND LEAVE NOW. DANGEROUS TO STAY. REAL WORLD HAS WHAT YOU ARE LOOKING FOR. I ONLY REMEMBER THE 1ST X POSITION...",ChatColor.ITALIC+"...IT WAS 7! I AM *POSITIVE*\""+ChatColor.RESET+"\n\nI did not know what to think. The 1st X position? I quickly remembered the 7 and sprinted out of the nether portal. And to think that was *THE END* of my adventures..."); + }break; + case 1:{ + bookdata.setAuthor("Lacey"); + bookdata.setTitle("A Hole in the Flower Garden"); + bookdata.addPage("A Hole in the Flower Garden\n"+ChatColor.ITALIC+" by Lacey\n======\n"+ChatColor.RESET+"It was a lovely day to pick flowers in the garden, they just finished blooming fully. I was so excited to pick them, but I didn't do so until","after I've taken in all the wonderful scents! Smelling all the flowers and wonderful smells of plants and trees and nature and grass. It was perfect. I was mindlessly walking along this prairie when I stumbled.","I fell, and fell, and fell. I hit the bottom of a ravine. It didn't even occur to me I would just walk into one. I took some minor damage, but when I got up, I noticed something strange.","There were two or three zombies gathered around a wall, etching something into it. I went over to read it once the zombies walked away. I saw on the wall:\n\n"+ChatColor.ITALIC+"X-2:6 <--END","It looked cryptic to me, but why would they write that on the wall? I quickly scribbled it down on a notepad I had in my pocket and started climbing out of the ravine to tend to my lovely flowers. What a day!"); + }break; + case 2:{ + bookdata.setAuthor("Jimmy"); + bookdata.setTitle("Messages in Music"); + bookdata.addPage("Messages in Music\n"+ChatColor.ITALIC+" by Jim"+"\n======"+ChatColor.RESET+"\nI popped out the disk from my Jukebox to put in another, I could jam to these all day! As I was looking through my collection for something to listen to","I found a really bent up disk. 'No way this could still play', I thought to myself. I put it in, and it crackled and snarled, but it was indeed playing! At first I heard some faint resemblence of music, but then suddenly,","a hiss, an explosion, and then 'CREEEEEEEEE----- 7X XSSSSSSSSSS 3RD EEEEEEE' mental images appeared in my head, but the 7X and 3RD stood out the most. It's like I was seeing them in my head while hearing something else!","I couldn't stand up anymore, or think. I forcibly reached up with my weak hand to find the eject button on the player and when I found the familiar nub in the button, pressed down on it and out popped the disk, hitting my face,","but putting me back into reality. Something was telling me that the 3RD and 7X was important. But I couldn't quite put my tongue on it."); + }break; + case 3:{ + bookdata.setAuthor("Creeper"); + bookdata.setTitle("HISS"); + bookdata.addPage("Y do i exisssst. nobody knowssss. i just want a hugssssss, HUGSSSSSSS. but i don't know Y i exist. there's no Y in the first position. it'sssss jusssst two digitssssss.... SSSSSSSSS. *THE END*"); + }break; + case 4:{ + bookdata.setAuthor("Marco"); + bookdata.setTitle("The Hunt for a Dragon"); + bookdata.addPage("The Hunt for a Dragon\n"+ChatColor.ITALIC+" by Marco"+"\n======"+ChatColor.RESET+"\nThere exists a rumor that a mythical dragon could be found in the depths of our world. It is even said he doesn't exist in OUR world, but ANOTHER world altogether!","That my friends already boggles me, but where the heck would I go to find it then? I have been told he exists, and I know he is. I believe deep in my heart. I searched day and night under and over ground.","One day I found something strange in the ground. It was pink wool, in the middle of a cave on the ground. It even said something, but I couldn't tell from so close up. So I literally dug all the way to the surface, keeping the boundaries","of that word uncovered the whole way up. When I got to the top and looked down, I was relieved to find it was made out of markings I could discern. It said: 'Y: X3?' It was definitely a weird group of symbols, but I have a strong feeling"," that it is directly linked with that dragon I am trying to hunt down. Maybe I can gather more clues and try to decipher the location of this thing."); + }break; + case 5:{ + bookdata.setAuthor("Steve"); + bookdata.setTitle("Cooking Food"); + bookdata.addPage("Cooking Food\n"+ChatColor.ITALIC+" by Steve"+"\n======"+ChatColor.RESET+"\nIt was a bright and rather typical sunny day in the Minecraft world. I don't actually think it was very hot either. I just managed to catch a few fish and was cooking them up.","It wasn't long before I got distracted and heard a funny noise. It was an ocelote. Lucky me, an ocelote has smelled the scent of my fish! I grab a few and hold it out for the ocelote. It slowly creeps over, and then takes it and runs from me.","I thought it was full and finished cooking the rest of the fish. However, the ocelote returned a few minutes later with a neatly-folded piece of paper in its mouth. It came up to me and set it down, like it was some message just for me.","I opened it up and it read:\n\n"+ChatColor.ITALIC+"Don't let the fish get to your tongue! If you know what's wise, you will investigate further. The 3rd position of Y being the number 5."+ChatColor.RESET+"\n\n","I didn't notice the ocelote run away, but I knew something FISHY was going on. That message seemed important for some reason, I've seen similar cryptic messages before... Perhaps I'll hold onto this in case I need it in the future."); + }break; + case 6:{ + bookdata.setAuthor("Fredric"); + bookdata.setTitle("Math Behind the Void"); + bookdata.addPage("Math Behind the Void\n"+ChatColor.ITALIC+" by Fredric"+"\n======"+ChatColor.RESET+"\nThis book describes a few principles that the void in this world follows. While no one has actually seen the void, we have found a few theories and rules regarding them.","1. The Void has a Light Level of -14. The Void actually absorbs light coming from light sources and thus, if The Void is ever opened to the real world, would suck up the light from it.","2. The Void always has a volume of 50,000m, being 50m x 20m x 50m. This means that The Void, regardless of location is always the same exact size. This would conclude to us that The Void is co-existing and multiple instaces of it may exist in the same realm.","3. Any Entity entering The Void will not be able to escape The Void as time passes much more quickly inside The Void. This means Entities that enter The Void feel accelerated processes and cannot combat it, since the time outside is behind them.","4. A point of connection between The Void and other dimensions has to exist, for The Void to exist. Speculation has it that one of these points has been leaked into the world, and is accessible by us directly. After further research,","we have learned that one of these points is located on the 1st respective numeral along our Z axis with the number 4. It has also been proven that this number has to be negative as the other two sources interacting with The Void are positive."); + }break; + case 7:{ + bookdata.setAuthor("Robert"); + bookdata.setTitle("TNT"); + bookdata.addPage("TNT\n"+ChatColor.ITALIC+" by Robert"+"\n======"+ChatColor.RESET+"\nYou know, the easiest way to clear a tunnel is using an item called TNT. It is a rather small block, but it is loaded with gunpowder. When lit by an external force, it ignites","with the force of 5 Creeper explosions to clear whole caves out. Well lo and behold one day I discovered a rather strange abandoned mineshaft. It wasn't normal for sure, because there were green vines everywhere and lots of strange doors.","It was like somebody lived here ages ago, and I am discovering the ruins of such a place. Inoperable levers, a few mobs I have to kill here and there that have made this area their designated home. It was a mess. But I did discover that","someone was trying to find what we would call 'The End'. It's a magical place, and I believe with the right amount of effort, we can find it someday too. He had scribbled the coordinates of the location he was trying to reach.","However, most of it is faded out and I can only tell faintly the remains of it: \n\n"+ChatColor.ITALIC+"X:---\nY:---\nZ:--7-"+ChatColor.RESET+"\n\nYep, that's about it.","Hopefully by me recording this data, someone else can fill in the remaining numbers and we can all find The End together. Someday..."); + }break; + case 8:{ + bookdata.setAuthor("Joshua"); + bookdata.setTitle("Fourside"); + bookdata.addPage("Fourside\n"+ChatColor.ITALIC+" by Joshua"+"\n======"+ChatColor.RESET+"\n"+ChatColor.DARK_BLUE+"ABANDONED PROJECT"+ChatColor.RESET+". A city that would be developed with the best technology and the highest standards. It would","succeed every single Minecraft city that has ever been built. Casinos, diamond-lined walkways, towering skyscrapers as far as the eye can see. Museums, Libraries, Educational Institutions. This mega-city would be able to hold","and sustain every single Minecrafter in existence. But no, something went terribly wrong. Our engineering team finally developed the perfect transportation system and we were wiring it up to our fusion power plant.","Something went horribly wrong. The Fusion power plant started self-combusting itself, leaving behind hyper-cold atoms. This caused nucleic waste to interact with the environment around itself and freezing the whole world as we knew it.","The city idea as we knew it was scrapped, and we would wait 2000 years before we could attempt this again. We wrote plans for a much more portable solution and have named it 'Twoside' and archived it appropriately.","Maybe someone will pick up that book and be able to make the future bright with a mini version of Fourside. That being said, we left the 3rd slot of the Z position of our city at 7. This should give you enough clue as to where NOT to build."); + }break; + } + book.setItemMeta(bookdata); + //p.setItemInHand(book); + p.getInventory().addItem(book); + p.updateInventory(); + p.sendMessage(ChatColor.LIGHT_PURPLE+"You feel a magical presence get inserted into your inventory."); + }*/ + if (this.plugin.PlayerinJob(p, "Enchanter")) { + if (this.plugin.getJobLv("Enchanter", p)>=10) { + e.setExpLevelCost((int)(e.getExpLevelCost()*0.75)); + } + for (Map.Entry entry : map.entrySet()) { + if (this.plugin.getJobLv("Enchanter", p)>=20) { + if (entry.getKey().getMaxLevel()=5) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Old time: "+e.getBurnTime()); + e.setBurnTime(e.getBurnTime()*2); + //Bukkit.getPlayer("sigonasr2").sendMessage("Doubled the furnace's burn time. New time: "+e.getBurnTime()); + } + } + + @EventHandler + public void onFurnaceSmelt(FurnaceSmeltEvent e) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Current time: "+((Furnace)e.getBlock().getState()).getBurnTime()); + //Look for an owner to this furnace. + String owner=""; + for (int i=0;i=20 && crafteditem) { + ItemStack result = e.getResult(); + result.setAmount(result.getAmount()+1); + e.setResult(result); + } + } + } + + @EventHandler + public void onCreatureInteract(PlayerInteractEntityEvent e) { + Player p = e.getPlayer(); + //When right-clicked on, check if it already exists in the entity list. + boolean contains=false; + int slot=0; + for (int i=0;i=20) { + Cow a = (Cow)e.getRightClicked(); + if (a.canBreed()) { + if (Math.random()<=0.50) { + p.getItemInHand().setAmount(p.getItemInHand().getAmount()+1); + } + } + } + //See if it exists already. + boolean contains_uuid=false; + String finalstring = ""; + if (this.plugin.getConfig().getString("fed.mobs").length()>4) { + String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); + //p.sendMessage("Mobs list length: "+mobslist.length); + for (int i=0;i=20) { + Sheep a = (Sheep)e.getRightClicked(); + if (a.canBreed()) { + if (Math.random()<=0.50) { + p.getItemInHand().setAmount(p.getItemInHand().getAmount()+1); + } + } + } + //See if it exists already. + boolean contains_uuid=false; + String finalstring = ""; + if (this.plugin.getConfig().getString("fed.mobs").length()>4) { + String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); + //p.sendMessage("Mobs list length: "+mobslist.length); + for (int i=0;i=20) { + Pig a = (Pig)e.getRightClicked(); + if (a.canBreed()) { + if (Math.random()<=0.50) { + p.getItemInHand().setAmount(p.getItemInHand().getAmount()+1); + } + } + } + //See if it exists already. + boolean contains_uuid=false; + String finalstring = ""; + if (this.plugin.getConfig().getString("fed.mobs").length()>4) { + String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); + //p.sendMessage("Mobs list length: "+mobslist.length); + for (int i=0;i=20) { + Chicken a = (Chicken)e.getRightClicked(); + if (a.canBreed()) { + if (Math.random()<=0.50) { + p.getItemInHand().setAmount(p.getItemInHand().getAmount()+1); + } + } + } + //See if it exists already. + boolean contains_uuid=false; + String finalstring = ""; + if (this.plugin.getConfig().getString("fed.mobs").length()>4) { + String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); + //p.sendMessage("Mobs list length: "+mobslist.length); + for (int i=0;i=20) { + Wolf a = (Wolf)e.getRightClicked(); + if (a.canBreed()) { + if (Math.random()<=0.50) { + p.getItemInHand().setAmount(p.getItemInHand().getAmount()+1); + } + } + } + //See if it exists already. + boolean contains_uuid=false; + String finalstring = ""; + if (this.plugin.getConfig().getString("fed.mobs").length()>4) { + String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); + //p.sendMessage("Mobs list length: "+mobslist.length); + for (int i=0;i=20) { + Ocelot a = (Ocelot)e.getRightClicked(); + if (a.canBreed()) { + if (Math.random()<=0.50) { + p.getItemInHand().setAmount(p.getItemInHand().getAmount()+1); + } + } + } + //See if it exists already. + boolean contains_uuid=false; + String finalstring = ""; + if (this.plugin.getConfig().getString("fed.mobs").length()>4) { + String[] mobslist = this.plugin.getConfig().getString("fed.mobs").split(","); + ////p.sendMessage("Mobs list length: "+mobslist.length); + for (int i=0;i=10) { + e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999999, 0, true)); + } + } else { + if (this.plugin.PlayerinJob(e.getPlayer(),"Hunter") && this.plugin.getJobLv("Hunter", e.getPlayer())>=10) { + if (e.getPlayer().hasPotionEffect(PotionEffectType.INVISIBILITY)) { + try { + Collection effects = e.getPlayer().getActivePotionEffects(); + for (PotionEffect nextpotioneffect : effects) { + if (nextpotioneffect.getType().getName().compareTo("INVISIBILITY")==0 && nextpotioneffect.getDuration()>24000) { + //This is definitely not a potion given to you. + e.getPlayer().removePotionEffect(PotionEffectType.INVISIBILITY); + break; + } + } + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible for a hunter while toggling sneak mode."); + } + } + } + } + } + + public String healthbar(double curHP,double maxHP) { + //█ ▌ + int bits=(int)(Math.ceil(curHP/maxHP*10)); + String bar=" "; + if (bits>6) { + bar+=ChatColor.GREEN+""; + } else + if (bits>3) { + bar+=ChatColor.YELLOW+""; + } else + { + bar+=ChatColor.RED+""; + } + for (int i=0;i6) { + bar+=ChatColor.GREEN+""; + } else + if (bits>3) { + bar+=ChatColor.YELLOW+""; + } else + { + bar+=ChatColor.RED+""; + } + } else { + if (bits>6) { + bar+=ChatColor.DARK_GREEN+""; + } else + if (bits>3) { + bar+=ChatColor.GOLD+""; + } else + { + bar+=ChatColor.DARK_RED+""; + } + } + for (int i=0;i newlore = p.getInventory().getArmorContents()[i].getItemMeta().getLore(); + for (int j=0;j=5) { + //p.sendMessage("Explorer speed buff set."); + newplayer.setBaseSpd(1); + } + if (this.plugin.PlayerinJob(p, "Hunter") && this.plugin.getJobLv("Hunter", p)>=20) { + //p.sendMessage("Explorer speed buff set."); + newplayer.setBaseSpd(newplayer.base_spdlv+1); + } + //Bukkit.getPlayer("sigonasr2").sendMessage("Got to here."); + newplayer.updatePlayerSpd(); + this.plugin.SPEED_CONTROL.add(newplayer); + //Bukkit.getPlayer("sigonasr2").sendMessage("Got to here."); + Iterator players = Bukkit.getWhitelistedPlayers().iterator(); + boolean playerwhitelisted=false; + String playerslist = ""; + while (players.hasNext()) { + if (playerslist!="") { + playerslist += ","; + } + String name = players.next().getName(); + playerslist += name; + if (name.compareToIgnoreCase(p.getName())==0) { + playerwhitelisted=true; + } + } + /* + //Boss platform is created +,+ coordinates from the location specified. + File file = new File("plugins/WorldEdit/schematics/boss.schematic"); + if (file.exists()) { + try { + com.sk89q.worldedit.Vector v = new com.sk89q.worldedit.Vector(p.getLocation().getX()-8, p.getLocation().getY(), p.getLocation().getZ()-8); + World worldf = Bukkit.getWorld("world"); + BukkitWorld BWf = new BukkitWorld(worldf); + EditSession es = new EditSession(BWf, 2000000); + CuboidClipboard c1 = SchematicFormat.MCEDIT.load(file); + c1.place(es, v, true); + } catch (DataException ex) { + Bukkit.getLogger().warning("DataException while trying to create structure."); + } catch (IOException ex) { + Bukkit.getLogger().warning("IOException while trying to create structure."); + } catch (MaxChangedBlocksException ex) { + Bukkit.getLogger().warning("MaxChangedBlocksException while trying to create structure."); + } + } else { + Bukkit.getLogger().warning(("File does not exist.")); + } + */ + //System.out.println("Whitelisted Players: "+playerslist); + //System.out.println("Maximum Air: "+p.getMaximumAir()); + if (!this.plugin.getAccountsConfig().contains(p.getName())) { + //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() + ".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.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."); + //Give a tutorial book and starting items to this user. + p.getInventory().addItem(new ItemStack(Material.STONE_SWORD)); + p.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE)); + p.getInventory().addItem(new ItemStack(Material.COOKED_CHICKEN,16)); + p.getInventory().addItem(new ItemStack(Material.TORCH,32)); + p.getInventory().addItem(new ItemStack(Material.LEATHER_HELMET)); + p.getInventory().addItem(new ItemStack(Material.LEATHER_CHESTPLATE)); + p.getInventory().addItem(new ItemStack(Material.LEATHER_LEGGINGS)); + p.getInventory().addItem(new ItemStack(Material.LEATHER_BOOTS)); + p.getInventory().addItem(new ItemStack(Material.MINECART)); + } + } else { + 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"))); + //Update account information for the stat point update. + 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(); + 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(); + System.out.println("Updated " + p.getName() + "'s data with nofitications update."); + } + if (this.plugin.getConfig().getBoolean("halloween-enabled")) { + //Update account information for Halloween book update. + PlayerInventory pi = p.getInventory(); + boolean full=true; + for (int i=0;i0) { + p.setMaximumAir(300+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName() + ".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. + Location newloc = p.getLocation(); + newloc.setX(1622.5d); + newloc.setY(87.0d); + newloc.setZ(51.65d); + p.teleport(newloc); + this.plugin.getConfig().set("spleefinsession", Boolean.valueOf(false)); + } + } + boolean found=false; + for (int i=0;i effects = p.getActivePotionEffects().iterator(); + //Figure out potion effects when player joins. + while (effects.hasNext()) { + PotionEffect nexteffect = effects.next(); + //Bukkit.getLogger().info(p.getName()+" w/buff "+nexteffect.getType().getName()+" for "+nexteffect.getDuration()/20+" sec."); + /*if (nexteffect.getType().getName().compareTo(PotionEffectType.JUMP.getName())==0) { + p.removePotionEffect(PotionEffectType.JUMP); + p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, nexteffect.getAmplifier()+2, true)); + }*/ + effects.remove(); + } + + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible while trying to slow down player."); + } + updateTopSPLEEFSigns(); + } + + @EventHandler + public void onPlayerInteract(PlayerInteractEntityEvent ev) { + Entity theAnimal = ev.getRightClicked(); + if (theAnimal.getType() == EntityType.WOLF) { + Wolf dog = (Wolf)theAnimal; + DyeColor dogcolor = dog.getCollarColor(); + Player p = ev.getPlayer(); + if (dog.getOwner() == null) { + return; + } + if (p != dog.getOwner()) { + return; + } + if (!dog.isAngry()) { + //Switch state of wolf. + //dog.setSitting(!dog.isSitting()); + return; + } + ev.setCancelled(true); + double oldhealth = dog.getHealth(); + dog.setSitting(true); + dog.remove(); + Location wolfloc = dog.getLocation(); + World world = Bukkit.getWorld("world"); + Entity newAnimal = world.spawnEntity(wolfloc, EntityType.WOLF); + Wolf newdog = (Wolf)newAnimal; + newdog.setOwner(p); + newdog.setHealth(oldhealth); + newdog.setSitting(true); + newdog.setCollarColor(dogcolor); + p.sendMessage(ChatColor.GREEN + "This dog is now happy!"); + } + } + + @EventHandler + public void onBlockGrow(BlockGrowEvent e) { + int x1,y1,z1,x2=0,y2=0,z2=0; + x1=e.getBlock().getX(); + y1=e.getBlock().getY(); + z1=e.getBlock().getZ(); + Player[] plist= Bukkit.getOnlinePlayers(); + for (int i=0;i=20) { + if (Math.random()<=0.30) { + if (e.getBlock().getType()==Material.POTATO || e.getBlock().getType()==Material.CARROT || e.getBlock().getType()==Material.CROPS || e.getBlock().getType()==Material.MELON_STEM || e.getBlock().getType()==Material.PUMPKIN_STEM) { + if (e.getBlock().getData()<7) { + e.getBlock().setData((byte) (e.getBlock().getData()+1)); + } + } + if (e.getBlock().getType()==Material.COCOA) { + if (e.getBlock().getData()<8) { + e.getBlock().setData((byte) (e.getBlock().getData()+4)); + } + } + if (e.getBlock().getType()==Material.NETHER_WARTS) { + if (e.getBlock().getData()<3) { + e.getBlock().setData((byte) (e.getBlock().getData()+1)); + } + } + } + } + } + } + } + } + + + @EventHandler + public void onCreatureSpawn(CreatureSpawnEvent e) { + Entity entity = e.getEntity(); + if (entity.getWorld().getName().compareTo("world")==0) { + boolean despawn=true; + if (entity instanceof LivingEntity) { + LivingEntity test = (LivingEntity)entity; + boolean block=false; + for (int i=-2;i<3;i++) { + for (int j=-2;j<3;j++) { + for (int k=-2;k<3;k++) { + if (Bukkit.getWorld("world").getBlockAt(test.getLocation().add(i,j,k)).getType()==Material.COMMAND) { + block=true; + Bukkit.getWorld("world").getBlockAt(test.getLocation().add(i,j,k)).setType(Material.COBBLESTONE); + despawn=false; + } + } + } + } + List entities = Bukkit.getWorld("world").getEntities(); + for (int i=0;i50000) { + maxgroup=(int)(20*groupmult); //Groups of up to 20 mobs. + chancer=0.25d; + despawnchancer=0.0625d; + LivingEntity l = (LivingEntity)entity; + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*1.0d)); + if (Math.random()<=0.25) { + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.5d)); + } + l.setHealth(l.getMaxHealth()); + } else + if (distancefromcity>20000) { + maxgroup=(int)(15*groupmult); //Groups of up to 15 mobs. + chancer=0.175d; + despawnchancer=0.1250d; + LivingEntity l = (LivingEntity)entity; + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.75d)); + if (Math.random()<=0.25) { + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.5d)); + } + l.setHealth(l.getMaxHealth()); + } else + if (distancefromcity>10000) { + maxgroup=(int)(12*groupmult); //Groups of up to 12 mobs. + chancer=0.125d; + despawnchancer=0.15d; + LivingEntity l = (LivingEntity)entity; + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.5d)); + if (Math.random()<=0.25) { + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.25d)); + } + l.setHealth(l.getMaxHealth()); + } else*/ + maxgroup=(int)(10*groupmult); + chancer=0.10d; + despawnchancer=0.25d; + if (this.plugin.getConfig().getBoolean("halloween-enabled")) { + groupmult=0.0625f; + chancer=0.025f; + despawnchancer=0.4375d; + } + /* + if (distancefromcity>4000) { + maxgroup=(int)(10*groupmult); //Groups of up to 10 mobs. + chancer=0.10d; + despawnchancer=0.25d; + LivingEntity l = (LivingEntity)entity; + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.5d)); + if (Math.random()<=0.25) { + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.25d)); + } + l.setHealth(l.getMaxHealth()); + } else + if (distancefromcity>2000) { + maxgroup=(int)(7*groupmult); //Groups of up to 7 mobs. + chancer=0.075d; + despawnchancer=0.35d; + LivingEntity l = (LivingEntity)entity; + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.25d)); + if (Math.random()<=0.25) { + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.25d)); + } + l.setHealth(l.getMaxHealth()); + } else + if (distancefromcity>1000) { + maxgroup=(int)(5*groupmult); //Groups of up to 5 mobs. + chancer=0.05d; + despawnchancer=0.50d; + LivingEntity l = (LivingEntity)entity; + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.25d)); + if (Math.random()<=0.25) { + //l.setMaxHealth(l.getMaxHealth()+(l.getMaxHealth()*0.25d)); + } + l.setHealth(l.getMaxHealth()); + } else + if (distancefromcity>400) { + maxgroup=(int)(3*groupmult); //Groups of up to 3 mobs. + chancer=0.025d; + despawnchancer=0.75d; + } else { + maxgroup=(int)(3*groupmult); //Groups of up to 3 mobs. + chancer=0.005d; + despawnchancer=0.95d; + }*/ + if (entity.getType()==EntityType.ZOMBIE || entity.getType()==EntityType.PIG_ZOMBIE || entity.getType()==EntityType.SKELETON) { + LivingEntity l = (LivingEntity)entity; + EntityEquipment inven = l.getEquipment(); + if (l.getCustomName()!=null && l.getCustomName().equals(ChatColor.GOLD+"Charge Zombie II")) { + despawnchancer/=4; + //Destroy a huge amount around it when it spawns. + for (int k=-4;k<5;k++) { + for (int j=-4;j<5;j++) { + for (int m=-1;m<5;m++) { + Location checkloc = l.getLocation().add(k,m,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER || bl.getType()!=Material.COMMAND || bl.getType()!=Material.MOSSY_COBBLESTONE) { + bl.breakNaturally(); + } + } + } + } + } + if (inven!=null) { + inven.setBootsDropChance(0.02f); + inven.setChestplateDropChance(0.02f); + inven.setLeggingsDropChance(0.02f); + inven.setHelmetDropChance(0.02f); + inven.setItemInHandDropChance(0.02f); + if (entity.getType()==EntityType.SKELETON) { + inven.setItemInHand(new ItemStack(Material.BOW)); + } + if (distancefromcity<2000) { + if (entity.getType()==EntityType.ZOMBIE) { + Zombie zomb = (Zombie)l; + if (zomb.isBaby()) { + zomb.setBaby(false); + } + } + if (inven.getItemInHand()!=null && inven.getItemInHand().getType()==Material.DIAMOND_SWORD || + inven.getItemInHand().getType()==Material.GOLD_SWORD || + inven.getItemInHand().getType()==Material.IRON_SWORD) { + inven.setItemInHand(new ItemStack(Material.WOOD_SWORD)); + } + if (inven.getChestplate()!=null && inven.getChestplate().getType()==Material.DIAMOND_CHESTPLATE || + inven.getChestplate().getType()==Material.GOLD_CHESTPLATE || + inven.getChestplate().getType()==Material.IRON_CHESTPLATE || + inven.getChestplate().getType()==Material.CHAINMAIL_CHESTPLATE) { + inven.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); + } + if (inven.getLeggings()!=null && inven.getLeggings().getType()==Material.DIAMOND_LEGGINGS || + inven.getLeggings().getType()==Material.GOLD_LEGGINGS || + inven.getLeggings().getType()==Material.IRON_LEGGINGS || + inven.getLeggings().getType()==Material.CHAINMAIL_LEGGINGS) { + inven.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); + } + if (inven.getBoots()!=null && inven.getBoots().getType()==Material.DIAMOND_BOOTS || + inven.getBoots().getType()==Material.GOLD_BOOTS || + inven.getBoots().getType()==Material.IRON_BOOTS || + inven.getBoots().getType()==Material.CHAINMAIL_BOOTS) { + inven.setBoots(new ItemStack(Material.LEATHER_BOOTS)); + } + if (inven.getHelmet()!=null && inven.getHelmet().getType()==Material.DIAMOND_HELMET || + inven.getHelmet().getType()==Material.GOLD_HELMET || + inven.getHelmet().getType()==Material.IRON_HELMET || + inven.getHelmet().getType()==Material.CHAINMAIL_HELMET) { + inven.setHelmet(new ItemStack(Material.LEATHER_HELMET)); + } + } + else if (distancefromcity<8000) { + if (entity.getType()==EntityType.ZOMBIE) { + Zombie zomb = (Zombie)l; + if (zomb.isBaby()) { + zomb.setBaby(false); + } + } + if (inven.getItemInHand()!=null && inven.getItemInHand().getType()==Material.DIAMOND_SWORD || + inven.getItemInHand().getType()==Material.GOLD_SWORD) { + inven.setItemInHand(new ItemStack(Material.IRON_SWORD)); + } + if (inven.getChestplate()!=null && inven.getChestplate().getType()==Material.DIAMOND_CHESTPLATE) { + inven.setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); + } + if (inven.getLeggings()!=null && inven.getLeggings().getType()==Material.DIAMOND_LEGGINGS) { + inven.setLeggings(new ItemStack(Material.IRON_LEGGINGS)); + } + if (inven.getBoots()!=null && inven.getBoots().getType()==Material.DIAMOND_BOOTS) { + inven.setBoots(new ItemStack(Material.IRON_BOOTS)); + } + if (inven.getHelmet()!=null && inven.getHelmet().getType()==Material.DIAMOND_HELMET) { + inven.setHelmet(new ItemStack(Material.IRON_HELMET)); + } + } + } + } + //Get the torches/glowstone/mob spawners around this entity. + int torches=0,glowstone=0,spawners=0; + for (int x=-5;x<5;x++) { + for (int y=-5;y<5;y++) { + for (int z=-5;z<5;z++) { + Block test = entity.getWorld().getBlockAt(entity.getLocation().add(x,y,z)); + if (test.getType()==Material.TORCH) { + torches++; + } else + if (test.getType()==Material.GLOWSTONE) { + glowstone++; + } else + if (test.getType()==Material.MOB_SPAWNER) { + spawners++; + } + } + } + } + if (Bukkit.getWorld("world").getHighestBlockYAt(entity.getLocation())>=96) { + //This is a tall world. + if (entity.getLocation().getBlockY()>104) { + despawnchancer*=(Math.random()*3.0d)+1; + } else { + for (int i=104-entity.getLocation().getBlockY();i>0;i--) { + despawnchancer/=1.0175d; + } + } + } else { + //This is a short world. + if (entity.getLocation().getBlockY()>52) { + despawnchancer*=(Math.random()*3.0d)+1; + } else { + for (int i=52-entity.getLocation().getBlockY();i>0;i--) { + despawnchancer/=1.025d; + } + } + } + //if (e.getSpawnReason()!=SpawnReason.NATURAL) { //If it's a natural spawn, we gotta do it. Ignore our checking stuff. + if (contains && spawners==0) { //We only do this despawn/extra spawn chance stuff when we have an actual mob AND when there's not a spawner nearby. + if ((Math.random()<=despawnchancer || (torches+glowstone>=3))/* && entity.getNearbyEntities(5, 5, 5).size()>50*/) { + //if (e.getSpawnReason()!=SpawnReason.CUSTOM && e.getLocation().getBlockY()!=Bukkit.getPlayer("AaMay").getLocation().getBlockY()) { + entity.remove(); + e.setCancelled(true); + //} + //Bukkit.getPlayer("AaMay").sendMessage(ChatColor.BLUE+entity.getType().getName()+": Removed mob due to despawn chancer / special case."); + } + else { + int totallvs=0; + List nearbylist = entity.getNearbyEntities(30, 30, 30); + //Filter out all unrelated entity types. + for (int k=0;k1 && !keep) { + entity.remove(); + e.setCancelled(true); + //Bukkit.getPlayer("AaMay").sendMessage(ChatColor.GREEN+entity.getType().getName()+": Removed mob due to too many mobs near it."); + } else { + //We then attempt to see if despawn chancer occurs. + if (Math.random()<=despawnchancer) { + entity.remove(); + e.setCancelled(true); + //Bukkit.getPlayer("AaMay").sendMessage(ChatColor.YELLOW+entity.getType().getName()+": Removed mob due to despawner chance."); + } else { + //Now we attempt to spawn more things. + int k = currentnearby; + while (k10 && Math.random()<=chancer) { + Location testloc = entity.getLocation().add(Math.random()*4.0d-Math.random()*4.0d,Math.random()*4.0d,Math.random()*4.0d-Math.random()*4.0d); + if (Bukkit.getWorld("world").getBlockAt(testloc).getType()==Material.AIR) { + Bukkit.getWorld("world").spawnEntity(testloc, entity.getType()); + this.plugin.last_mob_random_time=Bukkit.getWorld("world").getFullTime(); + //Bukkit.getPlayer("AaMay").sendMessage(ChatColor.RED+entity.getType().getName()+": Spawned extra mob."); + /*int j=0; + while (j<10) { + Bukkit.getWorld("world").spawnEntity(testloc, entity.getType()); + j++; + }*/ + } + } + k++; + } + } + } + double levelsmult=1.5; + if (totallvs>20*levelsmult) { + if (totallvs<40*levelsmult) { + //Sometimes wear leather armor. Only for Skeletons and Zombies. + if (entity.getType()==EntityType.SKELETON || entity.getType()==EntityType.ZOMBIE) { + LivingEntity l = (LivingEntity) entity; + if (Math.random()>=0.15) { + l.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); + if (Math.random()>=0.25) { + l.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); + if (Math.random()>=0.5) { + l.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); + if (Math.random()>=0.8) { + l.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); + } + } + } + } + } + } else + if (totallvs<60*levelsmult) { + //Wear leather armor a bit more often. Sometimes a chain piece here or there. Include a Wooden sword usually. + if (entity.getType()==EntityType.SKELETON || entity.getType()==EntityType.ZOMBIE) { + LivingEntity l = (LivingEntity) entity; + if (entity.getType()==EntityType.ZOMBIE) { + if (Math.random()<=0.65) { + l.getEquipment().setItemInHand(new ItemStack(Material.WOOD_SWORD)); + } + } + if (Math.random()>=0.25) { + if (Math.random()<=0.75) { + l.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE)); + } else { + l.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); + } + if (Math.random()>=0.45) { + if (Math.random()<=0.75) { + l.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS)); + } else { + l.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); + } + if (Math.random()>=0.65) { + if (Math.random()<=0.75) { + l.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); + } else { + l.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); + } + if (Math.random()>=0.95) { + if (Math.random()<=0.75) { + l.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); + } else { + l.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); + } + } + } + } + } + } + } else + if (totallvs<80*levelsmult) { + //Wear chainmail armor a bit more often. Sometimes an iron piece here or there. Include an Iron sword sometimes, a wooden one usually. + if (entity.getType()==EntityType.SKELETON || entity.getType()==EntityType.ZOMBIE) { + LivingEntity l = (LivingEntity) entity; + if (entity.getType()==EntityType.ZOMBIE) { + if (Math.random()<=0.65) { + if (Math.random()<=0.75) { + l.getEquipment().setItemInHand(new ItemStack(Material.WOOD_SWORD)); + } else { + l.getEquipment().setItemInHand(new ItemStack(Material.IRON_SWORD)); + } + } + } + if (Math.random()>=0.25) { + if (Math.random()<=0.75) { + l.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE)); + } else { + l.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); + } + if (Math.random()>=0.45) { + if (Math.random()<=0.75) { + l.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS)); + } else { + l.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); + } + if (Math.random()>=0.65) { + if (Math.random()<=0.75) { + l.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET)); + } else { + l.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET)); + } + if (Math.random()>=0.95) { + if (Math.random()<=0.75) { + l.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); + } else { + l.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS)); + } + } + } + } + } + } + } else + if (totallvs<100*levelsmult) { + //Wear iron armor a bit more often. Sometimes a diamond piece here or there. Include a Diamond sword sometimes, an iron one usually. + if (entity.getType()==EntityType.SKELETON || entity.getType()==EntityType.ZOMBIE) { + LivingEntity l = (LivingEntity) entity; + if (entity.getType()==EntityType.ZOMBIE) { + if (Math.random()<=0.65) { + if (Math.random()<=0.75) { + l.getEquipment().setItemInHand(new ItemStack(Material.IRON_SWORD)); + } else { + l.getEquipment().setItemInHand(new ItemStack(Material.DIAMOND_SWORD)); + } + } + } + if (Math.random()>=0.25) { + if (Math.random()<=0.75) { + l.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE)); + } else { + l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); + } + if (Math.random()>=0.45) { + if (Math.random()<=0.75) { + l.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS)); + } else { + l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); + } + if (Math.random()>=0.65) { + if (Math.random()<=0.75) { + l.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET)); + } else { + l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); + } + if (Math.random()>=0.95) { + if (Math.random()<=0.75) { + l.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS)); + } else { + l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); + } + } + } + } + } + } + } else + if (totallvs<120*levelsmult) { + //Wear diamond armor a bit more often. Sometimes an enchanted diamond piece here or there. Include a Golden sword sometimes, a diamond one usually. + if (entity.getType()==EntityType.SKELETON || entity.getType()==EntityType.ZOMBIE) { + LivingEntity l = (LivingEntity) entity; + if (entity.getType()==EntityType.ZOMBIE) { + if (Math.random()<=0.65) { + if (Math.random()<=0.75) { + l.getEquipment().setItemInHand(new ItemStack(Material.DIAMOND_SWORD)); + } else { + l.getEquipment().setItemInHand(new ItemStack(Material.GOLD_SWORD)); + } + } + } + if (Math.random()>=0.25) { + if (Math.random()<=0.75) { + l.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); + } else { + ItemStack enchanted = new ItemStack(Material.DIAMOND_CHESTPLATE); + enchanted.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); + l.getEquipment().setChestplate(enchanted); + } + if (Math.random()>=0.45) { + if (Math.random()<=0.75) { + l.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS)); + } else { + ItemStack enchanted = new ItemStack(Material.DIAMOND_LEGGINGS); + enchanted.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); + l.getEquipment().setLeggings(enchanted); + } + if (Math.random()>=0.65) { + if (Math.random()<=0.75) { + l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); + } else { + ItemStack enchanted = new ItemStack(Material.DIAMOND_HELMET); + enchanted.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); + l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET)); + } + if (Math.random()>=0.95) { + if (Math.random()<=0.75) { + l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); + } else { + ItemStack enchanted = new ItemStack(Material.DIAMOND_BOOTS); + enchanted.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1); + l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS)); + } + } + } + } + } + } + } + } + } + } + //} + /* + double distancefromcity = Math.abs(1627-entity.getLocation().getX())+Math.abs((67-entity.getLocation().getY()))+Math.abs(-267-entity.getLocation().getZ()); + double chancer=1.0d, increasechancer = 0.5d, despawnchancer = 32.0d; + if (distancefromcity>50000) { + chancer = 0.5d; + increasechancer=0.25d; + despawnchancer = 16.0d; + } else + if (distancefromcity>20000) { + chancer = 0.5d; + increasechancer=0.5d; + despawnchancer = 16.0d; + } else + if (distancefromcity>10000) { + chancer = 0.5d; + increasechancer=1.0d; + despawnchancer = 4.0d; + } else + if (distancefromcity>4000) { + chancer = 1.0d; + increasechancer=4.0d; + despawnchancer = 2.0d; + } else + if (distancefromcity>2000) { + chancer = 2.0d; + increasechancer=8.0d; + despawnchancer = 1.25d; + } else + if (distancefromcity>1000) { + chancer = 2.0d; + increasechancer=16.0d; + despawnchancer = 1.25d; + } else + if (distancefromcity>400) { + chancer = 16.0d; + increasechancer = 32.0d; + despawnchancer = 1.125d; + } else { + chancer = 32.0d; + increasechancer = 64.0d; + despawnchancer = 1.025d; + } + if (entity.getLocation().getY()>62) { + despawnchancer/=Math.random()*16.0d+1.0d; + } + if (entity.getLocation().getY()<50) { + chancer/=1.5d; + if (chancer<0.5d) { + chancer=0.5d; + } + for (int i=50;i>entity.getLocation().getY();i--) { + increasechancer/=1.03d; + despawnchancer*=1.03d; + } + if (increasechancer<0.01d) { + increasechancer=0.01d; + } + } + EntityType allowedtypes[] = {EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.ENDERMAN,EntityType.GHAST,EntityType.MAGMA_CUBE,EntityType.PIG_ZOMBIE,EntityType.SILVERFISH,EntityType.SLIME,EntityType.SPIDER,EntityType.ZOMBIE,EntityType.SKELETON,EntityType.CREEPER}; + boolean contains=false; + for (int i=0;i=3)) && spawners==0 && entity.getNearbyEntities(5, 5, 5).size()<50) { + //if (e.getSpawnReason()!=SpawnReason.CUSTOM && e.getLocation().getBlockY()!=Bukkit.getPlayer("AaMay").getLocation().getBlockY()) { + entity.remove(); + e.setCancelled(true); + //} + //Bukkit.getPlayer("sigonasr2").sendMessage(entity.getType()+" prevented from spawning."); + } + if (contains && (Bukkit.getWorld("world").getFullTime()-this.plugin.last_mob_random_time>10 || this.plugin.last_mob_random_time==0) && Math.random()*chancer<1.0d) { + this.plugin.last_mob_random_time=Bukkit.getWorld("world").getFullTime(); + Location testloc = entity.getLocation().add(Math.random()*4.0d-Math.random()*4.0d,Math.random()*4.0d,Math.random()*4.0d-Math.random()*4.0d); + if (Bukkit.getWorld("world").getBlockAt(testloc).getType()==Material.AIR) { + Bukkit.getWorld("world").spawnEntity(testloc, entity.getType()); + /*int j=0; + while (j<10) { + Bukkit.getWorld("world").spawnEntity(testloc, entity.getType()); + j++; + }*/ + /* + } + while (Math.random()*chancer<1.0d) { + chancer+=increasechancer; + testloc = entity.getLocation().add(Math.random()*4.0d-Math.random()*4.0d,Math.random()*4.0d,Math.random()*4.0d-Math.random()*4.0d); + if (Bukkit.getWorld("world").getBlockAt(testloc).getType()==Material.AIR && Bukkit.getWorld("world").getBlockAt(testloc.add(0,1,0)).getType()==Material.AIR) { + Bukkit.getWorld("world").spawnEntity(testloc, entity.getType()); + /*int j=0; + while (j<10) { + Bukkit.getWorld("world").spawnEntity(entity.getLocation().add(Math.random()*4.0d-Math.random()*4.0d,Math.random()*4.0d-Math.random()*4.0d,Math.random()*4.0d-Math.random()*4.0d), entity.getType()); + j++; + }*/ + /* } + } + } + */ + + } + } + if (entity.getWorld().getName().compareTo("world_nether")==0) { + if (entity.getType()==EntityType.PIG_ZOMBIE) { + if (Math.random()<=0.005) { + //0.5% chance of a magma cube spawning. + Bukkit.getWorld("world_nether").spawnEntity(entity.getLocation(), EntityType.MAGMA_CUBE); + } + if (Math.random()<=0.0003125) { + //0.03125% chance of a ghast spawning. + Bukkit.getWorld("world_nether").spawnEntity(entity.getLocation(), EntityType.GHAST); + } + } + } + if (entity.getWorld().getName().compareTo("world_the_end")==0) { + if (entity.getType()==EntityType.ENDER_DRAGON) { + LivingEntity l = (LivingEntity)entity; + l.setMaxHealth(l.getMaxHealth()*4); + l.setHealth(l.getMaxHealth()); + } + } + if (entity.getType()==EntityType.EXPERIENCE_ORB) { + Bukkit.getWorld("world").spawnEntity(entity.getLocation(),entity.getType()); + } + if (e.getSpawnReason()==SpawnReason.BREEDING) { + //Spawn reason for later spawning. + //Check for this entity in list of animals that have been interacted with. + int slot=-1; + Player p=null; + String owner1="",owner2=""; + List checklist = e.getEntity().getNearbyEntities(3, 3, 3); + for (int i=0;inearby=e.getEntity().getNearbyEntities(25, 25, 25); + int countamount=0; + for (int i=0;i=10) { + if (Math.random()<=0.25 && countamount<50) { + Chicken newent = (Chicken)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.CHICKEN); + newent.setBaby(); + } else + if (Math.random()<=0.25 && countamount<50) { + Chicken newent = (Chicken)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.CHICKEN); + newent.setBaby(); + newent = (Chicken)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.CHICKEN); + newent.setBaby(); + } + } + } + if (e.getEntity().getType()==EntityType.PIG) { + this.plugin.gainMoneyExp(p,"Breeder",0.01*mult,2*mult); + if (this.plugin.getJobLv("Breeder", p)>=10) { + if (Math.random()<=0.25 && countamount<50) { + Pig newent = (Pig)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.PIG); + newent.setBaby(); + } else + if (Math.random()<=0.25 && countamount<50) { + Pig newent = (Pig)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.PIG); + newent.setBaby(); + newent = (Pig)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.PIG); + newent.setBaby(); + } + } + } + if (e.getEntity().getType()==EntityType.SHEEP) { + this.plugin.gainMoneyExp(p,"Breeder",0.01*mult,2*mult); + if (this.plugin.getJobLv("Breeder", p)>=10) { + if (Math.random()<=0.25 && countamount<50) { + Sheep newent = (Sheep)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.SHEEP); + newent.setBaby(); + newent.setColor(((Sheep)e.getEntity()).getColor()); + } else + if (Math.random()<=0.25 && countamount<50) { + Sheep newent = (Sheep)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.SHEEP); + newent.setBaby(); + newent.setColor(((Sheep)e.getEntity()).getColor()); + newent = (Sheep)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.SHEEP); + newent.setBaby(); + newent.setColor(((Sheep)e.getEntity()).getColor()); + } + } + } + if (e.getEntity().getType()==EntityType.COW) { + this.plugin.gainMoneyExp(p,"Breeder",0.015*mult,2*mult); + if (this.plugin.getJobLv("Breeder", p)>=10) { + if (Math.random()<=0.25 && countamount<50) { + Cow newent = (Cow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.COW); + newent.setBaby(); + } else + if (Math.random()<=0.25 && countamount<50) { + Cow newent = (Cow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.COW); + newent.setBaby(); + newent = (Cow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.COW); + newent.setBaby(); + } + } + } + if (e.getEntity().getType()==EntityType.OCELOT) { + this.plugin.gainMoneyExp(p,"Breeder",0.02*mult,4*mult); + if (this.plugin.getJobLv("Breeder", p)>=10) { + if (Math.random()<=0.25 && countamount<50) { + Ocelot newent = (Ocelot)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.OCELOT); + newent.setBaby(); + newent.setOwner(((Ocelot)e.getEntity()).getOwner()); + newent.setCatType(((Ocelot)e.getEntity()).getCatType()); + } else + if (Math.random()<=0.25 && countamount<50) { + Ocelot newent = (Ocelot)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.OCELOT); + newent.setBaby(); + newent.setOwner(((Ocelot)e.getEntity()).getOwner()); + newent.setCatType(((Ocelot)e.getEntity()).getCatType()); + newent = (Ocelot)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.OCELOT); + newent.setBaby(); + newent.setOwner(((Ocelot)e.getEntity()).getOwner()); + newent.setCatType(((Ocelot)e.getEntity()).getCatType()); + } + } + } + if (e.getEntity().getType()==EntityType.WOLF) { + this.plugin.gainMoneyExp(p,"Breeder",0.03*mult,5*mult); + if (this.plugin.getJobLv("Breeder", p)>=10) { + if (Math.random()<=0.25 && countamount<50) { + Wolf newent = (Wolf)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.WOLF); + newent.setBaby(); + newent.setOwner(((Wolf)e).getOwner()); + newent.setCollarColor(((Wolf)e.getEntity()).getCollarColor()); + } else + if (Math.random()<=0.25 && countamount<50) { + Wolf newent = (Wolf)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.WOLF); + newent.setBaby(); + newent.setOwner(((Wolf)e).getOwner()); + newent.setCollarColor(((Wolf)e.getEntity()).getCollarColor()); + newent = (Wolf)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.WOLF); + newent.setBaby(); + newent.setOwner(((Wolf)e).getOwner()); + newent.setCollarColor(((Wolf)e.getEntity()).getCollarColor()); + } + } + } + if (e.getEntity().getType()==EntityType.MUSHROOM_COW) { + this.plugin.gainMoneyExp(p,"Breeder",0.15*mult,20*mult); + if (this.plugin.getJobLv("Breeder", p)>=10) { + if (Math.random()<=0.25 && countamount<50) { + MushroomCow newent = (MushroomCow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.MUSHROOM_COW); + newent.setBaby(); + } else + if (Math.random()<=0.25 && countamount<50) { + MushroomCow newent = (MushroomCow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.MUSHROOM_COW); + newent.setBaby(); + newent = (MushroomCow)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.MUSHROOM_COW); + newent.setBaby(); + } + } + } + if (e.getEntity().getType()==EntityType.HORSE) { + this.plugin.gainMoneyExp(p,"Breeder",1.20*mult,50*mult); + if (this.plugin.getJobLv("Breeder", p)>=10) { + if (Math.random()<=0.25 && countamount<50) { + Horse newent = (Horse)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.HORSE); + newent.setBaby(); + } else + if (Math.random()<=0.25 && countamount<50) { + Horse newent = (Horse)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.HORSE); + newent.setBaby(); + newent = (Horse)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.HORSE); + newent.setBaby(); + } + } + } + } + } + } + } + + @EventHandler + public void onBlockBreak(BlockBreakEvent e) { + Player p = e.getPlayer(); + //p.sendMessage("Block broke."); + //p.sendMessage("Has name: "+p.getItemInHand().getItemMeta().hasDisplayName()); + //p.sendMessage("Name is: "+p.getItemInHand().getItemMeta().getDisplayName()); + int myData=this.plugin.getPlayerDataSlot(p); + if (p!=null) { + if (e.getBlock().getType()==Material.STONE && p.getLocation().getY()<=50) { + //We are mining underground. + //Check if we need to spawn Charge Zombie II's. + //Find our player data. + int pdata_slot=0; + for (int i=0;i-6;j--) { + for (int k=2;k>-1;k--) { + for (int l=5;l>-6;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(20+j,k,spread+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { + torch1=true; + } + } + } + } + if (!torch1) { + int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; + for (int j=lb1;j>ub1;j--) { + for (int k=2;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(10+j,k,spread+l)); + if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + e1 = Bukkit.getWorld("world").spawnEntity(p.getLocation().add(10,0,spread), EntityType.ZOMBIE); + } + torch2=false; + spread = (int)(Math.random()*10); + for (int j=5;j>-6;j--) { + for (int k=2;k>-1;k--) { + for (int l=5;l>-6;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(-10+j,k,spread+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { + torch2=true; + } + } + } + } + if (!torch2) { + int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; + for (int j=lb1;j>ub1;j--) { + for (int k=2;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(-10+j,k,spread+l)); + if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + e2 = Bukkit.getWorld("world").spawnEntity(p.getLocation().add(-10,0,spread), EntityType.ZOMBIE); + } + spread = (int)(Math.random()*10); + for (int j=5;j>-6;j--) { + for (int k=2;k>-1;k--) { + for (int l=5;l>-6;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,10+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { + torch3=true; + } + } + } + } + if (!torch3) { + int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; + for (int j=lb1;j>ub1;j--) { + for (int k=2;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,10+l)); + if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + e3 = Bukkit.getWorld("world").spawnEntity(p.getLocation().add(spread,0,10), EntityType.ZOMBIE); + } + spread = (int)(Math.random()*10); + for (int j=5;j>-6;j--) { + for (int k=2;k>-1;k--) { + for (int l=5;l>-6;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,-10+l)); + if (b.getType()==Material.TORCH || b.getType()==Material.GLOWSTONE || b.getType()==Material.COMMAND || b.getType()==Material.MOSSY_COBBLESTONE) { + torch4=true; + } + } + } + } + if (!torch4) { + int lb1=(int)(Math.random()*5)+1,lb2=(int)(Math.random()*5)+1,ub1=-(int)(Math.random()*6)+1,ub2=-(int)(Math.random()*6)+1; + for (int j=lb1;j>ub1;j--) { + for (int k=2;k>-1;k--) { + for (int l=lb2;l>-ub2;l--) { + Block b =Bukkit.getWorld("world").getBlockAt(p.getLocation().add(spread+j,k,-10+l)); + if (b.getType()!=Material.BEDROCK && b.getType()!=Material.MOB_SPAWNER && b.getType()!=Material.ENDER_PORTAL && b.getType()!=Material.ENDER_PORTAL_FRAME) { + b.setType(Material.AIR); + } + } + } + } + e4 = Bukkit.getWorld("world").spawnEntity(p.getLocation().add(spread,0,-20), EntityType.ZOMBIE); + } + if (!torch1) { + Zombie z1 = (Zombie)e1; + z1.setCustomName(ChatColor.GOLD+"Charge Zombie II"); + z1.setCustomNameVisible(false); + z1.setTarget(p); + } + if (!torch2) { + Zombie z2 = (Zombie)e2; + z2.setCustomName(ChatColor.GOLD+"Charge Zombie II"); + z2.setCustomNameVisible(false); + z2.setTarget(p); + } + if (!torch3) { + Zombie z3 = (Zombie)e3; + z3.setCustomName(ChatColor.GOLD+"Charge Zombie II"); + z3.setCustomNameVisible(false); + z3.setTarget(p); + } + if (!torch4) { + Zombie z4 = (Zombie)e4; + z4.setCustomName(ChatColor.GOLD+"Charge Zombie II"); + z4.setCustomNameVisible(false); + z4.setTarget(p); + } + } + } + if (e.getBlock().getType()==Material.EMERALD_ORE || + e.getBlock().getType()==Material.DIAMOND_ORE || + e.getBlock().getType()==Material.GOLD_ORE || + e.getBlock().getType()==Material.IRON_ORE) { + /* + if (Math.random()<=0.01) { + //1% chance of getting a book. + ItemStack book = new ItemStack(Material.WRITTEN_BOOK); + BookMeta bookdata = (BookMeta)book.getItemMeta(); + int choosebook = (int)(Math.random()*9.0d); + switch (choosebook) { + case 0:{ + bookdata.setAuthor("Steve"); + bookdata.setTitle("Dangers of the Nether"); + bookdata.addPage("Dangers of the Nether\n"+ChatColor.ITALIC+" by Steve\n======\n"+ChatColor.RESET+"It didn't take me long to realize where we were. It was dangerous, very hot, and lots of torturous screams could be heard everywhere. I barely had time","to take it all in before a huge fireball was shot in my direction. I quickly looked to my side to find a convenient safe passage and hid there for a few minutes. I guess I was in there longer than I thought, I ended","up falling asleep and waking up to notice there was something scary on the wall.\n\n"+ChatColor.ITALIC+"\"TURN AND LEAVE NOW. DANGEROUS TO STAY. REAL WORLD HAS WHAT YOU ARE LOOKING FOR. I ONLY REMEMBER THE 1ST X POSITION...",ChatColor.ITALIC+"...IT WAS 7! I AM *POSITIVE*\""+ChatColor.RESET+"\n\nI did not know what to think. The 1st X position? I quickly remembered the 7 and sprinted out of the nether portal. And to think that was *THE END* of my adventures..."); + }break; + case 1:{ + bookdata.setAuthor("Lacey"); + bookdata.setTitle("A Hole in the Flower Garden"); + bookdata.addPage("A Hole in the Flower Garden\n"+ChatColor.ITALIC+" by Lacey\n======\n"+ChatColor.RESET+"It was a lovely day to pick flowers in the garden, they just finished blooming fully. I was so excited to pick them, but I didn't do so until","after I've taken in all the wonderful scents! Smelling all the flowers and wonderful smells of plants and trees and nature and grass. It was perfect. I was mindlessly walking along this prairie when I stumbled.","I fell, and fell, and fell. I hit the bottom of a ravine. It didn't even occur to me I would just walk into one. I took some minor damage, but when I got up, I noticed something strange.","There were two or three zombies gathered around a wall, etching something into it. I went over to read it once the zombies walked away. I saw on the wall:\n\n"+ChatColor.ITALIC+"X-2:6 <--END","It looked cryptic to me, but why would they write that on the wall? I quickly scribbled it down on a notepad I had in my pocket and started climbing out of the ravine to tend to my lovely flowers. What a day!"); + }break; + case 2:{ + bookdata.setAuthor("Jimmy"); + bookdata.setTitle("Messages in Music"); + bookdata.addPage("Messages in Music\n"+ChatColor.ITALIC+" by Jim"+"\n======"+ChatColor.RESET+"\nI popped out the disk from my Jukebox to put in another, I could jam to these all day! As I was looking through my collection for something to listen to","I found a really bent up disk. 'No way this could still play', I thought to myself. I put it in, and it crackled and snarled, but it was indeed playing! At first I heard some faint resemblence of music, but then suddenly,","a hiss, an explosion, and then 'CREEEEEEEEE----- 7X XSSSSSSSSSS 3RD EEEEEEE' mental images appeared in my head, but the 7X and 3RD stood out the most. It's like I was seeing them in my head while hearing something else!","I couldn't stand up anymore, or think. I forcibly reached up with my weak hand to find the eject button on the player and when I found the familiar nub in the button, pressed down on it and out popped the disk, hitting my face,","but putting me back into reality. Something was telling me that the 3RD and 7X was important. But I couldn't quite put my tongue on it."); + }break; + case 3:{ + bookdata.setAuthor("Creeper"); + bookdata.setTitle("HISS"); + bookdata.addPage("Y do i exisssst. nobody knowssss. i just want a hugssssss, HUGSSSSSSS. but i don't know Y i exist. there's no Y in the first position. it'sssss jusssst two digitssssss.... SSSSSSSSS. *THE END*"); + }break; + case 4:{ + bookdata.setAuthor("Marco"); + bookdata.setTitle("The Hunt for a Dragon"); + bookdata.addPage("The Hunt for a Dragon\n"+ChatColor.ITALIC+" by Marco"+"\n======"+ChatColor.RESET+"\nThere exists a rumor that a mythical dragon could be found in the depths of our world. It is even said he doesn't exist in OUR world, but ANOTHER world altogether!","That my friends already boggles me, but where the heck would I go to find it then? I have been told he exists, and I know he is. I believe deep in my heart. I searched day and night under and over ground.","One day I found something strange in the ground. It was pink wool, in the middle of a cave on the ground. It even said something, but I couldn't tell from so close up. So I literally dug all the way to the surface, keeping the boundaries","of that word uncovered the whole way up. When I got to the top and looked down, I was relieved to find it was made out of markings I could discern. It said: 'Y: X3?' It was definitely a weird group of symbols, but I have a strong feeling"," that it is directly linked with that dragon I am trying to hunt down. Maybe I can gather more clues and try to decipher the location of this thing."); + }break; + case 5:{ + bookdata.setAuthor("Steve"); + bookdata.setTitle("Cooking Food"); + bookdata.addPage("Cooking Food\n"+ChatColor.ITALIC+" by Steve"+"\n======"+ChatColor.RESET+"\nIt was a bright and rather typical sunny day in the Minecraft world. I don't actually think it was very hot either. I just managed to catch a few fish and was cooking them up.","It wasn't long before I got distracted and heard a funny noise. It was an ocelote. Lucky me, an ocelote has smelled the scent of my fish! I grab a few and hold it out for the ocelote. It slowly creeps over, and then takes it and runs from me.","I thought it was full and finished cooking the rest of the fish. However, the ocelote returned a few minutes later with a neatly-folded piece of paper in its mouth. It came up to me and set it down, like it was some message just for me.","I opened it up and it read:\n\n"+ChatColor.ITALIC+"Don't let the fish get to your tongue! If you know what's wise, you will investigate further. The 3rd position of Y being the number 5."+ChatColor.RESET+"\n\n","I didn't notice the ocelote run away, but I knew something FISHY was going on. That message seemed important for some reason, I've seen similar cryptic messages before... Perhaps I'll hold onto this in case I need it in the future."); + }break; + case 6:{ + bookdata.setAuthor("Fredric"); + bookdata.setTitle("Math Behind the Void"); + bookdata.addPage("Math Behind the Void\n"+ChatColor.ITALIC+" by Fredric"+"\n======"+ChatColor.RESET+"\nThis book describes a few principles that the void in this world follows. While no one has actually seen the void, we have found a few theories and rules regarding them.","1. The Void has a Light Level of -14. The Void actually absorbs light coming from light sources and thus, if The Void is ever opened to the real world, would suck up the light from it.","2. The Void always has a volume of 50,000m, being 50m x 20m x 50m. This means that The Void, regardless of location is always the same exact size. This would conclude to us that The Void is co-existing and multiple instaces of it may exist in the same realm.","3. Any Entity entering The Void will not be able to escape The Void as time passes much more quickly inside The Void. This means Entities that enter The Void feel accelerated processes and cannot combat it, since the time outside is behind them.","4. A point of connection between The Void and other dimensions has to exist, for The Void to exist. Speculation has it that one of these points has been leaked into the world, and is accessible by us directly. After further research,","we have learned that one of these points is located on the 1st respective numeral along our Z axis with the number 4. It has also been proven that this number has to be negative as the other two sources interacting with The Void are positive."); + }break; + case 7:{ + bookdata.setAuthor("Robert"); + bookdata.setTitle("TNT"); + bookdata.addPage("TNT\n"+ChatColor.ITALIC+" by Robert"+"\n======"+ChatColor.RESET+"\nYou know, the easiest way to clear a tunnel is using an item called TNT. It is a rather small block, but it is loaded with gunpowder. When lit by an external force, it ignites","with the force of 5 Creeper explosions to clear whole caves out. Well lo and behold one day I discovered a rather strange abandoned mineshaft. It wasn't normal for sure, because there were green vines everywhere and lots of strange doors.","It was like somebody lived here ages ago, and I am discovering the ruins of such a place. Inoperable levers, a few mobs I have to kill here and there that have made this area their designated home. It was a mess. But I did discover that","someone was trying to find what we would call 'The End'. It's a magical place, and I believe with the right amount of effort, we can find it someday too. He had scribbled the coordinates of the location he was trying to reach.","However, most of it is faded out and I can only tell faintly the remains of it: \n\n"+ChatColor.ITALIC+"X:---\nY:---\nZ:--7-"+ChatColor.RESET+"\n\nYep, that's about it.","Hopefully by me recording this data, someone else can fill in the remaining numbers and we can all find The End together. Someday..."); + }break; + case 8:{ + bookdata.setAuthor("Joshua"); + bookdata.setTitle("Fourside"); + bookdata.addPage("Fourside\n"+ChatColor.ITALIC+" by Joshua"+"\n======"+ChatColor.RESET+"\n"+ChatColor.DARK_BLUE+"ABANDONED PROJECT"+ChatColor.RESET+". A city that would be developed with the best technology and the highest standards. It would","succeed every single Minecraft city that has ever been built. Casinos, diamond-lined walkways, towering skyscrapers as far as the eye can see. Museums, Libraries, Educational Institutions. This mega-city would be able to hold","and sustain every single Minecrafter in existence. But no, something went terribly wrong. Our engineering team finally developed the perfect transportation system and we were wiring it up to our fusion power plant.","Something went horribly wrong. The Fusion power plant started self-combusting itself, leaving behind hyper-cold atoms. This caused nucleic waste to interact with the environment around itself and freezing the whole world as we knew it.","The city idea as we knew it was scrapped, and we would wait 2000 years before we could attempt this again. We wrote plans for a much more portable solution and have named it 'Twoside' and archived it appropriately.","Maybe someone will pick up that book and be able to make the future bright with a mini version of Fourside. That being said, we left the 3rd slot of the Z position of our city at 7. This should give you enough clue as to where NOT to build."); + }break; + } + book.setItemMeta(bookdata); + //p.setItemInHand(book); + p.getInventory().addItem(book); + p.updateInventory(); + p.sendMessage(ChatColor.LIGHT_PURPLE+"You feel a magical presence get inserted into your inventory."); + }*/ + } + if (this.plugin.PlayerinJob(p, "Builder")) { + this.plugin.playerdata_list.get(myData).BadInteract(e.getBlock().getType()); + } + if (this.plugin.PlayerinJob(p, "Woodcutter")) { + if (e.getBlock().getType()==Material.LOG) { + if (p.getItemInHand().getType()==Material.WOOD_AXE || p.getItemInHand().getType()==Material.STONE_AXE || p.getItemInHand().getType()==Material.IRON_AXE || p.getItemInHand().getType()==Material.GOLD_AXE || p.getItemInHand().getType()==Material.DIAMOND_AXE) { + //p.sendMessage("Cut down wood w/axe."); + this.plugin.gainMoneyExp(p,"Woodcutter",0.025,2); + } else { + //p.sendMessage("Cut down wood."); + this.plugin.gainMoneyExp(p,"Woodcutter",0.01,1); + } + } + } + if (this.plugin.PlayerinJob(p, "Miner")) { + if (this.plugin.getJobLv("Miner", p)>=10) { + //Half chance to set the durability back by one. + if (p.getItemInHand().getType()==Material.WOOD_PICKAXE || + p.getItemInHand().getType()==Material.STONE_PICKAXE || + p.getItemInHand().getType()==Material.GOLD_PICKAXE || + p.getItemInHand().getType()==Material.IRON_PICKAXE || + p.getItemInHand().getType()==Material.DIAMOND_PICKAXE) { + if (p.getItemInHand().getDurability()>0) { + if (Math.random()>=0.5) { + p.getItemInHand().setDurability((short)(p.getItemInHand().getDurability()-1)); + p.updateInventory(); + } + } + } + } + boolean has_silktouch=false; + if (!p.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) { + has_silktouch=false; + } else { + has_silktouch=true; + } + if (this.plugin.playerdata_list.get(myData).GoodInteract()) { + if (e.getBlock().getType()==Material.STONE) { + this.plugin.gainMoneyExp(p,"Miner",0.0025,1); + } else + if (e.getBlock().getType()==Material.NETHERRACK) { + this.plugin.gainMoneyExp(p,"Miner",0.005,1); + } else + if (e.getBlock().getType()==Material.COAL_ORE && !has_silktouch) { + this.plugin.gainMoneyExp(p,"Miner",0.0125,3); + } else + if (e.getBlock().getType()==Material.GLOWSTONE && !has_silktouch) { + this.plugin.gainMoneyExp(p,"Miner",0.015,3); + } else + if (e.getBlock().getType()==Material.SANDSTONE) { + this.plugin.gainMoneyExp(p,"Miner",0.015,4); + } else + if (e.getBlock().getType()==Material.NETHER_BRICK) { + this.plugin.gainMoneyExp(p,"Miner",0.02,3); + } else + if (e.getBlock().getType()==Material.QUARTZ_ORE && !has_silktouch) { + this.plugin.gainMoneyExp(p,"Miner",0.025,4); + } else + if (e.getBlock().getType()==Material.LAPIS_ORE && !has_silktouch) { + this.plugin.gainMoneyExp(p,"Miner",0.03,5); + } else + if (e.getBlock().getType()==Material.MOSSY_COBBLESTONE) { + this.plugin.gainMoneyExp(p,"Miner",0.0375,8); + } else + if (e.getBlock().getType()==Material.IRON_ORE && !has_silktouch) { + this.plugin.gainMoneyExp(p,"Miner",0.0375,6); + } else + if ((e.getBlock().getType()==Material.REDSTONE_ORE || e.getBlock().getType()==Material.GLOWING_REDSTONE_ORE) && !has_silktouch) { + this.plugin.gainMoneyExp(p,"Miner",0.05,9); + } else + if (e.getBlock().getType()==Material.OBSIDIAN) { + this.plugin.gainMoneyExp(p,"Miner",0.0625,10); + } else + if (e.getBlock().getType()==Material.GOLD_ORE && !has_silktouch) { + this.plugin.gainMoneyExp(p,"Miner",0.0975,12); + } else + if (e.getBlock().getType()==Material.DIAMOND_ORE && !has_silktouch) { + this.plugin.gainMoneyExp(p,"Miner",0.3125,60); + } else + if (e.getBlock().getType()==Material.EMERALD_ORE && !has_silktouch) { + this.plugin.gainMoneyExp(p,"Miner",0.7625,160); + } + } + } + if (this.plugin.PlayerinJob(p, "Digger")) { + if (this.plugin.getJobLv("Digger", p)>=20) { + //Half chance to set the durability back by one. + if (p.getItemInHand().getType()==Material.WOOD_SPADE || + p.getItemInHand().getType()==Material.STONE_SPADE || + p.getItemInHand().getType()==Material.GOLD_SPADE || + p.getItemInHand().getType()==Material.IRON_SPADE || + p.getItemInHand().getType()==Material.DIAMOND_SPADE) { + if (p.getItemInHand().getDurability()>0) { + if (Math.random()>=0.66) { + p.getItemInHand().setDurability((short)(p.getItemInHand().getDurability()-1)); + p.updateInventory(); + } + } + } + } else + if (this.plugin.getJobLv("Digger", p)>=10) { + //Half chance to set the durability back by one. + if (p.getItemInHand().getType()==Material.WOOD_SPADE || + p.getItemInHand().getType()==Material.STONE_SPADE || + p.getItemInHand().getType()==Material.GOLD_SPADE || + p.getItemInHand().getType()==Material.IRON_SPADE || + p.getItemInHand().getType()==Material.DIAMOND_SPADE) { + if (p.getItemInHand().getDurability()>0) { + if (Math.random()>=0.5) { + p.getItemInHand().setDurability((short)(p.getItemInHand().getDurability()-1)); + p.updateInventory(); + } + } + } + } + if (this.plugin.playerdata_list.get(myData).GoodInteract()) { + if (e.getBlock().getType()==Material.DIRT) { + this.plugin.gainMoneyExp(p,"Digger",0.005,1); + } + if (e.getBlock().getType()==Material.GRASS) { + this.plugin.gainMoneyExp(p,"Digger",0.005,2); + } + if (e.getBlock().getType()==Material.SAND) { + this.plugin.gainMoneyExp(p,"Digger",0.01,2); + } + if (e.getBlock().getType()==Material.GRAVEL) { + this.plugin.gainMoneyExp(p,"Digger",0.02,5); + } + if (e.getBlock().getType()==Material.SOUL_SAND) { + this.plugin.gainMoneyExp(p,"Digger",0.04,8); + } + if (e.getBlock().getType()==Material.CLAY) { + this.plugin.gainMoneyExp(p,"Digger",0.05,10); + } + } + } + //p.sendMessage("You broke the "+e.getBlock().getType()+", Data: "+e.getBlock().getData()); + if (this.plugin.PlayerinJob(p, "Farmer")) { + if (e.getBlock().getType()==Material.SUGAR_CANE_BLOCK) { + this.plugin.gainMoneyExp(p,"Farmer",0.00,1); + } + if (e.getBlock().getType()==Material.CROPS && e.getBlock().getData()==7) { + this.plugin.gainMoneyExp(p,"Farmer",0.01,2); + } + if (e.getBlock().getType()==Material.CARROT && e.getBlock().getData()==7) { + this.plugin.gainMoneyExp(p,"Farmer",0.01,2); + } + if (e.getBlock().getType()==Material.CACTUS) { + this.plugin.gainMoneyExp(p,"Farmer",0.00,3); + } + if (e.getBlock().getType()==Material.POTATO && e.getBlock().getData()==7) { + this.plugin.gainMoneyExp(p,"Farmer",0.03,3); + } + if (e.getBlock().getType()==Material.BROWN_MUSHROOM) { + this.plugin.gainMoneyExp(p,"Farmer",0.00,1); + } + if (e.getBlock().getType()==Material.RED_MUSHROOM) { + this.plugin.gainMoneyExp(p,"Farmer",0.00,1); + } + if (e.getBlock().getType()==Material.NETHER_WARTS && e.getBlock().getData()==3) { + this.plugin.gainMoneyExp(p,"Farmer",0.00,1); + } + /*if (e.getBlock().getType()==Material.PUMPKIN) { + this.plugin.gainMoneyExp(p,"Farmer",0.00,1); + }*/ + if (e.getBlock().getType()==Material.MELON_BLOCK) { + this.plugin.gainMoneyExp(p,"Farmer",0.10,10); + } + } + boolean hasfortune; + hasfortune = (p.getItemInHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS)>0)?true:false; + //Check blocks around it. If it's a spawner, it's protected until the spawner is destroyed. + for (int x=-4;x<4;x++) { + for (int y=0;y<2;y++) { + for (int z=-4;z<4;z++) { + if ((x!=0 || y!=0 || z!=0) && p.getWorld().getBlockAt(e.getBlock().getLocation().add(x,y,z)).getType()==Material.MOB_SPAWNER && e.getBlock().getType()!=Material.MOB_SPAWNER) { + e.setCancelled(true); + p.sendMessage("A Mob Spawner force field protects this block from being destroyed."); + } + } + } + } + if (e.getBlock().getType()==Material.IRON_ORE) { + e.setExpToDrop(1); + } + if (e.getBlock().getType()==Material.GOLD_ORE) { + e.setExpToDrop(1); + } + if (e.getBlock().getType()==Material.REDSTONE_ORE) { + e.setExpToDrop(3); + } + if (e.getBlock().getType()==Material.LAPIS_ORE) { + e.setExpToDrop(3); + } + if (e.getBlock().getType()==Material.DIAMOND_ORE) { + e.setExpToDrop(12); + } + if (e.getBlock().getType()==Material.EMERALD_ORE) { + e.setExpToDrop(28); + } + if (e.getBlock().getType()==Material.MOB_SPAWNER) { + p.setLevel(p.getLevel()+30); + try { + Iterator effects = p.getActivePotionEffects().iterator(); + //Figure out potion effects when player joins. + while (effects.hasNext()) { + PotionEffect nexteffect = effects.next(); + if (nexteffect.getType().getName().compareTo(PotionEffectType.SPEED.getName())==0) { + p.removePotionEffect(PotionEffectType.SPEED); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 360000, nexteffect.getAmplifier()+2, true)); + } + if (nexteffect.getType().getName().compareTo(PotionEffectType.HEALTH_BOOST.getName())==0) { + p.removePotionEffect(PotionEffectType.HEALTH_BOOST); + p.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 360000, nexteffect.getAmplifier()+1, true)); + } + /*if (nexteffect.getType().getName().compareTo(PotionEffectType.JUMP.getName())==0) { + p.removePotionEffect(PotionEffectType.JUMP); + p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, nexteffect.getAmplifier()+2, true)); + }*/ + effects.remove(); + } + + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible while initializing player speed."); + } + p.removePotionEffect(PotionEffectType.WATER_BREATHING); + p.removePotionEffect(PotionEffectType.FAST_DIGGING); + p.removePotionEffect(PotionEffectType.INCREASE_DAMAGE); + //p.removePotionEffect(PotionEffectType.NIGHT_VISION); + p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 360000, 1, true)); + p.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 360000, 0, true)); + p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 360000, 0, true)); + p.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 360000, 0, true)); + //p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 360000, 0, true)); + //p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, 1, true)); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 360000, 1, true)); + } + if ((e.getBlock().getX()==1616 && e.getBlock().getZ()>=53 && e.getBlock().getZ()<=64) || (e.getBlock().getX()==1627 && e.getBlock().getZ()>=53 && e.getBlock().getZ()<=64) || (e.getBlock().getZ()==53 && e.getBlock().getX()>=1616 && e.getBlock().getX()<=1627) || (e.getBlock().getZ()==64 && e.getBlock().getX()>=1616 && e.getBlock().getX()<=1627)) { + e.setCancelled(true); + } + if ((e.getBlock().getX()==1585 && e.getBlock().getZ()>=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)) { + 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)) { + 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) { + p.getItemInHand().setDurability((short)0); + //p.sendMessage("Got in."); + p.updateInventory(); + } + if (p.getItemInHand()!=null && p.getItemInHand().getItemMeta()!=null && p.getItemInHand().getItemMeta().hasDisplayName()==true && p.getItemInHand().getItemMeta().getDisplayName().compareTo("Spleef Stone Shovel")==0) { + p.getItemInHand().setDurability((short)0); + //p.sendMessage("Got in."); + p.updateInventory(); + } + } + return; + } + + @EventHandler + public void onItemDrop(PlayerDropItemEvent e) { + //If the player is a support, drop it with only 1 second of wait time. + Player p = e.getPlayer(); + if (this.plugin.PlayerinJob(p, "Support")) { + //This item drops with half the pickup speed of normal items. + e.getItemDrop().setPickupDelay(20); + this.plugin.supportstackslist.add(e.getItemDrop()); + } + } + + @EventHandler + public void onItemPickup(PlayerPickupItemEvent e) { + Player p = e.getPlayer(); + if (this.plugin.supportstackslist.contains(e.getItem())) { + boolean alreadyhas=false; + for (int i=0;ip.getMaxHealth()) { + p.setHealth(p.getMaxHealth()); + } else { + p.setHealth(p.getHealth()+24); + } + } + } + } + + @EventHandler + public void onPotionSplash(PotionSplashEvent e) { + try { + Iterator entities = e.getAffectedEntities().iterator(); + Player shooter; + if (e.getPotion().getShooter().getType() == EntityType.PLAYER) { + shooter=(Player)e.getPotion().getShooter(); + if (this.plugin.PlayerinJob(shooter,"Support")) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Shooter is "+shooter.getName()); + while (entities.hasNext()) { + LivingEntity next = entities.next(); + if (next.getType() == EntityType.PLAYER) { + final Player p = (Player)next; + Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { + @Override + public void run() { + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + } + },5); + if (p!=shooter) { + //Award the support. + //Bukkit.getPlayer("sigonasr2").sendMessage(p.getName()+" got hit by your potion!"); + //Iterator effects = e.getPotion().getEffects().iterator(); + try { + Collection effects = e.getPotion().getEffects(); + for (PotionEffect nextpotioneffect : effects) { + //shooter.sendMessage(nextpotioneffect.getType().getName()+" is the potion effect."); + if (nextpotioneffect.getType().getName().compareTo("NIGHT_VISION")==0) { + this.plugin.gainMoneyExp(shooter,"Support",0.10,5); + } + if (nextpotioneffect.getType().getName().compareTo("SPEED")==0) { + this.plugin.gainMoneyExp(shooter,"Support",0.15,6); + for (int i=0;i0) { + this.plugin.gainMoneyExp(shooter,"Support",0.60,30); + } + this.plugin.gainMoneyExp(shooter,"Support",0.25,12); + } + if (nextpotioneffect.getType().getName().compareTo("HEAL")==0) { + if (p.getHealth()/p.getMaxHealth()<=0.30) { + this.plugin.gainMoneyExp(shooter,"Support",0.60,30); + //shooter.sendMessage("This is a big heal."); + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + } + this.plugin.gainMoneyExp(shooter,"Support",0.30,14); + if (p.getHealth()+12>p.getMaxHealth()) { + p.setHealth(p.getMaxHealth()); + } else { + p.setHealth(p.getHealth()+12); + } + //shooter.sendMessage("This is a heal."); + } + if (nextpotioneffect.getType().getName().compareTo("REGENERATION")==0) { + if (p.getHealth()/p.getMaxHealth()<=0.30) { + this.plugin.gainMoneyExp(shooter,"Support",0.60,30); + } + this.plugin.gainMoneyExp(shooter,"Support",0.30,14); + //shooter.sendMessage("This is a heal."); + } + } + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible for a support while attempting a splash potion."); + } + /*while (effects.hasNext()) { + PotionEffect nextpotioneffect = effects.next(); + shooter.sendMessage(nextpotioneffect.getType().getName()+" is the potion effect."); + if (nextpotioneffect.getType().getName().compareTo("NIGHT_VISION")==0) { + this.plugin.gainMoneyExp(shooter,"Support",0.10,5); + } + if (nextpotioneffect.getType().getName().compareTo("SPEED")==0) { + this.plugin.gainMoneyExp(shooter,"Support",0.15,6); + for (int i=0;i0) { + this.plugin.gainMoneyExp(shooter,"Support",0.60,30); + } + this.plugin.gainMoneyExp(shooter,"Support",0.25,12); + } + if (nextpotioneffect.getType().getName().compareTo("HEAL")==0) { + if (p.getHealth()<=8) { + this.plugin.gainMoneyExp(shooter,"Support",0.60,30); + shooter.sendMessage("This is a big heal."); + } + this.plugin.gainMoneyExp(shooter,"Support",0.30,14); + shooter.sendMessage("This is a heal."); + } + if (nextpotioneffect.getType().getName().compareTo("REGENERATION")==0) { + if (p.getHealth()<=8) { + this.plugin.gainMoneyExp(shooter,"Support",0.60,30); + } + this.plugin.gainMoneyExp(shooter,"Support",0.30,14); + //shooter.sendMessage("This is a heal."); + } + effects.remove(); + } + */ + } else { + try { + Collection effects = e.getPotion().getEffects(); + for (PotionEffect nextpotioneffect : effects) { + //shooter.sendMessage(nextpotioneffect.getType().getName()+" is the potion effect."); + if (nextpotioneffect.getType().getName().compareTo("SPEED")==0) { + //this.plugin.gainMoneyExp(shooter,"Support",0.15,6); + //Apply this potion effect to our player buff data. + for (int i=0;ip.getMaxHealth()) { + p.setHealth(p.getMaxHealth()); + } else { + p.setHealth(p.getHealth()+12); + } + //shooter.sendMessage("This is a heal."); + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + } + } + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible for a player while modifying speed amount."); + } + } + } + entities.remove(); + } + } else { + while (entities.hasNext()) { + LivingEntity next = entities.next(); + if (next.getType() == EntityType.PLAYER) { + final Player p = (Player)next; + Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { + @Override + public void run() { + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + } + },5); + try { + Iterator effects = e.getPotion().getEffects().iterator(); + while (effects.hasNext()) { + PotionEffect nextpotioneffect = effects.next(); + //shooter.sendMessage(nextpotioneffect.getType().getName()+" is the potion effect."); + if (this.plugin.PlayerinJob(shooter, "Brewer") && this.plugin.getJobLv("Brewer", shooter)>=20) { + next.removePotionEffect(nextpotioneffect.getType()); + next.addPotionEffect(new PotionEffect(nextpotioneffect.getType(),nextpotioneffect.getDuration()*2,nextpotioneffect.getAmplifier(),false)); + nextpotioneffect.getDuration(); + } + if (nextpotioneffect.getType().getName().compareTo("SPEED")==0) { + //this.plugin.gainMoneyExp(shooter,"Support",0.15,6); + //Apply this potion effect to our player buff data. + for (int i=0;ip.getMaxHealth()) { + p.setHealth(p.getMaxHealth()); + } else { + p.setHealth(p.getHealth()+12); + } + //shooter.sendMessage("This is a heal."); + } + effects.remove(); + } + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible for a player during a splash potion speed update."); + } + } + entities.remove(); + } + } + } + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Entity Collection not accessible during splash potion effect."); + } + } + + @EventHandler + public void onItemPrepareCraft(PrepareItemCraftEvent e) { + CraftingInventory result = e.getInventory(); + if (result.getResult().getType()==Material.IRON_HELMET || + result.getResult().getType()==Material.IRON_CHESTPLATE || + result.getResult().getType()==Material.IRON_LEGGINGS || + result.getResult().getType()==Material.IRON_BOOTS) { + ItemStack[] craftwith = result.getMatrix(); + boolean ingots=true; + for (int i=0;i='a'&&mod[i]<='z') { + mod[i]-=32; + first=true; + } else + if (i==0) { + if (mod[i]>='A'&&mod[i]<='Z') { + first=true; + } + } else { + if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { + first=true; + } + } + } else { + if (mod[i-1]!=' ') { + if (mod[i]>='A'&&mod[i]<='Z') { + mod[i]+=32; + } + } + } + } + newarmor_meta.setDisplayName(String.copyValueOf(mod)); + List NewLore = new ArrayList(); + NewLore.add(ChatColor.RED+"-400% Durability"); + newarmor_meta.setLore(NewLore); + newarmor.setItemMeta(newarmor_meta); + result.setResult(newarmor); + } + } else + if (result.getResult().getType()==Material.GOLD_HELMET || + result.getResult().getType()==Material.GOLD_CHESTPLATE || + result.getResult().getType()==Material.GOLD_LEGGINGS || + result.getResult().getType()==Material.GOLD_BOOTS) { + ItemStack[] craftwith = result.getMatrix(); + boolean ingots=true; + for (int i=0;i='a'&&mod[i]<='z') { + mod[i]-=32; + first=true; + } else + if (i==0) { + if (mod[i]>='A'&&mod[i]<='Z') { + first=true; + } + } else { + if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { + first=true; + } + } + } else { + if (mod[i-1]!=' ') { + if (mod[i]>='A'&&mod[i]<='Z') { + mod[i]+=32; + } + } + } + } + newarmor_meta.setDisplayName(String.copyValueOf(mod)); + List NewLore = new ArrayList(); + NewLore.add(ChatColor.RED+"-400% Durability"); + newarmor_meta.setLore(NewLore); + newarmor.setItemMeta(newarmor_meta); + result.setResult(newarmor); + } + } else + if (result.getResult().getType()==Material.DIAMOND_HELMET || + result.getResult().getType()==Material.DIAMOND_CHESTPLATE || + result.getResult().getType()==Material.DIAMOND_LEGGINGS || + result.getResult().getType()==Material.DIAMOND_BOOTS) { + ItemStack[] craftwith = result.getMatrix(); + boolean ingots=true; + for (int i=0;i='a'&&mod[i]<='z') { + mod[i]-=32; + first=true; + } else + if (i==0) { + if (mod[i]>='A'&&mod[i]<='Z') { + first=true; + } + } else { + if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { + first=true; + } + } + } else { + if (mod[i-1]!=' ') { + if (mod[i]>='A'&&mod[i]<='Z') { + mod[i]+=32; + } + } + } + } + newarmor_meta.setDisplayName(String.copyValueOf(mod)); + List NewLore = new ArrayList(); + NewLore.add(ChatColor.RED+"-400% Durability"); + newarmor_meta.setLore(NewLore); + newarmor.setItemMeta(newarmor_meta); + result.setResult(newarmor); + } + } + //It could be with iron, gold, or diamond blocks. Try them out. + /* + boolean iron=false,gold=false,diamond=false; + boolean helmet=false,chestplate=false,leggings=false,boots=false; + ItemStack[] craftwith = result.getMatrix(); + if (craftwith[0].getType()==Material.IRON_BLOCK && + craftwith[1].getType()==Material.IRON_BLOCK && + craftwith[2].getType()==Material.IRON_BLOCK && + craftwith[3].getType()==Material.IRON_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.IRON_BLOCK && + craftwith[6].getType()==Material.IRON_BLOCK && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.IRON_BLOCK) { + ItemStack newarmor = new ItemStack(Material.IRON_LEGGINGS); + result.setResult(newarmor); + } else + if (craftwith[0].getType()==Material.IRON_BLOCK && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.IRON_BLOCK && + craftwith[3].getType()==Material.IRON_BLOCK && + craftwith[4].getType()==Material.IRON_BLOCK && + craftwith[5].getType()==Material.IRON_BLOCK && + craftwith[6].getType()==Material.IRON_BLOCK && + craftwith[7].getType()==Material.IRON_BLOCK && + craftwith[8].getType()==Material.IRON_BLOCK) { + ItemStack newarmor = new ItemStack(Material.IRON_CHESTPLATE); + result.setResult(newarmor); + } else + if ((craftwith[0].getType()==Material.IRON_BLOCK && + craftwith[1].getType()==Material.IRON_BLOCK && + craftwith[2].getType()==Material.IRON_BLOCK && + craftwith[3].getType()==Material.IRON_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.IRON_BLOCK && + craftwith[6].getType()==Material.AIR && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.IRON_BLOCK && + craftwith[4].getType()==Material.IRON_BLOCK && + craftwith[5].getType()==Material.IRON_BLOCK && + craftwith[6].getType()==Material.IRON_BLOCK && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.IRON_BLOCK && + craftwith[0].getType()==Material.AIR && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.AIR)) { + ItemStack newarmor = new ItemStack(Material.IRON_HELMET); + result.setResult(newarmor); + } else + if ((craftwith[0].getType()==Material.IRON_BLOCK && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.IRON_BLOCK && + craftwith[3].getType()==Material.IRON_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.IRON_BLOCK && + craftwith[6].getType()==Material.AIR && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.IRON_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.IRON_BLOCK && + craftwith[6].getType()==Material.IRON_BLOCK && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.IRON_BLOCK && + craftwith[0].getType()==Material.AIR && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.AIR)) { + ItemStack newarmor = new ItemStack(Material.IRON_BOOTS); + result.setResult(newarmor); + } + if (craftwith[0].getType()==Material.GOLD_BLOCK && + craftwith[1].getType()==Material.GOLD_BLOCK && + craftwith[2].getType()==Material.GOLD_BLOCK && + craftwith[3].getType()==Material.GOLD_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.GOLD_BLOCK && + craftwith[6].getType()==Material.GOLD_BLOCK && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.GOLD_BLOCK) { + ItemStack newarmor = new ItemStack(Material.GOLD_LEGGINGS); + result.setResult(newarmor); + } else + if (craftwith[0].getType()==Material.GOLD_BLOCK && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.GOLD_BLOCK && + craftwith[3].getType()==Material.GOLD_BLOCK && + craftwith[4].getType()==Material.GOLD_BLOCK && + craftwith[5].getType()==Material.GOLD_BLOCK && + craftwith[6].getType()==Material.GOLD_BLOCK && + craftwith[7].getType()==Material.GOLD_BLOCK && + craftwith[8].getType()==Material.GOLD_BLOCK) { + ItemStack newarmor = new ItemStack(Material.GOLD_CHESTPLATE); + result.setResult(newarmor); + } else + if ((craftwith[0].getType()==Material.GOLD_BLOCK && + craftwith[1].getType()==Material.GOLD_BLOCK && + craftwith[2].getType()==Material.GOLD_BLOCK && + craftwith[3].getType()==Material.GOLD_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.GOLD_BLOCK && + craftwith[6].getType()==Material.AIR && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.GOLD_BLOCK && + craftwith[4].getType()==Material.GOLD_BLOCK && + craftwith[5].getType()==Material.GOLD_BLOCK && + craftwith[6].getType()==Material.GOLD_BLOCK && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.GOLD_BLOCK && + craftwith[0].getType()==Material.AIR && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.AIR)) { + ItemStack newarmor = new ItemStack(Material.GOLD_HELMET); + result.setResult(newarmor); + } else + if ((craftwith[0].getType()==Material.GOLD_BLOCK && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.GOLD_BLOCK && + craftwith[3].getType()==Material.GOLD_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.GOLD_BLOCK && + craftwith[6].getType()==Material.AIR && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.GOLD_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.GOLD_BLOCK && + craftwith[6].getType()==Material.GOLD_BLOCK && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.GOLD_BLOCK && + craftwith[0].getType()==Material.AIR && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.AIR)) { + ItemStack newarmor = new ItemStack(Material.GOLD_BOOTS); + result.setResult(newarmor); + } + if (craftwith[0].getType()==Material.DIAMOND_BLOCK && + craftwith[1].getType()==Material.DIAMOND_BLOCK && + craftwith[2].getType()==Material.DIAMOND_BLOCK && + craftwith[3].getType()==Material.DIAMOND_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.DIAMOND_BLOCK && + craftwith[6].getType()==Material.DIAMOND_BLOCK && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.DIAMOND_BLOCK) { + ItemStack newarmor = new ItemStack(Material.DIAMOND_LEGGINGS); + result.setResult(newarmor); + } else + if (craftwith[0].getType()==Material.DIAMOND_BLOCK && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.DIAMOND_BLOCK && + craftwith[3].getType()==Material.DIAMOND_BLOCK && + craftwith[4].getType()==Material.DIAMOND_BLOCK && + craftwith[5].getType()==Material.DIAMOND_BLOCK && + craftwith[6].getType()==Material.DIAMOND_BLOCK && + craftwith[7].getType()==Material.DIAMOND_BLOCK && + craftwith[8].getType()==Material.DIAMOND_BLOCK) { + ItemStack newarmor = new ItemStack(Material.DIAMOND_CHESTPLATE); + result.setResult(newarmor); + } else + if ((craftwith[0].getType()==Material.DIAMOND_BLOCK && + craftwith[1].getType()==Material.DIAMOND_BLOCK && + craftwith[2].getType()==Material.DIAMOND_BLOCK && + craftwith[3].getType()==Material.DIAMOND_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.DIAMOND_BLOCK && + craftwith[6].getType()==Material.AIR && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.DIAMOND_BLOCK && + craftwith[4].getType()==Material.DIAMOND_BLOCK && + craftwith[5].getType()==Material.DIAMOND_BLOCK && + craftwith[6].getType()==Material.DIAMOND_BLOCK && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.DIAMOND_BLOCK && + craftwith[0].getType()==Material.AIR && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.AIR)) { + ItemStack newarmor = new ItemStack(Material.DIAMOND_HELMET); + result.setResult(newarmor); + } else + if ((craftwith[0].getType()==Material.DIAMOND_BLOCK && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.DIAMOND_BLOCK && + craftwith[3].getType()==Material.DIAMOND_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.DIAMOND_BLOCK && + craftwith[6].getType()==Material.AIR && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.AIR) || (craftwith[3].getType()==Material.DIAMOND_BLOCK && + craftwith[4].getType()==Material.AIR && + craftwith[5].getType()==Material.DIAMOND_BLOCK && + craftwith[6].getType()==Material.DIAMOND_BLOCK && + craftwith[7].getType()==Material.AIR && + craftwith[8].getType()==Material.DIAMOND_BLOCK && + craftwith[0].getType()==Material.AIR && + craftwith[1].getType()==Material.AIR && + craftwith[2].getType()==Material.AIR)) { + ItemStack newarmor = new ItemStack(Material.DIAMOND_BOOTS); + result.setResult(newarmor); + } + */ + } + + @EventHandler + public void onItemCraft(CraftItemEvent e) { + //This is something we just crafted. + //Bukkit.getPlayer("sigonasr2").sendMessage("Resulting item is "+result.getResult().getAmount()+" "+result.getResult().getType()); + CraftingInventory result = e.getInventory(); + //Bukkit.getPlayer("sigonasr2").sendMessage("Resulting item is "+result.getResult().getAmount()+" "+result.getResult().getType()); + Player p = Bukkit.getPlayer(e.getWhoClicked().getName()); + if (this.plugin.PlayerinJob(p,"Weaponsmith")) { + boolean crafteditem=false; + if (result.getResult().getType()==Material.ARROW) { + crafteditem=true; + } + if (result.getResult().getType()==Material.WOOD_SWORD) { + crafteditem=true; + } + if (result.getResult().getType()==Material.FLINT_AND_STEEL) { + crafteditem=true; + } + if (result.getResult().getType()==Material.BOW) { + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_SWORD) { + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_SWORD) { + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_SWORD) { + crafteditem=true; + } + if (this.plugin.getJobLv("Weaponsmith", p)>=20) { + ItemStack[] crafteditems = result.getMatrix(); + for (int i=0;i=5) { + ItemStack[] crafteditems = result.getMatrix(); + for (int i=0;i=10 && crafteditem) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); + ItemStack resulting = this.plugin.EnchantItem(result.getResult(),10); + result.setResult(resulting); + } + } + if (this.plugin.PlayerinJob(p,"Blacksmith")) { + boolean crafteditem=false; + if (result.getResult().getType()==Material.STONE_HOE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.04,7); + crafteditem=true; + } + if (result.getResult().getType()==Material.STONE_SPADE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.05,8); + crafteditem=true; + } + if (result.getResult().getType()==Material.STONE_PICKAXE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.075,15); + crafteditem=true; + } + if (result.getResult().getType()==Material.LEATHER_BOOTS) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.125,8); + crafteditem=true; + } + if (result.getResult().getType()==Material.LEATHER_HELMET) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.15,14); + crafteditem=true; + } + if (result.getResult().getType()==Material.LEATHER_LEGGINGS) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.175,15); + crafteditem=true; + } + if (result.getResult().getType()==Material.LEATHER_CHESTPLATE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.20,18); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_SPADE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.25,18); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_HOE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.325,24); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_BOOTS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",0.375*mult,27*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_PICKAXE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.40,30); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_HELMET) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",0.50*mult,45*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_SPADE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.625,55); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_HOE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.65,60); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_LEGGINGS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",0.725*mult,60*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_SPADE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.75,65); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_HOE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.80,70); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_BOOTS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",0.825*mult,50*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_CHESTPLATE) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",0.875*mult,70*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_HELMET) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",0.925*mult,80*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_PICKAXE) { + //this.plugin.gainMoneyExp(p,"Blacksmith",0.925,80); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_BOOTS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",1.00*mult,85*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_LEGGINGS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",1.025*mult,100*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_CHESTPLATE) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult,130*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_HELMET) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult,125*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_LEGGINGS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",1.325*mult,145*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_CHESTPLATE) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + //this.plugin.gainMoneyExp(p,"Blacksmith",1.50*mult,175*mult); + crafteditem=true; + } + if (this.plugin.getJobLv("Blacksmith", p)>=5 && crafteditem) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); + ItemStack resulting = this.plugin.EnchantItem(result.getResult(),5); + result.setResult(resulting); + } + if (this.plugin.getJobLv("Blacksmith", p)>=10 && crafteditem) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); + ItemStack resulting = this.plugin.EnchantItem(result.getResult(),10); + result.setResult(resulting); + } + if (this.plugin.getJobLv("Blacksmith", p)>=20) { + ItemStack[] crafteditems = result.getMatrix(); + for (int i=0;i=20) { + ItemStack[] crafteditems = result.getMatrix(); + for (int i=0;i=5) { + ItemStack[] crafteditems = result.getMatrix(); + for (int i=0;i=10 && crafteditem) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); + ItemStack resulting = this.plugin.EnchantItem(result.getResult(),10); + result.setResult(resulting); + } + } + if (this.plugin.PlayerinJob(p,"Blacksmith")) { + boolean crafteditem=false; + if (result.getResult().getType()==Material.STONE_HOE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.04,7); + crafteditem=true; + } + if (result.getResult().getType()==Material.STONE_SPADE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.05,8); + crafteditem=true; + } + if (result.getResult().getType()==Material.STONE_PICKAXE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.075,15); + crafteditem=true; + } + if (result.getResult().getType()==Material.LEATHER_BOOTS) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.125,8); + crafteditem=true; + } + if (result.getResult().getType()==Material.LEATHER_HELMET) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.15,14); + crafteditem=true; + } + if (result.getResult().getType()==Material.LEATHER_LEGGINGS) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.175,15); + crafteditem=true; + } + if (result.getResult().getType()==Material.LEATHER_CHESTPLATE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.20,18); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_SPADE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.25,18); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_HOE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.325,24); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_BOOTS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.375*mult,27*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_PICKAXE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.40,30); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_HELMET) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.50*mult,45*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_SPADE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.625,55); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_HOE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.65,60); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_LEGGINGS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.725*mult,60*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_SPADE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.75,65); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_HOE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.80,70); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_BOOTS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.825*mult,50*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.IRON_CHESTPLATE) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.875*mult,70*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_HELMET) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.925*mult,80*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_PICKAXE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.925,80); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_BOOTS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.00*mult,85*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_LEGGINGS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.025*mult,100*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.GOLD_CHESTPLATE) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult,130*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_HELMET) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult,125*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_LEGGINGS) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.325*mult,145*mult); + crafteditem=true; + } + if (result.getResult().getType()==Material.DIAMOND_CHESTPLATE) { + int mult=1; + if ((result.getResult().getItemMeta().getDisplayName()!=null && !result.getResult().getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || result.getResult().getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.50*mult,175*mult); + crafteditem=true; + } + if (this.plugin.getJobLv("Blacksmith", p)>=5 && crafteditem) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); + ItemStack resulting = this.plugin.EnchantItem(result.getResult(),5); + result.setResult(resulting); + } + if (this.plugin.getJobLv("Blacksmith", p)>=10 && crafteditem) { + //Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant."); + ItemStack resulting = this.plugin.EnchantItem(result.getResult(),10); + result.setResult(resulting); + } + if (this.plugin.getJobLv("Blacksmith", p)>=20) { + ItemStack[] crafteditems = result.getMatrix(); + for (int i=0;i=10 && crafteditem==true) { + ItemStack resultingitem = result.getResult(); + resultingitem.setAmount(resultingitem.getAmount()*2); + } + } + if (this.plugin.PlayerinJob(p,"Support")) { + if (result.getResult().getType()==Material.BREAD) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getResult().getType()==Material.MUSHROOM_SOUP) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getResult().getType()==Material.COOKIE) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getResult().getType()==Material.GOLDEN_CARROT) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getResult().getType()==Material.GOLDEN_APPLE) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getResult().getType()==Material.PUMPKIN_PIE) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getResult().getType()==Material.CAKE) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getResult().getType()==Material.IRON_SWORD) { + this.plugin.gainMoneyExp(p,"Support",0.015,3); + } + if (result.getResult().getType()==Material.IRON_CHESTPLATE || result.getResult().getType()==Material.IRON_HELMET || result.getResult().getType()==Material.IRON_BOOTS || result.getResult().getType()==Material.IRON_LEGGINGS) { + this.plugin.gainMoneyExp(p,"Support",0.025,5); + } + if (result.getResult().getType()==Material.DIAMOND_SWORD) { + this.plugin.gainMoneyExp(p,"Support",0.075,8); + } + if (result.getResult().getType()==Material.DIAMOND_CHESTPLATE || result.getResult().getType()==Material.DIAMOND_HELMET || result.getResult().getType()==Material.DIAMOND_BOOTS || result.getResult().getType()==Material.DIAMOND_LEGGINGS) { + this.plugin.gainMoneyExp(p,"Support",0.20,20); + } + if (result.getResult().getType()==Material.CAKE) { + this.plugin.gainMoneyExp(p,"Support",0.03,2); + } + } + */ + } + + /*@EventHandler + public void onFurnaceGet(FurnaceExtractEvent e) { + Player p = e.getPlayer(); + Bukkit.getPlayer("sigonasr2").sendMessage("Extacting "+e.getItemAmount()+" "+e.getItemType()); + }*/ + @EventHandler + public void onLeafDecay(LeavesDecayEvent e) { + Player[] list = Bukkit.getOnlinePlayers(); + for (int i=0;i=20) { + //Increase sapling drops by 64%. + if (e.getBlock().getData()!=3) { + //This is not a jungle leaf block. + if (Math.random()*100<=25) { + //Produce a sapling. + Bukkit.getWorld("world").dropItem(e.getBlock().getLocation(), new ItemStack(Material.SAPLING,1,e.getBlock().getData())); + //list[i].sendMessage("You got an extra spawned sapling."); + } + } else { + if (Math.random()*100<=12.5) { + //Produce a sapling. + Bukkit.getWorld("world").dropItem(e.getBlock().getLocation(), new ItemStack(Material.SAPLING,1,e.getBlock().getData())); + } + } + } else + if (this.plugin.PlayerinJob(list[i], "Woodcutter") && this.plugin.getJobLv("Woodcutter", list[i])>=5) { + //Increase sapling drops by 40%. + if (e.getBlock().getData()!=3) { + //This is not a jungle leaf block. + if (Math.random()*100<=12) { + //Produce a sapling. + Bukkit.getWorld("world").dropItem(e.getBlock().getLocation(), new ItemStack(Material.SAPLING,1,e.getBlock().getData())); + //list[i].sendMessage("You got an extra spawned sapling."); + } + } else { + if (Math.random()*100<=6) { + //Produce a sapling. + Bukkit.getWorld("world").dropItem(e.getBlock().getLocation(), new ItemStack(Material.SAPLING,1,e.getBlock().getData())); + } + } + } + } + } + } + + @EventHandler + public void onItemChange(PlayerItemHeldEvent e) { + Player p = e.getPlayer(); + if (this.plugin.PlayerinJob(p, "Miner") && this.plugin.getJobLv("Miner", p)>=20) { + if (p.getInventory().getContents()[e.getNewSlot()]!=null && + (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_PICKAXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_PICKAXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_PICKAXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_PICKAXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_PICKAXE)) { + ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; + if (!currentitem.containsEnchantment(Enchantment.getByName("DIG_SPEED"))) { + currentitem.addEnchantment(Enchantment.getByName("DIG_SPEED"), 2); + } else { + //if (currentitem.getEnchantmentLevel()) + } + } + } else + if (this.plugin.PlayerinJob(p, "Miner") && this.plugin.getJobLv("Miner", p)>=5) { + if (p.getInventory().getContents()[e.getNewSlot()]!=null && + (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_PICKAXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_PICKAXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_PICKAXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_PICKAXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_PICKAXE)) { + ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; + if (!currentitem.containsEnchantment(Enchantment.getByName("DIG_SPEED"))) { + currentitem.addEnchantment(Enchantment.getByName("DIG_SPEED"), 1); + } + } + } + if (this.plugin.PlayerinJob(p, "Digger") && this.plugin.getJobLv("Digger", p)>=5) { + if (p.getInventory().getContents()[e.getNewSlot()]!=null && + (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_SPADE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_SPADE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_SPADE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_SPADE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_SPADE)) { + ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; + if (!currentitem.containsEnchantment(Enchantment.getByName("DIG_SPEED"))) { + currentitem.addEnchantment(Enchantment.getByName("DIG_SPEED"), 1); + } + } + } else + if (this.plugin.PlayerinJob(p, "Digger") && this.plugin.getJobLv("Digger", p)>=20) { + if (p.getInventory().getContents()[e.getNewSlot()]!=null && + (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_SPADE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_SPADE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_SPADE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_SPADE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_SPADE)) { + ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; + if (!currentitem.containsEnchantment(Enchantment.getByName("DIG_SPEED"))) { + currentitem.addEnchantment(Enchantment.getByName("DIG_SPEED"), 2); + } + } + } + if (this.plugin.PlayerinJob(p, "Hunter") && this.plugin.getJobLv("Hunter", p)>=20) { + if (p.getInventory().getContents()[e.getNewSlot()]!=null && + (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_SWORD || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_SWORD || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_SWORD || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_SWORD || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_SWORD)) { + ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; + if (!currentitem.containsEnchantment(Enchantment.getByName("FIRE_ASPECT"))) { + currentitem.addEnchantment(Enchantment.getByName("FIRE_ASPECT"), 2); + } + } + } + if (this.plugin.PlayerinJob(p, "Woodcutter") && this.plugin.getJobLv("Woodcutter", p)>=10) { + if (p.getInventory().getContents()[e.getNewSlot()]!=null && + (p.getInventory().getContents()[e.getNewSlot()].getType()==Material.WOOD_AXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.IRON_AXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.GOLD_AXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.DIAMOND_AXE || + p.getInventory().getContents()[e.getNewSlot()].getType()==Material.STONE_AXE)) { + ItemStack currentitem = p.getInventory().getContents()[e.getNewSlot()]; + if (!currentitem.containsEnchantment(Enchantment.getByName("DIG_SPEED"))) { + currentitem.addEnchantment(Enchantment.getByName("DIG_SPEED"), 1); + } + } + } + } + +public ItemStack getGoodie() { + ItemStack item = null; + if (Math.random()<0.33) { + //Add a weapon/armor piece. + int rand = (int)(Math.random()*5); + String type = ""; + String type2 = ""; + switch (rand) { + case 0: { + type = "LEATHER"; + }break; + case 1: { + type = "IRON"; + }break; + case 2: { + type = "GOLD"; + }break; + case 3: { + type = "CHAINMAIL"; + }break; + case 4: { + type = "DIAMOND"; + }break; + } + if (rand!=0 && rand!=3) { + rand = (int)(Math.random()*9); + type2 = ""; + switch (rand) { + case 0: { + type2 = "HELMET"; + }break; + case 1: { + type2 = "CHESTPLATE"; + }break; + case 2: { + type2 = "LEGGINGS"; + }break; + case 3: { + type2 = "BOOTS"; + }break; + case 4: { + type2 = "SWORD"; + }break; + case 5: { + type2 = "PICKAXE"; + }break; + case 6: { + type2 = "SPADE"; + }break; + case 7: { + type2 = "HOE"; + }break; + case 8: { + type2 = "AXE"; + }break; + } + } else { + rand = (int)(Math.random()*5); + type2 = ""; + switch (rand) { + case 0: { + type2 = "HELMET"; + }break; + case 1: { + type2 = "CHESTPLATE"; + }break; + case 2: { + type2 = "LEGGINGS"; + }break; + case 3: { + type2 = "BOOTS"; + }break; + case 4: { + type2 = "BOW"; + }break; + } + } + if (type2.equalsIgnoreCase("BOW")) { + item = new ItemStack(Material.BOW); + int enchants[] = {48,49,50,51}; + for (int j=0;j ourLore = new ArrayList(); + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Critical Chance"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*3)+1)+" "+ChatColor.BLUE+"Armor Penetration"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Life Steal"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+1)+"% "+ChatColor.BLUE+"Attack Speed"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*5)+1)+" "+ChatColor.BLUE+"Damage"); + } + ItemMeta meta = item.getItemMeta(); + meta.setLore(ourLore); + item.setItemMeta(meta); + } else { + item = new ItemStack(Material.getMaterial(type+"_"+type2)); + if (type2.equalsIgnoreCase("SWORD")) { + int enchants[] = {16,17,18,19,20,21,34}; + for (int j=0;j ourLore = new ArrayList(); + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Critical Chance"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*3)+1)+" "+ChatColor.BLUE+"Armor Penetration"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Life Steal"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+1)+"% "+ChatColor.BLUE+"Attack Speed"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*5)+1)+" "+ChatColor.BLUE+"Damage"); + } + ItemMeta meta = item.getItemMeta(); + meta.setLore(ourLore); + item.setItemMeta(meta); + } else if (type2.equalsIgnoreCase("SPADE") || type2.equalsIgnoreCase("PICKAXE") || type2.equalsIgnoreCase("HOE") || type2.equalsIgnoreCase("AXE")) { + int enchants[] = {32,33,34,35}; + for (int j=0;j ourLore = new ArrayList(); + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Critical Chance"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*3)+1)+" "+ChatColor.BLUE+"Armor Penetration"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Life Steal"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+1)+"% "+ChatColor.BLUE+"Attack Speed"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*5)+1)+" "+ChatColor.BLUE+"Damage"); + } + ItemMeta meta = item.getItemMeta(); + meta.setLore(ourLore); + item.setItemMeta(meta); + } else { + int enchants[] = {0,1,2,3,4,5,6,7,34}; + for (int j=0;j ourLore = new ArrayList(); + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*4)+1)+" "+ChatColor.BLUE+"Health"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Damage Reduction"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+1)*10)+"% "+ChatColor.BLUE+"Durability"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Block Chance"); + } + if (Math.random()<=0.2) { + ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Speed Boost Chance"); + } + ItemMeta meta = item.getItemMeta(); + meta.setLore(ourLore); + item.setItemMeta(meta); + } + } + } else { + //Add minerals. + int rand = (int)(Math.random()*9); + switch (rand) { + case 0 :{ + item = new ItemStack(Material.IRON_INGOT,(int)(Math.random()*40)+20); + }break; + case 1 :{ + item = new ItemStack(Material.IRON_BLOCK,(int)(Math.random()*4)+2); + }break; + case 2 :{ + item = new ItemStack(Material.GOLD_INGOT,(int)(Math.random()*20)+10); + }break; + case 3 :{ + item = new ItemStack(Material.GOLD_BLOCK,(int)(Math.random()*2)+1); + }break; + case 4 :{ + item = new ItemStack(Material.LAPIS_BLOCK,(int)(Math.random()*40)+20); + }break; + case 5 :{ + item = new ItemStack(Material.REDSTONE_BLOCK,(int)(Math.random()*25)+5); + }break; + case 6 :{ + item = new ItemStack(Material.DIAMOND,(int)(Math.random()*4)+1); + }break; + case 7 :{ + item = new ItemStack(Material.DIAMOND_BLOCK,(int)(Math.random()*2)+1); + }break; + case 8 :{ + item = new ItemStack(Material.EMERALD,(int)(Math.random()*2)+1); + }break; + } + } + return item; +} + + @EventHandler + public void onEnemyKill(EntityDeathEvent e) { + if (e.getEntity().getType()==EntityType.SQUID || e.getEntity().getType()==EntityType.SLIME || e.getEntity().getType()==EntityType.ZOMBIE || e.getEntity().getType()==EntityType.SPIDER || e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.CREEPER + || e.getEntity().getType()==EntityType.PIG_ZOMBIE || e.getEntity().getType()==EntityType.GHAST || e.getEntity().getType()==EntityType.ENDERMAN || e.getEntity().getType()==EntityType.BLAZE + || e.getEntity().getType()==EntityType.ENDER_DRAGON || e.getEntity().getType()==EntityType.WITHER || e.getEntity().getType()==EntityType.CHICKEN || e.getEntity().getType()==EntityType.SHEEP + || 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 (Math.random()<=0.005) { + /* + if (Math.random()<=0.005) { + //0.5% chance of a mystical book dropping. + if (f.getKiller()!=null) { + ItemStack book = new ItemStack(Material.WRITTEN_BOOK); + BookMeta bookdata = (BookMeta)book.getItemMeta(); + int choosebook = (int)(Math.random()*9.0d); + switch (choosebook) { + case 0:{ + bookdata.setAuthor("Steve"); + bookdata.setTitle("Dangers of the Nether"); + bookdata.addPage("Dangers of the Nether\n"+ChatColor.ITALIC+" by Steve\n======\n"+ChatColor.RESET+"It didn't take me long to realize where we were. It was dangerous, very hot, and lots of torturous screams could be heard everywhere. I barely had time","to take it all in before a huge fireball was shot in my direction. I quickly looked to my side to find a convenient safe passage and hid there for a few minutes. I guess I was in there longer than I thought, I ended","up falling asleep and waking up to notice there was something scary on the wall.\n\n"+ChatColor.ITALIC+"\"TURN AND LEAVE NOW. DANGEROUS TO STAY. REAL WORLD HAS WHAT YOU ARE LOOKING FOR. I ONLY REMEMBER THE 1ST X POSITION...",ChatColor.ITALIC+"...IT WAS 7! I AM *POSITIVE*\""+ChatColor.RESET+"\n\nI did not know what to think. The 1st X position? I quickly remembered the 7 and sprinted out of the nether portal. And to think that was *THE END* of my adventures..."); + }break; + case 1:{ + bookdata.setAuthor("Lacey"); + bookdata.setTitle("A Hole in the Flower Garden"); + bookdata.addPage("A Hole in the Flower Garden\n"+ChatColor.ITALIC+" by Lacey\n======\n"+ChatColor.RESET+"It was a lovely day to pick flowers in the garden, they just finished blooming fully. I was so excited to pick them, but I didn't do so until","after I've taken in all the wonderful scents! Smelling all the flowers and wonderful smells of plants and trees and nature and grass. It was perfect. I was mindlessly walking along this prairie when I stumbled.","I fell, and fell, and fell. I hit the bottom of a ravine. It didn't even occur to me I would just walk into one. I took some minor damage, but when I got up, I noticed something strange.","There were two or three zombies gathered around a wall, etching something into it. I went over to read it once the zombies walked away. I saw on the wall:\n\n"+ChatColor.ITALIC+"X-2:6 <--END","It looked cryptic to me, but why would they write that on the wall? I quickly scribbled it down on a notepad I had in my pocket and started climbing out of the ravine to tend to my lovely flowers. What a day!"); + }break; + case 2:{ + bookdata.setAuthor("Jimmy"); + bookdata.setTitle("Messages in Music"); + bookdata.addPage("Messages in Music\n"+ChatColor.ITALIC+" by Jim"+"\n======"+ChatColor.RESET+"\nI popped out the disk from my Jukebox to put in another, I could jam to these all day! As I was looking through my collection for something to listen to","I found a really bent up disk. 'No way this could still play', I thought to myself. I put it in, and it crackled and snarled, but it was indeed playing! At first I heard some faint resemblence of music, but then suddenly,","a hiss, an explosion, and then 'CREEEEEEEEE----- 7X XSSSSSSSSSS 3RD EEEEEEE' mental images appeared in my head, but the 7X and 3RD stood out the most. It's like I was seeing them in my head while hearing something else!","I couldn't stand up anymore, or think. I forcibly reached up with my weak hand to find the eject button on the player and when I found the familiar nub in the button, pressed down on it and out popped the disk, hitting my face,","but putting me back into reality. Something was telling me that the 3RD and 7X was important. But I couldn't quite put my tongue on it."); + }break; + case 3:{ + bookdata.setAuthor("Creeper"); + bookdata.setTitle("HISS"); + bookdata.addPage("Y do i exisssst. nobody knowssss. i just want a hugssssss, HUGSSSSSSS. but i don't know Y i exist. there's no Y in the first position. it'sssss jusssst two digitssssss.... SSSSSSSSS. *THE END*"); + }break; + case 4:{ + bookdata.setAuthor("Marco"); + bookdata.setTitle("The Hunt for a Dragon"); + bookdata.addPage("The Hunt for a Dragon\n"+ChatColor.ITALIC+" by Marco"+"\n======"+ChatColor.RESET+"\nThere exists a rumor that a mythical dragon could be found in the depths of our world. It is even said he doesn't exist in OUR world, but ANOTHER world altogether!","That my friends already boggles me, but where the heck would I go to find it then? I have been told he exists, and I know he is. I believe deep in my heart. I searched day and night under and over ground.","One day I found something strange in the ground. It was pink wool, in the middle of a cave on the ground. It even said something, but I couldn't tell from so close up. So I literally dug all the way to the surface, keeping the boundaries","of that word uncovered the whole way up. When I got to the top and looked down, I was relieved to find it was made out of markings I could discern. It said: 'Y: X3?' It was definitely a weird group of symbols, but I have a strong feeling"," that it is directly linked with that dragon I am trying to hunt down. Maybe I can gather more clues and try to decipher the location of this thing."); + }break; + case 5:{ + bookdata.setAuthor("Steve"); + bookdata.setTitle("Cooking Food"); + bookdata.addPage("Cooking Food\n"+ChatColor.ITALIC+" by Steve"+"\n======"+ChatColor.RESET+"\nIt was a bright and rather typical sunny day in the Minecraft world. I don't actually think it was very hot either. I just managed to catch a few fish and was cooking them up.","It wasn't long before I got distracted and heard a funny noise. It was an ocelote. Lucky me, an ocelote has smelled the scent of my fish! I grab a few and hold it out for the ocelote. It slowly creeps over, and then takes it and runs from me.","I thought it was full and finished cooking the rest of the fish. However, the ocelote returned a few minutes later with a neatly-folded piece of paper in its mouth. It came up to me and set it down, like it was some message just for me.","I opened it up and it read:\n\n"+ChatColor.ITALIC+"Don't let the fish get to your tongue! If you know what's wise, you will investigate further. The 3rd position of Y being the number 5."+ChatColor.RESET+"\n\n","I didn't notice the ocelote run away, but I knew something FISHY was going on. That message seemed important for some reason, I've seen similar cryptic messages before... Perhaps I'll hold onto this in case I need it in the future."); + }break; + case 6:{ + bookdata.setAuthor("Fredric"); + bookdata.setTitle("Math Behind the Void"); + bookdata.addPage("Math Behind the Void\n"+ChatColor.ITALIC+" by Fredric"+"\n======"+ChatColor.RESET+"\nThis book describes a few principles that the void in this world follows. While no one has actually seen the void, we have found a few theories and rules regarding them.","1. The Void has a Light Level of -14. The Void actually absorbs light coming from light sources and thus, if The Void is ever opened to the real world, would suck up the light from it.","2. The Void always has a volume of 50,000m, being 50m x 20m x 50m. This means that The Void, regardless of location is always the same exact size. This would conclude to us that The Void is co-existing and multiple instaces of it may exist in the same realm.","3. Any Entity entering The Void will not be able to escape The Void as time passes much more quickly inside The Void. This means Entities that enter The Void feel accelerated processes and cannot combat it, since the time outside is behind them.","4. A point of connection between The Void and other dimensions has to exist, for The Void to exist. Speculation has it that one of these points has been leaked into the world, and is accessible by us directly. After further research,","we have learned that one of these points is located on the 1st respective numeral along our Z axis with the number 4. It has also been proven that this number has to be negative as the other two sources interacting with The Void are positive."); + }break; + case 7:{ + bookdata.setAuthor("Robert"); + bookdata.setTitle("TNT"); + bookdata.addPage("TNT\n"+ChatColor.ITALIC+" by Robert"+"\n======"+ChatColor.RESET+"\nYou know, the easiest way to clear a tunnel is using an item called TNT. It is a rather small block, but it is loaded with gunpowder. When lit by an external force, it ignites","with the force of 5 Creeper explosions to clear whole caves out. Well lo and behold one day I discovered a rather strange abandoned mineshaft. It wasn't normal for sure, because there were green vines everywhere and lots of strange doors.","It was like somebody lived here ages ago, and I am discovering the ruins of such a place. Inoperable levers, a few mobs I have to kill here and there that have made this area their designated home. It was a mess. But I did discover that","someone was trying to find what we would call 'The End'. It's a magical place, and I believe with the right amount of effort, we can find it someday too. He had scribbled the coordinates of the location he was trying to reach.","However, most of it is faded out and I can only tell faintly the remains of it: \n\n"+ChatColor.ITALIC+"X:---\nY:---\nZ:--7-"+ChatColor.RESET+"\n\nYep, that's about it.","Hopefully by me recording this data, someone else can fill in the remaining numbers and we can all find The End together. Someday..."); + }break; + case 8:{ + bookdata.setAuthor("Joshua"); + bookdata.setTitle("Fourside"); + bookdata.addPage("Fourside\n"+ChatColor.ITALIC+" by Joshua"+"\n======"+ChatColor.RESET+"\n"+ChatColor.DARK_BLUE+"ABANDONED PROJECT"+ChatColor.RESET+". A city that would be developed with the best technology and the highest standards. It would","succeed every single Minecraft city that has ever been built. Casinos, diamond-lined walkways, towering skyscrapers as far as the eye can see. Museums, Libraries, Educational Institutions. This mega-city would be able to hold","and sustain every single Minecrafter in existence. But no, something went terribly wrong. Our engineering team finally developed the perfect transportation system and we were wiring it up to our fusion power plant.","Something went horribly wrong. The Fusion power plant started self-combusting itself, leaving behind hyper-cold atoms. This caused nucleic waste to interact with the environment around itself and freezing the whole world as we knew it.","The city idea as we knew it was scrapped, and we would wait 2000 years before we could attempt this again. We wrote plans for a much more portable solution and have named it 'Twoside' and archived it appropriately.","Maybe someone will pick up that book and be able to make the future bright with a mini version of Fourside. That being said, we left the 3rd slot of the Z position of our city at 7. This should give you enough clue as to where NOT to build."); + }break; + } + book.setItemMeta(bookdata); + //p.setItemInHand(book); + f.getKiller().getInventory().addItem(book); + f.getKiller().updateInventory(); + f.getKiller().sendMessage(ChatColor.LIGHT_PURPLE+"You feel a magical presence get inserted into your inventory."); + } + }*/ + } + if (f.getCustomName()!=null) { + if (f.getCustomName().contains("Strong")) { + e.setDroppedExp(e.getDroppedExp()*2); + } + if (f.getCustomName().contains("II")) { + e.setDroppedExp(e.getDroppedExp()*2); + } + if (f.getCustomName().contains("Venomous")) { + e.setDroppedExp(e.getDroppedExp()*2); + } + if (f.getCustomName().contains("Snaring")) { + e.setDroppedExp(e.getDroppedExp()*2); + } + if (f.getCustomName().contains("Charge")) { + e.setDroppedExp(e.getDroppedExp()*2); + } + if (f.getCustomName().contains("Explosive")) { + e.setDroppedExp(e.getDroppedExp()*2); + } + if (f.getCustomName().contains("Destructive")) { + e.setDroppedExp(e.getDroppedExp()*2); + } + if (f.getCustomName().contains("Sniper")) { + e.setDroppedExp(e.getDroppedExp()*2); + } + if (f.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { + e.setDroppedExp(e.getDroppedExp()*20); + f.setHealth(0); + this.plugin.BOSS_DEFEAT=100; + this.plugin.BOSS_DEFEAT_LOC=f.getLocation(); + //Create a chest at the death spot. + Bukkit.getWorld("world").getBlockAt(f.getLocation()).setType(Material.CHEST); + Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(f.getLocation()).getState(); + for (int i=0;i<27;i++) { + ItemStack item = null; + if (Math.random()<=0.3) { + item = getGoodie(); + c.getBlockInventory().setItem(i, item); + } + } + } + } + if (this.plugin.getAccountsConfig().getBoolean("halloween-enabled")) { + e.setDroppedExp(e.getDroppedExp()*2); + } + if (f.getKiller()!=null && f.getKiller().getType()==EntityType.PLAYER) { + Player p = f.getKiller(); + for (int x=-10;x<10;x++) { + for (int y=-3;y<3;y++) { + for (int z=-10;z<10;z++) { + if (f.getWorld().getBlockAt(f.getLocation().add(x,y,z)).getType()==Material.MOB_SPAWNER) { + //This is near a spawner. Do not drop exp orbs or items. + List drops = e.getDrops(); + for (int i=0;i=5) { + e.setDroppedExp(e.getDroppedExp()*2); + } + p.giveExp(e.getDroppedExp()); + if (e.getDroppedExp()!=0) { + p.playSound(p.getLocation(), Sound.ORB_PICKUP, 0.9f, 1); + } + //p.sendMessage(f.getType()+" is mad at you."); + if (!this.plugin.PlayerinJob(p, "Support")) { + //Make sure a support did not kill it. + for (int i=0;i=10) { + List drops = e.getDrops(); + for (int i=0;i0) { + ItemStack reward = getGoodie(); + Bukkit.getWorld("world").dropItemNaturally(s.getLocation(), reward); + times--; + } + } + } + } + e.setDroppedExp(0); + /* + if (f.getType()==EntityType.PLAYER) { + Player p = (Player)f; + Bukkit.getPlayer("sigonasr2").sendMessage("EXP Lost: "+p.get); + if (this.plugin.PlayerinJob(p, "Explorer")) { + if (this.plugin.getJobLv("Explorer", p)>=10) { + //Don't lose levels. + + } + } + }*/ + } + } + + @EventHandler + public void onFoodLevelChange(FoodLevelChangeEvent e) { + //Check for nearby support. + if (e.getEntity().getType()==EntityType.PLAYER) { + HumanEntity p = (HumanEntity)e.getEntity(); + if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9")>0) { + if (Math.random()<=this.plugin.getStatBonus(8, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat9"))/100.0d) { + e.setFoodLevel(e.getFoodLevel()+1); + } + } + List nearby = p.getNearbyEntities(10, 10, 10); + for (int i=0;i=20) { + if (Math.random()<=0.50) { + e.setFoodLevel(e.getFoodLevel()+1); + } + } + } + } + } + + @EventHandler + public void onBucketEmpty(PlayerBucketEmptyEvent e) { + Player p = e.getPlayer(); + if (e.getBucket()==Material.WATER_BUCKET) { + if (this.plugin.PlayerinJob(p, "Support")) { + //Check if someone's with us. If not, we don't get awarded for supporting. + List nearby = p.getNearbyEntities(10, 20, 10); + boolean playernearby=false; + boolean onfire=false; + for (int i=0;i0 && ((Player)nearby.get(i)).getHealth()<=8) { + //They are on fire, you intend to douse them. + this.plugin.gainMoneyExp(p,"Support",0.60,30); + } + } + } + if (playernearby) { + //Check for lava below. If we find some, award some money and experience. + boolean foundlava=false; + for (int x=-10;x<10;x++) { + for (int y=-20;y<0;y++) { + for (int z=-10;z<10;z++) { + if (Bukkit.getWorld("world").getBlockAt(p.getLocation().getBlockX()+x,p.getLocation().getBlockY()+y,p.getLocation().getBlockZ()+z).getType()==Material.LAVA) { + foundlava=true; + break; + } + } + if (foundlava) { + break; + } + } + if (foundlava) { + break; + } + } + if (foundlava) { + this.plugin.gainMoneyExp(p,"Support",0.05,10); + } + } + } + } + } + + + @EventHandler + public void onLightningStrike(LightningStrikeEvent e) { + if (this.plugin.last_lightning_random_time=5) { + //Half chance to set the durability back by one. + if (p.getItemInHand().getType()==Material.FISHING_ROD) { + if (p.getItemInHand().getDurability()>0) { + if (Math.random()>=0.5) { + p.getItemInHand().setDurability((short)(p.getItemInHand().getDurability()-1)); + } + } + } + } + if (this.plugin.getJobLv("Fisherman", p)>=20) { + e.setExpToDrop(e.getExpToDrop()*2); + int i=4; + while (i>0) { + if (Math.random()<=0.25) { + this.plugin.gainMoneyExp(p,"Fisherman",0.175,3); + if (Math.random()<=0.50) { + p.getInventory().addItem(new ItemStack(Material.COOKED_FISH)); + this.plugin.gainMoneyExp(p,"Fisherman",0.125,2); + } else { + p.getInventory().addItem(new ItemStack(Material.RAW_FISH)); + } + } + i--; + } + } else + if (this.plugin.getJobLv("Fisherman", p)>=10) { + e.setExpToDrop(e.getExpToDrop()*2); + if (Math.random()<=0.25) { + p.getInventory().addItem(new ItemStack(Material.RAW_FISH)); + this.plugin.gainMoneyExp(p,"Fisherman",0.175,3); + } + } + + } + } + } + + @EventHandler + public void onWorldLoad(WorldLoadEvent e) { + /*for (int i=0;i <"+f.getLocation().getY()+"> <"+f.getLocation().getZ()+">"); + f.remove(); + arrows++; + } + } + this.plugin.cleaned=true; + } + if (!e.isNewChunk()) { //Make sure this chunk is an existing one. + //Attempt to load up the custom chunk. + List debugmessages = new ArrayList(); + FileConfiguration customchunk = this.plugin.reloadChunksConfig(e.getChunk().getX(), e.getChunk().getZ()); + if (!customchunk.contains("animal-reset2")) { + customchunk.set("animal-reset2", Long.valueOf(Bukkit.getWorld("world").getFullTime()+17280000)); + Chunk c = e.getChunk(); + Random r = new Random(); + for (int x=0;x<16;x++) { + for (int z=0;z<16;z++) { + if (r.nextDouble()<=0.000244140625) { + Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,Bukkit.getWorld("world").getHighestBlockYAt(x+c.getX()*16, z+c.getZ()*16),z+c.getZ()*16); + if (b.getType()!=Material.WATER && b.getType()!=Material.ICE && b.getType()!=Material.LAVA && !b.getBiome().name().equalsIgnoreCase("ocean") && !b.getBiome().name().equalsIgnoreCase("river")) { + if (b.getType()==Material.SNOW || b.getType()==Material.DIRT || b.getType()==Material.SAND || b.getType()==Material.LEAVES || b.getType()==Material.GRASS || b.getType()==Material.GRAVEL || b.getType()==Material.STONE || b.getType()==Material.COBBLESTONE || b.getType()==Material.MYCEL || b.getType()==Material.BROWN_MUSHROOM || b.getType()==Material.RED_MUSHROOM) { + if (b.getBiome().name().equalsIgnoreCase("plains")) { + //Best place for things to spawn. Any mob type can spawn here. + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.HORSE,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + } else { + if (b.getBiome().name().equalsIgnoreCase("forest")) { + //Wolves can still spawn here. Horses cannot. + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + }else { + if (b.getBiome().name().equalsIgnoreCase("jungle")) { + //Chance to spawn ocelots here. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.OCELOT}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + }else { + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + } + } + } + } + } + } + ////Bukkit.getLogger().info("Biome here is "+b.getBiome().name()); + } + } + } else { + //Check the value and regenerate if necessary. + if (Bukkit.getWorld("world").getFullTime()>customchunk.getLong("animal-reset2")) { + customchunk.set("animal-reset2", Long.valueOf(Bukkit.getWorld("world").getFullTime()+17280000)); + Chunk c = e.getChunk(); + Random r = new Random(); + for (int x=0;x<16;x++) { + for (int z=0;z<16;z++) { + if (r.nextDouble()<=0.000244140625) { + Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,Bukkit.getWorld("world").getHighestBlockYAt(x+c.getX()*16, z+c.getZ()*16),z+c.getZ()*16); + if (b.getType()!=Material.WATER && b.getType()!=Material.ICE && b.getType()!=Material.LAVA && !b.getBiome().name().equalsIgnoreCase("ocean") && !b.getBiome().name().equalsIgnoreCase("river")) { + if (b.getType()==Material.SNOW || b.getType()==Material.DIRT || b.getType()==Material.SAND || b.getType()==Material.LEAVES || b.getType()==Material.GRASS || b.getType()==Material.GRAVEL || b.getType()==Material.STONE || b.getType()==Material.COBBLESTONE || b.getType()==Material.MYCEL || b.getType()==Material.BROWN_MUSHROOM || b.getType()==Material.RED_MUSHROOM) { + if (b.getBiome().name().equalsIgnoreCase("plains")) { + //Best place for things to spawn. Any mob type can spawn here. + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.HORSE,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + } else { + if (b.getBiome().name().equalsIgnoreCase("forest")) { + //Wolves can still spawn here. Horses cannot. + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.WOLF}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + }else { + if (b.getBiome().name().equalsIgnoreCase("jungle")) { + //Chance to spawn ocelots here. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN,EntityType.OCELOT}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + }else { + //Choose a mob type randomly. + EntityType[] mobs = {EntityType.COW,EntityType.PIG,EntityType.SHEEP,EntityType.CHICKEN}; + int i=(int)(Math.random()*4)+2; + EntityType selected = mobs[(int)(mobs.length*Math.random())]; + ////Bukkit.getLogger().info("Spawned "+i+" "+selected.getName()+" in Biome "+b.getBiome().name()+" for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+"."); + debugmessages.add(" Spawned: "+i+" "+selected.getName()); + while (i>0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(b.getLocation().add(Math.random()*10-Math.random()*10,1,Math.random()*10-Math.random()*10), selected); + f.setRemoveWhenFarAway(false); //This should be a permanent mob. + i--; + } + } + } + } + } + } + } + ////Bukkit.getLogger().info("Biome here is "+b.getBiome().name()); + } + } + } + } + if (!customchunk.contains("diamond-generate")) { + customchunk.set("diamond-generate", Boolean.valueOf(true)); + Chunk c = e.getChunk(); + int adddiamond=0; + for (int x=0;x<16;x++) { + for (int y=5;y<25;y++) { + for (int z=0;z<16;z++) { + Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16); + if (b!=null && b.getType()==Material.STONE) { + if (Math.random()<=0.000625) { + int i=(int)(Math.random()*8.0d)+1; + while (i>0) { + Block d = c.getBlock(x+(int)(Math.random()*i)-(int)(Math.random()*i), y+(int)(Math.random()*i)-(int)(Math.random()*i), z+(int)(Math.random()*i)-(int)(Math.random()*i)); + adddiamond++; + b.setType(Material.DIAMOND_ORE); + i--; + } + //Make a patch between 1 and 8. + } + } + } + } + } + ////Bukkit.getLogger().info("Generated "+adddiamond+" new diamonds for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()); + if (adddiamond>0) { + debugmessages.add(" Added "+adddiamond+" diamond"+((adddiamond!=1)?"s":"")+"."); + } + } + if (!customchunk.contains("limit-ore-generation")) { + customchunk.set("limit-ore-generation", Boolean.valueOf(true)); + Chunk c = e.getChunk(); + int removeore=0,totalore=0,newore=0; + for (int x=0;x<16;x++) { + for (int y=5;y<96;y++) { + for (int z=0;z<16;z++) { + Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16); + if (b!=null && (b.getType()==Material.COAL_ORE || + b.getType()==Material.IRON_ORE || + b.getType()==Material.GOLD_ORE || + b.getType()==Material.REDSTONE_ORE || + b.getType()==Material.LAPIS_ORE || + b.getType()==Material.DIAMOND_ORE)) { + if (Math.random()<=0.60) { + removeore++; + b.setType(Material.STONE); + //Make a patch between 1 and 8. + } + totalore++; + } + } + } + } + for (int x=0;x<16;x++) { + for (int y=5;y<96;y++) { + for (int z=0;z<16;z++) { + Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16); + if (b!=null && (b.getType()==Material.COAL_ORE || + b.getType()==Material.IRON_ORE || + b.getType()==Material.GOLD_ORE || + b.getType()==Material.REDSTONE_ORE || + b.getType()==Material.LAPIS_ORE || + b.getType()==Material.DIAMOND_ORE)) { + newore++; + } + } + } + } + ////Bukkit.getLogger().info("Removed "+removeore+"/"+totalore+" ore for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+". There are now "+newore+" ores left."); + debugmessages.add(" Removed: "+removeore+"/"+totalore+" ores."); + } + this.plugin.saveChunksConfig(customchunk, e.getChunk().getX(), e.getChunk().getZ()); + if (debugmessages.size()>0) { + for (int i=0;i newlore = new ArrayList(); + newlore.add("Requires "+((int)(Math.random()*1000)+100)+" Pumpkin Pie in inventory"); + newlore.add("to convert to a legendary equipment item."); + meta.setLore(newlore); + meta.setDisplayName(ChatColor.GREEN+"Magical Pumpkin Pie"); + pump.setItemMeta(meta); + a.addItem(pump); + p.openInventory(a); + } + } + } + } + for (int m=0;m data = p.getInventory().getContents()[m].getItemMeta().getLore(); + //newlore.add("Requires "+((int)(Math.random()*1000)+100)+" Pumpkin Pie in inventory"); + ItemStack magic_pie = null; + for (int i=0;i=pies) { + p.getInventory().remove(magic_pie); + int deductpies=pies; + int itemslot=0; + while (deductpies>0 || itemslot0) { + if (p.getInventory().getItem(itemslot).getType()==Material.PUMPKIN_PIE && p.getInventory().getItem(itemslot).getItemMeta().getDisplayName()==null) { + if (p.getInventory().getItem(itemslot).getAmount()>1) { + p.getInventory().remove(p.getInventory().getItem(itemslot)); + deductpies-=p.getInventory().getItem(itemslot).getAmount(); + } else { + p.getInventory().remove(p.getInventory().getItem(itemslot)); + deductpies-=1; + } + itemslot++; + } else { + itemslot++; + } + } else { + itemslot++; + } + } + /* + for (int i=0;i0) { + if (amountleft>=64) { + p.getInventory().addItem(new ItemStack(Material.PUMPKIN_PIE,64)); + amountleft-=64; + } else { + p.getInventory().addItem(new ItemStack(Material.PUMPKIN_PIE,1)); + amountleft--; + } + }*/ + //Give a legendary armor/weapon here. + //Bukkit.getLogger().info("LEGENDARY!"); + giveLegendaryItem(p); + p.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION,1728000,0)); + p.updateInventory(); + } + } + } + } + } + } + + @EventHandler + public void onHurt(EntityDamageEvent e) { + if (e.getEntity().getType()==EntityType.PLAYER) { + final Player p = (Player)e.getEntity(); + Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { + @Override + public void run() { + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + } + },5); + //p.sendMessage("Your Health: "+p.getHealth()+", Damage: "+e.getDamage()+", Actual: "+this.plugin.DMGCALC.getDamage(p, e.getDamage(), DamageCause.ENTITY_ATTACK)); + double actualdmg = this.plugin.DMGCALC.getDamage(p, e.getDamage(), e.getCause()); + List nearby = p.getNearbyEntities(10, 10, 10); + for (int i=0;i=20) { + //A support with the Lv20 buff is detected. If health is less than 8, take half damage. + if (p.getHealth()<=8) { + e.setDamage(e.getDamage()/2.0d); + } + } + } + if (this.plugin.PlayerinJob(p, "Explorer")) { + if (this.plugin.getJobLv("Explorer", p)>=10) { + //Check to see if our "fatal survivor" effect is available. + boolean survivor=false; + for (int i=0;i='a'&&mod[i]<='z') { + mod[i]-=32; + first=true; + } else + if (i==0) { + if (mod[i]>='A'&&mod[i]<='Z') { + first=true; + } + } else { + if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { + first=true; + } + } + } else { + if (mod[i-1]!=' ') { + if (mod[i]>='A'&&mod[i]<='Z') { + mod[i]+=32; + } + } + } + } + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Picked up "+e.getItem().getItemStack().getAmount()+" "+String.valueOf(mod)+"."); + } + } + + @EventHandler + public void onPlayerOnFire(EntityCombustEvent e) { + if (e.getEntity().getType()==EntityType.PLAYER) { + Player p = (Player)e.getEntity(); + if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")>0) { + p.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, (this.plugin.getStatBonus(5, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6"))/3)*20, 0)); + } + } + } + + @EventHandler + public void onRegainHealth(EntityRegainHealthEvent e) { + if (e.getEntity().getType()==EntityType.PLAYER) { + Player p = (Player)e.getEntity(); + p.getScoreboard().getTeam(p.getName()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth())); + try { + Iterator effects = p.getActivePotionEffects().iterator(); + //Figure out potion effects when player joins. + while (effects.hasNext()) { + PotionEffect nexteffect = effects.next(); + if (nexteffect.getType().getName().compareTo(PotionEffectType.REGENERATION.getName())==0) { + e.setAmount(e.getAmount()+1); + } + /*if (nexteffect.getType().getName().compareTo(PotionEffectType.JUMP.getName())==0) { + p.removePotionEffect(PotionEffectType.JUMP); + p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, nexteffect.getAmplifier()+2, true)); + }*/ + effects.remove(); + } + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible while trying to regenerate player."); + } + 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)); + } + } + } + + @EventHandler + public void onEnemyHit(EntityDamageByEntityEvent e) { + if (e.getEntity() instanceof LivingEntity) { + LivingEntity l = (LivingEntity)e.getEntity(); + if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { + if (l.getHealth()>=1) { + LivingEntity enderdragon = (LivingEntity)Bukkit.getWorld("world").spawnEntity(new Location(l.getWorld(),l.getLocation().getBlockX(),-250,l.getLocation().getBlockZ()),EntityType.ENDER_DRAGON); + enderdragon.setCustomName(ChatColor.DARK_PURPLE+"Charge Zombie III"); + enderdragon.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,127,999999)); + enderdragon.setMaxHealth(200); + enderdragon.setHealth(l.getHealth()/l.getMaxHealth()*200); + enderdragon.setNoDamageTicks(999999); + enderdragon.setRemoveWhenFarAway(false); + } + Iterator e_list = Bukkit.getWorld("world").getEntitiesByClass(EnderDragon.class).iterator(); + boolean first=false; + while (e_list.hasNext()) { + //p.sendMessage("Moving Enderdragon to "+new Location(p.getWorld(),p.getLocation().getBlockX()+i,-50,p.getLocation().getBlockZ()+j)); + EnderDragon next = e_list.next(); + if (!first) { + first=true; + } else { + next.remove(); + } + } + boolean clear_torches=false; + try { + Iterator effects = l.getActivePotionEffects().iterator(); + //Figure out potion effects when player joins. + while (effects.hasNext()) { + PotionEffect nexteffect = effects.next(); + if (nexteffect.getType().getName().compareTo(PotionEffectType.SLOW.getName())==0 && nexteffect.getDuration()>99999) { + l.removePotionEffect(PotionEffectType.SLOW); + //Make lightning strikes in random places. + for (int i=0;i<8;i++) { + Bukkit.getWorld("world").strikeLightningEffect(l.getLocation().add(Math.random()*10-Math.random()*10,0,Math.random()*10-Math.random()*10)); + this.plugin.last_lightning_random_time=Bukkit.getWorld("world").getFullTime()+60; + } + int extramobs=0; + List nearbylist = e.getEntity().getNearbyEntities(30, 30, 30); + //Filter out all unrelated entity types. + for (int k=0;k nearbylist = e.getEntity().getNearbyEntities(30, 30, 30); + //Filter out all unrelated entity types. + for (int k=0;k100) { + extradurability=(0.24*((this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/500.0d))); + } else { + extradurability=-(0.76*(1-(this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/500.0d))); + } + } + } + //Bukkit.getLogger().info("Made it through 2.1.6."); + } + if (Math.random()<=0.76+extradurability) { + item.setDurability((short)(item.getDurability()-1)); + ////Bukkit.getLogger().info("Armor durability now "+item.getDurability()); + } + //Bukkit.getLogger().info("Made it through 2.1.7."); + this.plugin.SPEED_CONTROL.get(slot).boots_durability=item.getDurability(); + //Bukkit.getLogger().info("Made it through 2.1.8."); + } + } + } else { + this.plugin.SPEED_CONTROL.get(slot).boots_durability=-1; + //Bukkit.getLogger().info("Made it through 2.1.9."); + } + //Bukkit.getLogger().info("Made it through 2.1."); + if (p.getEquipment().getChestplate()!=null) { + ItemStack item = p.getEquipment().getChestplate(); + if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { + for (int i=0;i100) { + extradurability=(0.24*((this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/500.0d))); + } else { + extradurability=-(0.76*(1-(this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/500.0d))); + } + } + } + } + if (Math.random()<=0.76+extradurability) { + item.setDurability((short)(item.getDurability()-1)); + ////Bukkit.getLogger().info("Armor durability now "+item.getDurability()); + } + this.plugin.SPEED_CONTROL.get(slot).chestplate_durability=item.getDurability(); + } + } + } else { + this.plugin.SPEED_CONTROL.get(slot).chestplate_durability=-1; + } + //Bukkit.getLogger().info("Made it through 2.2."); + if (p.getEquipment().getLeggings()!=null) { + ItemStack item = p.getEquipment().getLeggings(); + if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { + for (int i=0;i100) { + extradurability=(0.24*((this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/500.0d))); + } else { + extradurability=-(0.76*(1-(this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/500.0d))); + } + } + } + } + if (Math.random()<=0.76+extradurability) { + item.setDurability((short)(item.getDurability()-1)); + ////Bukkit.getLogger().info("Armor durability now "+item.getDurability()); + } + this.plugin.SPEED_CONTROL.get(slot).leggings_durability=item.getDurability(); + } + } + } else { + this.plugin.SPEED_CONTROL.get(slot).leggings_durability=-1; + } + //Bukkit.getLogger().info("Made it through 2.3"); + if (p.getEquipment().getHelmet()!=null) { + ItemStack item = p.getEquipment().getHelmet(); + if (item.getItemMeta()!=null && item.getItemMeta().getLore()!=null && item.getItemMeta().getLore().size()!=0) { + for (int i=0;i100) { + extradurability=(0.24*((this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/500.0d))); + } else { + extradurability=-(0.76*(1-(this.plugin.getEnchantmentNumb(item.getItemMeta().getLore().get(i))/500.0d))); + } + } + } + } + if (Math.random()<=0.76+extradurability) { + item.setDurability((short)(item.getDurability()-1)); + ////Bukkit.getLogger().info("Armor durability now "+item.getDurability()); + } + this.plugin.SPEED_CONTROL.get(slot).helmet_durability=item.getDurability(); + } + } + } else { + this.plugin.SPEED_CONTROL.get(slot).helmet_durability=-1; + } + //Bukkit.getLogger().info("Made it through 3."); + //This is the player getting hit. + for (int i=0;i effects = p.getActivePotionEffects().iterator(); + //Figure out potion effects when player joins. + while (effects.hasNext()) { + PotionEffect nexteffect = effects.next(); + if (nexteffect.getType().getName().compareTo(PotionEffectType.SPEED.getName())==0) { + p.removePotionEffect(PotionEffectType.SPEED); + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,1200,nexteffect.getAmplifier())); + } + effects.remove(); + } + + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible while finalizing player speed."); + } + p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,1200,1)); + } + if (Math.random()<=block_chance/100.0d) { + e.setDamage(0); + e.setCancelled(true); + } + //Bukkit.getLogger().info("Made it through 4."); + p.updateInventory(); + if (this.plugin.getAccountsConfig().getInt(p.getName()+".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))); + //p.sendMessage("Damage set from "+olddmg+" to "+e.getDamage()); + } + } + //Bukkit.getLogger().info("Made it through 5."); + if (e.getEntity().getType()==EntityType.PLAYER && e.getDamager().getType()==EntityType.SPIDER) { + LivingEntity enemy = (LivingEntity)e.getDamager(); + if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.YELLOW+"Venomous Spider")==0)) { + LivingEntity p = (LivingEntity)e.getEntity(); + p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 100, 1, false)); + } else + if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GOLD+"Venomous Spider II")==0)) { + LivingEntity p = (LivingEntity)e.getEntity(); + p.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 100, 2, false)); + } else + if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.YELLOW+"Snaring Spider")==0)) { + LivingEntity p = (LivingEntity)e.getEntity(); + p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100, 2, false)); + //Create web at the position of the player. + /* + for (int x=-1;x<2;x++) { + for (int y=-1;y<2;y++) { + for (int z=-1;z<2;z++) { + Block b = Bukkit.getWorld("world").getBlockAt(p.getLocation().add(x,y,z)); + if (b.getType()==Material.AIR) { + b.setType(Material.WEB); + this.plugin.TEMP_WEBS.add(new TempWeb(p.getLocation().add(x,y,z), 90)); + } + } + } + }*/ + } else + if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GOLD+"Snaring Spider II")==0)) { + LivingEntity p = (LivingEntity)e.getEntity(); + try { + Iterator effects = p.getActivePotionEffects().iterator(); + //Figure out potion effects when player joins. + while (effects.hasNext()) { + PotionEffect nexteffect = effects.next(); + if (nexteffect.getType().getName().compareTo(PotionEffectType.SLOW.getName())==0) { + p.removePotionEffect(PotionEffectType.SLOW); + p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 150, nexteffect.getAmplifier()+1, true)); + } + /*if (nexteffect.getType().getName().compareTo(PotionEffectType.JUMP.getName())==0) { + p.removePotionEffect(PotionEffectType.JUMP); + p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 360000, nexteffect.getAmplifier()+2, true)); + }*/ + effects.remove(); + } + + } catch (ConcurrentModificationException ex_e) { + Bukkit.getLogger().warning("Potion Effect Collection not accessible while trying to slow down player."); + } + p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 150, 1, true)); + //Create web at the position of the player. + /*for (int x=-2;x<3;x++) { + for (int y=-2;y<3;y++) { + for (int z=-2;z<3;z++) { + Block b = Bukkit.getWorld("world").getBlockAt(p.getLocation().add(x,y,z)); + if (b.getType()==Material.AIR) { + b.setType(Material.WEB); + this.plugin.TEMP_WEBS.add(new TempWeb(p.getLocation().add(x,y,z), 150)); + } + } + } + }*/ + } + } + //Bukkit.getLogger().info("Made it through 6."); + 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())); + 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)) { + 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))/2; + 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) { + p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"You were hurt for "+Math.round(throughdmg*10)/10+" damage from "+convertToItemName(e.getCause().name())+"."); + } + } else { + p.setHealth(0); + } + } else { + if (p.getHealth()-e.getDamage()/2>0) { + p.setHealth(p.getHealth()-e.getDamage()/2); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".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 { + p.setHealth(0); + } + } + e.setDamage(0); + for (int k=-1;k<2;k++) { + for (int j=-1;j<2;j++) { + Location checkloc = enemy.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = enemy.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = enemy.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + } + } + } else + if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GOLD+"Charge Zombie II")==0)) { + 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))/1.25d; + if (throughdmg>e.getDamage()) { + if (p.getHealth()-throughdmg>0) { + p.setHealth(p.getHealth()-throughdmg); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".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 { + p.setHealth(0); + } + } else { + if (p.getHealth()-e.getDamage()>0) { + p.setHealth(p.getHealth()-e.getDamage()); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".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 { + p.setHealth(0); + } + } + for (int k=-2;k<3;k++) { + for (int j=-2;j<3;j++) { + Location checkloc = enemy.getLocation().add(k,1,j); + Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = enemy.getLocation().add(k,2,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + bl = Bukkit.getWorld("world").getBlockAt(checkloc); + checkloc = enemy.getLocation().add(k,0,j); + if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER) { + bl.breakNaturally(); + } + } + } + e.setDamage(0); + } else + if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GRAY+"Zombie Ninja")==0)) { + enemy.removePotionEffect(PotionEffectType.INVISIBILITY); + this.plugin.ninjavisible_list.add(new InvisibilityData(enemy.getUniqueId(), Bukkit.getWorld("world").getFullTime()+10)); + } + } + //Bukkit.getLogger().info("Made it through 7."); + if (e.getEntity() instanceof LivingEntity) { + LivingEntity f = (LivingEntity) e.getEntity(); + if (e.getDamager().getType()==EntityType.PLAYER || e.getDamager().getType()==EntityType.ARROW) { + if (e.getDamager().getType()==EntityType.PLAYER) { + if (e.getEntity() instanceof LivingEntity) { + LivingEntity enemy = (LivingEntity)e.getEntity(); + if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GRAY+"Zombie Ninja")==0)) { + boolean found=false; + for (int i=0;i0) { + if (Math.random()<=critical_chance/100.0d) { + e.setDamage(e.getDamage()*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)); + 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)); + if (f.getHealth()-(normaldmg+armor_pen)>0) { + f.setHealth(f.getHealth()-(normaldmg+armor_pen)); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".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 { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); + } + } + } else { + f.setHealth(0); + } + } else { + //This means piercing would do extra damage. Just subtract throughdmg. + if (f.getHealth()-throughdmg>0) { + f.setHealth(f.getHealth()-throughdmg); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { + if (f.getCustomName()!=null) { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); + } else { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); + } + } + } else { + f.setHealth(0); + } + } + e.setDamage(0); + } + if (f.getNoDamageTicks()0) { + if (p.getHealth()+e.getDamage()*(life_steal/100.0d)0) { + f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d))); + } + if (dmg>0) { + e.setDamage(e.getDamage()+dmg); + } + if (this.plugin.PlayerinJob((Player)e.getDamager(), "Support")) { + for (int i=0;i=5) { + //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 (f.getNoDamageTicks()0) { + //e.setDamage(e.getDamage()+(this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5"))/4)); + 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+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)) { + //This means some piercing can be done. + //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)); + if (f.getHealth()-(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))>0) { + f.setHealth(f.getHealth()-(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { + if (f.getCustomName()!=null) { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getCustomName())+"."); + } else { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getType().getName())+"."); + } + } + } else { + f.setHealth(0); + } + } else { + //This means piercing would do extra damage. Just subtract throughdmg. + if (f.getHealth()-throughdmg>0) { + f.setHealth(f.getHealth()-throughdmg); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { + if (f.getCustomName()!=null) { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); + } else { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); + } + } + } else { + f.setHealth(0); + } + } + e.setDamage(0); + } + if (f.getNoDamageTicks()0) { + if (Math.random()<=critical_chance/100.0d) { + e.setDamage(e.getDamage()*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)); + 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)); + if (f.getHealth()-(normaldmg+armor_pen)>0) { + f.setHealth(f.getHealth()-(normaldmg+armor_pen)); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".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 { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(normaldmg+armor_pen)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); + } + } + } else { + f.setHealth(0); + } + } else { + //This means piercing would do extra damage. Just subtract throughdmg. + if (f.getHealth()-throughdmg>0) { + f.setHealth(f.getHealth()-throughdmg); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { + if (f.getCustomName()!=null) { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); + } else { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); + } + } + } else { + f.setHealth(0); + } + } + e.setDamage(0); + } + if (f.getNoDamageTicks()0) { + if (p.getHealth()+e.getDamage()*(life_steal/100.0d)0) { + f.setNoDamageTicks(f.getNoDamageTicks()-(int)(f.getNoDamageTicks()*(attack_speed/100.0d))); + } + if (dmg>0) { + e.setDamage(e.getDamage()+dmg); + } + if (e.getEntity() instanceof LivingEntity) { + LivingEntity enemy = (LivingEntity)e.getEntity(); + if (enemy.getCustomName()!=null && (enemy.getCustomName().compareTo(ChatColor.GRAY+"Zombie Ninja")==0)) { + boolean found=false; + for (int i=0;i=5) { + //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 (f.getNoDamageTicks()0) { + //e.setDamage(e.getDamage()+(this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5"))/4)); + 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+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)) { + //This means some piercing can be done. + //e.setDamage(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4)); + if (f.getHealth()-(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))>0) { + f.setHealth(f.getHealth()-(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { + if (f.getCustomName()!=null) { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getCustomName())+"."); + } else { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(normaldmg+this.plugin.getStatBonus(4, this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat5")/4))+" damage to "+convertToItemName(f.getType().getName())+"."); + } + } + } else { + f.setHealth(0); + } + } else { + //This means piercing would do extra damage. Just subtract throughdmg. + if (f.getHealth()-throughdmg>0) { + f.setHealth(f.getHealth()-throughdmg); + if (this.plugin.getAccountsConfig().getBoolean(p.getName()+".settings.notify4")) { + if (f.getCustomName()!=null) { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getCustomName())+"."); + } else { + p.sendMessage(ChatColor.RED+""+ChatColor.ITALIC+" Dealt "+(Math.round(throughdmg)*10)/10+" damage to "+convertToItemName(f.getType().getName())+"."); + } + } + } else { + f.setHealth(0); + } + } + e.setDamage(0); + } + if (f.getNoDamageTicks()=20) { + if (Math.random()<=0.05) { + ItemStack replenishitem = e.getItemInHand().clone(); + replenishitem.setAmount(1); + p.getInventory().addItem(replenishitem); + p.updateInventory(); + } + } else + if (this.plugin.getJobLv("Builder", p)>=10) { + if (Math.random()<=0.01) { + ItemStack replenishitem = e.getItemInHand().clone(); + replenishitem.setAmount(1); + p.getInventory().addItem(replenishitem); + p.updateInventory(); + } + } + if (e.getBlockPlaced().getType()==Material.COBBLESTONE) { + this.plugin.gainMoneyExp(p,"Builder",0.005,1); + if (this.plugin.getJobLv("Builder", p)>=5 && (int)this.plugin.getcurrentJobExp("Builder", p)%5==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + if (e.getBlockPlaced().getType()==Material.WOOD) { + this.plugin.gainMoneyExp(p,"Builder",0.005,2); + for (int i=0;i<2;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.LOG) { + this.plugin.gainMoneyExp(p,"Builder",0.01,3); + for (int i=0;i<3;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.WOOD_STEP) { + this.plugin.gainMoneyExp(p,"Builder",0.015,3); + for (int i=0;i<2;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.COBBLESTONE_STAIRS) { + this.plugin.gainMoneyExp(p,"Builder",0.015,3); + for (int i=0;i<2;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.STONE) { + this.plugin.gainMoneyExp(p,"Builder",0.015,4); + for (int i=0;i<4;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.FENCE) { + this.plugin.gainMoneyExp(p,"Builder",0.015,3); + for (int i=0;i<3;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.STEP) { + switch (e.getBlockPlaced().getData()) { + case 0:{ + this.plugin.gainMoneyExp(p,"Builder",0.02,4); + for (int i=0;i<4;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 1:{ + this.plugin.gainMoneyExp(p,"Builder",0.025,4); + for (int i=0;i<4;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 3:{ + this.plugin.gainMoneyExp(p,"Builder",0.015,3); + for (int i=0;i<3;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 4:{ + this.plugin.gainMoneyExp(p,"Builder",0.05,9); + for (int i=0;i<9;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 5:{ + this.plugin.gainMoneyExp(p,"Builder",0.03,5); + for (int i=0;i<5;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 6:{ + this.plugin.gainMoneyExp(p,"Builder",0.03,5); + for (int i=0;i<5;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 7:{ + this.plugin.gainMoneyExp(p,"Builder",0.06,12); + for (int i=0;i<12;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 8:{ + this.plugin.gainMoneyExp(p,"Builder",0.02,4); + for (int i=0;i<4;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 9:{ + this.plugin.gainMoneyExp(p,"Builder",0.025,4); + for (int i=0;i<4;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 10:{ + this.plugin.gainMoneyExp(p,"Builder",0.015,3); + for (int i=0;i<3;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 11:{ + this.plugin.gainMoneyExp(p,"Builder",0.015,3); + for (int i=0;i<3;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 12:{ + this.plugin.gainMoneyExp(p,"Builder",0.05,9); + for (int i=0;i<9;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 13:{ + this.plugin.gainMoneyExp(p,"Builder",0.03,5); + for (int i=0;i<5;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 14:{ + this.plugin.gainMoneyExp(p,"Builder",0.03,5); + for (int i=0;i<5;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + case 15:{ + this.plugin.gainMoneyExp(p,"Builder",0.06,12); + for (int i=0;i<12;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + }break; + } + } + if (e.getBlockPlaced().getType()==Material.WOOD_STAIRS) { + this.plugin.gainMoneyExp(p,"Builder",0.02,4); + for (int i=0;i<4;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.LAPIS_BLOCK) { + this.plugin.gainMoneyExp(p,"Builder",0.02,3); + for (int i=0;i<3;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.COBBLE_WALL) { + this.plugin.gainMoneyExp(p,"Builder",0.025,5); + for (int i=0;i<5;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.NETHER_BRICK_STAIRS) { + this.plugin.gainMoneyExp(p,"Builder",0.025,5); + for (int i=0;i<5;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.NETHER_BRICK) { + this.plugin.gainMoneyExp(p,"Builder",0.03,5); + for (int i=0;i<5;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.NETHER_FENCE) { + this.plugin.gainMoneyExp(p,"Builder",0.03,6); + for (int i=0;i<6;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.WOOL) { + this.plugin.gainMoneyExp(p,"Builder",0.035,7); + for (int i=0;i<7;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.getMaterial(109)) { + this.plugin.gainMoneyExp(p,"Builder",0.04,8); + for (int i=0;i<8;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.getMaterial(98)) { + this.plugin.gainMoneyExp(p,"Builder",0.04,8); + for (int i=0;i<8;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.GLASS) { + this.plugin.gainMoneyExp(p,"Builder",0.04,8); + for (int i=0;i<8;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.GLOWSTONE) { + this.plugin.gainMoneyExp(p,"Builder",0.05,10); + for (int i=0;i<10;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.HARD_CLAY) { + this.plugin.gainMoneyExp(p,"Builder",0.05,10); + for (int i=0;i<10;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.STAINED_CLAY) { + this.plugin.gainMoneyExp(p,"Builder",0.05,10); + for (int i=0;i<10;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.SANDSTONE_STAIRS) { + this.plugin.gainMoneyExp(p,"Builder",0.05,10); + for (int i=0;i<10;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.SANDSTONE) { + this.plugin.gainMoneyExp(p,"Builder",0.06,10); + for (int i=0;i<10;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.QUARTZ_STAIRS) { + this.plugin.gainMoneyExp(p,"Builder",0.06,12); + for (int i=0;i<12;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.IRON_FENCE) { + this.plugin.gainMoneyExp(p,"Builder",0.06,12); + for (int i=0;i<12;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.BRICK_STAIRS) { + this.plugin.gainMoneyExp(p,"Builder",0.065,9); + for (int i=0;i<9;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.QUARTZ_BLOCK) { + this.plugin.gainMoneyExp(p,"Builder",0.07,14); + for (int i=0;i<14;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + if (e.getBlockPlaced().getType()==Material.BRICK) { + this.plugin.gainMoneyExp(p,"Builder",0.075,11); + for (int i=0;i<11;i++) { + if (this.plugin.getJobLv("Builder", p)>=5 && ((((int)this.plugin.getcurrentJobExp("Builder", p))%5)-i)==0) { + //Give a torch to the player. + p.getInventory().addItem(new ItemStack(Material.TORCH,1)); p.updateInventory(); + } + } + } + } + } + if (this.plugin.PlayerinJob(p, "Miner")) { + this.plugin.playerdata_list.get(myData).BadInteract(e.getBlockPlaced().getType()); + } + if (this.plugin.PlayerinJob(p, "Digger")) { + this.plugin.playerdata_list.get(myData).BadInteract(e.getBlockPlaced().getType()); + } + if (this.plugin.PlayerinJob(p, "Farmer")) { + if (e.getBlockPlaced().getType()==Material.CROPS) { + this.plugin.gainMoneyExp(p,"Farmer",0.005,1); + } + if (e.getBlockPlaced().getType()==Material.PUMPKIN_SEEDS) { + this.plugin.gainMoneyExp(p,"Farmer",0.01,2); + } + if (e.getBlockPlaced().getType()==Material.MELON_SEEDS) { + this.plugin.gainMoneyExp(p,"Farmer",0.01,2); + } + } + if (this.plugin.PlayerinJob(p, "Support")) { + if (e.getBlockPlaced().getType()==Material.TORCH) { + //Make sure there are no other torches or Glowstone nearby. + boolean found=false; + for (int x=-5;x<5;x++) { + for (int y=-3;y<3;y++) { + for (int z=-5;z<5;z++) { + if (Bukkit.getWorld(p.getWorld().getName()).getBlockAt(p.getLocation().add(x,0,z)).getType()==Material.TORCH || Bukkit.getWorld(p.getWorld().getName()).getBlockAt(p.getLocation().add(x,0,z)).getType()==Material.GLOWSTONE) { + found=true; + break; + } + if (found) { + break; + } + } + if (found) { + break; + } + } + } + if (!found) { + this.plugin.gainMoneyExp(p,"Support",0.00,1); + } + } else + if (e.getBlockPlaced().getType()==Material.GLOWSTONE) { + //Make sure there are no other torches or Glowstone nearby. + boolean found=false; + for (int x=-5;x<5;x++) { + for (int y=-3;y<3;y++) { + for (int z=-5;z<5;z++) { + if (Bukkit.getWorld(p.getWorld().getName()).getBlockAt(p.getLocation().add(x,0,z)).getType()==Material.TORCH || Bukkit.getWorld(p.getWorld().getName()).getBlockAt(p.getLocation().add(x,0,z)).getType()==Material.GLOWSTONE) { + found=true; + break; + } + if (found) { + break; + } + } + if (found) { + break; + } + } + } + if (!found) { + this.plugin.gainMoneyExp(p,"Support",0.00,1); + } + } + } + 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)) { + e.setCancelled(true); + } + 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)) { + e.setCancelled(true); + } + return; + } + + @EventHandler + public void onItemBreak(PlayerItemBreakEvent e) { + Player p = e.getPlayer(); + ItemStack i = e.getBrokenItem(); + if (i.getItemMeta()!=null && i.getItemMeta().hasDisplayName() && i.getItemMeta().getDisplayName().compareTo("Spleef Wooden Shovel")==0) { + i.setDurability((short)0); + p.getInventory().addItem(i); + } + if (i.hasItemMeta() && i.getItemMeta().getLore()!=null) { + boolean is_halloween=false; + List finallore = new ArrayList(); + for (int j=0;j=10 && crafteditem==true) { + ItemStack resultingitem = result; + resultingitem.setAmount(resultingitem.getAmount()*2); + } + } + if (this.plugin.PlayerinJob(p,"Support")) { + if (result.getType()==Material.BREAD) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getType()==Material.MUSHROOM_SOUP) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getType()==Material.COOKIE) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getType()==Material.GOLDEN_CARROT) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getType()==Material.GOLDEN_APPLE) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getType()==Material.PUMPKIN_PIE) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getType()==Material.CAKE) { + this.plugin.gainMoneyExp(p,"Support",0.015,2); + } + if (result.getType()==Material.IRON_SWORD) { + this.plugin.gainMoneyExp(p,"Support",0.015,3); + } + if (result.getType()==Material.IRON_CHESTPLATE || result.getType()==Material.IRON_HELMET || result.getType()==Material.IRON_BOOTS || result.getType()==Material.IRON_LEGGINGS) { + this.plugin.gainMoneyExp(p,"Support",0.025,5); + } + if (result.getType()==Material.DIAMOND_SWORD) { + this.plugin.gainMoneyExp(p,"Support",0.075,8); + } + if (result.getType()==Material.DIAMOND_CHESTPLATE || result.getType()==Material.DIAMOND_HELMET || result.getType()==Material.DIAMOND_BOOTS || result.getType()==Material.DIAMOND_LEGGINGS) { + this.plugin.gainMoneyExp(p,"Support",0.20,20); + } + if (result.getType()==Material.CAKE) { + this.plugin.gainMoneyExp(p,"Support",0.03,2); + } + } + } + } + }*/ + + @EventHandler + public void onInventoryCloseEvent(InventoryCloseEvent e) { + Player p = (Player)e.getPlayer(); + p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.WHITE+""); + if (p.hasPermission("group.moderator")) { + p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.GREEN+""); + } + if (p.hasPermission("group.administrators")) { + p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.LIGHT_PURPLE+""); + } + if (e.getInventory().getName().contains("Item Cube")) { + int identifier=-1; + //Get idenfitier. + String ident_string=e.getInventory().getTitle().substring(e.getInventory().getTitle().indexOf("#")).replace("#", ""); + identifier=Integer.valueOf(ident_string); + if (identifier==-1) { + Bukkit.getLogger().severe("SEVERE error when saving Item Cube contents! Could not get ID!"); + return; + } + //We are going to save the contents of this inventory appropriately. + FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); + for (int i=0;i ench1 = ((EnchantmentStorageMeta) stack1.getItemMeta()).getStoredEnchants(); + Map ench2 = ((EnchantmentStorageMeta) stack2.getItemMeta()).getStoredEnchants(); + if(!ench1.equals(ench2)) return false; //Enchants aren't the same. + } + } + catch(ClassNotFoundException e){ + //Nothing. They dont have a build high enough to support this. + } + + return true; + } + + /** + * Returns the number of items that can be given to the inventory safely. + * @param inv The inventory to count + * @param item The item prototype. Material, durabiltiy and enchants must match for 'stackability' to occur. + * @return The number of items that can be given to the inventory safely. + */ + public static int countSpace(Inventory inv, ItemStack item){ + int space = 0; + for(ItemStack iStack : inv.getContents()){ + if(iStack == null || iStack.getType() == Material.AIR){ + space += item.getMaxStackSize(); + } + else if(matches(item, iStack)){ + space += item.getMaxStackSize() - iStack.getAmount(); + } + } + return space; + } + + public void giveLegendaryItem(Player p) { + String prefix = ""; + String suffix = ""; + int type=(int)(Math.random()*6); + //int type=5; //TESTING. + List enchants1 = new ArrayList(); + List enchants2 = new ArrayList(); + ItemStack finalitem = null; + if (type==0) { + finalitem=new ItemStack(Material.DIAMOND_HELMET); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Breathing"); + enchants1.add("Working"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==1) { + finalitem=new ItemStack(Material.DIAMOND_CHESTPLATE); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==2) { + finalitem=new ItemStack(Material.DIAMOND_LEGGINGS); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==3) { + finalitem=new ItemStack(Material.DIAMOND_BOOTS); + enchants1.add("Protective"); + enchants1.add("Fire-Proof"); + enchants1.add("Blast Resistant"); + enchants1.add("Untouchable"); + enchants1.add("Lightweight"); + enchants1.add("Unbreaking"); + enchants1.add("Thorny"); + enchants2.add("Life"); + enchants2.add("Resistance"); + enchants2.add("Durability"); + enchants2.add("Protection"); + } + if (type==4) { + finalitem=new ItemStack(Material.BOW); + enchants1.add("Power"); + enchants1.add("Punch"); + enchants1.add("Flaming"); + enchants1.add("Infinite"); + enchants1.add("Unbreaking"); + enchants2.add("Smiting"); + enchants2.add("Penetration"); + enchants2.add("Draining"); + enchants2.add("Fury"); + enchants2.add("Power"); + } + if (type==5) { + finalitem=new ItemStack(Material.DIAMOND_SWORD); + enchants1.add("Damaging"); + enchants1.add("Knockback"); + enchants1.add("Undead"); + enchants1.add("Baning"); + enchants1.add("Fiery"); + enchants1.add("Greedy"); + enchants1.add("Unbreaking"); + enchants2.add("Smiting"); + enchants2.add("Penetration"); + enchants2.add("Draining"); + enchants2.add("Fury"); + enchants2.add("Power"); + } + prefix = enchants1.get((int)(Math.random()*enchants1.size())); + suffix = enchants2.get((int)(Math.random()*enchants2.size())); + if (prefix.equalsIgnoreCase("Protective")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 10); + } + if (prefix.equalsIgnoreCase("Fire-Proof")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FIRE, 10); + } + if (prefix.equalsIgnoreCase("Blast Resistant")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 10); + } + if (prefix.equalsIgnoreCase("Untouchable")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + } + if (prefix.equalsIgnoreCase("Breathing")) { + finalitem.addUnsafeEnchantment(Enchantment.OXYGEN, 10); + } + if (prefix.equalsIgnoreCase("Working")) { + finalitem.addUnsafeEnchantment(Enchantment.WATER_WORKER, 10); + } + if (prefix.equalsIgnoreCase("Unbreaking")) { + finalitem.addUnsafeEnchantment(Enchantment.DURABILITY, 10); + } + if (prefix.equalsIgnoreCase("Thorny")) { + finalitem.addUnsafeEnchantment(Enchantment.THORNS, 10); + } + if (prefix.equalsIgnoreCase("Untouchable")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_PROJECTILE, 10); + } + if (prefix.equalsIgnoreCase("Lightweight")) { + finalitem.addUnsafeEnchantment(Enchantment.PROTECTION_FALL, 10); + } + if (prefix.equalsIgnoreCase("Power")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 10); + } + if (prefix.equalsIgnoreCase("Damaging")) { + finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 10); + } + if (prefix.equalsIgnoreCase("Knockback")) { + finalitem.addUnsafeEnchantment(Enchantment.KNOCKBACK, 10); + } + if (prefix.equalsIgnoreCase("Punch")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 10); + } + if (prefix.equalsIgnoreCase("Flaming")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 10); + } + if (prefix.equalsIgnoreCase("Infinite")) { + finalitem.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 10); + } + if (prefix.equalsIgnoreCase("Undead")) { + finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_UNDEAD, 10); + } + if (prefix.equalsIgnoreCase("Baning")) { + finalitem.addUnsafeEnchantment(Enchantment.DAMAGE_ARTHROPODS, 10); + } + if (prefix.equalsIgnoreCase("Fiery")) { + finalitem.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, 10); + } + if (prefix.equalsIgnoreCase("Greedy")) { + finalitem.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10); + } + ItemMeta meta = finalitem.getItemMeta(); + meta.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+prefix+" "+convertToItemName(finalitem.getType().name())+" of "+suffix); + List setLore = new ArrayList(); + if (suffix.equalsIgnoreCase("Life")) { + setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+10)+" "+ChatColor.BLUE+"Health"); + } + if (suffix.equalsIgnoreCase("Resistance")) { + setLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*70)+20)+"% "+ChatColor.BLUE+"Damage Reduction"); + } + if (suffix.equalsIgnoreCase("Durability")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*200)+50)*10)+"% "+ChatColor.BLUE+"Durability"); + } + if (suffix.equalsIgnoreCase("Protection")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Block Chance"); + } + if (suffix.equalsIgnoreCase("Smiting")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Critical Chance"); + } + if (suffix.equalsIgnoreCase("Penetration")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*20)+5))+" "+ChatColor.BLUE+"Armor Penetration"); + } + if (suffix.equalsIgnoreCase("Draining")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*30)+20))+"% "+ChatColor.BLUE+"Life Steal"); + } + if (suffix.equalsIgnoreCase("Fury")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+10))+"% "+ChatColor.BLUE+"Attack Speed"); + } + if (suffix.equalsIgnoreCase("Power")) { + setLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*10)+5))+" "+ChatColor.BLUE+"Damage"); + } + setLore.add(""); + setLore.add(ChatColor.YELLOW+"[Halloween]"); + setLore.add("This item was created during the Halloween"); + setLore.add("event. When this item breaks, it simply turns"); + setLore.add("into a \"broken\" state and has a recharge time"); + setLore.add("of 1 week. The item will be fully restored after"); + setLore.add("a week of cooldown."); + meta.setLore(setLore); + finalitem.setItemMeta(meta); + //finalitem.setDurability((short)1560); //TESTING. + p.getInventory().addItem(finalitem); + } + + @EventHandler + public void onInventoryClickEvent(InventoryClickEvent event) { + Player p = (Player)event.getWhoClicked(); + p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.DARK_GRAY+""); + if (p.hasPermission("group.moderator")) { + p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.DARK_GREEN+""); + } + if (p.hasPermission("group.administrators")) { + p.getScoreboard().getTeam(p.getName()).setPrefix(ChatColor.DARK_PURPLE+""); + } + if (event.getCursor()!=null) { + //Regardless of the inventory, if we try to put it inside a chest, got to try to insert it in there. + if (event.getCurrentItem()!=null) { + if (event.getCursor()!=null && event.getCursor().getType()!=Material.AIR && (event.getCurrentItem().getType()==Material.CHEST || event.getCurrentItem().getType()==Material.TRAPPED_CHEST) && event.getClick()==ClickType.LEFT) { + //We have to attempt to insert the item in the Item Cube. + boolean largechest=false; + boolean smallchest=false; + int identifier=-1; + if (event.getCurrentItem().getItemMeta().getLore()!=null) { + //Check to see if the Lore contains anything. + for (int i=0;i1) { + ItemStack newitem = event.getCurrentItem().clone(); + newitem.setAmount(event.getCurrentItem().getAmount()-1); + event.getCurrentItem().setAmount(1); + //Drop the rest on the ground. + p.getWorld().dropItemNaturally(p.getLocation(), newitem); + } + ItemMeta meta = event.getCurrentItem().getItemMeta(); + List newlore = meta.getLore(); + newlore.add("ID#"+identifier); + meta.setLore(newlore); + event.getCurrentItem().setItemMeta(meta); + } + if (smallchest) { + FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); + if (!f.contains("created")) { + for (int i=0;i<9;i++) { + f.set("item-"+i, new ItemStack(Material.AIR)); + } + f.set("item-0", event.getCursor()); + event.getCursor().setType(Material.AIR); + f.set("created", Boolean.valueOf(true)); + } else { + + //We need to see if we have the inventory opened already...If so we have to add it to THAT one. + Inventory thisinven=Bukkit.createInventory(event.getWhoClicked(), 9, "Item Cube #"+identifier); + boolean changeinven=false; + if (event.getInventory().getTitle().contains("Item Cube") && event.getInventory().getTitle().length()>0) { + if (Integer.valueOf(event.getInventory().getTitle().substring(event.getInventory().getTitle().indexOf("#")).replace("#", ""))==identifier) { + thisinven=event.getInventory(); + changeinven=true; + } + } + if (!changeinven) { + for (int i=0;i<9;i++) { + //items.add(f.getItemStack("item-"+i)); + if (f.contains("item-"+i)) { + thisinven.addItem(f.getItemStack("item-"+i)); + } + } + } + int countinven = countSpace(thisinven,event.getCursor()); + if (countinven>=event.getCursor().getAmount()) { + //We can simply add it in no problem. + thisinven.addItem(event.getCursor()); + for (int i=0;i0) { + //We can at least fit a few. + int fit = event.getCursor().getAmount()-countinven; + //Leave behind this many. + ItemStack thisitem = event.getCursor(), thisitem2 = event.getCursor(); + thisitem.setAmount(fit); + event.setCursor(thisitem); + //Bukkit.getPlayer("sigonasr2").sendMessage("Cursor gets "+thisitem.getAmount()); + thisitem2.setAmount(countinven); + thisinven.addItem(thisitem2); + //Bukkit.getPlayer("sigonasr2").sendMessage("Item Cube gets "+thisitem2.getAmount()); + for (int i=0;i items = new ArrayList(); + //We need to see if we have the inventory opened already...If so we have to add it to THAT one. + Inventory thisinven=Bukkit.createInventory(event.getWhoClicked(), 54, "Item Cube #"+identifier); + boolean changeinven=false; + if (event.getInventory().getTitle().contains("Item Cube") && event.getInventory().getTitle().length()>0) { + if (Integer.valueOf(event.getInventory().getTitle().substring(event.getInventory().getTitle().indexOf("#")).replace("#", ""))==identifier) { + thisinven=event.getInventory(); + changeinven=true; + } + } + if (!changeinven) { + for (int i=0;i<54;i++) { + //items.add(f.getItemStack("item-"+i)); + if (f.contains("item-"+i)) { + thisinven.addItem(f.getItemStack("item-"+i)); + } + } + } + int countinven = countSpace(thisinven,event.getCursor()); + if (countinven>=event.getCursor().getAmount()) { + //We can simply add it in no problem. + thisinven.addItem(event.getCursor()); + for (int i=0;i0) { + //We can at least fit a few. + int fit = event.getCursor().getAmount()-countinven; + //Leave behind this many. + ItemStack thisitem = event.getCursor(), thisitem2 = event.getCursor(); + thisitem.setAmount(fit); + event.setCursor(thisitem); + //Bukkit.getPlayer("sigonasr2").sendMessage("Cursor gets "+thisitem.getAmount()); + thisitem2.setAmount(countinven); + thisinven.addItem(thisitem2); + //Bukkit.getPlayer("sigonasr2").sendMessage("Item Cube gets "+thisitem2.getAmount()); + for (int i=0;i1) { + ItemStack newitem = event.getCurrentItem().clone(); + newitem.setAmount(event.getCurrentItem().getAmount()-1); + event.getCurrentItem().setAmount(1); + //Drop the rest on the ground. + p.getWorld().dropItemNaturally(p.getLocation(), newitem); + } + ItemMeta meta = event.getCurrentItem().getItemMeta(); + List newlore = meta.getLore(); + newlore.add("ID#"+identifier); + meta.setLore(newlore); + event.getCurrentItem().setItemMeta(meta); + } + Inventory screen = null; + if (smallchest) { + FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); + if (!f.contains("created")) { + for (int i=0;i<9;i++) { + f.set("item-"+i, new ItemStack(Material.AIR)); + } + f.set("created", Boolean.valueOf(true)); + } + //List items = new ArrayList(); + screen=Bukkit.createInventory(event.getWhoClicked(), 9, "Item Cube #"+identifier); + for (int i=0;i<9;i++) { + //items.add(f.getItemStack("item-"+i)); + screen.setItem(i, f.getItemStack("item-"+i)); + } + this.plugin.saveItemCubeConfig(f, identifier); + } + if (largechest) { + FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); + if (!f.contains("created")) { + for (int i=0;i<54;i++) { + f.set("item-"+i, new ItemStack(Material.AIR)); + } + f.set("created", Boolean.valueOf(true)); + } + //List items = new ArrayList(); + screen=Bukkit.createInventory(event.getWhoClicked(), 54, "Large Item Cube #"+identifier); + for (int i=0;i<54;i++) { + //items.add(f.getItemStack("item-"+i)); + screen.setItem(i, f.getItemStack("item-"+i)); + } + this.plugin.saveItemCubeConfig(f, identifier); + } + if (screen!=null) { + event.getWhoClicked().closeInventory(); + event.getWhoClicked().openInventory(screen); + event.setCancelled(true); + //return; + } + } + } + } + }else + if (event.getInventory().getType()==InventoryType.CHEST && !event.getInventory().getName().equalsIgnoreCase("Notification Options")) { + //If we click a chest, make sure it's not the same ID chest. + if (event.getCurrentItem()!=null) { + if ((event.getCurrentItem().getType()==Material.CHEST || event.getCurrentItem().getType()==Material.TRAPPED_CHEST)) { + int identifier=-1; + if (event.getCurrentItem().getItemMeta().getLore()!=null) { + //Check to see if the Lore contains anything. + for (int i=0;i=10) { + if (event.getCurrentItem()!=null && event.getCurrentItem().getType()==Material.POTION) { + if (event.getCurrentItem().getItemMeta()!=null && event.getCurrentItem().getItemMeta().getLore()!=null) { + List loredata = event.getCurrentItem().getItemMeta().getLore(); + boolean found=false; + for (int i=0;i loredata = new ArrayList(); + loredata.add(ChatColor.RED+"Duplicated"); + ItemMeta meta = event.getCurrentItem().getItemMeta(); + meta.setLore(loredata); + event.getCurrentItem().setItemMeta(meta); + } + } + } + } + } else + if (event.getInventory().getName().equalsIgnoreCase("Notification Options")) { + if (event.getSlotType()==SlotType.CONTAINER && (event.getSlot()==2 || event.getSlot()==6 || + event.getSlot()==11 || event.getSlot()==15 || + event.getSlot()==20 || event.getSlot()==24)) { + if (event.getInventory().getContents()[event.getSlot()].getType()==Material.REDSTONE_TORCH_OFF) { + event.getInventory().getContents()[event.getSlot()].setType(Material.REDSTONE_TORCH_ON); + } else { + event.getInventory().getContents()[event.getSlot()].setType(Material.REDSTONE_TORCH_OFF); + } + } + if (event.getSlotType()==SlotType.CONTAINER && (event.getSlot()==1 || event.getSlot()==5 || + event.getSlot()==10 || event.getSlot()==14 || + event.getSlot()==19 || event.getSlot()==23)) { + if (event.getInventory().getContents()[event.getSlot()+1].getType()==Material.REDSTONE_TORCH_OFF) { + event.getInventory().getContents()[event.getSlot()+1].setType(Material.REDSTONE_TORCH_ON); + } else { + event.getInventory().getContents()[event.getSlot()+1].setType(Material.REDSTONE_TORCH_OFF); + } + } + event.setCancelled(true); + } + if (event.getInventory() != null && + event.getSlotType() == SlotType.RESULT) { + + switch (event.getInventory().getType()) { + case CRAFTING: + handleCrafting(event); + break; + case WORKBENCH: + handleCrafting(event); + break; + } + + } + } + + private void rewardCraft(ItemStack item, int amount, HumanEntity pl) { + Player p = (Player)pl; + if (this.plugin.PlayerinJob(p,"Digger")) { + if (item.getType()==Material.SANDSTONE) { + this.plugin.gainMoneyExp(p,"Digger",0.02*amount,6*amount); + } + if (item.getType()==Material.BRICK) { + this.plugin.gainMoneyExp(p,"Digger",0.04*amount,8*amount); + } + } + if (this.plugin.PlayerinJob(p,"Weaponsmith")) { + boolean crafteditem=false; + if (item.getType()==Material.ARROW) { + this.plugin.gainMoneyExp(p,"Weaponsmith",0.025*amount,4*amount); + crafteditem=true; + } + if (item.getType()==Material.WOOD_SWORD) { + this.plugin.gainMoneyExp(p,"Weaponsmith",0.05*amount,10*amount); + crafteditem=true; + } + if (item.getType()==Material.FLINT_AND_STEEL) { + this.plugin.gainMoneyExp(p,"Weaponsmith",0.06*amount,12*amount); + crafteditem=true; + } + if (item.getType()==Material.BOW) { + this.plugin.gainMoneyExp(p,"Weaponsmith",0.075*amount,12*amount); + crafteditem=true; + } + if (item.getType()==Material.IRON_SWORD) { + this.plugin.gainMoneyExp(p,"Weaponsmith",0.375*amount,75*amount); + crafteditem=true; + } + if (item.getType()==Material.GOLD_SWORD) { + this.plugin.gainMoneyExp(p,"Weaponsmith",0.50*amount,100*amount); + crafteditem=true; + } + if (item.getType()==Material.DIAMOND_SWORD) { + this.plugin.gainMoneyExp(p,"Weaponsmith",0.975*amount,175*amount); + crafteditem=true; + } + } + if (this.plugin.PlayerinJob(p,"Blacksmith")) { + boolean crafteditem=false; + if (item.getType()==Material.STONE_HOE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.04*amount,7*amount); + crafteditem=true; + } + if (item.getType()==Material.STONE_SPADE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.05*amount,8*amount); + crafteditem=true; + } + if (item.getType()==Material.STONE_PICKAXE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.075*amount,15*amount); + crafteditem=true; + } + if (item.getType()==Material.LEATHER_BOOTS) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.125*amount,8*amount); + crafteditem=true; + } + if (item.getType()==Material.LEATHER_HELMET) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.15*amount,14*amount); + crafteditem=true; + } + if (item.getType()==Material.LEATHER_LEGGINGS) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.175*amount,15*amount); + crafteditem=true; + } + if (item.getType()==Material.LEATHER_CHESTPLATE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.20*amount,18*amount); + crafteditem=true; + } + if (item.getType()==Material.IRON_SPADE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.25*amount,18*amount); + crafteditem=true; + } + if (item.getType()==Material.IRON_HOE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.325*amount,24*amount); + crafteditem=true; + } + if (item.getType()==Material.IRON_BOOTS) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.375*mult*amount,27*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.IRON_PICKAXE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.40*amount,30*amount); + crafteditem=true; + } + if (item.getType()==Material.IRON_HELMET) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.50*mult*amount,45*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.GOLD_SPADE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.625*amount,55*amount); + crafteditem=true; + } + if (item.getType()==Material.GOLD_HOE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.65*amount,60*amount); + crafteditem=true; + } + if (item.getType()==Material.IRON_LEGGINGS) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.725*mult*amount,60*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.DIAMOND_SPADE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.75*amount,65*amount); + crafteditem=true; + } + if (item.getType()==Material.DIAMOND_HOE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.80*amount,70*amount); + crafteditem=true; + } + if (item.getType()==Material.GOLD_BOOTS) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.825*mult*amount,50*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.IRON_CHESTPLATE) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.875*mult*amount,70*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.GOLD_HELMET) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",0.925*mult*amount,80*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.DIAMOND_PICKAXE) { + this.plugin.gainMoneyExp(p,"Blacksmith",0.925*amount,80*amount); + crafteditem=true; + } + if (item.getType()==Material.DIAMOND_BOOTS) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.00*mult*amount,85*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.GOLD_LEGGINGS) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.025*mult*amount,100*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.GOLD_CHESTPLATE) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult*amount,130*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.DIAMOND_HELMET) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.15*mult*amount,125*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.DIAMOND_LEGGINGS) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.325*mult*amount,145*mult*amount); + crafteditem=true; + } + if (item.getType()==Material.DIAMOND_CHESTPLATE) { + int mult=1; + if ((item.getItemMeta().getDisplayName()!=null && !item.getItemMeta().getDisplayName().contains(ChatColor.DARK_AQUA+"Weak ")) || item.getItemMeta().getDisplayName()==null) { + mult=8; + } + this.plugin.gainMoneyExp(p,"Blacksmith",1.50*mult*amount,175*mult*amount); + crafteditem=true; + } + } + if (this.plugin.PlayerinJob(p,"Cook")) { + boolean crafteditem=false; + if (item.getType()==Material.BREAD) { + this.plugin.gainMoneyExp(p,"Cook",0.0125*amount,5*amount); + crafteditem=true; + } + if (item.getType()==Material.MUSHROOM_SOUP) { + this.plugin.gainMoneyExp(p,"Cook",0.0375*amount,15*amount); + crafteditem=true; + } + if (item.getType()==Material.COOKIE) { + this.plugin.gainMoneyExp(p,"Cook",0.0675*amount,25*amount); + crafteditem=true; + } + if (item.getType()==Material.GOLDEN_CARROT) { + this.plugin.gainMoneyExp(p,"Cook",0.0875*amount,35*amount); + crafteditem=true; + } + if (item.getType()==Material.GOLDEN_APPLE) { + this.plugin.gainMoneyExp(p,"Cook",0.1125*amount,45*amount); + crafteditem=true; + } + if (item.getType()==Material.PUMPKIN_PIE) { + this.plugin.gainMoneyExp(p,"Cook",0.15*amount,60*amount); + crafteditem=true; + } + if (item.getType()==Material.CAKE) { + this.plugin.gainMoneyExp(p,"Cook",0.2125*amount,85*amount); + crafteditem=true; + } + if (this.plugin.getJobLv("Cook", p)>=10 && crafteditem==true) { + //This is an ugly fix for the problem...But it works somehow. + //Player newp = Bukkit.getPlayer(p.getName()); + p.getInventory().addItem(new ItemStack(item.getType(),amount,item.getDurability(),item.getData().getData())); + } + } + if (this.plugin.PlayerinJob(p,"Support")) { + if (item.getType()==Material.BREAD) { + this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); + } + if (item.getType()==Material.MUSHROOM_SOUP) { + this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); + } + if (item.getType()==Material.COOKIE) { + this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); + } + if (item.getType()==Material.GOLDEN_CARROT) { + this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); + } + if (item.getType()==Material.GOLDEN_APPLE) { + this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); + } + if (item.getType()==Material.PUMPKIN_PIE) { + this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); + } + if (item.getType()==Material.CAKE) { + this.plugin.gainMoneyExp(p,"Support",0.015*amount,2*amount); + } + if (item.getType()==Material.IRON_SWORD) { + this.plugin.gainMoneyExp(p,"Support",0.015*amount,3*amount); + } + if (item.getType()==Material.IRON_CHESTPLATE || item.getType()==Material.IRON_HELMET || item.getType()==Material.IRON_BOOTS || item.getType()==Material.IRON_LEGGINGS) { + this.plugin.gainMoneyExp(p,"Support",0.025*amount,5*amount); + } + if (item.getType()==Material.DIAMOND_SWORD) { + this.plugin.gainMoneyExp(p,"Support",0.075*amount,8*amount); + } + if (item.getType()==Material.DIAMOND_CHESTPLATE || item.getType()==Material.DIAMOND_HELMET || item.getType()==Material.DIAMOND_BOOTS || item.getType()==Material.DIAMOND_LEGGINGS) { + this.plugin.gainMoneyExp(p,"Support",0.20*amount,20*amount); + } + if (item.getType()==Material.CAKE) { + this.plugin.gainMoneyExp(p,"Support",0.03*amount,2*amount); + } + } + } + + private void handleCrafting(InventoryClickEvent event) { + + HumanEntity player = event.getWhoClicked(); + ItemStack toCraft = event.getCurrentItem(); + ItemStack toStore = event.getCursor(); + + // Make sure we are actually crafting anything + if (player != null && hasItems(toCraft)) { + + if (event.isShiftClick()) { + // Hack ahoy + schedulePostDetection(player, toCraft); + } else { + // The items are stored in the cursor. Make sure there's enough space. + if (isStackSumLegal(toCraft, toStore)) { + int newItemsCount = toCraft.getAmount(); + + rewardCraft(toCraft,newItemsCount,player); + } + } + } + } + + // HACK! The API doesn't allow us to easily determine the resulting number of + // crafted items, so we're forced to compare the inventory before and after. + private void schedulePostDetection(final HumanEntity player, final ItemStack compareItem) { + final ItemStack[] preInv = player.getInventory().getContents(); + final int ticks = 1; + + // Clone the array. The content may (was for me) be mutable. + for (int i = 0; i < preInv.length; i++) { + preInv[i] = preInv[i] != null ? preInv[i].clone() : null; + } + Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { + @Override + public void run() { + final ItemStack[] postInv = player.getInventory().getContents(); + int newItemsCount = 0; + + for (int i = 0; i < preInv.length; i++) { + ItemStack pre = preInv[i]; + ItemStack post = postInv[i]; + if (pre!=null && post!=null) { + //See if they are the same item. + if (pre.getTypeId()==post.getTypeId() && pre.getDurability()==post.getDurability() && + pre.getItemMeta().equals(post.getItemMeta()) && pre.getEnchantments().equals(post.getEnchantments()) && + compareItem.getTypeId()==post.getTypeId() && compareItem.getDurability()==post.getDurability() && + compareItem.getItemMeta().equals(post.getItemMeta()) && compareItem.getEnchantments().equals(post.getEnchantments())) { + //See if the quantities differ. + newItemsCount += post.getAmount()-pre.getAmount(); + //Bukkit.getPlayer("sigonasr2").sendMessage("Item amounts differ. New count: "+newItemsCount); + } + } else { + if (post!=null) { + //pre is null, so we just add the amount. + if (compareItem.getTypeId()==post.getTypeId() && compareItem.getDurability()==post.getDurability() && + compareItem.getItemMeta().equals(post.getItemMeta()) && compareItem.getEnchantments().equals(post.getEnchantments())) { + newItemsCount += post.getAmount(); + } + //Bukkit.getPlayer("sigonasr2").sendMessage("Item amounts differ. New count: "+newItemsCount); + } + } + } + + if (newItemsCount > 0) { + //Bukkit.getPlayer("AaMay").sendMessage(newItemsCount+" New Items have been detected."); + if (plugin.getAccountsConfig().getBoolean(player.getName()+".settings.notify2")) { + Bukkit.getPlayer(player.getName()).sendMessage(ChatColor.DARK_AQUA+""+ChatColor.ITALIC+"Crafted "+newItemsCount+" "+convertToItemName(compareItem.getType().name())+"."); + } + rewardCraft(compareItem,newItemsCount,player); + } + } + }, ticks); + } + + private boolean hasSameItem(ItemStack a, ItemStack b) { + if (a == null) + return b == null; + else if (b == null) + return a == null; + return a.getTypeId() == b.getTypeId() && + a.getDurability() == b.getDurability() && + ((a.getItemMeta()!=null && b.getItemMeta()!=null)?Objects.equal(a.getItemMeta(), b.getItemMeta()):true) && + ((a.getEnchantments()!=null && b.getEnchantments()!=null)?Objects.equal(a.getEnchantments(), b.getEnchantments()):true); + } + + private boolean hasItems(ItemStack stack) { + return stack != null && stack.getAmount() > 0; + } + + private boolean isStackSumLegal(ItemStack a, ItemStack b) { + // See if we can create a new item stack with the combined elements of a and b + if (a == null || b == null) + return true; // Treat null as an empty stack + else + return a.getAmount() + b.getAmount() <= a.getType().getMaxStackSize(); + } + + @EventHandler + public void onItemSpawn(ItemSpawnEvent e) { + if (e.getEntity().getType()==EntityType.DROPPED_ITEM) { + if (e.getEntity().getItemStack().getType()==Material.IRON_ORE) { + e.getEntity().getItemStack().setType(Material.IRON_INGOT); + } else if (e.getEntity().getItemStack().getType()==Material.GOLD_ORE) { + e.getEntity().getItemStack().setType(Material.GOLD_INGOT); + } + return; + } + } + + @EventHandler + public void onItemDespawn(ItemDespawnEvent e) { + Item i = e.getEntity(); + Player p = Bukkit.getPlayer("sigonasr2"); + boolean allow=true; + if (this.plugin.getConfig().getBoolean("halloween-enabled") && ( + i.getItemStack().getType()==Material.PUMPKIN_PIE || + i.getItemStack().getType()==Material.SUGAR || + i.getItemStack().getType()==Material.PUMPKIN || + i.getItemStack().getType()==Material.EGG + )) { + allow=false; + } + //p.sendMessage("Item "+i.getItemStack().getItemMeta().getDisplayName()+" despawned.");// <-- CHECK THIS FOR NULL TO DETERMINE IF IT'S A REAL ITEM. + //String metastring = "Has name: "+i.getItemStack().getItemMeta().hasDisplayName(); + //p.sendMessage(metastring); + if (allow) { + Location l1 = new Location(Bukkit.getWorld("world"), 1617, 67, -351); + Location l2 = new Location(Bukkit.getWorld("world"), 1618, 67, -351); + Location k1 = new Location(Bukkit.getWorld("world"), 1617, 67, -355); + Location k2 = new Location(Bukkit.getWorld("world"), 1618, 67, -355); + Location j1 = new Location(Bukkit.getWorld("world"), 1622, 67, -355); + Location j2 = new Location(Bukkit.getWorld("world"), 1623, 67, -355); + Location i1 = new Location(Bukkit.getWorld("world"), 1622, 67, -351); + Location i2 = new Location(Bukkit.getWorld("world"), 1623, 67, -351); + Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(l1).getState(); + int selection=0; + //Choose a chest randomly. + switch ((int)(Math.random()*8)) { + case 0:{ + c=(Chest)Bukkit.getWorld("world").getBlockAt(l1).getState(); + selection=1; + }break; + case 1:{ + c=(Chest)Bukkit.getWorld("world").getBlockAt(l2).getState(); + selection=2; + }break; + case 2:{ + c=(Chest)Bukkit.getWorld("world").getBlockAt(k1).getState(); + selection=3; + }break; + case 3:{ + c=(Chest)Bukkit.getWorld("world").getBlockAt(k2).getState(); + selection=4; + }break; + case 4:{ + c=(Chest)Bukkit.getWorld("world").getBlockAt(j1).getState(); + selection=5; + }break; + case 5:{ + c=(Chest)Bukkit.getWorld("world").getBlockAt(j2).getState(); + selection=6; + }break; + case 6:{ + c=(Chest)Bukkit.getWorld("world").getBlockAt(i1).getState(); + selection=7; + }break; + case 7:{ + c=(Chest)Bukkit.getWorld("world").getBlockAt(i2).getState(); + selection=8; + }break; + } + //Get data about this slot. + int itemslot=this.plugin.getConfig().getInt("chest"+selection+"item"); + double chance=this.plugin.getConfig().getDouble("chest"+selection+"i"); + //First determine if we can even allow this item in. + if (i.getItemStack().getItemMeta().hasDisplayName()==false) { + //p.sendMessage("Item is being checked."); + //Now see if the chance should be reduced, based on its material name. + for (int y=0;y<27;y++) { + if (c.getBlockInventory().getItem(y)!=null && c.getBlockInventory().getItem(y).getType()==i.getItemStack().getType()) { + chance*=2.0d; + //p.sendMessage("Block inventory chance went up. "+c.getBlockInventory().getItem(y).getType()+"="+i.getItemStack().getType()); + } + } + //p.sendMessage("Past for loop."); + //Now check for chance to deposit it. + if (Math.random()*chance<1.0d) { + //Deposit item. Set chance higher. + //p.sendMessage("Going inside..."); + if (c.getBlockInventory().getItem(itemslot)!=null) { + c.getBlockInventory().remove(itemslot); + } + //p.sendMessage("Removed..."); + c.getBlockInventory().setItem(itemslot,i.getItemStack()); + //Clone the item. + //ItemStack tempitem = i.getItemStack(); + //tempitem.setType(Material.STONE_SPADE); + //ItemMeta tempmeta = tempitem.getItemMeta(); + //tempmeta.setDisplayName("Spleef Stone Shovel"); + //tempitem.setItemMeta(tempmeta); + //tempitem.setDurability((short)0); + //p.sendMessage("This item has "+tempitem.getDurability()+" uses."); + //p.getInventory().setItemInHand(tempitem); + //p.sendMessage("Added..."); + this.plugin.getConfig().set("chest"+selection+"item", Integer.valueOf((itemslot+1)%27)); + this.plugin.getConfig().set("chest"+selection+"i", Double.valueOf(this.plugin.getConfig().getDouble("chest"+selection+"i")+this.plugin.getConfig().getDouble("chestchanceincrease"))); + if (this.plugin.getConfig().getDouble("randomitemchance")>8.0d) { + this.plugin.getConfig().set("randomitemchance", Double.valueOf(this.plugin.getConfig().getDouble("randomitemchance")-1.0d)); + } + //////////////p.sendMessage(ChatColor.GRAY+"A new item has been deposited."); + } else { + //p.sendMessage("Failed. Trying this method."); + if (Math.random()*this.plugin.getConfig().getDouble("randomitemchance")<1.0d) { + //p.sendMessage("Made it in."); + int[] items = {1,3,4,5,6,1,13,14,15,17,18,20,22,23,24,25,27,28,39,31,32,33,35,37,38,39,40,41,42,44,45,46,47,48,49,50,53,54,57,58,61,65,66,67,69,70,72,76,77,78,80,81,82,84,85,86,87,88,89,91,96,98,101,102,103,106,107,108,109,111,112,113,114,116,121,122,123,126,128,130,131,133,134,135,136,138,139,143,145,146,147,148,151,152,154,155,156,157,158,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267}; + int[] rareitems = {41,46,57,116,122,133,130,146,151,264,266,276,277,278,279,293,310,311,312,313,368,381,406}; + int item = items[(int)(Math.random()*items.length)]; + ItemStack newitem = i.getItemStack(); + newitem.setTypeId(item); + boolean contains=false; + for (int k=0;k8.0d) { + this.plugin.getConfig().set("randomitemchance", Double.valueOf(this.plugin.getConfig().getDouble("randomitemchance")-1.0d)); + } + } + if (this.plugin.getConfig().getDouble("chest"+selection+"i")>=this.plugin.getConfig().getDouble("chestdecrease")) { + this.plugin.getConfig().set("chest"+selection+"i", Double.valueOf(this.plugin.getConfig().getDouble("chest"+selection+"i")-this.plugin.getConfig().getDouble("chestdecrease"))); + } + this.plugin.getConfig().set("chest"+selection+"item", Integer.valueOf((itemslot+1)%27)); + } + this.plugin.saveConfig(); + } + } + return; + } + //c.getBlockInventory().getSize(); + /* + if (Bukkit.getWorld("world").getBlockAt(l).getType()==Material.CHEST) { + p.sendMessage("Added item "+i.getItemStack().getTypeId()+" to chest."); + Chest c = (Chest)Bukkit.getWorld("world").getBlockAt(l1).getState(); + c.getBlockInventory(). + c.getBlockInventory().addItem(i.getItemStack()); + }*/ + /*// WORKING ITEM CODE. + Location l = new Location(Bukkit.getWorld("world"), 1617, 67, -351); + if (Bukkit.getWorld("world").getBlockAt(l).getType()==Material.CHEST) { + p.sendMessage("Added item to chest."); + Chest c = (Chest)Bukkit.getWorld("world").getBlockAt(l).getState(); + c.getBlockInventory().addItem(i.getItemStack()); + } + */ + + /* + @EventHandler + public void onDamage(EntityDamageEvent e) { + if (e.getEntity().getType() == EntityType.PLAYER) { + Player p = (Player) e.getEntity(); + TagAPI.refreshPlayer(p); + } else { + return; + } + //Player p = e.getPlayer(); + //Player p = Bukkit.getPlayer("sigonasr2"); + //p.setDisplayName(ChatColor.RED+"TEST"); + //p.setPlayerListName(ChatColor.RED+"TEST"); + } + + @EventHandler + public void onHeal(EntityRegainHealthEvent e) { + if (e.getEntity().getType() == EntityType.PLAYER) { + Player p = (Player) e.getEntity(); + TagAPI.refreshPlayer(p); + } else { + return; + } + //Player p = e.getPlayer(); + //Player p = Bukkit.getPlayer("sigonasr2"); + //p.setDisplayName(ChatColor.RED+"TEST"); + //p.setPlayerListName(ChatColor.RED+"TEST"); + } + */ + @EventHandler + public void onRedstoneChange(BlockRedstoneEvent e) { + if (e.getBlock().getType()==Material.REDSTONE_LAMP_ON || e.getBlock().getType()==Material.REDSTONE_LAMP_OFF) { + if (e.getBlock().getX()>=1562 && e.getBlock().getX()<=1644 && e.getBlock().getY()>=64 && e.getBlock().getY()<=79 && e.getBlock().getZ()>=-357 && e.getBlock().getZ()<=-211) { + e.setNewCurrent(15); + } + } + } + + @EventHandler +public void onMinecartExit(VehicleExitEvent e) { + if (e.getVehicle().getType()==EntityType.MINECART) { + Bukkit.getWorld("world").dropItemNaturally(e.getVehicle().getLocation(),new ItemStack(Material.MINECART)); + e.getVehicle().remove(); + } + } + + @EventHandler +public void onMinecartEnter(VehicleEnterEvent e) { + /*if (e.getEntered().getType()==EntityType.PLAYER) { + if (e.getVehicle().getType()==EntityType.MINECART) { + Minecart m = (Minecart)e.getVehicle(); + if (e.getEntered().getLocation().getBlockZ()==-328 || e.getEntered().getLocation().getBlockZ()==-316) { + m.setMaxSpeed(8.0); + } else { + m.setMaxSpeed(4.0); + } + } + }*/ + } + /* + @EventHandler + public void onEntityEvent(EntityEvent e) { + return; + if (e.getEntity().getType()==EntityType.ZOMBIE) { + LivingEntity f = (LivingEntity)e.getEntity(); + if (f.getCustomName()!=null && (f.getCustomName().compareTo("&eCharge Zombie")==0 || f.getCustomName().compareTo("&6Charge Zombie II")==0)) { + //Destroy blocks around it. + + boolean doit=true; + if (f.getKiller()!=null && f.getKiller().getLocation().getY()>f.getLocation().getY()) { + doit=false; + } + if (doit) { + Bukkit.getPlayer("sigonasr2").sendMessage("Charge Zombie!"); + for (int i=-1;i<2;i++) { + for (int j=-1;j<2;j++) { + Location checkloc = f.getLocation().add(i,f.getLocation().getY()+1,j); + Bukkit.getWorld("world").getBlockAt(checkloc).breakNaturally(); + checkloc = f.getLocation().add(i,f.getLocation().getY()+2,j); + Bukkit.getWorld("world").getBlockAt(checkloc).breakNaturally(); + } + } + } + } else { + if (f.getCustomName()!=null) { + Bukkit.getPlayer("sigonasr2").sendMessage(f.getCustomName()); + } + } + } + }*/ + +@EventHandler +public void onShootArrow(ProjectileHitEvent e) { + LivingEntity l = e.getEntity().getShooter(); + if (l!=null && l.getType()==EntityType.SKELETON && l.getCustomName()!=null) { + if ((l.getCustomName().compareTo(ChatColor.YELLOW+"Sniper")==0)) { + boolean found=false; + if (!found) { + //Create a new shooter from this skeleton only if they are not shooting already. + this.plugin.ARROW_SHOOTERS.add(new ArrowShooter(e.getEntity().getVelocity(), e.getEntity().getLocation(),50,10,l)); + } + } else + if (l.getCustomName().compareTo(ChatColor.GOLD+"Sniper II")==0) { + boolean found=false; + if (!found) { + //Create a new shooter from this skeleton only if they are not shooting already. + for (int i=-2;i<3;i+=2) { + this.plugin.ARROW_SHOOTERS.add(new ArrowShooter(e.getEntity().getVelocity(), e.getEntity().getLocation().add(0,i,0),50,5,l)); + this.plugin.ARROW_SHOOTERS.add(new ArrowShooter(e.getEntity().getVelocity(), e.getEntity().getLocation().add(0,i,0),50,5,l)); + } + } + } + } +} + +@EventHandler +public void onEntityExpode(ExplosionPrimeEvent e) { + //Bukkit.getPlayer("AaMay").sendMessage("Entity Type: "+e.getEntity().getType().getName()); + if (e.getEntity().getType()==EntityType.CREEPER) { + LivingEntity c = (LivingEntity)e.getEntity(); + //Bukkit.getPlayer("AaMay").sendMessage("A Creeper exploded."); + if (c.getCustomName()!=null) { + //Bukkit.getPlayer("AaMay").sendMessage("Detected a name."); + if (c.getCustomName().compareTo(ChatColor.YELLOW+"Explosive Creeper")==0) { + Bukkit.getWorld("world").createExplosion(c.getLocation().getX(),c.getLocation().getY(),c.getLocation().getZ(),3f,false,true); + //Bukkit.getPlayer("AaMay").sendMessage("Sent explosion"); + e.setCancelled(true); + } else + if (c.getCustomName().compareTo(ChatColor.GOLD+"Explosive Creeper II")==0) { + Bukkit.getWorld("world").createExplosion(c.getLocation().getX(),c.getLocation().getY(),c.getLocation().getZ(),4f,false,true); + //Bukkit.getPlayer("AaMay").sendMessage("Sent explosion"); + e.setCancelled(true); + } else + if (c.getCustomName().compareTo(ChatColor.YELLOW+"Destructive Creeper")==0) { + Bukkit.getWorld("world").createExplosion(c.getLocation().getX(),c.getLocation().getY(),c.getLocation().getZ(),2f,true,true); + //Bukkit.getPlayer("AaMay").sendMessage("Sent explosion"); + e.setCancelled(true); + } else + if (c.getCustomName().compareTo(ChatColor.GOLD+"Destructive Creeper II")==0) { + Bukkit.getWorld("world").createExplosion(c.getLocation().getX(),c.getLocation().getY(),c.getLocation().getZ(),3f,true,true); + //Bukkit.getPlayer("AaMay").sendMessage("Sent explosion"); + e.setCancelled(true); + } + } + } + //Bukkit.broadcastMessage("Explosion occurs."); +} + +/* + @SuppressWarnings("deprecation") +@EventHandler + public void onPlayerMove(PlayerMoveEvent e) { + Player p = e.getPlayer(); + 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().compareTo(this.plugin.getConfig().getString("spleefrequestc4player"))==0 || p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestd4player"))==0))) { + //You lose. + //See if we're the winner. + int countdead=0; //We're looking for 3. + + + Player winningplayer = p,losingplayer = p; + if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo("none")==0) { + countdead++; + } else { + if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { + losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequesta4player")); + } else { + winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequesta4player")); + } + } + if (this.plugin.getConfig().getString("spleefrequestb4player").compareTo("none")==0) { + countdead++; + } else { + if (this.plugin.getConfig().getString("spleefrequestb4player").compareTo(p.getName())==0) { + losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestb4player")); + } else { + winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestb4player")); + } + } + if (this.plugin.getConfig().getString("spleefrequestc4player").compareTo("none")==0) { + countdead++; + } else { + if (this.plugin.getConfig().getString("spleefrequestc4player").compareTo(p.getName())==0) { + losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestc4player")); + } else { + winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestc4player")); + } + } + if (this.plugin.getConfig().getString("spleefrequestd4player").compareTo("none")==0) { + countdead++; + } else { + if (this.plugin.getConfig().getString("spleefrequestd4player").compareTo(p.getName())==0) { + losingplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestd4player")); + } else { + winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestd4player")); + } + } + if (countdead==2) { + this.plugin.getConfig().set("spleef4insession", Boolean.valueOf(false)); + + + + + + //Stand someplace else when you win. + + + //Losing player has losing player stuff happen. + //This was a player that lost. + //Move them out, give them back their stuff. + Location newloc = p.getLocation(); + //Look for the special shovel for the sake of storing it. + p.getInventory().clear(); + p.getInventory().clear(p.getInventory().getHeldItemSlot()); + //Give inventories back. + if (this.plugin.getConfig().getString("spleefrequesta4player").compareTo(p.getName())==0) { + for (int i=0;i=400) { + //WE have come to a standstill. Pick winner based on who has more blocks. + int player_a_blocks=0,player_b_blocks=0; + for (int i=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getLocation().getBlockX()-4;iplayer_b_blocks) { + blockwinner=1; + } else { + blockwinner=2; + } + } else + if ((p.getLocation().getY()<86.5d || p.getLocation().getZ()<52.0d || p.getLocation().getZ()>65.0d || p.getLocation().getX()>1628.0d || p.getLocation().getX()<1615.0d) || blockwinner!=0) { + //We lose. Other player wins. + this.plugin.getConfig().set("spleefinsession", Boolean.valueOf(false)); + //Find out if we're player A, or player B. + Player winningplayer,losingplayer; + if (p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestaplayer"))==0 || blockwinner==2) { + //We're player A. + //Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestbplayer")+" is the winner of this spleef game! "+this.plugin.getConfig().getString("spleefrequestaplayer")+" loses."); + losingplayer=p; + winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")); + + double val1,val2,value,newval1,newval2; + if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleefrating")) { + val1 = this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleefrating"); + } else { + val1 = 1000.0d; + } + if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleefrating")) { + val2 = this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleefrating"); + } else { + val2 = 1000.0d; + } + value = 1.0d/(1.0d+Math.pow(10.0d, ((val2-val1)/400.0d))); + if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleefwins")) { + this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(this.plugin.getAccountsConfig().getInt(winningplayer.getName()+".spleefwins")+1)); + } else { + this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(1)); + } + if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleeflosses")) { + this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(this.plugin.getAccountsConfig().getInt(winningplayer.getName()+".spleeflosses"))); + } else { + this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(0)); + } + if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleefwins")) { + this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(this.plugin.getAccountsConfig().getInt(losingplayer.getName()+".spleefwins"))); + } else { + this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(0)); + } + if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleeflosses")) { + this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(this.plugin.getAccountsConfig().getInt(losingplayer.getName()+".spleeflosses")+1)); + } else { + this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(1)); + } + newval1 = (val1+Math.round(((50.0d/((this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleefwins")+this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleeflosses"))/20.0d))*(1.0d-value)))); + newval2 = (val2+Math.round(((50.0d/((this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleefwins")+this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleeflosses"))/20.0d))*(0.0d-value)))); + this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefrating",Double.valueOf(newval1)); + this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefrating",Double.valueOf(newval2)); + Location newloc = winningplayer.getLocation(); + + Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestbplayer")+"["+(int)newval1/10+"] is the winner of this spleef game! "+this.plugin.getConfig().getString("spleefrequestaplayer")+"["+(int)newval2/10+"] loses."); + newloc.setX(1622.5d); + newloc.setY(87.0d); + newloc.setZ(51.65d); + winningplayer.teleport(newloc); + updateTopSPLEEFSigns(); + this.plugin.saveAccountsConfig(); + } else { + //We're player B. + //Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestaplayer")+" is the winner of this spleef game! "+this.plugin.getConfig().getString("spleefrequestbplayer")+" loses."); + losingplayer=p; + winningplayer=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")); + double val1,val2,value,newval1,newval2; + if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleefrating")) { + val1 = this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleefrating"); + } else { + val1 = 1000.0d; + } + if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleefrating")) { + val2 = this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleefrating"); + } else { + val2 = 1000.0d; + } + value = 1.0d/(1.0d+Math.pow(10.0d, ((val2-val1)/400.0d))); + if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleefwins")) { + this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(this.plugin.getAccountsConfig().getInt(winningplayer.getName()+".spleefwins")+1)); + } else { + this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefwins", Integer.valueOf(1)); + } + if (this.plugin.getAccountsConfig().contains(winningplayer.getName()+".spleeflosses")) { + this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(this.plugin.getAccountsConfig().getInt(winningplayer.getName()+".spleeflosses"))); + } else { + this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleeflosses", Integer.valueOf(0)); + } + if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleefwins")) { + this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(this.plugin.getAccountsConfig().getInt(losingplayer.getName()+".spleefwins"))); + } else { + this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefwins", Integer.valueOf(0)); + } + if (this.plugin.getAccountsConfig().contains(losingplayer.getName()+".spleeflosses")) { + this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(this.plugin.getAccountsConfig().getInt(losingplayer.getName()+".spleeflosses")+1)); + } else { + this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleeflosses", Integer.valueOf(1)); + } + newval1 = ((val1+Math.round((50.0d/((this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleefwins")+this.plugin.getAccountsConfig().getDouble(winningplayer.getName()+".spleeflosses"))/20.0d))*(1.0d-value)))); + newval2 = ((val2+Math.round((50.0d/((this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleefwins")+this.plugin.getAccountsConfig().getDouble(losingplayer.getName()+".spleeflosses"))/20.0d))*(0.0d-value)))); + this.plugin.getAccountsConfig().set(winningplayer.getName()+".spleefrating",Double.valueOf(newval1)); + this.plugin.getAccountsConfig().set(losingplayer.getName()+".spleefrating",Double.valueOf(newval2)); + Location newloc = winningplayer.getLocation(); + + Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestaplayer")+"["+(int)newval1/10+"] is the winner of this spleef game! "+this.plugin.getConfig().getString("spleefrequestbplayer")+"["+(int)newval2/10+"] loses."); + newloc.setX(1622.5d); + newloc.setY(87.0d); + newloc.setZ(51.65d); + winningplayer.teleport(newloc); + updateTopSPLEEFSigns(); + this.plugin.saveAccountsConfig(); + } + //Look for the special shovel. + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().getHeldItemSlot()); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().getHeldItemSlot()); + //Give inventories back. + 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); + newloc.setY(87.0d); + newloc.setZ(51.65d); + p.teleport(newloc); + p.sendMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.YELLOW+"You are a spectator! What are you thinking?!"); + } + } + } + } + */ + + /* + @EventHandler + public void onNameTag(PlayerReceiveNameTagEvent event) { + //String event.getNamedPlayer().getName() + String name = event.getNamedPlayer().getName(); + //Divide name into two sections based on health. + double healthratio = (double)event.getNamedPlayer().getHealth() / (double)event.getNamedPlayer().getMaxHealth(); + String firstpart=name.substring(0,(int)(name.length() * healthratio)); + String secondpart=name.substring(firstpart.length(),name.length()-firstpart.length()); + event.setTag(ChatColor.GREEN + firstpart + ChatColor.DARK_RED + secondpart); +} +*/ + + @EventHandler + public void onPlayerLeave(PlayerQuitEvent e) { + Player p = e.getPlayer(); + for (int i=0;i nearby = p.getNearbyEntities(30, 30, 30); + for (int i=0;i=20) { + finalcost*=0.25; + } + if (mymoney>=mincost) { + p.sendMessage("You died. It will cost you $"+df.format(finalcost)+" to revive. To revive, type /revive me."); + } else { + p.sendMessage("You died. You do not have enough money in your bank to revive."); + p.sendMessage("Cost: $"+df.format(finalcost)+". If you want to revive, type "+ChatColor.AQUA+"/revive me"+ChatColor.WHITE+" when you have enough."); + } + } + + @EventHandler + public void onSignPlace(SignChangeEvent e) + { + Player p = e.getPlayer(); + String[] lines = e.getLines(); + updateTopSPLEEFSigns(); + if (p.hasPermission("bankeconomy.sign.create")) { + if ((lines[0].equalsIgnoreCase("[Bank]")) && (lines[1].equalsIgnoreCase("Deposit"))) { + e.setLine(0, ChatColor.DARK_GREEN + "[Bank]"); + e.setLine(1, ChatColor.DARK_RED + "Deposit"); + e.setLine(2, "Right-Click"); + e.setLine(3, "to use"); + } else + if ((lines[0].equalsIgnoreCase("[Bank]")) && (lines[1].equalsIgnoreCase("Withdraw"))) { + e.setLine(0, ChatColor.DARK_GREEN + "[Bank]"); + e.setLine(1, ChatColor.DARK_BLUE + "Withdraw"); + e.setLine(2, "Right-Click"); + e.setLine(3, "to use"); + } else + if ((lines[0].equalsIgnoreCase("[Bank]")) && (lines[1].equalsIgnoreCase("Check Balance"))) { + e.setLine(0, ChatColor.DARK_GREEN + "[Bank]"); + e.setLine(1, ChatColor.DARK_GRAY + "Check Balance"); + e.setLine(2, "Right-Click"); + e.setLine(3, "to use"); + } else { + if ((lines[0].equalsIgnoreCase("[Bank]"))) { + e.setCancelled(true); + p.sendMessage("ァcYou do not have permission to create [Bank] signs."); + } + } + } + /* + if (p.hasPermission("bankeconomy.sign.create")) { + if ((lines[0].equalsIgnoreCase("[BankEconomy]")) && (lines[1].equalsIgnoreCase("deposit"))) { + e.setLine(0, ChatColor.DARK_GREEN + "[BankEconomy]"); + if (!lines[2].matches("^[0-9]+$")) { + e.setLine(1, ChatColor.DARK_RED + "Error"); + e.setLine(2, " "); + p.sendMessage("ァ2[BankEconomy]" + ChatColor.AQUA + " The amount of money is invalid. (line 3)"); + } else if (!lines[3].isEmpty()) { + e.setLine(1, ChatColor.DARK_RED + "Error"); + e.setLine(2, " "); + e.setLine(3, " "); + p.sendMessage("ァ2[BankEconomy]" + ChatColor.AQUA + " The line 4 must be empty."); + } else { + e.setLine(1, ChatColor.YELLOW + "deposit"); + p.sendMessage("ァ2[BankEconomy]" + ChatColor.AQUA + " Sign created successfully!"); + } + } else if ((lines[0].equalsIgnoreCase("[BankEconomy]")) && (lines[1].equalsIgnoreCase("withdraw"))) { + e.setLine(0, ChatColor.DARK_GREEN + "[BankEconomy]"); + if (!lines[3].isEmpty()) { + e.setLine(1, ChatColor.DARK_RED + "Error"); + e.setLine(2, " "); + e.setLine(3, " "); + p.sendMessage("ァ2[BankEconomy]" + ChatColor.AQUA + " The line 4 must be empty."); + } else if (!lines[2].matches("^[0-9]+$")) { + e.setLine(1, ChatColor.DARK_RED + "Error"); + e.setLine(2, " "); + p.sendMessage("ァ2[BankEconomy]" + ChatColor.AQUA + " The amount of money is invalid. (line 3)"); + } else { + e.setLine(1, ChatColor.YELLOW + "withdraw"); + p.sendMessage("ァ2[BankEconomy]" + ChatColor.AQUA + " Sign created successfully!"); + } + } else if ((lines[0].equalsIgnoreCase("[BankEconomy]")) && (lines[1].equalsIgnoreCase("information"))) { + e.setLine(0, ChatColor.DARK_GREEN + "[BankEconomy]"); + if ((!lines[2].isEmpty()) || (!lines[3].isEmpty())) { + e.setLine(1, ChatColor.DARK_RED + "Error"); + e.setLine(2, " "); + e.setLine(3, " "); + p.sendMessage("ァ2[BankEconomy]" + ChatColor.AQUA + " Lines 3 and 4 must be empty."); + } else { + e.setLine(0, ChatColor.DARK_GREEN + "[BankEconomy]"); + e.setLine(1, ChatColor.YELLOW + "information"); + } + } else if (lines[0].equalsIgnoreCase("[BankEconomy]")) { + e.setLine(0, ChatColor.DARK_GREEN + "[BankEconomy]"); + e.setLine(1, ChatColor.DARK_RED + "Error"); + e.setLine(2, " "); + e.setLine(3, " "); + p.sendMessage("ァ2[BankEconomy]" + ChatColor.AQUA + " Invalid action."); + } + } else { + if ((lines[0].equalsIgnoreCase("[BankEconomy]"))) { + e.setCancelled(true); + p.sendMessage("ァcYou do not have permission."); + } + }*/ + } + + public int getSongDuration(Material record) { + int padding=20; + if (record==Material.RECORD_3) { + return 345/2+5+padding; + } else + if (record==Material.RECORD_4) { + return 185/2+5+padding; + } else + if (record==Material.RECORD_5) { + return 174/2+5+padding; + } else + if (record==Material.RECORD_6) { + return 197/2+5+padding; + } else + if (record==Material.RECORD_7) { + return 96/2+5+padding; + } else + if (record==Material.RECORD_8) { + return 150/2+5+padding; + } else + if (record==Material.RECORD_9) { + return 188/2+5+padding; + } else + if (record==Material.RECORD_10) { + return 251/2+5+padding; + } else + if (record==Material.RECORD_11) { + return 71/2+5+padding; + } else + if (record==Material.RECORD_12) { + return 238/2+5+padding; + } else + if (record==Material.GOLD_RECORD) { + return 178/2+5+padding; + } else + if (record==Material.GREEN_RECORD) { + return 185/2+5+padding; + } else + return 0; + } + + @EventHandler + public void onPlayerChat(PlayerChatEvent e) { + //Check if they are withdrawing or depositing money. + DecimalFormat df = new DecimalFormat("#0.00"); + if (e.getPlayer().getName().equalsIgnoreCase(this.plugin.last_bank_deposit_user) && this.plugin.last_bank_deposit_use_time+200>Bukkit.getWorld("world").getFullTime()) { + //Parse the amount. + double val=0; + if (e.getMessage().equalsIgnoreCase("all")) { + //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)); + 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 { + try { + val = Double.parseDouble(e.getMessage()); + //Make sure the user is holding at least that much money. + if (this.plugin.economy.getBalance(e.getPlayer().getName())>=val && val>0) { + //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)); + 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 { + 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)"); + this.plugin.last_bank_deposit_use_time=Bukkit.getWorld("world").getFullTime(); + } + } catch (NumberFormatException ex_e) { + e.getPlayer().sendMessage(ChatColor.RED+"That is not a valid amount! Please try again."); + this.plugin.last_bank_deposit_use_time=Bukkit.getWorld("world").getFullTime(); + } + } + e.setCancelled(true); + } else + if (e.getPlayer().getName().equalsIgnoreCase(this.plugin.last_bank_withdraw_user) && this.plugin.last_bank_withdraw_use_time+200>Bukkit.getWorld("world").getFullTime()) { + //Parse the amount. + 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)); + 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; + } 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) { + //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)); + 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 { + 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)"); + this.plugin.last_bank_withdraw_use_time=Bukkit.getWorld("world").getFullTime(); + } + } catch (NumberFormatException ex_e) { + e.getPlayer().sendMessage(ChatColor.RED+"That is not a valid amount! Please try again."); + this.plugin.last_bank_withdraw_use_time=Bukkit.getWorld("world").getFullTime(); + } + } + e.setCancelled(true); + } else + { + Player[] playerlist = Bukkit.getOnlinePlayers(); + for (int i=0;i1) { + ItemStack newitem = p.getItemInHand().clone(); + newitem.setAmount(p.getItemInHand().getAmount()-1); + p.getItemInHand().setAmount(1); + //Drop the rest on the ground. + p.getWorld().dropItemNaturally(p.getLocation(), newitem); + } + ItemMeta meta = p.getItemInHand().getItemMeta(); + List newlore = meta.getLore(); + newlore.add("ID#"+identifier); + meta.setLore(newlore); + p.getItemInHand().setItemMeta(meta); + } + Inventory screen = null; + if (smallchest) { + FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); + if (!f.contains("created")) { + for (int i=0;i<9;i++) { + f.set("item-"+i, new ItemStack(Material.AIR)); + } + f.set("created", Boolean.valueOf(true)); + } + //List items = new ArrayList(); + screen=Bukkit.createInventory(p, 9, "Item Cube #"+identifier); + for (int i=0;i<9;i++) { + //items.add(f.getItemStack("item-"+i)); + screen.setItem(i, f.getItemStack("item-"+i)); + } + this.plugin.saveItemCubeConfig(f, identifier); + } + if (largechest) { + FileConfiguration f = this.plugin.reloadItemCubeConfig(identifier); + if (!f.contains("created")) { + for (int i=0;i<54;i++) { + f.set("item-"+i, new ItemStack(Material.AIR)); + } + f.set("created", Boolean.valueOf(true)); + } + //List items = new ArrayList(); + screen=Bukkit.createInventory(p, 54, "Large Item Cube #"+identifier); + for (int i=0;i<54;i++) { + //items.add(f.getItemStack("item-"+i)); + screen.setItem(i, f.getItemStack("item-"+i)); + } + this.plugin.saveItemCubeConfig(f, identifier); + } + if (screen!=null) { + p.closeInventory(); + p.openInventory(screen); + e.setCancelled(true); + return; + } + } + } + } + if (blockAction == Action.RIGHT_CLICK_BLOCK) { + /*//CREATE THE GIANT PUMPKIN + File file = new File("plugins/WorldEdit/schematics/Pumpkin.schematic"); + if (file.exists()) { + try { + //Pumpkin is 18x18. + com.sk89q.worldedit.Vector v = new com.sk89q.worldedit.Vector(e.getClickedBlock().getLocation().getX(), e.getClickedBlock().getLocation().getY()+1, e.getClickedBlock().getLocation().getZ()); + World worldf = Bukkit.getWorld("world"); + BukkitWorld BWf = new BukkitWorld(worldf); + EditSession es = new EditSession(BWf, 2000000); + CuboidClipboard c1 = SchematicFormat.MCEDIT.load(file); + c1.place(es, v, true); + } catch (DataException ex) { + Bukkit.getLogger().warning("DataException while trying to create structure."); + } catch (IOException ex) { + Bukkit.getLogger().warning("IOException while trying to create structure."); + } catch (MaxChangedBlocksException ex) { + Bukkit.getLogger().warning("MaxChangedBlocksException while trying to create structure."); + } + } else { + Bukkit.getLogger().warning(("File does not exist.")); + }*/ + //Bukkit.getWorld("world").createExplosion(p.getLocation().getX(),p.getLocation().getY(),p.getLocation().getZ(),3f,false,true); + /* + if (p.getName().compareToIgnoreCase("AaMay")==0) { + LivingEntity f = (LivingEntity)Bukkit.getWorld("world").spawnEntity(p.getLocation(), EntityType.CREEPER); + f.setCustomName(ChatColor.GOLD+"Destructive Creeper II"); + f.setCustomNameVisible(true); + }*/ + if ((e.getClickedBlock().getType()==Material.GRASS || e.getClickedBlock().getType()==Material.DIRT) && ( + p.getItemInHand().getType()==Material.WOOD_HOE || + p.getItemInHand().getType()==Material.STONE_HOE || + p.getItemInHand().getType()==Material.IRON_HOE || + p.getItemInHand().getType()==Material.GOLD_HOE || + p.getItemInHand().getType()==Material.DIAMOND_HOE) && this.plugin.PlayerinJob(p, "Farmer") && this.plugin.getJobLv("Farmer", p)>=5) { + p.getItemInHand().setDurability((short)0); + p.updateInventory(); + } + if (e.getClickedBlock().getType() == Material.JUKEBOX && e.getItem()!=null && (e.getItem().getType()==Material.RECORD_3 || + e.getItem().getType()==Material.RECORD_4 || e.getItem().getType()==Material.RECORD_5 || + e.getItem().getType()==Material.RECORD_6 || e.getItem().getType()==Material.RECORD_7 || + e.getItem().getType()==Material.RECORD_8 || e.getItem().getType()==Material.RECORD_9 || + e.getItem().getType()==Material.RECORD_10 || e.getItem().getType()==Material.RECORD_11 || + e.getItem().getType()==Material.RECORD_12 || e.getItem().getType()==Material.GOLD_RECORD || + e.getItem().getType()==Material.GREEN_RECORD)) { + //if (p.getName().compareTo("sigonasr2")==0) {p.sendMessage("This is a jukebox.");} + //if (p.getName().compareTo("sigonasr2")==0) {p.sendMessage("Item in hand: "+e.getItem().getType().toString());} + boolean contains=false; + for (int i=0;i newlore = new ArrayList(); + newlore.add("Requires "+((int)(Math.random()*1000)+100)+" Pumpkin Pie in inventory"); + newlore.add("to convert to a legendary equipment item."); + meta.setLore(newlore); + meta.setDisplayName(ChatColor.GREEN+"Magical Pumpkin Pie"); + pump.setItemMeta(meta); + c.getInventory().setItem(i, pump); + break; + } + } + } + } + } + /* + if (p.getName().compareTo("sigonasr2")==0) { + int v=2; + final Vector direction = p.getEyeLocation().getDirection().multiply(v); + Bukkit.getWorld("world").spawnEntity(p.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), EntityType.SILVERFISH); + }*/ + //if (p.getName().compareTo("sigonasr2")==0) {Bukkit.getPlayer("sigonasr2").sendMessage("This block is at "+e.getClickedBlock().getX()+" "+e.getClickedBlock().getY()+" "+e.getClickedBlock().getZ()+" Data value:"+e.getClickedBlock().getData());} + if ((e.getClickedBlock().getState() instanceof BrewingStand)) { + BrewingStand brewingstand = (BrewingStand)e.getClickedBlock().getState(); + //Bukkit.getPlayer("sigonasr2").sendMessage("This is a furnace "+furnace.getBurnTime()+","+furnace.getCookTime()); + boolean contains=false; + //This furnace becomes owned. Add it to list if it doesn't exist. + 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)) { + 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())); + } + } else { + if (p.getName().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())); + 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; + } else { + playerarating=1000; + } + if (this.plugin.getAccountsConfig().contains(this.plugin.getConfig().getString("spleefrequestbplayer")+".spleefrating")) { + playerbrating=(int)this.plugin.getAccountsConfig().getDouble(this.plugin.getConfig().getString("spleefrequestbplayer")+".spleefrating")/10; + } else { + playerbrating=1000; + } + Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.GREEN+"Spleef Game Started: "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestaplayer")+"["+playerarating+"] vs. "+this.plugin.getConfig().getString("spleefrequestbplayer")+"["+playerbrating+"]"); + this.plugin.getConfig().set("spleefinsession", Boolean.valueOf(true)); + this.plugin.spleef_inventory_a = Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().getContents(); + this.plugin.spleef_inventory_b = Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().getContents(); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().getHeldItemSlot()); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().getHeldItemSlot()); + //Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).updateInventory(); + //Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).updateInventory(); + for (int i=1617;i<1627;i++) { + for (int j=54;j<64;j++) { + Bukkit.getWorld("world").getBlockAt(i,86,j).setType(Material.DIRT); + } + } + Location theshovel = new Location(Bukkit.getWorld("world"), 1627, 50, 27); + Chest shovelchest = (Chest)Bukkit.getWorld("world").getBlockAt(theshovel).getState(); + for (int i=0;i<27;i++) { + if (shovelchest.getBlockInventory().getContents()[i]!=null && shovelchest.getBlockInventory().getContents()[i].getType()==Material.WOOD_SPADE) { + this.plugin.store_shovel=shovelchest.getBlockInventory().getContents()[i]; + break; + } + } + Location l1 = new Location(Bukkit.getWorld("world"), 1622, 85, 58); + Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(l1).getState(); + if (!c.getBlockInventory().contains(this.plugin.store_shovel)) { + c.getBlockInventory().setItem((int)(Math.random()*27.0d), this.plugin.store_shovel); + } + for (int i=1617;i<1627;i++) { + for (int j=54;j<64;j++) { + Bukkit.getWorld("world").getBlockAt(i,86,j).setType(Material.DIRT); + } + } + Bukkit.getWorld("world").getBlockAt(1622,86,58).setType(Material.WOOD); + Location newloc=playera.getLocation(); + newloc.setX(1622.49d); + newloc.setY(87.0d); + newloc.setZ(54.53d); + playera.teleport(newloc); + newloc.setZ(63.5d); + playerb.teleport(newloc); + this.plugin.spleef_last_broken_block=p.getPlayerTime(); + } + } + this.plugin.saveConfig(); + 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)) { + 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())); + } + } else { + if (p.getName().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())); + playera=Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")); + playerb=p; + if (this.plugin.getAccountsConfig().contains(this.plugin.getConfig().getString("spleefrequestaplayer")+".spleefrating")) { + playerarating=(int)this.plugin.getAccountsConfig().getDouble(this.plugin.getConfig().getString("spleefrequestaplayer")+".spleefrating")/10; + } else { + playerarating=100; + } + if (this.plugin.getAccountsConfig().contains(this.plugin.getConfig().getString("spleefrequestbplayer")+".spleefrating")) { + playerbrating=(int)this.plugin.getAccountsConfig().getDouble(this.plugin.getConfig().getString("spleefrequestbplayer")+".spleefrating")/10; + } else { + playerbrating=100; + } + Bukkit.broadcastMessage(ChatColor.RED+"[SPLEEF] "+ChatColor.GREEN+"Spleef Game Started: "+ChatColor.YELLOW+this.plugin.getConfig().getString("spleefrequestaplayer")+"["+playerarating+"] vs. "+this.plugin.getConfig().getString("spleefrequestbplayer")+"["+playerbrating+"]"); + this.plugin.getConfig().set("spleefinsession", Boolean.valueOf(true)); + this.plugin.spleef_inventory_a = Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().getContents(); + this.plugin.spleef_inventory_b = Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().getContents(); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).getInventory().getHeldItemSlot()); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(); + Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().clear(Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).getInventory().getHeldItemSlot()); + //Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestaplayer")).updateInventory(); + //Bukkit.getPlayer(this.plugin.getConfig().getString("spleefrequestbplayer")).updateInventory(); + Location theshovel = new Location(Bukkit.getWorld("world"), 1627, 50, 27); + Chest shovelchest = (Chest)Bukkit.getWorld("world").getBlockAt(theshovel).getState(); + for (int i=0;i<27;i++) { + if (shovelchest.getBlockInventory().getContents()[i]!=null && shovelchest.getBlockInventory().getContents()[i].getType()==Material.WOOD_SPADE) { + this.plugin.store_shovel=shovelchest.getBlockInventory().getContents()[i]; + break; + } + } + Location l1 = new Location(Bukkit.getWorld("world"), 1622, 85, 58); + Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(l1).getState(); + if (!c.getBlockInventory().contains(this.plugin.store_shovel)) { + c.getBlockInventory().setItem((int)(Math.random()*27.0d), this.plugin.store_shovel); + } + for (int i=1617;i<1627;i++) { + for (int j=54;j<64;j++) { + Bukkit.getWorld("world").getBlockAt(i,86,j).setType(Material.DIRT); + } + } + Bukkit.getWorld("world").getBlockAt(1622,86,58).setType(Material.WOOD); + Location newloc=playera.getLocation(); + newloc.setX(1622.49d); + newloc.setY(87.0d); + newloc.setZ(54.53d); + playera.teleport(newloc); + newloc.setZ(63.5d); + playerb.teleport(newloc); + this.plugin.spleef_last_broken_block=p.getPlayerTime(); + } + } + this.plugin.saveConfig(); + this.plugin.saveAccountsConfig(); + } + } + if (stats) { + if (p.hasPermission("bankeconomy.sign.use")) { + if ((sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_GREEN + "[Bank]")) && (sign.getLine(1).equalsIgnoreCase(ChatColor.DARK_RED + "Deposit"))) { + /*double value = Double.parseDouble(arg0); + double total = actMon + value; + if (value <= actHand) { + this.plugin.getAccountsConfig().set(p.getName() + ".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); + } 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())) { + this.plugin.last_bank_withdraw_user=""; + } + if (this.plugin.last_bank_deposit_use_time+200='a'&&mod[i]<='z') { + mod[i]-=32; + first=true; + } else + if (i==0) { + if (mod[i]>='A'&&mod[i]<='Z') { + first=true; + } + } else { + if (mod[i]>='A'&&mod[i]<='Z'&&(mod[i-1]<'A'||mod[i-1]>'Z')) { + first=true; + } + } + } else { + if (mod[i-1]!=' ') { + if (mod[i]>='A'&&mod[i]<='Z') { + mod[i]+=32; + } + } + } + } + return String.valueOf(mod); +} +/* + @EventHandler + public void onLightningStrike(LightningStrikeEvent e) { + Bukkit.getWorld("world").strikeLightning(new Location("world", Bukkit.getOnlinePlayers()[(int)(Math.random()*Bukkit.getOnlinePlayers().length)].getLocation().getX(), 0d, 0d)); + }*/ + +} + diff --git a/BankEconomyMod/src/me/kaZep/Base/ReviveInventory.java b/BankEconomyMod/src/me/kaZep/Base/ReviveInventory.java new file mode 100644 index 0000000..7d730fc --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/ReviveInventory.java @@ -0,0 +1,24 @@ +package me.kaZep.Base; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class ReviveInventory { + public ItemStack[] mainInventory; + public ItemStack[] armorInventory; + public float expamt; + public float explv; + public long dropTime; + public Player p; + public Location deathLocation; + public ReviveInventory(Player p) { + mainInventory = p.getInventory().getContents(); + armorInventory = p.getInventory().getArmorContents(); + expamt = p.getExp(); + explv = p.getLevel(); + dropTime = Bukkit.getWorld("world").getFullTime()+12000; + deathLocation = p.getLocation(); + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/StoreValues.java b/BankEconomyMod/src/me/kaZep/Base/StoreValues.java new file mode 100644 index 0000000..cd7436e --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/StoreValues.java @@ -0,0 +1,16 @@ +package me.kaZep.Base; + +import org.bukkit.enchantments.Enchantment; + +public class StoreValues { + double chance; + Enchantment enchant; + int level; + int enchantlevel; + StoreValues(double chance, Enchantment enchant,int level,int enchantlevel) { + this.chance=chance; + this.enchant=enchant; + this.level=level; + this.enchantlevel=enchantlevel; + } +} \ No newline at end of file diff --git a/BankEconomyMod/src/me/kaZep/Base/SupportEntity.java b/BankEconomyMod/src/me/kaZep/Base/SupportEntity.java new file mode 100644 index 0000000..a989adc --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/SupportEntity.java @@ -0,0 +1,26 @@ +package me.kaZep.Base; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +public class SupportEntity { + public List id; + Player p; + public long registeredtime; + public SupportEntity(Player p) { + this.p=p; + id = new ArrayList(); + registeredtime = Bukkit.getWorld("world").getFullTime()+1200; + } + public List getEntities() { + return id; + } + public Player getPlayer() { + return p; + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/SupportPlayer.java b/BankEconomyMod/src/me/kaZep/Base/SupportPlayer.java new file mode 100644 index 0000000..85c503b --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/SupportPlayer.java @@ -0,0 +1,13 @@ +package me.kaZep.Base; + +import org.bukkit.entity.Player; + +public class SupportPlayer { + Player p; + int myarmorbuff=0; + int myhpbuff=0; + int myspdbuff=0; + public SupportPlayer(Player p) { + this.p=p; + } +} diff --git a/BankEconomyMod/src/me/kaZep/Base/TempWeb.java b/BankEconomyMod/src/me/kaZep/Base/TempWeb.java new file mode 100644 index 0000000..117c473 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Base/TempWeb.java @@ -0,0 +1,12 @@ +package me.kaZep.Base; + +import org.bukkit.Location; + +public class TempWeb { + public Location loc; + public int timer; + public TempWeb(Location loc, int timer) { + this.loc=loc; + this.timer=timer; + } +} diff --git a/BankEconomyMod/src/me/kaZep/Commands/JobsDataInfo.java b/BankEconomyMod/src/me/kaZep/Commands/JobsDataInfo.java new file mode 100644 index 0000000..af32055 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Commands/JobsDataInfo.java @@ -0,0 +1,252 @@ +package me.kaZep.Commands; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +public class JobsDataInfo { + String jobname; + String introstring; + String actionname1; + String actionname2; + String actionname3; + String actionname4; + List extrainfo; + List datanames1; + List datanames2; + List datanames3; + List datanames4; + String lv5buff; + String lv10buff; + String lv20buff; + String lv40buff; + List dataprice1; + List dataprice2; + List dataprice3; + List dataprice4; + List dataexp1; + List dataexp2; + List dataexp3; + List dataexp4; + public double basexp; + public double explvup; + public double explvmult; + public double moneymult; + public JobsDataInfo() { + jobname = ""; + introstring = ""; + actionname1 = ""; + actionname2 = ""; + actionname3 = ""; + actionname4 = ""; + extrainfo = new ArrayList(); + datanames1 = new ArrayList(); + datanames2 = new ArrayList(); + datanames3 = new ArrayList(); + datanames4 = new ArrayList(); + lv5buff = ""; + lv10buff = ""; + lv20buff = ""; + lv40buff = ""; + dataprice1 = new ArrayList(); + dataprice2 = new ArrayList(); + dataprice3 = new ArrayList(); + dataprice4 = new ArrayList(); + dataexp1 = new ArrayList(); + dataexp2 = new ArrayList(); + dataexp3 = new ArrayList(); + dataexp4 = new ArrayList(); + basexp = 0; + explvup = 0; + explvmult = 0; + moneymult = 0; + } + public void setJobName(String title) { + this.jobname = title; + } + public void setJobDescription(String desc) { + this.introstring = desc; + } + public void addExtraData(String info) { + extrainfo.add(info); + } + public String getBuffData(int lv) { + switch (lv) { + case 5:{ + return this.lv5buff; + } + case 10:{ + return this.lv10buff; + } + case 20:{ + return this.lv20buff; + } + case 40:{ + return this.lv40buff; + } + } + return ""; + } + public void setBuffData(String lv5,String lv10,String lv20,String lv40) { + this.lv5buff=lv5; + this.lv10buff=lv10; + this.lv20buff=lv20; + this.lv40buff=lv40; + } + public void setAction(int numb, String name) { + switch (numb) { + case 0:{ + this.actionname1=name; + }break; + case 1:{ + this.actionname2=name; + }break; + case 2:{ + this.actionname3=name; + }break; + case 3:{ + this.actionname4=name; + }break; + default:{ + this.actionname1=name; + } + } + } + public void setExp(double base, double lvup, double lvmult, double moneymult) { + this.basexp=base; + this.explvup=lvup; + this.explvmult=lvmult; + this.moneymult=moneymult-1; + } + public void addData(String name, double price, double exp, int actionnumb) { + switch (actionnumb) { + case 0:{ + this.datanames1.add(name); + this.dataprice1.add(price); + this.dataexp1.add(exp); + }break; + case 1:{ + this.datanames2.add(name); + this.dataprice2.add(price); + this.dataexp2.add(exp); + }break; + case 2:{ + this.datanames3.add(name); + this.dataprice3.add(price); + this.dataexp3.add(exp); + }break; + case 3:{ + this.datanames4.add(name); + this.dataprice4.add(price); + this.dataexp4.add(exp); + }break; + default:{ + this.datanames1.add(name); + this.dataprice1.add(price); + this.dataexp1.add(exp); + } + } + } + public void sendOutput(Player p) { + DecimalFormat df = new DecimalFormat("#0.00"); + p.sendMessage(this.jobname); + p.sendMessage(""); + p.sendMessage(this.introstring); + if (this.extrainfo!=null) { + for (int i=0;i0 && lv<=40) { + DecimalFormat df = new DecimalFormat("#0.00"); + p.sendMessage(this.jobname); + p.sendMessage(""); + p.sendMessage(this.introstring); + if (this.extrainfo!=null) { + for (int i=0;i40) { + p.sendMessage(ChatColor.RED+"Level must be between 1 and 40."); + } + return false; + } + } +} diff --git a/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java new file mode 100644 index 0000000..c7f10a1 --- /dev/null +++ b/BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java @@ -0,0 +1,913 @@ +package me.kaZep.Commands; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import me.kaZep.Base.Main; +import net.milkbowl.vault.economy.Economy; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.Server; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.MerchantInventory; +import org.bukkit.inventory.meta.ItemMeta; + + +public class commandBankEconomy + implements CommandExecutor +{ + public Main plugin; + String prefix = "2[BankEconomy]"; + String usage = "bUsage:"; + String invARG = "cInvalid argument. Please use 2/bankeconomyc to see a full list of commands."; + String invARGT2 = "cInvalid argument or insufficient permissions."; + String offlinePlayer = "cPlayer not found."; + String accountDisabled = "cYour account is disabled."; + + String cmdInfo = "aYour bank balance isb"; + String cmdCheckARG1 = "a/bankeconomy check "; + String cmdResetARG1 = "a/bankeconomy reset "; + String cmdDepositARG1 = "a"; + String cmdWithdrawARG1 = "a"; + String cmdTransferARG1 = "a/transfer "; + String cmdTransferARG2 = "aPlease precise the name of the player."; + String cmdEditARG1 = "a/bankeconomy edit "; + String cmdEditARG2 = "aPlease precise the value."; + + String cmdCheckReponsePlayer = "a's bank balance isb"; + String cmdResetToPlayer1 = "aYou have reset"; + String cmdResetToPlayer2 = "'s bank account."; + String cmdResetToTarget = "has reset your bank account."; + String cmdReload = "aAll the configs have been reloaded succesfully."; + String notEnoughMoney = "aYou do not own that amount of money."; + String succesfullDeposited = "aYou have depositedb"; + String succesfullWithdraw = "aYou have withdrawnb"; + String cmdTransferToPlayer1 = "aYou have transferedb"; + String cmdTransferToPlayer2 = "atob"; + String cmdTransferToTarget1 = "ahas transfered to youb"; + String cmdTransferSameNick = "aYou can't transfer money to yourself."; + String cmdEditAvaibleActions = "aAvaible actions: status, balance"; + String cmdEditDisabledToPlayer1 = "aYou have disabled"; + String cmdEditDisabledToPlayer2 = "'s bank account."; + String cmdEditEnableToPlayer1 = "aYou have enabled"; + String cmdEditEnableToPlayer2 = "'s bank account."; + String cmdEditAmountSetPlayer1 = "aYou have set"; + String cmdEditAmountSetPlayer2 = "atob"; + String cmdEditAmountSetPlayer3 = "a's account."; + + public commandBankEconomy(Main plugin) + { + this.plugin = plugin; + } + + public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) + { + if ((sender instanceof Player)) { + Player p = (Player)sender; + + boolean status = this.plugin.getAccountsConfig().getBoolean(p.getName() + ".status"); + int playerBankBalance = this.plugin.getAccountsConfig().getInt(p.getName() + ".money"); + + String currencySingular = Main.economy.currencyNameSingular(); + String currencyPlural = Main.economy.currencyNamePlural(); + + if (!status) + p.sendMessage(this.prefix + " " + this.accountDisabled); + else if (status) { + if ((args.length == 0)) { + if (cmd.getName().equalsIgnoreCase("sp")) { + //Show a list of all stat points and what you have currently allocated. + p.sendMessage(""); + p.sendMessage("Stat Listing shown as: "+ChatColor.AQUA+"Cost, "+ChatColor.YELLOW+"Current Buff, "+ChatColor.RED+"Next Level, "+ChatColor.GREEN+" Description"); + p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"#10 "+ChatColor.RESET+ChatColor.WHITE+"+"+this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")/6+" - "+ChatColor.AQUA+" 6 pts: "+ChatColor.YELLOW+((this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")<24 /*Not maxed.*/?(this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat1")>0/*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.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")) { + Inventory i = Bukkit.createInventory(p, 27, "Notification Options"); + int count=-1; + ItemStack temp,on,off; + temp=new ItemStack(Material.DIRT); + 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)); + 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_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_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_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_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)); + p.openInventory(i); + } else + if (cmd.getName().equalsIgnoreCase("event")) { + if (p.hasPermission("maintenance-mode-admin")) { + p.sendMessage("Events available: halloween. Use: /event "); + } + } else + if (cmd.getName().equalsIgnoreCase("maintenance")) { + if (p.hasPermission("maintenance-mode-admin")) { + if (this.plugin.getConfig().getBoolean("maintenance-mode")) { + this.plugin.getConfig().set("maintenance-mode", Boolean.valueOf(false)); + Bukkit.broadcastMessage("Maintenance mode is now "+ChatColor.BLUE+" OFF"+ChatColor.RESET+"."); + } else { + this.plugin.getConfig().set("maintenance-mode", Boolean.valueOf(true)); + Bukkit.broadcastMessage("Maintenance mode is now "+ChatColor.RED+" ON"+ChatColor.RESET+"."); + } + this.plugin.saveConfig(); + } + } else + if (cmd.getName().equalsIgnoreCase("transfer")) { + p.sendMessage("Usage: "+ChatColor.RED+"/transfer name money"+ChatColor.WHITE+" - Transfer money to a player."); + } else + if (cmd.getName().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")) { + Map map = p.getItemInHand().getEnchantments(); + for (Map.Entry entry : map.entrySet()) { + p.getItemInHand().removeEnchantment(entry.getKey()); + } + p.sendMessage("Enchantments removed on this item."); + } + else + if (cmd.getName().equalsIgnoreCase("jobs")) { + FileConfiguration config = this.plugin.getConfig(); + int MAXJOBS = config.getInt("jobs.MAX_JOBS"); + p.sendMessage(ChatColor.GOLD+" Blacksmith ("+config.getInt("jobs.Blacksmith")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.DARK_GREEN+" Breeder ("+config.getInt("jobs.Breeder")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.LIGHT_PURPLE+" Brewer ("+config.getInt("jobs.Brewer")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.WHITE+" Builder ("+config.getInt("jobs.Builder")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.YELLOW+" Cook ("+config.getInt("jobs.Cook")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.GOLD+" Digger ("+config.getInt("jobs.Digger")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.DARK_BLUE+" Enchanter ("+config.getInt("jobs.Enchanter")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.WHITE+" Explorer ("+config.getInt("jobs.Explorer")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.BLUE+" Farmer ("+config.getInt("jobs.Farmer")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.AQUA+" Fisherman ("+config.getInt("jobs.Fisherman")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.RED+" Hunter ("+config.getInt("jobs.Hunter")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.GRAY+" Miner ("+config.getInt("jobs.Miner")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.DARK_RED+" Support ("+config.getInt("jobs.Support")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.DARK_PURPLE+" Weaponsmith ("+config.getInt("jobs.Weaponsmith")+"/"+MAXJOBS+")"); + p.sendMessage(ChatColor.GREEN+" Woodcutter ("+config.getInt("jobs.Woodcutter")+"/"+MAXJOBS+")"); + p.sendMessage("For more information, type "+ChatColor.GREEN+"/jobs info [JobName]"); + } else + if (!p.hasPermission("bankeconomy.main.admin")) { + p.sendMessage(ChatColor.GOLD + "---===" + this.prefix + + ChatColor.GOLD + "===---"); + p.sendMessage(ChatColor.RED + "/bankeconomy transfer " + + ChatColor.AQUA + + "- Transfer some money to other player."); + p.sendMessage(ChatColor.RED + "/bankeconomy info " + + ChatColor.AQUA + "- See your bank informations."); + p.sendMessage(ChatColor.RED + "/revive me" + + ChatColor.AQUA + "- Revive after a death."); + p.sendMessage(ChatColor.RED + "/revive amount " + + ChatColor.AQUA + "- Check cost to revive at current location."); + } else { + p.sendMessage(ChatColor.GOLD + "---===" + this.prefix + + ChatColor.GOLD + "===---"); + p.sendMessage(ChatColor.RED + "/bankeconomy transfer " + + ChatColor.AQUA + + "- Transfer some money to other player."); + p.sendMessage(ChatColor.RED + "/bankeconomy info " + + ChatColor.AQUA + "- See your bank informations."); + p.sendMessage(ChatColor.DARK_RED + "/bankeconomy edit " + + ChatColor.DARK_AQUA + "- Edit a player bank account."); + p.sendMessage(ChatColor.RED + "/revive me" + + ChatColor.AQUA + "- Revive after a death."); + p.sendMessage(ChatColor.RED + "/revive amount " + + ChatColor.AQUA + "- Check cost to revive at current location."); + p.sendMessage(ChatColor.DARK_RED + "/bankeconomy check " + + ChatColor.DARK_AQUA + + "- Check a player bank account."); + p.sendMessage(ChatColor.DARK_RED + "/bankeconomy reset " + + ChatColor.DARK_AQUA + + "- Delete a player bank account."); + p.sendMessage(ChatColor.DARK_RED + "/bankeconomy reload " + + ChatColor.DARK_AQUA + + "- Reloads config and accounts."); + } + } else + if (cmd.getName().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)); + p.sendMessage("Halloween event disabled."); + } else { + this.plugin.getConfig().set("halloween-enabled", Boolean.valueOf(true)); + p.sendMessage("Halloween event enabled."); + } + this.plugin.saveConfig(); + } + } else + if (cmd.getName().equalsIgnoreCase("event") && args.length==2 && p.hasPermission("maintenance-mode-admin")) { + if (args[0].equalsIgnoreCase("halloween") && args[1].equalsIgnoreCase("giant_pumpkin")) { + if (this.plugin.getConfig().getBoolean("halloween-enabled")) { + ItemStack item = new ItemStack(Material.PUMPKIN); + ItemMeta meta = item.getItemMeta(); + meta.setDisplayName(ChatColor.GREEN+"Giant Pumpkin"); + List lore = new ArrayList(); + lore.add("Place the Giant Pumpkin on an Orange"); + lore.add("Block to start carving your pumpkin!"); + meta.setLore(lore); + item.setItemMeta(meta); + p.getInventory().addItem(item); + } + this.plugin.saveConfig(); + } + if (args[0].equalsIgnoreCase("halloween") && args[1].equalsIgnoreCase("pie_label")) { + if (this.plugin.getConfig().getBoolean("halloween-enabled")) { + for (int i=1;i<11;i++) { + ItemStack item = new ItemStack(Material.PUMPKIN_PIE); + ItemMeta meta = item.getItemMeta(); + meta.setDisplayName("Pie "+i); + item.setItemMeta(meta); + p.getInventory().addItem(item); + } + } + this.plugin.saveConfig(); + } + } else + if (cmd.getName().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) { + 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()) { + 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"); + + this.plugin.getAccountsConfig().set(p.getName() + ".money", Double.valueOf(totalWithdraw)); + this.plugin.getAccountsConfig().set(target.getName() + ".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."); + } 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."); + } + } + + } + else + if (cmd.getName().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."); + } 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."); + } 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."); + } 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."); + } 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."); + } 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."); + } 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."); + } 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."); + } 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."); + } 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."); + //Increase maximum air by 200 ticks. + p.setMaximumAir(300+this.plugin.getStatBonus(9, this.plugin.getAccountsConfig().getInt(p.getName() + ".stats.stat10"))*20); + } else { + p.sendMessage(ChatColor.RED+"You do not have enough stat points to get that stat! (You need 1.)"); + } + } + } else { + p.sendMessage(ChatColor.RED+"Please choose an appropriate stat point slot (1-10)."); + } + } catch (NumberFormatException ex_e) { + 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"))) { + if (args.length == 1) { + if (playerBankBalance <= 1) + p.sendMessage(this.prefix + " " + this.cmdInfo + " " + playerBankBalance + currencySingular + "a."); + else if (playerBankBalance > 1) + p.sendMessage(this.prefix + " " + this.cmdInfo + " " + playerBankBalance + currencyPlural + "a."); + } + else + p.sendMessage(this.invARG); + } + else if (cmd.getName().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) { + Player target = p.getServer().getPlayer(args[1]); + + if (target == null) { + p.sendMessage(this.prefix + " " + this.offlinePlayer); + } else { + int targetBalance = this.plugin.getAccountsConfig().getInt(target.getName() + ".money"); + + if (targetBalance <= 1) + p.sendMessage(this.prefix + "a " + target.getName() + this.cmdCheckReponsePlayer + " " + targetBalance + currencySingular); + else if (targetBalance > 1) + p.sendMessage(this.prefix + "a " + target.getName() + this.cmdCheckReponsePlayer + " " + targetBalance + currencyPlural); + } + } + else { + p.sendMessage(this.invARG); + } + } else if (cmd.getName().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) { + Player target = p.getServer().getPlayer(args[1]); + + if (target == null) { + p.sendMessage(this.prefix + " " + this.offlinePlayer); + } else { + this.plugin.getAccountsConfig().set(target.getName() + ".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); + } + } else { + p.sendMessage(this.invARG); + } + } else if ((args[0].equalsIgnoreCase("reload")) && (p.hasPermission("bankeconomy.reload"))) { + if (args.length == 1) { + p.sendMessage(this.prefix + " " + this.cmdReload); + + FileConfiguration conf = this.plugin.getConfig(); + this.plugin.reloadConfig(); + return conf == this.plugin.getConfig(); + } + p.sendMessage(this.invARG); + } + else if (cmd.getName().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) { + p.sendMessage(this.prefix + " " + this.cmdTransferARG2); + } else if (args.length == 3) { + double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", "")); + Player target = p.getServer().getPlayer(args[2]); + + if (target == null) { + p.sendMessage(this.prefix + " " + this.offlinePlayer); + } + else if (target.getName() == p.getName()) { + 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"); + + this.plugin.getAccountsConfig().set(p.getName() + ".money", Double.valueOf(totalWithdraw)); + this.plugin.getAccountsConfig().set(target.getName() + ".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."); + } 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."); + } + } + } + else + { + p.sendMessage(this.invARG); + } + } else if (cmd.getName().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); + } else if (args.length == 2) { + p.sendMessage(this.prefix + " " + this.cmdTransferARG2); + } else if (args.length == 3) { + p.sendMessage(this.prefix + " " + this.cmdEditARG2); + } else if (args.length == 4) { + double amount = Double.parseDouble(args[3].replaceAll("[^0-9\\.]", "")); + Player target = p.getServer().getPlayer(args[2]); + + if (target == null) { + p.sendMessage(this.prefix + " " + this.offlinePlayer); + } + else if (args[1].equalsIgnoreCase("status")) { + if (amount == 1.0D) { + this.plugin.getAccountsConfig().set(target.getName() + ".status", Boolean.valueOf(true)); + this.plugin.saveAccountsConfig(); + + p.sendMessage(this.prefix + " " + this.cmdEditEnableToPlayer1 + " " + p.getName() + this.cmdEditEnableToPlayer2); + } else if (amount == 0.0D) { + this.plugin.getAccountsConfig().set(target.getName() + ".status", Boolean.valueOf(false)); + this.plugin.saveAccountsConfig(); + + p.sendMessage(this.prefix + " " + this.cmdEditDisabledToPlayer1 + " " + p.getName() + this.cmdEditDisabledToPlayer2); + } + } else if (args[1].equalsIgnoreCase("balance")) { + this.plugin.getAccountsConfig().set(target.getName() + ".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); + else if (amount <= 1.0D) + p.sendMessage(this.prefix + " " + this.cmdEditAmountSetPlayer1 + " b" + amount + currencySingular + " " + this.cmdEditAmountSetPlayer2 + " " + target.getName() + this.cmdEditAmountSetPlayer3); + } + else { + p.sendMessage(this.prefix + " " + this.cmdEditAvaibleActions); + } + } + else { + p.sendMessage(this.invARG); + } + } + else if (cmd.getName().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"); + //p.sendMessage("Got 1."); + if (this.plugin.getAccountsConfig().getBoolean(p.getName() + ".revived")==false && p.getPlayerTime()-this.plugin.getAccountsConfig().getDouble(p.getName() + ".revivetime")<12000) { + double mincost = this.plugin.getConfig().getDouble("revive-cost-rate"); + //p.sendMessage("Got 2."); + if (p.getBedSpawnLocation()!=null) { + mincost *= Math.abs(p.getBedSpawnLocation().getX()-deathX)+Math.abs(p.getBedSpawnLocation().getY()-deathY)+Math.abs(p.getBedSpawnLocation().getZ()-deathZ); + } 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 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", Double.valueOf(0.0d)); + 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."); + org.bukkit.Location teleportloc = p.getLocation(); + if (p.getBedSpawnLocation()!=null) { + teleportloc = p.getBedSpawnLocation(); + } else { + //Use world spawn point. + teleportloc = p.getWorld().getSpawnLocation(); + } + teleportloc.setX(deathX); + teleportloc.setY(deathY); + teleportloc.setZ(deathZ); + teleportloc.setWorld(Bukkit.getWorld(deathWorld)); + //p.sendMessage("Got 6."); + p.teleport(teleportloc); + //p.sendMessage("Got 7."); + Bukkit.broadcastMessage(ChatColor.GREEN+p.getName()+ChatColor.WHITE+" decided to revive to their death location."); + } 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(); + return true; + } + else if (cmd.getName().equalsIgnoreCase("revive") && (args[0].equalsIgnoreCase("amount"))) { + DecimalFormat df = new DecimalFormat("#0.00"); + double deathX = p.getLocation().getX(); + double deathY = p.getLocation().getY(); + double deathZ = p.getLocation().getZ(); + double mincost = this.plugin.getConfig().getDouble("revive-cost-rate"); + if (p.getBedSpawnLocation()!=null) { + mincost *= Math.abs(p.getBedSpawnLocation().getX()-deathX)+Math.abs(p.getBedSpawnLocation().getY()-deathY)+Math.abs(p.getBedSpawnLocation().getZ()-deathZ); + } 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 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("You need to have $"+df.format(finalcost)+" to revive."); + return true; + } + else if (cmd.getName().equalsIgnoreCase("tele") && (args[0].equalsIgnoreCase("to"))) { + DecimalFormat df = new DecimalFormat("#0.00"); + if (p.getPlayerTime()-this.plugin.getAccountsConfig().getDouble(p.getName() + ".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) { + //Teleport. + Player target = p.getServer().getPlayer(args[1]); + if (target == null) { + p.sendMessage(this.prefix + " " + this.offlinePlayer); + } else { + if (target.getName() == this.plugin.getAccountsConfig().getString(p.getName() + ".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 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(); + 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.teleport(target); + } else { + 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. + //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 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())); + } 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."); + } + } + } + } + } else { + //Say how much it costs. If the player is found. = + 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) { + //Teleport. + Player target = p.getServer().getPlayer(args[1]); + if (target == null) { + p.sendMessage(this.prefix + " " + this.offlinePlayer); + } else { + //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 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())); + } 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."); + } + } + } + } + return true; + } else + if (cmd.getName().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")) { + 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")) { + 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")) { + 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("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")) { + //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")) { + 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; + boolean error=false; + for (int i=0;i=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) { + //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=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.getServer().getPlayer(args[1]))>=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=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) { + //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