r258. Many tweaks to jobs, bugfixes.

anvil_rework
sigonasr2 11 years ago
parent ab0800643d
commit 89377ecaf0
  1. BIN
      BankEconomyMod/bin/me/kaZep/Base/EnchantLevelDatabase.class
  2. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$1.class
  3. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$2.class
  4. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$3.class
  5. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$4.class
  6. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main.class
  7. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerData.class
  8. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class
  9. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$2.class
  10. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$3.class
  11. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$4.class
  12. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$5.class
  13. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$6.class
  14. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener.class
  15. BIN
      BankEconomyMod/bin/me/kaZep/Commands/commandBankEconomy.class
  16. 29
      BankEconomyMod/src/me/kaZep/Base/EnchantLevelDatabase.java
  17. 182
      BankEconomyMod/src/me/kaZep/Base/Main.java
  18. 4
      BankEconomyMod/src/me/kaZep/Base/PlayerData.java
  19. 514
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  20. 64
      BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java

@ -15,12 +15,15 @@ public class EnchantLevelDatabase {
public List<StoreValues> leather_pants = new ArrayList<StoreValues>();
public List<StoreValues> leather_tunic = new ArrayList<StoreValues>();
public List<StoreValues> iron_shovel = new ArrayList<StoreValues>();
public List<StoreValues> iron_axe = new ArrayList<StoreValues>();
public List<StoreValues> iron_boots = new ArrayList<StoreValues>();
public List<StoreValues> iron_pickaxe = new ArrayList<StoreValues>();
public List<StoreValues> iron_helmet = new ArrayList<StoreValues>();
public List<StoreValues> golden_shovel = new ArrayList<StoreValues>();
public List<StoreValues> golden_axe = new ArrayList<StoreValues>();
public List<StoreValues> iron_leggings = new ArrayList<StoreValues>();
public List<StoreValues> diamond_shovel = new ArrayList<StoreValues>();
public List<StoreValues> diamond_axe = new ArrayList<StoreValues>();
public List<StoreValues> diamond_hoe = new ArrayList<StoreValues>();
public List<StoreValues> golden_boots = new ArrayList<StoreValues>();
public List<StoreValues> iron_chestplate = new ArrayList<StoreValues>();
@ -80,6 +83,10 @@ public class EnchantLevelDatabase {
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_axe.add(new StoreValues(0.506,Enchantment.DIG_SPEED,1,5));
iron_axe.add(new StoreValues(0.355,Enchantment.DURABILITY,1,5));
iron_axe.add(new StoreValues(0.126,Enchantment.DIG_SPEED,2,5));
iron_axe.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));
@ -104,6 +111,12 @@ public class EnchantLevelDatabase {
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));
golden_axe.add(new StoreValues(0.364,Enchantment.DIG_SPEED,2,5));
golden_axe.add(new StoreValues(0.256,Enchantment.DIG_SPEED,1,5));
golden_axe.add(new StoreValues(0.253,Enchantment.DURABILITY,1,5));
golden_axe.add(new StoreValues(0.101,Enchantment.DURABILITY,2,5));
golden_axe.add(new StoreValues(0.01,Enchantment.LOOT_BONUS_BLOCKS,1,5));
golden_axe.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));
@ -112,6 +125,9 @@ public class EnchantLevelDatabase {
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));
diamond_axe.add(new StoreValues(0.623,Enchantment.DIG_SPEED,1,5));
diamond_axe.add(new StoreValues(0.356,Enchantment.DURABILITY,1,5));
diamond_axe.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));
@ -272,6 +288,10 @@ public class EnchantLevelDatabase {
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_axe.add(new StoreValues(0.506,Enchantment.DIG_SPEED,1,10));
iron_axe.add(new StoreValues(0.355,Enchantment.DURABILITY,1,10));
iron_axe.add(new StoreValues(0.126,Enchantment.DIG_SPEED,2,10));
iron_axe.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));
@ -296,6 +316,12 @@ public class EnchantLevelDatabase {
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));
golden_axe.add(new StoreValues(0.364,Enchantment.DIG_SPEED,2,10));
golden_axe.add(new StoreValues(0.256,Enchantment.DIG_SPEED,1,10));
golden_axe.add(new StoreValues(0.253,Enchantment.DURABILITY,1,10));
golden_axe.add(new StoreValues(0.101,Enchantment.DURABILITY,2,10));
golden_axe.add(new StoreValues(0.01,Enchantment.LOOT_BONUS_BLOCKS,1,10));
golden_axe.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));
@ -304,6 +330,9 @@ public class EnchantLevelDatabase {
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));
diamond_axe.add(new StoreValues(0.623,Enchantment.DIG_SPEED,1,10));
diamond_axe.add(new StoreValues(0.356,Enchantment.DURABILITY,1,10));
diamond_axe.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));

@ -440,6 +440,7 @@ public class Main extends JavaPlugin
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.addData("HARDENED CLAY", 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.",
@ -534,9 +535,9 @@ public class Main extends JavaPlugin
Weaponsmith_job.addData("IRON SWORD", 0.375, 75, 0);
Weaponsmith_job.addData("GOLD SWORD", 0.50, 100, 0);
Weaponsmith_job.addData("DIAMOND SWORD", 3.60, 280, 0);
Weaponsmith_job.setBuffData("Materials used in crafting have a 10% chance of being preserved.",
Weaponsmith_job.setBuffData("Crafting Weaponsmith items have a 10% chance of preserving materials used.",
"Weapons crafted gain a free level 5 enchantment.",
"Materials used in crafting have a 25% chance of being preserved.",
"Crafting Weaponsmith items have a 25% chance of preserving materials used.",
"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");
@ -552,14 +553,17 @@ public class Main extends JavaPlugin
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, 38, 0);
Blacksmith_job.addData("IRON AXE", 0.35, 40, 0);
Blacksmith_job.addData("WEAK IRON BOOTS", 0.375, 80, 0);
Blacksmith_job.addData("IRON PICKAXE", 0.40, 58, 0);
Blacksmith_job.addData("WEAK IRON HELMET", 0.50, 100, 0);
Blacksmith_job.addData("GOLDEN SHOVEL", 0.625, 23, 0);
Blacksmith_job.addData("GOLDEN HOE", 0.65, 65, 0);
Blacksmith_job.addData("GOLDEN AXE", 0.70, 70, 0);
Blacksmith_job.addData("WEAK IRON LEGGINGS", 0.725, 140, 0);
Blacksmith_job.addData("DIAMOND SHOVEL", 0.75, 90, 0);
Blacksmith_job.addData("DIAMOND HOE", 0.8, 188, 0);
Blacksmith_job.addData("DIAMOND AXE", 0.81, 196, 0);
Blacksmith_job.addData("WEAK GOLDEN BOOTS", 0.825, 120, 0);
Blacksmith_job.addData("WEAK IRON CHESTPLATE", 0.875, 175, 0);
Blacksmith_job.addData("WEAK GOLDEN HELMET", 0.925, 150, 0);
@ -584,7 +588,7 @@ public class Main extends JavaPlugin
Blacksmith_job.addData("DIAMOND CHESTPLATE", 1.50*10, 750*10, 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.",
"Crafting Blacksmith items have a 30% chance of preserving materials used.",
"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");
@ -633,30 +637,30 @@ public class Main extends JavaPlugin
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.setExp(50, 40, 8, 1.08);
Enchanter_job.addExtraData("Each level of enchantment multiplies your income and exp gain exponentially.");
Enchanter_job.addExtraData("Ex. If PROTECTION gives $0.08 and 4XP, PROTECTION III would give you x9 exp and money: $0.72 and 36XP.");
Enchanter_job.addData("PROTECTION", 0.08, 4, 0);
Enchanter_job.addData("SMITE", 0.10, 8, 0);
Enchanter_job.addData("FIRE PROTECTION", 0.10, 6, 0);
Enchanter_job.addData("BANE OF ARTHROPODS", 0.12, 8, 0);
Enchanter_job.addData("FEATHER FALLING", 0.14, 10, 0);
Enchanter_job.addData("SHARPNESS", 0.15, 14, 0);
Enchanter_job.addData("POWER", 0.15, 14, 0);
Enchanter_job.addData("EFFICIENCY", 0.15, 14, 0);
Enchanter_job.addData("BLAST PROTECTION", 0.20, 16, 0);
Enchanter_job.addData("THORNS", 0.20, 16, 0);
Enchanter_job.addData("KNOCKBACK", 0.20, 18, 0);
Enchanter_job.addData("PUNCH", 0.20, 18, 0);
Enchanter_job.addData("FIRE ASPECT", 0.22, 20, 0);
Enchanter_job.addData("FLAME", 0.22, 20, 0);
Enchanter_job.addData("AQUA AFFINITY", 0.25, 16, 0);
Enchanter_job.addData("RESPIRATION", 0.30, 20, 0);
Enchanter_job.addData("UNBREAKING", 0.35, 24, 0);
Enchanter_job.addData("INFINITY", 0.40, 40, 0);
Enchanter_job.addData("LOOTING", 0.40, 30, 0);
Enchanter_job.addData("FORTUNE", 0.50, 40, 0);
Enchanter_job.addData("SILK TOUCH", 0.50, 40, 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.)",
@ -667,19 +671,19 @@ public class Main extends JavaPlugin
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.setExp(70, 60, 8, 1.03);
Breeder_job.addExtraData("In areas where there are little to no animals, breeders get 20x the amount of money and xp.");
Breeder_job.addData("CHICKEN", 0.01, 2, 0);
Breeder_job.addData("PIG", 0.02, 4, 0);
Breeder_job.addData("SHEEP", 0.02, 4, 0);
Breeder_job.addData("COW", 0.03, 4, 0);
Breeder_job.addData("OCELOT", 0.04, 8, 0);
Breeder_job.addData("WOLF", 0.06, 10, 0);
Breeder_job.addData("MUSHROOM COW", 0.20, 16, 0);
Breeder_job.addData("HORSE", 0.30, 30, 0);
Breeder_job.addData("SHEEP", 0.02, 2, 1);
Breeder_job.addData("SHEEP", 0.002, 0.2, 2);
Breeder_job.addData("MUSHROOM COW", 0.005, 1, 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.",
@ -1090,14 +1094,15 @@ public void runTick() {
enderdragon.setHealth(200);
enderdragon.setRemoveWhenFarAway(false);
//enderdragon.teleport(new Location(p.getWorld(),p.getLocation().getBlockX()+i,-250,p.getLocation().getBlockZ()+j));
p.sendMessage(ChatColor.DARK_PURPLE+"You feel a dark presence nearby.");
//p.sendMessage(ChatColor.DARK_PURPLE+"You feel a dark presence nearby.");
zombie.setRemoveWhenFarAway(false);
zombie.setMaxHealth(300);
zombie.setHealth(300);
zombie.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,999999,6));
zombie.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION,999999,0));
zombie.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,999999,0));
zombie.setTicksLived(0);
zombie.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING,999999,0));
zombie.setTicksLived(1);
//p.sendMessage("Command is: "+"npc create Boss --type EnderDragon --at "+(p.getLocation().getBlockX()+i)+":-50:"+(p.getLocation().getBlockZ()+j));
Iterator<EnderDragon> e_list = Bukkit.getWorld("world").getEntitiesByClass(EnderDragon.class).iterator();
boolean first=false;
@ -2069,7 +2074,7 @@ public void checkJukeboxes() {
if (Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(xoffset+j,y,zoffset+k)).getType()!=Material.STONE && Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(xoffset+j,y,zoffset+k)).getType()!=Material.AIR) {
unmatched++;
}
if (Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(xoffset+j,y,zoffset+k)).getType()==Material.TORCH || Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(xoffset+j,y,zoffset+k)).getType()==Material.GLOWSTONE || Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(xoffset+j,y,zoffset+k)).getType()==Material.COMMAND) {
if (Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(xoffset+j,y,zoffset+k)).getType()==Material.TORCH || Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(xoffset+j,y,zoffset+k)).getType()==Material.GLOWSTONE || Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(xoffset+j,y,zoffset+k)).getType()==Material.COMMAND || Bukkit.getWorld("world").getBlockAt(list[i].getLocation().add(xoffset+j,y,zoffset+k)).getType()==Material.COBBLESTONE) {
notallowed=true;
}
}
@ -2110,6 +2115,8 @@ public void checkJukeboxes() {
Bukkit.getLogger().warning(("File does not exist."));
}
last_boss_dungeon_time=Bukkit.getWorld("world").getFullTime()+12000;
} else {
last_boss_dungeon_time=Bukkit.getWorld("world").getFullTime()+12000;
}
}
//Bukkit.getLogger().info("Disparity is "+(unmatched/6727.0d*100)+"%");
@ -3261,45 +3268,12 @@ public void payDay(int time)
}
public void gainMoneyExp(String p,String job,double amount,double exp) {
String[] jobs = getJobs(p);
int slot=-1;
if (getConfig().getBoolean("halloween-enabled")) {
amount*=2;
exp*=2;
}
//Add to how much we've earned so far.
for (int i=0;i<SPEED_CONTROL.size();i++) {
if (SPEED_CONTROL.get(i).p.getName().equalsIgnoreCase(p)) {
SPEED_CONTROL.get(i).money_gained+=amount;
break;
}
}
JobsDataInfo[] Jobsinfo = {Woodcutter_job,Miner_job,Builder_job,Digger_job,Farmer_job,Hunter_job,Fisherman_job,Weaponsmith_job,Blacksmith_job,Cook_job,Brewer_job,Enchanter_job,Breeder_job,Explorer_job,Support_job};
for (int i=0;i<jobs.length;i++) {
if (job.equalsIgnoreCase(jobs[i])) {
slot=i;
break;
}
}
JobsDataInfo info = Jobsinfo[getJobSlot(job)];
economy.depositPlayer(p, amount*(1d+(info.moneymult*getAccountsConfig().getInt(p+".jobs.job"+(slot+1)+"lv"))));
if (getAccountsConfig().getDouble(p+".jobs.job"+(slot+1)+"exp")+exp>=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 (getJobLv(job,p)<40 && getJobExp(job,getAccountsConfig().getInt(p+".jobs.job"+(slot+1)+"lv"))<=getAccountsConfig().getDouble(p+".jobs.job"+(slot+1)+"exp")) { //Make sure we can't go over level cap.
//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!");
}
}
Player m = Bukkit.getPlayer(p);
if (m!=null) {
gainMoneyExp(m,job,amount,exp);
} else {
Bukkit.getLogger().severe("Could not find player "+p+"! Could not add in job experience!");
}
saveAccountsConfig();
}
public void setMoneyExp(Player p,String job,double newamount,double newexp) {
@ -3345,14 +3319,16 @@ public void payDay(int time)
economy.depositPlayer(p.getName(), amount*(1d+(info.moneymult*getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv"))));
getAccountsConfig().set(p.getName()+".jobs.job"+(slot+1)+"exp", Double.valueOf(getAccountsConfig().getDouble(p.getName()+".jobs.job"+(slot+1)+"exp")+exp));
//Check for lv up.
if (getJobExp(job,getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv"))<=getAccountsConfig().getDouble(p.getName()+".jobs.job"+(slot+1)+"exp")) {
if (getJobLv(job,p)<40 && getJobExp(job,getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv"))<=getAccountsConfig().getDouble(p.getName()+".jobs.job"+(slot+1)+"exp")) {
//Level up! Level up! YEAH!
getAccountsConfig().set(p.getName()+".jobs.job"+(slot+1)+"exp", Double.valueOf(getAccountsConfig().getDouble(p.getName()+".jobs.job"+(slot+1)+"exp")-getJobExp(job,getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv"))));
getAccountsConfig().set(p.getName()+".jobs.job"+(slot+1)+"lv", Integer.valueOf(getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv")+1));
Bukkit.broadcastMessage(p.getName()+" is now a Level "+getAccountsConfig().getInt(p.getName()+".jobs.job"+(slot+1)+"lv")+" "+getJobColor(job)+job+ChatColor.WHITE+".");
if (getJobTotalLvs(p)%5==0) {
Bukkit.broadcastMessage(ChatColor.GREEN+p.getName()+" has reached Level "+getJobTotalLvs(p)+"!");
p.sendMessage(ChatColor.GOLD+"You have earned 1 stat point! You now have "+(((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))+" stat point"+((((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))==1?"":"s")+" to spend. "+ChatColor.ITALIC+ChatColor.BLUE+" Type /sp to spend them!");
if ((((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))>0) {
p.sendMessage(ChatColor.GOLD+"You have earned 1 stat point! You now have "+(((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))+" stat point"+((((getJobTotalLvs(p)/5+1)-getStatPointTotal(p)))==1?"":"s")+" to spend. "+ChatColor.ITALIC+ChatColor.BLUE+" Type /sp to spend them!");
}
}
}
saveAccountsConfig();
@ -3546,64 +3522,64 @@ public void payDay(int time)
}
}
if (entry.getKey().getName()==Enchantment.PROTECTION_ENVIRONMENTAL.getName()) {
gainMoneyExp(p,"Enchanter",0.04*entry.getValue(),2*entry.getValue());
gainMoneyExp(p,"Enchanter",0.08*entry.getValue(),4*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.DAMAGE_UNDEAD.getName()) {
gainMoneyExp(p,"Enchanter",0.05*entry.getValue(),4*entry.getValue());
gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),8*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.PROTECTION_FIRE.getName()) {
gainMoneyExp(p,"Enchanter",0.05*entry.getValue(),3*entry.getValue());
gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),6*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.DAMAGE_ARTHROPODS.getName()) {
gainMoneyExp(p,"Enchanter",0.06*entry.getValue(),4*entry.getValue());
gainMoneyExp(p,"Enchanter",0.12*entry.getValue(),8*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.PROTECTION_FALL.getName()) {
gainMoneyExp(p,"Enchanter",0.07*entry.getValue(),5*entry.getValue());
gainMoneyExp(p,"Enchanter",0.14*entry.getValue(),10*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.DAMAGE_ALL.getName()) {
gainMoneyExp(p,"Enchanter",0.075*entry.getValue(),7*entry.getValue());
gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),14*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.DIG_SPEED.getName()) {
gainMoneyExp(p,"Enchanter",0.075*entry.getValue(),7*entry.getValue());
gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),14*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.PROTECTION_EXPLOSIONS.getName()) {
gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),8*entry.getValue());
gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),16*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.THORNS.getName()) {
gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),8*entry.getValue());
gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),16*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.KNOCKBACK.getName()) {
gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),9*entry.getValue());
gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),18*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.ARROW_KNOCKBACK.getName()) {
gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),9*entry.getValue());
gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),18*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.FIRE_ASPECT.getName()) {
gainMoneyExp(p,"Enchanter",0.11*entry.getValue(),10*entry.getValue());
gainMoneyExp(p,"Enchanter",0.22*entry.getValue(),20*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.ARROW_FIRE.getName()) {
gainMoneyExp(p,"Enchanter",0.11*entry.getValue(),10*entry.getValue());
gainMoneyExp(p,"Enchanter",0.22*entry.getValue(),20*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.WATER_WORKER.getName()) {
gainMoneyExp(p,"Enchanter",0.125*entry.getValue(),8*entry.getValue());
gainMoneyExp(p,"Enchanter",0.25*entry.getValue(),16*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.OXYGEN.getName()) {
gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),10*entry.getValue());
gainMoneyExp(p,"Enchanter",0.30*entry.getValue(),20*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.DURABILITY.getName()) {
gainMoneyExp(p,"Enchanter",0.175*entry.getValue(),12*entry.getValue());
gainMoneyExp(p,"Enchanter",0.35*entry.getValue(),24*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.ARROW_INFINITE.getName()) {
gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),20*entry.getValue());
gainMoneyExp(p,"Enchanter",0.40*entry.getValue(),40*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.LOOT_BONUS_MOBS.getName()) {
gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),15*entry.getValue());
gainMoneyExp(p,"Enchanter",0.40*entry.getValue(),30*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.LOOT_BONUS_BLOCKS.getName()) {
gainMoneyExp(p,"Enchanter",0.225*entry.getValue(),20*entry.getValue());
gainMoneyExp(p,"Enchanter",0.50*entry.getValue(),40*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.SILK_TOUCH.getName()) {
gainMoneyExp(p,"Enchanter",0.25*entry.getValue(),20*entry.getValue());
gainMoneyExp(p,"Enchanter",0.50*entry.getValue(),40*entry.getValue());
}
}
}

@ -44,8 +44,8 @@ public class PlayerData {
buildamt=0;
return true;
} else {
if (buildamt>10) {
buildamt=10; //This is the upper bound of this value.
if (buildamt>100) {
buildamt=100; //This is the upper bound of this value.
}
return false;
}

@ -55,6 +55,7 @@ import org.bukkit.entity.Item;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Monster;
import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Pig;
@ -435,75 +436,297 @@ public class PlayerListener
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));
if (e.getItem().getType()==Material.BOW) {
int enchants[] = {48,49,50,51};
for (int j=0;j<enchants.length;j++) {
if (Math.random()<1.0d/enchants.length) {
//e.getItem().addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*10)+1);
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Critical Chance");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*3)+1)+" "+ChatColor.BLUE+"Armor Penetration");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Life Steal");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+1)+"% "+ChatColor.BLUE+"Attack Speed");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*5)+1)+" "+ChatColor.BLUE+"Damage");
}
ItemMeta meta = e.getItem().getItemMeta();
meta.setLore(ourLore);
e.getItem().setItemMeta(meta);
} else {
if (e.getItem().getType().toString().toLowerCase().contains("sword")) {
int enchants[] = {16,17,18,19,20,21,34};
for (int j=0;j<enchants.length;j++) {
if (Math.random()<1.0d/enchants.length) {
//e.getItem().addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*10)+1);
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Critical Chance");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*3)+1)+" "+ChatColor.BLUE+"Armor Penetration");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Life Steal");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+1)+"% "+ChatColor.BLUE+"Attack Speed");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*5)+1)+" "+ChatColor.BLUE+"Damage");
}
ItemMeta meta = e.getItem().getItemMeta();
meta.setLore(ourLore);
e.getItem().setItemMeta(meta);
} else if (e.getItem().getType().toString().toLowerCase().contains("spade") ||
e.getItem().getType().toString().toLowerCase().contains("axe") ||
e.getItem().getType().toString().toLowerCase().contains("hoe") ||
e.getItem().getType().toString().toLowerCase().contains("pickaxe")) {
int enchants[] = {32,33,34,35};
for (int j=0;j<enchants.length;j++) {
if (Math.random()<1.0d/enchants.length) {
//e.getItem().addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*10)+1);
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Critical Chance");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*3)+1)+" "+ChatColor.BLUE+"Armor Penetration");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Life Steal");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*30)+1)+"% "+ChatColor.BLUE+"Attack Speed");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*5)+1)+" "+ChatColor.BLUE+"Damage");
}
ItemMeta meta = e.getItem().getItemMeta();
meta.setLore(ourLore);
e.getItem().setItemMeta(meta);
} else {
int enchants[] = {0,1,2,3,4,5,6,7,34};
for (int j=0;j<enchants.length;j++) {
if (Math.random()<1.0d/enchants.length) {
//e.getItem().addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*10)+1);
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*4)+1)+" "+ChatColor.BLUE+"Health");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Damage Reduction");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*50)+1)*10)+"% "+ChatColor.BLUE+"Durability");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Block Chance");
} else
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+"% "+ChatColor.BLUE+"Speed Boost Chance");
}
ItemMeta meta = e.getItem().getItemMeta();
meta.setLore(ourLore);
e.getItem().setItemMeta(meta);
}
}
}
for (Map.Entry<Enchantment,Integer> entry : map.entrySet()) {
if (this.plugin.getJobLv("Enchanter", p)>=20) {
if (entry.getKey().getMaxLevel()<entry.getValue()) {
entry.setValue(entry.getValue()+1);
entry.setValue(entry.getValue()+((int)(Math.random()*2)+1));
}
}
if (e.getItem().getType()==Material.BOW) {
int enchants[] = {48,49,50,51};
for (int j=0;j<enchants.length;j++) {
if (Math.random()<1.0d/enchants.length) {
e.getItem().addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*5)+1);
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Critical Chance");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*6)+1)+" "+ChatColor.BLUE+"Armor Penetration");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Life Steal");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+1)+"% "+ChatColor.BLUE+"Attack Speed");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+" "+ChatColor.BLUE+"Damage");
}
ItemMeta meta = e.getItem().getItemMeta();
meta.setLore(ourLore);
e.getItem().setItemMeta(meta);
} else {
if (e.getItem().getType().toString().toLowerCase().contains("sword")) {
int enchants[] = {16,17,18,19,20,21,34};
for (int j=0;j<enchants.length;j++) {
if (Math.random()<1.0d/enchants.length) {
e.getItem().addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*5)+1);
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Critical Chance");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*6)+1)+" "+ChatColor.BLUE+"Armor Penetration");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Life Steal");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+1)+"% "+ChatColor.BLUE+"Attack Speed");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+" "+ChatColor.BLUE+"Damage");
}
ItemMeta meta = e.getItem().getItemMeta();
meta.setLore(ourLore);
e.getItem().setItemMeta(meta);
} else if (e.getItem().getType().toString().toLowerCase().contains("spade") ||
e.getItem().getType().toString().toLowerCase().contains("axe") ||
e.getItem().getType().toString().toLowerCase().contains("hoe") ||
e.getItem().getType().toString().toLowerCase().contains("pickaxe")) {
int enchants[] = {32,33,34,35};
for (int j=0;j<enchants.length;j++) {
if (Math.random()<1.0d/enchants.length) {
e.getItem().addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*5)+1);
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Critical Chance");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*6)+1)+" "+ChatColor.BLUE+"Armor Penetration");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Life Steal");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*60)+1)+"% "+ChatColor.BLUE+"Attack Speed");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*10)+1)+" "+ChatColor.BLUE+"Damage");
}
ItemMeta meta = e.getItem().getItemMeta();
meta.setLore(ourLore);
e.getItem().setItemMeta(meta);
} else {
int enchants[] = {0,1,2,3,4,5,6,7,34};
for (int j=0;j<enchants.length;j++) {
if (Math.random()<1.0d/enchants.length) {
e.getItem().addUnsafeEnchantment(Enchantment.getById(enchants[j]), (int)(Math.random()*5)+1);
}
}
List<String> ourLore = new ArrayList<String>();
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*6)+1)+" "+ChatColor.BLUE+"Health");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Damage Reduction");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+(((int)(Math.random()*100)+1)*10)+"% "+ChatColor.BLUE+"Durability");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Block Chance");
}
if (Math.random()<=0.2) {
ourLore.add(ChatColor.YELLOW+"+"+((int)(Math.random()*20)+1)+"% "+ChatColor.BLUE+"Speed Boost Chance");
}
ItemMeta meta = e.getItem().getItemMeta();
meta.setLore(ourLore);
e.getItem().setItemMeta(meta);
}
}
if (entry.getKey().getName()==Enchantment.PROTECTION_ENVIRONMENTAL.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.04*entry.getValue(),2*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.08*entry.getValue(),4*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.DAMAGE_UNDEAD.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.05*entry.getValue(),4*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),8*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.PROTECTION_FIRE.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.05*entry.getValue(),3*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),6*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.DAMAGE_ARTHROPODS.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.06*entry.getValue(),4*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.12*entry.getValue(),8*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.PROTECTION_FALL.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.07*entry.getValue(),5*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.14*entry.getValue(),10*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.DAMAGE_ALL.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.075*entry.getValue(),7*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),14*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.DIG_SPEED.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.075*entry.getValue(),7*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),14*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.PROTECTION_EXPLOSIONS.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),8*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),16*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.THORNS.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),8*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),16*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.KNOCKBACK.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),9*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),18*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.ARROW_KNOCKBACK.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.10*entry.getValue(),9*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),18*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.FIRE_ASPECT.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.11*entry.getValue(),10*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.22*entry.getValue(),20*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.ARROW_FIRE.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.11*entry.getValue(),10*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.22*entry.getValue(),20*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.WATER_WORKER.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.125*entry.getValue(),8*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.25*entry.getValue(),16*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.OXYGEN.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.15*entry.getValue(),10*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.30*entry.getValue(),20*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.DURABILITY.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.175*entry.getValue(),12*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.35*entry.getValue(),24*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.ARROW_INFINITE.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),20*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.40*entry.getValue(),40*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.LOOT_BONUS_MOBS.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.20*entry.getValue(),15*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.40*entry.getValue(),30*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.LOOT_BONUS_BLOCKS.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.225*entry.getValue(),20*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.50*entry.getValue(),40*entry.getValue());
}
if (entry.getKey().getName()==Enchantment.SILK_TOUCH.getName()) {
this.plugin.gainMoneyExp(p,"Enchanter",0.25*entry.getValue(),20*entry.getValue());
this.plugin.gainMoneyExp(p,"Enchanter",0.50*entry.getValue(),40*entry.getValue());
}
}
}
@ -549,6 +772,9 @@ public class PlayerListener
if (e.getResult().getType()==Material.BRICK) {
this.plugin.gainMoneyExp(owner,"Digger",0.04,8);
}
if (e.getResult().getType()==Material.HARD_CLAY) {
this.plugin.gainMoneyExp(owner,"Digger",0.04,8);
}
}
if (this.plugin.PlayerinJob(owner, "Fisherman")) {
if (e.getResult().getType()==Material.COOKED_FISH) {
@ -913,10 +1139,10 @@ public class PlayerListener
Player p = e.getPlayer();
if (this.plugin.PlayerinJob(p, "Breeder")) {
if (e.getEntity().getType()==EntityType.SHEEP) {
this.plugin.gainMoneyExp(p,"Breeder",0.001,0.1);
this.plugin.gainMoneyExp(p,"Breeder",0.002,0.2);
}
if (e.getEntity().getType()==EntityType.MUSHROOM_COW) {
this.plugin.gainMoneyExp(p,"Breeder",0.005,0.5);
this.plugin.gainMoneyExp(p,"Breeder",0.005,1);
}
}
}
@ -939,7 +1165,7 @@ public class PlayerListener
return;
}
if (this.plugin.PlayerinJob(p, "Breeder")) {
this.plugin.gainMoneyExp(p,"Breeder",0.005,1);
this.plugin.gainMoneyExp(p,"Breeder",0.02,2);
}
}
}
@ -1378,6 +1604,7 @@ public class PlayerListener
updateTopSPLEEFSigns();
}
/*
@EventHandler
public void onPortalEnter(PlayerTeleportEvent e) {
final Player p = e.getPlayer();
@ -1406,7 +1633,7 @@ public class PlayerListener
}
}
}
}
}*/
@EventHandler
public void onPlayerInteract(PlayerInteractEntityEvent ev) {
@ -1485,16 +1712,18 @@ public class PlayerListener
Entity entity = e.getEntity();
if (entity.getWorld().getName().compareTo("world")==0) {
boolean despawn=true;
if (entity instanceof LivingEntity) {
if (entity instanceof Monster) {
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;
if (test.getCustomName()!=null && test.getCustomName().contains(ChatColor.DARK_PURPLE+"")) {
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;
}
}
}
}
@ -1508,16 +1737,12 @@ public class PlayerListener
}
}
}
if (test.getCustomName()!=null && (test.getCustomName().contains("Happy")||test.getCustomName().contains("Halloween"))) {
despawn=false;
test.setRemoveWhenFarAway(false);
}
if (block || (test.getCustomName()!=null && (test.getCustomName().contains(""+ChatColor.DARK_PURPLE) || test.getType()==EntityType.ENDER_DRAGON))) {
if (block || (test.getCustomName()!=null && (test.getCustomName().contains(ChatColor.DARK_PURPLE+"") || test.getType()==EntityType.ENDER_DRAGON))) {
despawn=false; //This is an epic boss and its healthbar. WE can't just despawn it.
}
}
if (despawn) {
if (this.plugin.getConfig().getBoolean("halloween-enabled") && Math.random()<=0.75) {
if (this.plugin.getConfig().getBoolean("halloween-enabled") && Math.random()<=0.75 && entity instanceof Monster) {
//Just despawn it right now.
entity.remove();
e.setCancelled(true);
@ -1527,13 +1752,7 @@ public class PlayerListener
double chancer=1.0d; //The percent chance a duplicated mob will form.
double despawnchancer=0.0d; //The percent chance the mob will be forced to despawn. Decreasing natural spawning.
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<allowedtypes.length;i++) {
if (entity.getType()==allowedtypes[i]) {
contains=true;
break;
}
}
boolean contains=entity instanceof Monster;
//Mobs have more health when they are farther away, to make the mobs harder in general.
float groupmult=0.25f; //Change this to modify the global grouping multiplier.
/*
@ -1982,7 +2201,7 @@ public class PlayerListener
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);
enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1);
l.getEquipment().setChestplate(enchanted);
}
if (Math.random()>=0.45) {
@ -1990,7 +2209,7 @@ public class PlayerListener
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);
enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1);
l.getEquipment().setLeggings(enchanted);
}
if (Math.random()>=0.65) {
@ -1998,7 +2217,7 @@ public class PlayerListener
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);
enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1);
l.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
}
if (Math.random()>=0.95) {
@ -2006,7 +2225,84 @@ public class PlayerListener
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);
enchanted.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*4.0d)+1);
l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
}
}
}
}
}
}
} else {
//Well dang, your party's huge and OP.
//Wear diamond armor almost always. Enchanted diamond pieces here and there.
if (entity.getType()==EntityType.SKELETON || entity.getType()==EntityType.ZOMBIE) {
LivingEntity l = (LivingEntity) entity;
if (entity.getType()==EntityType.ZOMBIE) {
if (Math.random()<=0.80) {
if (Math.random()<=0.75) {
ItemStack enchanted = new ItemStack(Material.DIAMOND_SWORD);
enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1);
if (Math.random()<=0.5) {
enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1);
} else {
enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*5.0d)+1);
}
l.getEquipment().setItemInHand(enchanted);
} else {
ItemStack enchanted = new ItemStack(Material.GOLD_SWORD);
enchanted.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, (int)(Math.random()*4.0d)+1);
if (Math.random()<=0.5) {
enchanted.addUnsafeEnchantment(Enchantment.KNOCKBACK, (int)(Math.random()*2.0d)+1);
} else {
enchanted.addUnsafeEnchantment(Enchantment.FIRE_ASPECT, (int)(Math.random()*5.0d)+1);
}
l.getEquipment().setItemInHand(enchanted);
}
}
}
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.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*6.0d)+1);
if (Math.random()<=0.5) {
enchanted.addUnsafeEnchantment(Enchantment.THORNS, (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.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*6.0d)+1);
if (Math.random()<=0.5) {
enchanted.addUnsafeEnchantment(Enchantment.THORNS, (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.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*6.0d)+1);
if (Math.random()<=0.5) {
enchanted.addUnsafeEnchantment(Enchantment.THORNS, (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.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, (int)(Math.random()*6.0d)+1);
if (Math.random()<=0.5) {
enchanted.addUnsafeEnchantment(Enchantment.THORNS, (int)(Math.random()*4.0d)+1);
}
l.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
}
}
@ -2078,7 +2374,7 @@ public class PlayerListener
}
}
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;
boolean contains=entity instanceof Monster
for (int i=0;i<allowedtypes.length;i++) {
if (entity.getType()==allowedtypes[i]) {
contains=true;
@ -2266,7 +2562,7 @@ public class PlayerListener
}
//p.sendMessage("There were "+countamount+" "+e.getEntity().getType());
if (countamount<4) {
mult=10;
mult=20;
} else {
mult=1;
}
@ -2274,7 +2570,7 @@ public class PlayerListener
p.sendMessage("You started a new "+ChatColor.GREEN+e.getEntity().getType()+ChatColor.WHITE+" family out here!");
}
if (e.getEntity().getType()==EntityType.CHICKEN) {
this.plugin.gainMoneyExp(p,"Breeder",0.005*mult,1*mult);
this.plugin.gainMoneyExp(p,"Breeder",0.01*mult,2*mult);
if (this.plugin.getJobLv("Breeder", p)>=10) {
if (Math.random()<=0.25 && countamount<50) {
Chicken newent = (Chicken)Bukkit.getWorld("world").spawnEntity(e.getLocation(), EntityType.CHICKEN);
@ -2289,7 +2585,7 @@ public class PlayerListener
}
}
if (e.getEntity().getType()==EntityType.PIG) {
this.plugin.gainMoneyExp(p,"Breeder",0.01*mult,2*mult);
this.plugin.gainMoneyExp(p,"Breeder",0.02*mult,4*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);
@ -2304,7 +2600,7 @@ public class PlayerListener
}
}
if (e.getEntity().getType()==EntityType.SHEEP) {
this.plugin.gainMoneyExp(p,"Breeder",0.01*mult,2*mult);
this.plugin.gainMoneyExp(p,"Breeder",0.02*mult,4*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);
@ -2322,7 +2618,7 @@ public class PlayerListener
}
}
if (e.getEntity().getType()==EntityType.COW) {
this.plugin.gainMoneyExp(p,"Breeder",0.015*mult,2*mult);
this.plugin.gainMoneyExp(p,"Breeder",0.03*mult,4*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);
@ -2337,7 +2633,7 @@ public class PlayerListener
}
}
if (e.getEntity().getType()==EntityType.OCELOT) {
this.plugin.gainMoneyExp(p,"Breeder",0.02*mult,4*mult);
this.plugin.gainMoneyExp(p,"Breeder",0.04*mult,8*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);
@ -2358,7 +2654,7 @@ public class PlayerListener
}
}
if (e.getEntity().getType()==EntityType.WOLF) {
this.plugin.gainMoneyExp(p,"Breeder",0.03*mult,5*mult);
this.plugin.gainMoneyExp(p,"Breeder",0.06*mult,10*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);
@ -2379,7 +2675,7 @@ public class PlayerListener
}
}
if (e.getEntity().getType()==EntityType.MUSHROOM_COW) {
this.plugin.gainMoneyExp(p,"Breeder",0.15*mult,20*mult);
this.plugin.gainMoneyExp(p,"Breeder",0.20*mult,16*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);
@ -2394,7 +2690,7 @@ public class PlayerListener
}
}
if (e.getEntity().getType()==EntityType.HORSE) {
this.plugin.gainMoneyExp(p,"Breeder",1.20*mult,50*mult);
this.plugin.gainMoneyExp(p,"Breeder",0.30*mult,30*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);
@ -2421,6 +2717,10 @@ public class PlayerListener
//p.sendMessage("Name is: "+p.getItemInHand().getItemMeta().getDisplayName());
int myData=this.plugin.getPlayerDataSlot(p);
if (p!=null) {
if (e.getBlock().getType()==Material.COMMAND) {
e.setCancelled(true);
return;
}
if (e.getBlock().getType()==Material.STONE && p.getLocation().getY()<=50) {
//We are mining underground.
//Check if we need to spawn Charge Zombie II's.
@ -3571,7 +3871,7 @@ public class PlayerListener
if (result.getResult().getType()==Material.DIAMOND_SWORD) {
crafteditem=true;
}
if (this.plugin.getJobLv("Weaponsmith", p)>=20) {
if (this.plugin.getJobLv("Weaponsmith", p)>=20 && crafteditem) {
ItemStack[] crafteditems = result.getMatrix();
if (e.getClick()==ClickType.SHIFT_RIGHT || e.getClick()==ClickType.SHIFT_LEFT) {
int lowestamt=9999;
@ -3607,7 +3907,7 @@ public class PlayerListener
}
}
} else
if (this.plugin.getJobLv("Weaponsmith", p)>=5) {
if (this.plugin.getJobLv("Weaponsmith", p)>=5 && crafteditem) {
ItemStack[] crafteditems = result.getMatrix();
if (e.getClick()==ClickType.SHIFT_RIGHT || e.getClick()==ClickType.SHIFT_LEFT) {
int lowestamt=9999;
@ -3644,13 +3944,16 @@ public class PlayerListener
}
}
if (this.plugin.getJobLv("Weaponsmith", p)>=10 && crafteditem) {
Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant.");
ItemStack resulting = this.plugin.EnchantItem(result.getResult(),5,p);
result.setResult(resulting);
//Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant.");
if (e.getClick()!=ClickType.SHIFT_RIGHT && e.getClick()!=ClickType.SHIFT_LEFT) {
ItemStack resulting = this.plugin.EnchantItem(result.getResult(),5,p);
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;
@ -3662,7 +3965,7 @@ public class PlayerListener
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;
@ -3683,6 +3986,10 @@ public class PlayerListener
//this.plugin.gainMoneyExp(p,"Blacksmith",0.25,18);
crafteditem=true;
}
if (result.getResult().getType()==Material.IRON_AXE) {
//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;
@ -3711,6 +4018,10 @@ public class PlayerListener
//this.plugin.gainMoneyExp(p,"Blacksmith",0.625,55);
crafteditem=true;
}
if (result.getResult().getType()==Material.GOLD_AXE) {
//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;
@ -3727,6 +4038,10 @@ public class PlayerListener
//this.plugin.gainMoneyExp(p,"Blacksmith",0.75,65);
crafteditem=true;
}
if (result.getResult().getType()==Material.DIAMOND_AXE) {
//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;
@ -3809,15 +4124,19 @@ public class PlayerListener
}
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,p);
result.setResult(resulting);
if (e.getClick()!=ClickType.SHIFT_RIGHT && e.getClick()!=ClickType.SHIFT_LEFT) {
ItemStack resulting = this.plugin.EnchantItem(result.getResult(),5,p);
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,p);
result.setResult(resulting);
if (e.getClick()!=ClickType.SHIFT_RIGHT && e.getClick()!=ClickType.SHIFT_LEFT) {
ItemStack resulting = this.plugin.EnchantItem(result.getResult(),10,p);
result.setResult(resulting);
}
}
if (this.plugin.getJobLv("Blacksmith", p)>=20) {
if (this.plugin.getJobLv("Blacksmith", p)>=20 && crafteditem) {
ItemStack[] crafteditems = result.getMatrix();
if (e.getClick()==ClickType.SHIFT_RIGHT || e.getClick()==ClickType.SHIFT_LEFT) {
int lowestamt=9999;
@ -5500,13 +5819,7 @@ public ItemStack getGoodie() {
}
}
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 k=0;k<allowedtypes.length;k++) {
if (e.getEntity().getType()==allowedtypes[k]) {
contains=true;
break;
}
}
boolean contains=e.getEntity() instanceof Monster;
if (contains) {
LivingEntity l = (LivingEntity)e.getEntity();
if ((l.getCustomName()==null || !l.getCustomName().contains(""+ChatColor.DARK_PURPLE)) && l.getType()!=EntityType.ENDER_DRAGON) {
@ -5593,8 +5906,17 @@ public ItemStack getGoodie() {
@EventHandler
public void onEnemyHit(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof LivingEntity) {
LivingEntity l = (LivingEntity)e.getEntity();
final LivingEntity l = (LivingEntity)e.getEntity();
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.DARK_PURPLE+"")) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
//Multiplying by a number lower than 1 will reduce knockback
//Multiplying by a number greater than 1 will increase knockback
Vector knockback = l.getVelocity().multiply(0.1f);
l.setVelocity(knockback);
}
}, 1L);
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");
@ -5692,6 +6014,9 @@ public ItemStack getGoodie() {
for (int i=-20;i<21;i++) {
for (int j=-20;j<21;j++) {
for (int k=-20;k<21;k++) {
if (Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.COMMAND) {
Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).setType(Material.COBBLESTONE);
}
if (Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.TORCH || Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.GLOWSTONE) {
Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).breakNaturally();
}
@ -8234,6 +8559,10 @@ public ItemStack getGoodie() {
this.plugin.gainMoneyExp(p,"Blacksmith",0.325*amount,38*amount);
crafteditem=true;
}
if (item.getType()==Material.IRON_AXE) {
this.plugin.gainMoneyExp(p,"Blacksmith",0.35*amount,40*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) {
@ -8262,6 +8591,10 @@ public ItemStack getGoodie() {
this.plugin.gainMoneyExp(p,"Blacksmith",0.65*amount,65*amount);
crafteditem=true;
}
if (item.getType()==Material.GOLD_AXE) {
this.plugin.gainMoneyExp(p,"Blacksmith",0.70*amount,70*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) {
@ -8278,6 +8611,10 @@ public ItemStack getGoodie() {
this.plugin.gainMoneyExp(p,"Blacksmith",0.80*amount,188*amount);
crafteditem=true;
}
if (item.getType()==Material.DIAMOND_AXE) {
this.plugin.gainMoneyExp(p,"Blacksmith",0.81*amount,196*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) {
@ -8569,19 +8906,22 @@ public ItemStack getGoodie() {
if (PlayerinJob((Player)player,"Weaponsmith")) {
if (getJobLv("Weaponsmith", player.getName())>=10 && validItem_Weaponsmith(post)) {
//Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant.");
ItemStack resulting = EnchantItem(post,5,(Player)player);
ItemStack clone = post.clone();
ItemStack resulting = EnchantItem(clone,5,(Player)player);
player.getInventory().setItem(i, resulting);
}
}
if (PlayerinJob((Player)player,"Blacksmith")) {
if (getJobLv("Blacksmith", player.getName())>=10 && validItem_Blacksmith(post)) {
//Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant.");
ItemStack resulting = EnchantItem(post,10,(Player)player);
ItemStack clone = post.clone();
ItemStack resulting = EnchantItem(clone,10,(Player)player);
player.getInventory().setItem(i, resulting);
} else
if (getJobLv("Blacksmith", player.getName())>=5 && validItem_Blacksmith(post)) {
//Bukkit.getPlayer("sigonasr2").sendMessage("Valid item. Going to attempt to enchant.");
ItemStack resulting = EnchantItem(post,5,(Player)player);
ItemStack clone = post.clone();
ItemStack resulting = EnchantItem(clone,5,(Player)player);
player.getInventory().setItem(i, resulting);
}
}
@ -9855,10 +10195,12 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
e.setCancelled(true);
} else
{
Player[] playerlist = Bukkit.getOnlinePlayers();
for (int i=0;i<playerlist.length;i++) {
if (playerlist[i]!=e.getPlayer()) {
playerlist[i].playSound(playerlist[i].getLocation(), Sound.NOTE_STICKS, 0.6f, 0.85f);
if (e.getMessage().replaceAll("[0-9.]","").length()>0) {
Player[] playerlist = Bukkit.getOnlinePlayers();
for (int i=0;i<playerlist.length;i++) {
if (playerlist[i]!=e.getPlayer()) {
playerlist[i].playSound(playerlist[i].getLocation(), Sound.NOTE_STICKS, 0.6f, 0.85f);
}
}
}
String f="";

@ -1,5 +1,7 @@
package me.kaZep.Commands;
import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
@ -15,6 +17,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -27,6 +30,13 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MerchantInventory;
import org.bukkit.inventory.meta.ItemMeta;
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;
public class commandBankEconomy
implements CommandExecutor
@ -240,6 +250,46 @@ public class commandBankEconomy
}
} else
if (cmd.getName().equalsIgnoreCase("event") && args.length==2 && p.hasPermission("maintenance-mode-admin")) {
if (args[0].equalsIgnoreCase("spawn_dungeon") && args[1].equalsIgnoreCase("boss")) {
//Empty the whole area.
double xoffset = Math.random()*10+15;
double zoffset = Math.random()*10+15;
if (Math.random()<=0.5) {
xoffset*=-1;
}
if (Math.random()<=0.5) {
zoffset*=-1;
}
for (int j=-15;j<16;j++) {
for (int y=0;y<10;y++) {
for (int k=-15;k<16;k++) {
Bukkit.getWorld("world").getBlockAt(p.getLocation().add(xoffset+j,y,zoffset+k)).setType(Material.AIR);
}
}
}
Bukkit.getLogger().info("Spawned a new boss area.");
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()+xoffset-8, p.getLocation().getY(), p.getLocation().getZ()+zoffset-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);
Bukkit.getWorld("world").getBlockAt(new Location(p.getWorld(),p.getLocation().getX()+xoffset, p.getLocation().getY()+2, p.getLocation().getZ()+zoffset)).setType(Material.COMMAND);
} 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."));
}
this.plugin.last_boss_dungeon_time=Bukkit.getWorld("world").getFullTime()+12000;
}
if (args[0].equalsIgnoreCase("fatal_survivor") && args[1].equalsIgnoreCase("reset")) {
boolean survivor=false;
this.plugin.explorers.clear();
@ -864,7 +914,13 @@ public class commandBankEconomy
for (int i=0;i<joblist.length;i++) {
if (!joblist[i].equalsIgnoreCase("None")) {
int mylv=this.plugin.getAccountsConfig().getInt(p.getServer().getPlayer(args[1]).getName()+".jobs.job"+(i+1)+"lv");
p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(p.getServer().getPlayer(args[1]).getName()+".jobs.job"+(i+1)+"exp"))+"/"+Math.round(this.plugin.getJobExp(joblist[i], this.plugin.getAccountsConfig().getInt(p.getServer().getPlayer(args[1]).getName()+".jobs.job"+(i+1)+"lv")))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":""));
if (mylv==40) {
p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(p.getServer().getPlayer(args[1]).getName()+".jobs.job"+(i+1)+"exp"))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":""));
} else {
p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(p.getServer().getPlayer(args[1]).getName()+".jobs.job"+(i+1)+"exp"))+"/"+Math.round(this.plugin.getJobExp(joblist[i], this.plugin.getAccountsConfig().getInt(p.getServer().getPlayer(args[1]).getName()+".jobs.job"+(i+1)+"lv")))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":""));
}
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;
@ -895,7 +951,11 @@ public class commandBankEconomy
for (int i=0;i<joblist.length;i++) {
if (!joblist[i].equalsIgnoreCase("None")) {
int mylv=this.plugin.getAccountsConfig().getInt(q.getName()+".jobs.job"+(i+1)+"lv");
p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(q.getName()+".jobs.job"+(i+1)+"exp"))+"/"+Math.round(this.plugin.getJobExp(joblist[i], this.plugin.getAccountsConfig().getInt(q.getName()+".jobs.job"+(i+1)+"lv")))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":""));
if (mylv==40) {
p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(q.getName()+".jobs.job"+(i+1)+"exp"))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":""));
} else {
p.sendMessage("Lv"+mylv+" "+this.plugin.getJobColor(joblist[i])+joblist[i]+ChatColor.WHITE+": "+Math.round(this.plugin.getAccountsConfig().getInt(q.getName()+".jobs.job"+(i+1)+"exp"))+"/"+Math.round(this.plugin.getJobExp(joblist[i], this.plugin.getAccountsConfig().getInt(q.getName()+".jobs.job"+(i+1)+"lv")))+"xp "+ChatColor.BLUE+(mylv>=5?"+Lv5 Buff":"")+ChatColor.GREEN+(mylv>=10?" +Lv10 Buff":"")+ChatColor.GOLD+(mylv>=20?" +Lv20 Buff":""));
}
}
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.

Loading…
Cancel
Save