Mob spawn rates above ground reduced. Zombie Ninja fixes. Diablodrops

socket conversion.
dev
sigonasr2 11 years ago
parent 0e1bc2320e
commit 3c08b366ae
  1. 161
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 4
      BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java
  3. 664
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java

@ -504,9 +504,9 @@ public class Main extends JavaPlugin
ShapelessRecipe portable_table = new ShapelessRecipe(table); ShapelessRecipe portable_table = new ShapelessRecipe(table);
portable_table.addIngredient(Material.WORKBENCH); portable_table.addIngredient(1,Material.WORKBENCH);
portable_table.addIngredient(Material.CHEST); portable_table.addIngredient(1,Material.CHEST);
portable_table.addIngredient(Material.IRON_AXE); portable_table.addIngredient(1,Material.IRON_AXE);
Bukkit.addRecipe(portable_table); Bukkit.addRecipe(portable_table);
@ -750,6 +750,80 @@ public class Main extends JavaPlugin
Bukkit.addRecipe(powered_rare_heads); Bukkit.addRecipe(powered_rare_heads);
} }
List<Material> equip_list = new ArrayList<Material>();
List<Material> sockets_list = new ArrayList<Material>();
equip_list.add(Material.DIAMOND_CHESTPLATE);
equip_list.add(Material.IRON_CHESTPLATE);
equip_list.add(Material.CHAINMAIL_CHESTPLATE);
equip_list.add(Material.GOLD_CHESTPLATE);
equip_list.add(Material.LEATHER_CHESTPLATE);
equip_list.add(Material.DIAMOND_BOOTS);
equip_list.add(Material.IRON_BOOTS);
equip_list.add(Material.CHAINMAIL_BOOTS);
equip_list.add(Material.GOLD_BOOTS);
equip_list.add(Material.LEATHER_BOOTS);
equip_list.add(Material.DIAMOND_LEGGINGS);
equip_list.add(Material.IRON_LEGGINGS);
equip_list.add(Material.CHAINMAIL_LEGGINGS);
equip_list.add(Material.GOLD_LEGGINGS);
equip_list.add(Material.LEATHER_LEGGINGS);
equip_list.add(Material.DIAMOND_HELMET);
equip_list.add(Material.IRON_HELMET);
equip_list.add(Material.CHAINMAIL_HELMET);
equip_list.add(Material.GOLD_HELMET);
equip_list.add(Material.LEATHER_HELMET);
equip_list.add(Material.WOOD_SWORD);
equip_list.add(Material.STONE_SWORD);
equip_list.add(Material.IRON_SWORD);
equip_list.add(Material.GOLD_SWORD);
equip_list.add(Material.DIAMOND_SWORD);
equip_list.add(Material.WOOD_PICKAXE);
equip_list.add(Material.STONE_PICKAXE);
equip_list.add(Material.IRON_PICKAXE);
equip_list.add(Material.GOLD_PICKAXE);
equip_list.add(Material.DIAMOND_PICKAXE);
equip_list.add(Material.WOOD_SPADE);
equip_list.add(Material.STONE_SPADE);
equip_list.add(Material.IRON_SPADE);
equip_list.add(Material.GOLD_SPADE);
equip_list.add(Material.DIAMOND_SPADE);
equip_list.add(Material.WOOD_AXE);
equip_list.add(Material.STONE_AXE);
equip_list.add(Material.IRON_AXE);
equip_list.add(Material.GOLD_AXE);
equip_list.add(Material.DIAMOND_AXE);
equip_list.add(Material.WOOD_HOE);
equip_list.add(Material.STONE_HOE);
equip_list.add(Material.IRON_HOE);
equip_list.add(Material.GOLD_HOE);
equip_list.add(Material.DIAMOND_HOE);
equip_list.add(Material.BOW);
sockets_list.add(Material.SKULL_ITEM);
sockets_list.add(Material.DIAMOND);
sockets_list.add(Material.EMERALD);
//Add socket crafting recipes.
for (int i=0;i<equip_list.size();i++) {
for (int j=0;j<sockets_list.size();j++) {
ShapelessRecipe socket_rec = new ShapelessRecipe(new ItemStack(equip_list.get(i)));
socket_rec.addIngredient(1,sockets_list.get(j));
socket_rec.addIngredient(1,equip_list.get(i));
Bukkit.getLogger().info("Add recipe: "+socket_rec.getIngredientList().toString());
Bukkit.addRecipe(socket_rec);
}
}
//Add deconversion recipes. //Add deconversion recipes.
ShapelessRecipe DeConv_diamond_chestplate = new ShapelessRecipe(new ItemStack(Material.DIAMOND)); ShapelessRecipe DeConv_diamond_chestplate = new ShapelessRecipe(new ItemStack(Material.DIAMOND));
DeConv_diamond_chestplate.addIngredient(Material.DIAMOND_CHESTPLATE); DeConv_diamond_chestplate.addIngredient(Material.DIAMOND_CHESTPLATE);
@ -848,6 +922,10 @@ public class Main extends JavaPlugin
Bukkit.addRecipe(DeConv_gold_spade); Bukkit.addRecipe(DeConv_gold_spade);
Bukkit.addRecipe(DeConv_stone_spade); Bukkit.addRecipe(DeConv_stone_spade);
//FurnaceRecipe socket_enchantment = new FurnaceRecipe(new ItemStack(Material.IRON_CHESTPLATE),Material.DIAMOND);
//Bukkit.addRecipe(socket_enchantment);
for (int i=0;i<16;i++) { for (int i=0;i<16;i++) {
ShapelessRecipe nametag_color = new ShapelessRecipe(new ItemStack(Material.NAME_TAG)); ShapelessRecipe nametag_color = new ShapelessRecipe(new ItemStack(Material.NAME_TAG));
nametag_color.addIngredient(Material.NAME_TAG); nametag_color.addIngredient(Material.NAME_TAG);
@ -950,19 +1028,19 @@ public class Main extends JavaPlugin
ItemSetList.addSet(set); ItemSetList.addSet(set);
//Add in custom enchantments. //Add in custom enchantments.
ENCHANT_CRITICAL_CHANCE = new BonusEnchantment("Critical Chance",true,false,ItemType.WEAPONS,new IntRange(0,100)); ENCHANT_CRITICAL_CHANCE = new BonusEnchantment("Critical Chance",true,false,ItemType.WEAPONS,new IntRange(1,100));
ENCHANT_ARMOR_PENETRATION = new BonusEnchantment("Armor Penetration",false,false,ItemType.WEAPONS,new IntRange(0,100)); ENCHANT_ARMOR_PENETRATION = new BonusEnchantment("Armor Penetration",false,false,ItemType.WEAPONS,new IntRange(1,100));
ENCHANT_LIFE_STEAL = new BonusEnchantment("Life Steal",true,false,ItemType.WEAPONS,new IntRange(0,100)); ENCHANT_LIFE_STEAL = new BonusEnchantment("Life Steal",true,false,ItemType.WEAPONS,new IntRange(1,100));
ENCHANT_ATTACK_SPEED = new BonusEnchantment("Attack Speed",true,false,ItemType.WEAPONS,new IntRange(0,200)); ENCHANT_ATTACK_SPEED = new BonusEnchantment("Attack Speed",true,false,ItemType.WEAPONS,new IntRange(1,200));
ENCHANT_DAMAGE = new BonusEnchantment("Damage",false,false,ItemType.WEAPONS,new IntRange(0,40)); ENCHANT_DAMAGE = new BonusEnchantment("Damage",false,false,ItemType.WEAPONS,new IntRange(1,40));
ENCHANT_HEALTH = new BonusEnchantment("Health",false,false,ItemType.ARMOR,new IntRange(0,60)); ENCHANT_HEALTH = new BonusEnchantment("Health",false,false,ItemType.ARMOR,new IntRange(1,60));
ENCHANT_DAMAGE_REDUCTION = new BonusEnchantment("Damage Reduction",true,false,ItemType.ARMOR,new IntRange(0,100)); ENCHANT_DAMAGE_REDUCTION = new BonusEnchantment("Damage Reduction",true,false,ItemType.ARMOR,new IntRange(1,100));
ENCHANT_DURABILITY = new BonusEnchantment("Durability",true,false,ItemType.ARMOR,new IntRange(0,2000)); ENCHANT_DURABILITY = new BonusEnchantment("Durability",true,false,ItemType.ARMOR,new IntRange(1,2000));
ENCHANT_BLOCK_CHANCE = new BonusEnchantment("Block Chance",true,false,ItemType.ARMOR,new IntRange(0,100)); ENCHANT_BLOCK_CHANCE = new BonusEnchantment("Block Chance",true,false,ItemType.ARMOR,new IntRange(1,100));
ENCHANT_SPEED_BOOST_CHANCE = new BonusEnchantment("Speed Boost Chance",true,false,ItemType.ARMOR,new IntRange(0,100)); ENCHANT_SPEED_BOOST_CHANCE = new BonusEnchantment("Speed Boost Chance",true,false,ItemType.ARMOR,new IntRange(1,100));
ENCHANT_STURDY = new BonusEnchantment("Sturdy",false,true,ItemType.ARMOR,new IntRange(0,10)); ENCHANT_STURDY = new BonusEnchantment("Sturdy",false,true,ItemType.ARMOR,new IntRange(1,10));
ENCHANT_REPAIR = new BonusEnchantment("Repair",false,true,ItemType.ARMOR,new IntRange(0,10)); ENCHANT_REPAIR = new BonusEnchantment("Repair",false,true,ItemType.ARMOR,new IntRange(1,10));
ENCHANT_EXECUTE = new BonusEnchantment("Execute",false,true,ItemType.WEAPONS,new IntRange(0,10)); ENCHANT_EXECUTE = new BonusEnchantment("Execute",false,true,ItemType.WEAPONS,new IntRange(1,10));
DMGCALC = new DamageAPI(); DMGCALC = new DamageAPI();
//System.out.println("Running BankEconomy in "+this.getDataFolder().getAbsolutePath()); //System.out.println("Running BankEconomy in "+this.getDataFolder().getAbsolutePath());
@ -2287,7 +2365,7 @@ public void runTick() {
boolean contains=nearby.get(i) instanceof LivingEntity; boolean contains=nearby.get(i) instanceof LivingEntity;
boolean containsmonster=nearby.get(i) instanceof Monster; boolean containsmonster=nearby.get(i) instanceof Monster;
if (containsmonster && aoedmg>0) { if (containsmonster && aoedmg>0) {
if (nearby.get(i).getLocation().distance(p.getLocation())<=9) { if (((Monster)(nearby.get(i))).hasLineOfSight(p) && nearby.get(i).getLocation().distance(p.getLocation())<=9) {
//p.sendMessage("AOE Damage is "+aoedmg); //p.sendMessage("AOE Damage is "+aoedmg);
LivingEntity l = (LivingEntity)nearby.get(i); LivingEntity l = (LivingEntity)nearby.get(i);
l.damage(aoedmg); l.damage(aoedmg);
@ -2338,17 +2416,25 @@ public void runTick() {
for (int i=0;i<nearby.size();i++) { for (int i=0;i<nearby.size();i++) {
boolean contains_mob=false; boolean contains_mob=false;
for (int j=0;j<powered_mob_list.size();j++) { for (int j=0;j<powered_mob_list.size();j++) {
if (powered_mob_list.get(j).id.equals(nearby.get(i).getUniqueId())) { if (powered_mob_list.get(j).id.equals(nearby.get(i).getUniqueId()) && !nearby.get(i).isDead()) {
contains_mob=true; contains_mob=true;
//Play particley effects. //Play particley effects.
//nearby.get(i).getWorld().playEffect(nearby.get(i).getLocation(), Effect.BLAZE_SHOOT, 0); //nearby.get(i).getWorld().playEffect(nearby.get(i).getLocation(), Effect.BLAZE_SHOOT, 0);
nearby.get(i).getWorld().playSound(nearby.get(i).getLocation(), Sound.BLAZE_BREATH, 0.1f, 0.2f); nearby.get(i).getWorld().playSound(nearby.get(i).getLocation(), Sound.BLAZE_BREATH, 0.1f, 0.3f);
for (int z=0;z<3;z++) { for (int z=0;z<3;z++) {
final Entity mob = nearby.get(i); final Entity mob = nearby.get(i);
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
mob.getWorld().playEffect(new Location(mob.getWorld(), mob.getLocation().getX()+(Math.random()*1-Math.random()*1), mob.getLocation().getY()+(Math.random()*1-Math.random()*1), mob.getLocation().getZ()+(Math.random()*1-Math.random()*1)), Effect.STEP_SOUND, Material.STATIONARY_LAVA.getId()); boolean contains=false;
for (int j=0;j<powered_mob_list.size();j++) {
if (powered_mob_list.get(j).id.equals(mob.getUniqueId()) && !mob.isDead()) {
contains=true;
}
}
if (contains) {
mob.getWorld().playEffect(new Location(mob.getWorld(), mob.getLocation().getX()+(Math.random()*0.5-Math.random()*0.5), mob.getLocation().getY()+(Math.random()*2), mob.getLocation().getZ()+(Math.random()*0.5-Math.random()*0.5)), Effect.MOBSPAWNER_FLAMES, 0);
}
} }
},(int)(Math.random()*30)); },(int)(Math.random()*30));
} }
@ -2404,8 +2490,14 @@ public void runTick() {
if (!something) { if (!something) {
chance/=4; chance/=4;
} }
if (Math.random()<=0.05/ents.size() && l.hasLineOfSight(p)) { if (Math.random()<=0.007/ents.size() && l.hasLineOfSight(p)) {
if (!contains_mob) { boolean is_baby=false;
if (l instanceof Zombie) {
if (((Zombie)l).isBaby()) {
is_baby=true;
}
}
if (!contains_mob && !is_baby) {
powered_mob_list.add(new PoweredMob(l.getUniqueId(), Main.SERVER_TICK_TIME)); powered_mob_list.add(new PoweredMob(l.getUniqueId(), Main.SERVER_TICK_TIME));
l.getWorld().playSound(l.getLocation(), Sound.SPIDER_DEATH, 0.4f, 0.04f); l.getWorld().playSound(l.getLocation(), Sound.SPIDER_DEATH, 0.4f, 0.04f);
} }
@ -3906,6 +3998,7 @@ public void payDay(int time)
{ {
public void run() public void run()
{ {
/*
for (Player allOnlineP : Bukkit.getOnlinePlayers()) { for (Player allOnlineP : Bukkit.getOnlinePlayers()) {
allOnlineP.sendMessage(ChatColor.DARK_GREEN+"<=========["+ChatColor.LIGHT_PURPLE+"Interest"+ChatColor.DARK_GREEN+"]=========>"); allOnlineP.sendMessage(ChatColor.DARK_GREEN+"<=========["+ChatColor.LIGHT_PURPLE+"Interest"+ChatColor.DARK_GREEN+"]=========>");
DecimalFormat df = new DecimalFormat("#0.00"); DecimalFormat df = new DecimalFormat("#0.00");
@ -3920,7 +4013,7 @@ public void payDay(int time)
getAccountsConfig().set(allOnlineP.getName().toLowerCase() + ".money", ((Main.this.getConfig().getDouble("payday.amount")*(getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money"))+getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money")))); getAccountsConfig().set(allOnlineP.getName().toLowerCase() + ".money", ((Main.this.getConfig().getDouble("payday.amount")*(getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money"))+getAccountsConfig().getDouble(allOnlineP.getName().toLowerCase() + ".money"))));
} }
//Main.economy.depositPlayer(allOnlineP.getName().toLowerCase(), (Main.this.getConfig().getDouble("payday.amount")*Main.economy.bankBalance(allOnlineP.getName().toLowerCase()).balance)); //Main.economy.depositPlayer(allOnlineP.getName().toLowerCase(), (Main.this.getConfig().getDouble("payday.amount")*Main.economy.bankBalance(allOnlineP.getName().toLowerCase()).balance));
} }*/
//saveAccountsConfig() //Commented out; //saveAccountsConfig() //Commented out;
List<UUID> expired_uuids = new ArrayList<UUID>(); List<UUID> expired_uuids = new ArrayList<UUID>();
String moblist = getConfig().getString("fed.mobs"); String moblist = getConfig().getString("fed.mobs");
@ -5605,7 +5698,7 @@ public void payDay(int time)
return -1; return -1;
} }
public boolean is_PermanentProperty(String property) { public static boolean is_PermanentProperty(String property) {
//This function determines if the certain lore property is supposed to be kept on the item. //This function determines if the certain lore property is supposed to be kept on the item.
//Useful for checking what to remove and not remove from lore. //Useful for checking what to remove and not remove from lore.
List<String> permanent_properties = new ArrayList<String>(); List<String> permanent_properties = new ArrayList<String>();
@ -5620,7 +5713,7 @@ public void payDay(int time)
} }
} }
public double getEnchantmentNumb(String s) { public static double getEnchantmentNumb(String s) {
//Parse the string for spaces. //Parse the string for spaces.
String[] enchant = s.split(" "); String[] enchant = s.split(" ");
if (!s.contains(ChatColor.RED+"-400% Durability") && enchant[0].contains(ChatColor.YELLOW+"")) { if (!s.contains(ChatColor.RED+"-400% Durability") && enchant[0].contains(ChatColor.YELLOW+"")) {
@ -5716,7 +5809,7 @@ public void payDay(int time)
* @param numb The number to convert to Roman Numerals. * @param numb The number to convert to Roman Numerals.
* @return A String version of the number converted in Roman Numeral Format. * @return A String version of the number converted in Roman Numeral Format.
*/ */
public String toRomanNumeral(int numb) { public static String toRomanNumeral(int numb) {
String[] ones = {"I","II","III","IV","V","VI","VII","VIII","IX"}; String[] ones = {"I","II","III","IV","V","VI","VII","VIII","IX"};
String[] tens = {"X","XX","XXX","XL","L","LX","LXX","LXXX","XC"}; String[] tens = {"X","XX","XXX","XL","L","LX","LXX","LXXX","XC"};
String[] hundreds = {"C","CC","CCC","CD","D","DC","DCC","DCCC","CM"}; String[] hundreds = {"C","CC","CCC","CD","D","DC","DCC","DCCC","CM"};
@ -5757,7 +5850,7 @@ public void payDay(int time)
* @param roman_numeral The string in roman numeral form. * @param roman_numeral The string in roman numeral form.
* @return The integer version of the roman numeral given. * @return The integer version of the roman numeral given.
*/ */
public int toNumber(String roman_numeral) { public static int toNumber(String roman_numeral) {
String[] ones = {"I","II","III","IV","V","VI","VII","VIII","IX"}; String[] ones = {"I","II","III","IV","V","VI","VII","VIII","IX"};
String[] tens = {"X","XX","XXX","XL","L","LX","LXX","LXXX","XC"}; String[] tens = {"X","XX","XXX","XL","L","LX","LXX","LXXX","XC"};
String[] hundreds = {"C","CC","CCC","CD","D","DC","DCC","DCCC","CM"}; String[] hundreds = {"C","CC","CCC","CD","D","DC","DCC","DCCC","CM"};
@ -5918,7 +6011,7 @@ public void payDay(int time)
* @param amt The value of the enchantment to apply. * @param amt The value of the enchantment to apply.
* @return The item with the new enchantment added in. * @return The item with the new enchantment added in.
*/ */
public ItemStack addBonusEnchantment(ItemStack item, BonusEnchantment enchant, int amt) { public static ItemStack addBonusEnchantment(ItemStack item, BonusEnchantment enchant, int amt) {
return addBonusEnchantment(item, enchant, amt, false); return addBonusEnchantment(item, enchant, amt, false);
} }
@ -5933,7 +6026,7 @@ public void payDay(int time)
* @param override Whether or not the enchantment should be overwritten. * @param override Whether or not the enchantment should be overwritten.
* @return The item with the new enchantment added in. * @return The item with the new enchantment added in.
*/ */
public ItemStack addBonusEnchantment(ItemStack item, BonusEnchantment enchant, int amt, boolean override) { public static ItemStack addBonusEnchantment(ItemStack item, BonusEnchantment enchant, int amt, boolean override) {
Bukkit.getLogger().info("Adding bonus enchantment "+enchant.name+" @ level "+amt+" with override set to "+override+". On ItemStack: "+item.toString()); Bukkit.getLogger().info("Adding bonus enchantment "+enchant.name+" @ level "+amt+" with override set to "+override+". On ItemStack: "+item.toString());
if (amt<=0) {return item;} //Cannot have a negative number or 0 for an enchantment. Just return the item itself instead. if (amt<=0) {return item;} //Cannot have a negative number or 0 for an enchantment. Just return the item itself instead.
List<String> lore = null; List<String> lore = null;
@ -5951,12 +6044,20 @@ public void payDay(int time)
//Take that old amount and add onto it. //Take that old amount and add onto it.
double oldamt=0; double oldamt=0;
if (!override) {oldamt = getEnchantmentNumb(lore.get(i));} else {oldamt=0;} if (!override) {oldamt = getEnchantmentNumb(lore.get(i));} else {oldamt=0;}
if (oldamt+amt>enchant.value_range.getMaximumInteger()) {
oldamt=0;
amt=enchant.value_range.getMaximumInteger();
}
lore.set(i, ChatColor.YELLOW+"+"+(int)(oldamt+amt)+((percent)?"% ":" ")+ChatColor.BLUE+enchant_string); lore.set(i, ChatColor.YELLOW+"+"+(int)(oldamt+amt)+((percent)?"% ":" ")+ChatColor.BLUE+enchant_string);
} else { } else {
double oldamt=0; double oldamt=0;
String parser = lore.get(i); String parser = lore.get(i);
parser.replace(enchant_string, ""); parser.replace(enchant_string, "");
if (!override) {oldamt=toNumber(parser);} else {oldamt=0;} if (!override) {oldamt=toNumber(parser);} else {oldamt=0;}
if (oldamt+amt>enchant.value_range.getMaximumInteger()) {
oldamt=0;
amt=enchant.value_range.getMaximumInteger();
}
lore.set(i, ChatColor.GRAY+enchant_string+" "+toRomanNumeral((int)(oldamt+amt))); lore.set(i, ChatColor.GRAY+enchant_string+" "+toRomanNumeral((int)(oldamt+amt)));
} }
added=true; added=true;
@ -5995,7 +6096,7 @@ public void payDay(int time)
* @param item The item to sort Enchantments on. * @param item The item to sort Enchantments on.
* @return The item with all enchantments sorted out. * @return The item with all enchantments sorted out.
*/ */
public ItemStack sortEnchantments(ItemStack item) { public static ItemStack sortEnchantments(ItemStack item) {
//Sorts the enchantments so they are in the intended order. //Sorts the enchantments so they are in the intended order.
//(All Enchantments with Roman numerals are first.) //(All Enchantments with Roman numerals are first.)
//(All bonus enchantments are sorted via their ID.) //(All bonus enchantments are sorted via their ID.)

@ -164,11 +164,11 @@ public class PlayerBuffData {
int zombierarebheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,MobHeadRareType.RARE_TYPE_B), playerheads); int zombierarebheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,MobHeadRareType.RARE_TYPE_B), playerheads);
int zombiepoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,false,true), playerheads); int zombiepoweredheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,false,true), playerheads);
int zombiepoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,true), playerheads); int zombiepoweredrareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.ZOMBIE,true,true), playerheads);
Bukkit.getLogger().info("Base Health is "+base_hplv+"."); //Bukkit.getLogger().info("Base Health is "+base_hplv+".");
base_hplv+=zombierarebheads; base_hplv+=zombierarebheads;
base_hplv+=zombiepoweredheads; base_hplv+=zombiepoweredheads;
base_hplv+=zombiepoweredrareheads*4; base_hplv+=zombiepoweredrareheads*4;
Bukkit.getLogger().info("Base Health is "+base_hplv+"."); //Bukkit.getLogger().info("Base Health is "+base_hplv+".");
} }
extra_hp=0; extra_hp=0;
//p.setMaxHealth(base_hplv); //p.setMaxHealth(base_hplv);

@ -245,6 +245,7 @@ implements Listener
this.plugin = plugin; this.plugin = plugin;
} }
enum SocketColor { RED, GREEN, BLUE }
enum Cube { SMALL, LARGE, ENDER } enum Cube { SMALL, LARGE, ENDER }
enum SpecialMob { COUNTER_SLIME, VIRAL_SPIDER, SILENCER, enum SpecialMob { COUNTER_SLIME, VIRAL_SPIDER, SILENCER,
HOUND_CALLER, FISH_CALLER, EXPLOSIVE_BOMBER, SUICIDAL_CREEPER, HOUND_CALLER, FISH_CALLER, EXPLOSIVE_BOMBER, SUICIDAL_CREEPER,
@ -1960,6 +1961,8 @@ implements Listener
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".money", Double.valueOf(this.plugin.getConfig().getDouble("start-balance"))); this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".money", Double.valueOf(this.plugin.getConfig().getDouble("start-balance")));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".interestdistributedtime", Long.valueOf(Main.SERVER_TICK_TIME)); this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".interestdistributedtime", Long.valueOf(Main.SERVER_TICK_TIME));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".revived", Boolean.valueOf(true)); this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".revived", Boolean.valueOf(true));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".experience", Double.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".level", Integer.valueOf(1));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleefrating", Double.valueOf(1000.0d)); this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleefrating", Double.valueOf(1000.0d));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleefwins", Integer.valueOf(0)); this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleefwins", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleeflosses", Integer.valueOf(0)); this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".spleeflosses", Integer.valueOf(0));
@ -2024,6 +2027,23 @@ implements Listener
p.sendMessage(ChatColor.DARK_AQUA+"For a list of all changes made to this server, visit: http://z-gamers.net/changelog.html"); 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("----------------------------");
p.sendMessage(ChatColor.YELLOW+"Current Money Balance: $ "+df.format(Main.economy.bankBalance(p.getName().toLowerCase()).balance)+", Bank Balance: $"+df.format(this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase()+".money"))); p.sendMessage(ChatColor.YELLOW+"Current Money Balance: $ "+df.format(Main.economy.bankBalance(p.getName().toLowerCase()).balance)+", Bank Balance: $"+df.format(this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase()+".money")));
/* IN THE NEAR FUTURE.
if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".experience")) {
//Apply new experience/leveling system to players.
//Also reset stat points to 0. New system implementation.
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".experience", Double.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".level", Integer.valueOf(1));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat1", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat2", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat3", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat4", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat5", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat6", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat7", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat8", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat9", Integer.valueOf(0));
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".stats.stat10", Integer.valueOf(0));
}*/
if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".interestdistributedtime")) { if (!this.plugin.getAccountsConfig().contains(p.getName().toLowerCase() + ".interestdistributedtime")) {
this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".interestdistributedtime", Long.valueOf(Main.SERVER_TICK_TIME)); this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".interestdistributedtime", Long.valueOf(Main.SERVER_TICK_TIME));
//this.plugin.saveAccountsConfig(); //this.plugin.saveAccountsConfig();
@ -2635,7 +2655,7 @@ implements Listener
l.setHealth(l.getMaxHealth()); l.setHealth(l.getMaxHealth());
} }
} else { } else {
if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) { if (l.getLocation().getY()<=30 && Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) {
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
l.setCustomName(ChatColor.GRAY+"Zombie Ninja"); l.setCustomName(ChatColor.GRAY+"Zombie Ninja");
l.setCustomNameVisible(false); l.setCustomNameVisible(false);
@ -2765,8 +2785,8 @@ implements Listener
} }
} else { } else {
float groupmult=1.0f; //Change this to modify the global grouping multiplier. float groupmult=1.25f; //Change this to modify the global grouping multiplier.
int maxgroup=(int)(10*groupmult); double maxgroup=(int)(4);
double chancer=0.10d; double chancer=0.10d;
double despawnchancer=0.25d; double despawnchancer=0.25d;
@ -2774,6 +2794,14 @@ implements Listener
e.getEntity().remove(); //Too much HP. Nothing should have this much. e.getEntity().remove(); //Too much HP. Nothing should have this much.
return; return;
} }
if (e.getEntity().getLocation().getY()>=60) {
//This is above ground, there is a higher chance it will despawn.
if (Math.random()<=0.6) {
e.getEntity().remove();
return;
}
}
boolean allow=false; //If this is set to true, it will not be marked for removal. boolean allow=false; //If this is set to true, it will not be marked for removal.
@ -2835,7 +2863,7 @@ implements Listener
int totallvs=0; int totallvs=0;
List<Entity> nearbylist = e.getEntity().getNearbyEntities(30, 30, 30); List<Entity> nearbylist = e.getEntity().getNearbyEntities(20, 20, 20);
//Filter out all unrelated e.getEntity() types. //Filter out all unrelated e.getEntity() types.
for (int k=0;k<nearbylist.size();k++) { for (int k=0;k<nearbylist.size();k++) {
//See if human players are near. If so, factor that in for determining how many mobs may exist. //See if human players are near. If so, factor that in for determining how many mobs may exist.
@ -2848,118 +2876,114 @@ implements Listener
if (g.getInventory().getHelmet()!=null) { if (g.getInventory().getHelmet()!=null) {
ItemStack equip = g.getInventory().getHelmet(); ItemStack equip = g.getInventory().getHelmet();
if (equip.getType().toString().toLowerCase().contains("leather")) { if (equip.getType().toString().toLowerCase().contains("leather")) {
maxgroup+=0.2d; maxgroup+=0.02d;
totallvs+=2; totallvs+=2;
} }
if (equip.getType().toString().toLowerCase().contains("gold")) { if (equip.getType().toString().toLowerCase().contains("gold")) {
maxgroup+=3d; maxgroup+=0.03d;
totallvs+=3; totallvs+=3;
} }
if (equip.getType().toString().toLowerCase().contains("chainmail")) { if (equip.getType().toString().toLowerCase().contains("chainmail")) {
maxgroup+=1d; maxgroup+=0.1d;
totallvs+=10; totallvs+=10;
} }
if (equip.getType().toString().toLowerCase().contains("iron")) { if (equip.getType().toString().toLowerCase().contains("iron")) {
maxgroup+=1d; maxgroup+=0.1d;
totallvs+=10; totallvs+=10;
} }
if (equip.getType().toString().toLowerCase().contains("diamond")) { if (equip.getType().toString().toLowerCase().contains("diamond")) {
maxgroup+=3d; maxgroup+=0.3d;
totallvs+=30; totallvs+=30;
} }
} }
if (g.getInventory().getBoots()!=null) { if (g.getInventory().getBoots()!=null) {
ItemStack equip = g.getInventory().getBoots(); ItemStack equip = g.getInventory().getBoots();
if (equip.getType().toString().toLowerCase().contains("leather")) { if (equip.getType().toString().toLowerCase().contains("leather")) {
maxgroup+=0.2d; maxgroup+=0.02d;
totallvs+=2; totallvs+=2;
} }
if (equip.getType().toString().toLowerCase().contains("gold")) { if (equip.getType().toString().toLowerCase().contains("gold")) {
maxgroup+=3d; maxgroup+=0.03d;
totallvs+=3; totallvs+=3;
} }
if (equip.getType().toString().toLowerCase().contains("chainmail")) { if (equip.getType().toString().toLowerCase().contains("chainmail")) {
maxgroup+=1d; maxgroup+=0.1d;
totallvs+=10; totallvs+=10;
} }
if (equip.getType().toString().toLowerCase().contains("iron")) { if (equip.getType().toString().toLowerCase().contains("iron")) {
maxgroup+=1d; maxgroup+=0.1d;
totallvs+=10; totallvs+=10;
} }
if (equip.getType().toString().toLowerCase().contains("diamond")) { if (equip.getType().toString().toLowerCase().contains("diamond")) {
maxgroup+=3d; maxgroup+=0.3d;
totallvs+=30; totallvs+=30;
} }
} }
if (g.getInventory().getLeggings()!=null) { if (g.getInventory().getLeggings()!=null) {
ItemStack equip = g.getInventory().getLeggings(); ItemStack equip = g.getInventory().getLeggings();
if (equip.getType().toString().toLowerCase().contains("leather")) { if (equip.getType().toString().toLowerCase().contains("leather")) {
maxgroup+=0.2d; maxgroup+=0.02d;
totallvs+=2*1.5; totallvs+=2;
} }
if (equip.getType().toString().toLowerCase().contains("gold")) { if (equip.getType().toString().toLowerCase().contains("gold")) {
maxgroup+=3d; maxgroup+=0.03d;
totallvs+=3*1.5; totallvs+=3;
} }
if (equip.getType().toString().toLowerCase().contains("chainmail")) { if (equip.getType().toString().toLowerCase().contains("chainmail")) {
maxgroup+=1d; maxgroup+=0.1d;
totallvs+=10*1.5; totallvs+=10;
} }
if (equip.getType().toString().toLowerCase().contains("iron")) { if (equip.getType().toString().toLowerCase().contains("iron")) {
maxgroup+=1d; maxgroup+=0.1d;
totallvs+=10*1.5; totallvs+=10;
} }
if (equip.getType().toString().toLowerCase().contains("diamond")) { if (equip.getType().toString().toLowerCase().contains("diamond")) {
maxgroup+=3d; maxgroup+=0.3d;
totallvs+=30*1.5; totallvs+=30;
} }
} }
if (g.getInventory().getChestplate()!=null) { if (g.getInventory().getChestplate()!=null) {
ItemStack equip = g.getInventory().getChestplate(); ItemStack equip = g.getInventory().getChestplate();
if (equip.getType().toString().toLowerCase().contains("leather")) { if (equip.getType().toString().toLowerCase().contains("leather")) {
maxgroup+=0.2d; maxgroup+=0.02d;
totallvs+=2*2; totallvs+=2;
} }
if (equip.getType().toString().toLowerCase().contains("gold")) { if (equip.getType().toString().toLowerCase().contains("gold")) {
maxgroup+=3d; maxgroup+=0.03d;
totallvs+=3*2; totallvs+=3;
} }
if (equip.getType().toString().toLowerCase().contains("chainmail")) { if (equip.getType().toString().toLowerCase().contains("chainmail")) {
maxgroup+=1d; maxgroup+=0.1d;
totallvs+=10*2; totallvs+=10;
} }
if (equip.getType().toString().toLowerCase().contains("iron")) { if (equip.getType().toString().toLowerCase().contains("iron")) {
maxgroup+=1d; maxgroup+=0.1d;
totallvs+=10*2; totallvs+=10;
} }
if (equip.getType().toString().toLowerCase().contains("diamond")) { if (equip.getType().toString().toLowerCase().contains("diamond")) {
maxgroup+=3d; maxgroup+=0.3d;
totallvs+=30*2; totallvs+=30;
} }
} }
if (g.getInventory().getItemInHand()!=null) { if (g.getInventory().getItemInHand()!=null) {
ItemStack equip = g.getInventory().getItemInHand(); ItemStack equip = g.getInventory().getItemInHand();
if (equip.getType().toString().toLowerCase().contains("bow")) { if (equip.getType().toString().toLowerCase().contains("bow")) {
maxgroup+=1.5d; maxgroup+=0.15d;
totallvs+=15; totallvs+=15;
} }
if (equip.getType().toString().toLowerCase().contains("diamond")) { if (equip.getType().toString().toLowerCase().contains("diamond")) {
maxgroup+=2d; maxgroup+=0.2d;
totallvs+=20; totallvs+=20;
} }
} }
////Bukkit.getLogger().info("Mob maxgroup increased to "+maxgroup+" down here."); ////Bukkit.getLogger().info("Mob maxgroup increased to "+maxgroup+" down here.");
} }
if (nearbylist.get(k).getType()!=EntityType.SKELETON && if (!(nearbylist.get(k) instanceof Monster)) {
nearbylist.get(k).getType()!=EntityType.ZOMBIE &&
nearbylist.get(k).getType()!=EntityType.CREEPER &&
nearbylist.get(k).getType()!=EntityType.SPIDER &&
nearbylist.get(k).getType()!=EntityType.ENDERMAN) {
nearbylist.remove(k); nearbylist.remove(k);
k--; k--;
} }
} }
maxgroup/=groupmult; maxgroup*=groupmult;
int currentnearby = nearbylist.size(); int currentnearby = nearbylist.size();
if (currentnearby>maxgroup) { if (currentnearby>maxgroup) {
allow=false; //Too many mobs, can't have more. allow=false; //Too many mobs, can't have more.
@ -5352,6 +5376,58 @@ implements Listener
@EventHandler @EventHandler
public void onItemPickup(PlayerPickupItemEvent e) { public void onItemPickup(PlayerPickupItemEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
ItemStack check=e.getItem().getItemStack();
if (check.hasItemMeta() &&
check.getItemMeta().hasLore()) {
//Look through the lore for any (Socket) entries.
//Count how many there are, and replace them with legitimate
//and random enchantments.
//Also divide the durability of the items by 12 or so. Make it MUCH smaller.
List<String> oldLore = new ArrayList<String>();
int socket_count=0;
for (int j=0;j<check.getItemMeta().getLore().size();j++) {
if (check.getItemMeta().getLore().get(j).contains("(Socket)")) {
socket_count++;
} else {
oldLore.add(check.getItemMeta().getLore().get(j));
}
}
ItemMeta meta = check.getItemMeta();
meta.setLore(oldLore);
check.setItemMeta(meta);
for (int j=0;j<socket_count;j++) {
check.setDurability((short)(check.getDurability()/12));
//Main.addB
if (check.getType().toString().toLowerCase().contains("sword") ||
check.getType().toString().toLowerCase().contains("bow") ||
check.getType().toString().toLowerCase().contains("spade") ||
check.getType().toString().toLowerCase().contains("hoe") ||
check.getType().toString().toLowerCase().contains("axe") ||
check.getType().toString().toLowerCase().contains("rod") ||
check.getType().toString().toLowerCase().contains("shears")) {
int enchantment_numb = (int)(Math.random()*Main.getBonusWeaponEnchantments().size());
check=Main.addBonusEnchantment(check, Main.getBonusWeaponEnchantments().get(enchantment_numb), Main.getBonusWeaponEnchantments().get(enchantment_numb).value_range.getMaximumInteger()/4+Main.getBonusWeaponEnchantments().get(enchantment_numb).value_range.getMinimumInteger());
} else {
int enchantment_numb = (int)(Math.random()*Main.getBonusArmorEnchantments().size());
check=Main.addBonusEnchantment(check, Main.getBonusArmorEnchantments().get(enchantment_numb), Main.getBonusArmorEnchantments().get(enchantment_numb).value_range.getMaximumInteger()/4+Main.getBonusArmorEnchantments().get(enchantment_numb).value_range.getMinimumInteger());
}
}
}
if (check.hasItemMeta() && check.getItemMeta().hasLore()) {
List<String> newLore = new ArrayList<String>();
for (String s : check.getItemMeta().getLore()) {
//Bukkit.getLogger().info("OLD: "+s);
s=s.replace("Put in the","Put in a");
s=s.replace("bottom of a furnace", "crafting table with");
s=s.replace("with another item in the top","another item with (Socket)");
//Bukkit.getLogger().info("NEW: "+s);
newLore.add(s);
}
ItemMeta meta = check.getItemMeta();
meta.setLore(newLore);
check.setItemMeta(meta);
}
e.getItem().setItemStack(check);
if (this.plugin.supportstackslist.contains(e.getItem())) { if (this.plugin.supportstackslist.contains(e.getItem())) {
boolean alreadyhas=false; boolean alreadyhas=false;
for (int i=0;i<p.getInventory().getSize();i++) { for (int i=0;i<p.getInventory().getSize();i++) {
@ -6265,7 +6341,7 @@ implements Listener
public void onItemPrepareCraft(PrepareItemCraftEvent e) { public void onItemPrepareCraft(PrepareItemCraftEvent e) {
CraftingInventory result = e.getInventory(); CraftingInventory result = e.getInventory();
//Bukkit.getLogger().info("Triggered PrepareItemCraftEvent."); Bukkit.getLogger().info("Triggered PrepareItemCraftEvent. With result: "+e.getInventory().getResult().toString());
//****************************// Job Boofs poof here. //****************************// Job Boofs poof here.
@ -6280,6 +6356,7 @@ implements Listener
result.setResult(new ItemStack(Material.WOOD,6,result.getResult().getData().getData())); result.setResult(new ItemStack(Material.WOOD,6,result.getResult().getData().getData()));
} }
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.1");}
if (result.getResult().getType()==Material.CLAY_BALL) { if (result.getResult().getType()==Material.CLAY_BALL) {
//Check to see if there is an artifact in the crafting grid. //Check to see if there is an artifact in the crafting grid.
boolean artifact=false, ender_eye=false; boolean artifact=false, ender_eye=false;
@ -6320,7 +6397,7 @@ implements Listener
return; //Don't allow it to continue. return; //Don't allow it to continue.
} }
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.2");}
if (result.getResult().getType()==Material.SKULL_ITEM) { if (result.getResult().getType()==Material.SKULL_ITEM) {
//This could potentially be a mob head. //This could potentially be a mob head.
//Find the mob head. //Find the mob head.
@ -6376,6 +6453,7 @@ implements Listener
return; return;
} }
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.3");}
boolean is_battleShovel=false; boolean is_battleShovel=false;
if (result.getResult().getType()==Material.WOOD_SPADE) { if (result.getResult().getType()==Material.WOOD_SPADE) {
@ -6389,6 +6467,7 @@ implements Listener
} }
} }
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.4");}
boolean allowed=false; boolean allowed=false;
if (is_battleShovel) { if (is_battleShovel) {
for (int i=0;i<e.getInventory().getViewers().size();i++) { for (int i=0;i<e.getInventory().getViewers().size();i++) {
@ -6401,6 +6480,87 @@ implements Listener
return; return;
} }
} }
//Find out if we have a socket enchancement inside.
boolean has_socket=false;
ItemStack socket = new ItemStack(Material.AIR);
boolean has_equip=false;
ItemStack equip = new ItemStack(Material.AIR);
for (int i=0;i<result.getMatrix().length;i++) {
if (result.getMatrix()[i]!=null) {
if (result.getMatrix()[i].getType()==Material.DIAMOND ||
result.getMatrix()[i].getType()==Material.EMERALD ||
result.getMatrix()[i].getType()==Material.SKULL_ITEM) {
//This might be a socket.
ItemStack socket_check = result.getMatrix()[i];
if (socket_check.hasItemMeta() && socket_check.getItemMeta().hasLore()) {
for (String s : socket_check.getItemMeta().getLore()) {
if (s.contains("Put in a crafting table with")) {
//This is a socket. Socket found.
//So now find the equipment piece.
Bukkit.getLogger().info("Found socket: "+socket.toString());
socket=result.getMatrix()[i];
has_socket=true;
break;
}
}
}
} else {
if (result.getMatrix()[i].getType()!=Material.AIR) {
has_equip=true;
Bukkit.getLogger().info("Found equip: "+equip.toString());
equip=result.getMatrix()[i];
}
}
}
}
if (has_equip && has_socket) {
//This item can be socketed. Set the result to ???.
result.setResult(equip);
//Figure out the color of the socket.
SocketColor thiscolor = null;
if (socket.getItemMeta().getDisplayName().contains(ChatColor.BLUE+"Socket Enhancement")) {
thiscolor = SocketColor.BLUE;
}
if (socket.getItemMeta().getDisplayName().contains(ChatColor.GREEN+"Socket Enhancement")) {
thiscolor = SocketColor.GREEN;
}
if (socket.getItemMeta().getDisplayName().contains(ChatColor.RED+"Socket Enhancement")) {
thiscolor = SocketColor.RED;
}
Bukkit.getLogger().info("Socket color is "+thiscolor.toString());
//Now that we know the color, find the first match of that color, if possible.
boolean foundsocket=false;
if (equip.hasItemMeta() && equip.getItemMeta().hasLore()) {
List<String> newLore = new ArrayList<String>();
for (String s : equip.getItemMeta().getLore()) {
ChatColor checkcolor = ChatColor.WHITE;
switch (thiscolor) {
case BLUE:{
checkcolor=ChatColor.BLUE;
}break;
case GREEN:{
checkcolor=ChatColor.GREEN;
}break;
case RED:{
checkcolor=ChatColor.RED;
}break;
}
if (!foundsocket && s.contains(checkcolor+"(Socket)")) {
Bukkit.getLogger().info("Found a matching color! Replacing...");
s=s.replace(checkcolor+"(Socket)",checkcolor+"???");
foundsocket=true;
}
newLore.add(s);
}
ItemMeta meta = equip.getItemMeta();
meta.setLore(newLore);
equip.setItemMeta(meta);
}
}
//Find out if there is only 1 item in the crafting matrix. It also have to be an armor/tool. //Find out if there is only 1 item in the crafting matrix. It also have to be an armor/tool.
boolean check=false; boolean check=false;
@ -6418,8 +6578,17 @@ implements Listener
result.getMatrix()[i].getType().name().toLowerCase().contains("hoe")) { result.getMatrix()[i].getType().name().toLowerCase().contains("hoe")) {
check=true; check=true;
count++; count++;
} else {
if (result.getMatrix()[i].getType()!=Material.AIR) {
//This is a different item. check is false, this is irrelevant now.
check=false;
count=0;
}
} }
} }
}
if (count==3) {
} }
if (check && count==1) { if (check && count==1) {
//Bukkit.getLogger().info("Found only 1 piece inside."); //Bukkit.getLogger().info("Found only 1 piece inside.");
@ -6480,7 +6649,8 @@ implements Listener
result.setResult(offering); result.setResult(offering);
} }
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.5");}
Player p = null; Player p = null;
for (int i=0;i<e.getInventory().getViewers().size();i++) { for (int i=0;i<e.getInventory().getViewers().size();i++) {
if (this.plugin.hasJobBuff("Cook", e.getInventory().getViewers().get(i).getName(), Job.JOB10)) { if (this.plugin.hasJobBuff("Cook", e.getInventory().getViewers().get(i).getName(), Job.JOB10)) {
@ -6531,7 +6701,7 @@ implements Listener
} }
//****************************//Job Non-Boofs go below. //****************************//Job Non-Boofs go below.
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.6");}
if (result.getResult().getType()==Material.NAME_TAG) { if (result.getResult().getType()==Material.NAME_TAG) {
ItemStack dye = null; ItemStack dye = null;
ItemStack name_tag = null; ItemStack name_tag = null;
@ -6586,7 +6756,7 @@ implements Listener
return; return;
} }
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.7");}
ItemStack armor1 = null; ItemStack armor1 = null;
for (int i=0;i<result.getMatrix().length;i++) { for (int i=0;i<result.getMatrix().length;i++) {
//Disable crafting if two pieces of the same armor are in the slots. //Disable crafting if two pieces of the same armor are in the slots.
@ -6605,6 +6775,7 @@ implements Listener
result.getMatrix()[i].getType().name().toLowerCase().contains("shears")) { result.getMatrix()[i].getType().name().toLowerCase().contains("shears")) {
if (armor1.getType()==result.getMatrix()[i].getType()) { if (armor1.getType()==result.getMatrix()[i].getType()) {
//Two pieces with the same type. Disable merge crafting. //Two pieces with the same type. Disable merge crafting.
Bukkit.getLogger().info("Found two pieces of the same type. Disabled crafting.");
result.setResult(new ItemStack(Material.AIR)); result.setResult(new ItemStack(Material.AIR));
return; return;
} else { } else {
@ -6617,16 +6788,24 @@ implements Listener
(result.getMatrix()[i].getType().name().toLowerCase().contains("helmet") || (result.getMatrix()[i].getType().name().toLowerCase().contains("helmet") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("chestplate") || result.getMatrix()[i].getType().name().toLowerCase().contains("chestplate") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("leggings") || result.getMatrix()[i].getType().name().toLowerCase().contains("leggings") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("boots"))) { result.getMatrix()[i].getType().name().toLowerCase().contains("boots") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("pickaxe") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("bow") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("sword") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("spade") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("axe") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("hoe") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("fishing_rod") ||
result.getMatrix()[i].getType().name().toLowerCase().contains("shears"))) {
armor1 = result.getMatrix()[i]; armor1 = result.getMatrix()[i];
} }
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.8");}
// Disable melon crafting recipe // Disable melon crafting recipe
if (result.getResult().getType()==Material.MELON_BLOCK) { if (result.getResult().getType()==Material.MELON_BLOCK) {
result.setResult(new ItemStack(Material.AIR)); result.setResult(new ItemStack(Material.AIR));
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.9");}
if (result.getResult().getType()==Material.WOOL && result.getResult().getAmount() == 1) { if (result.getResult().getType()==Material.WOOL && result.getResult().getAmount() == 1) {
//Make sure the crafting matrix only contains three string. //Make sure the crafting matrix only contains three string.
int stringcount=0; int stringcount=0;
@ -6640,7 +6819,7 @@ implements Listener
return; return;
} }
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.10");}
// Increase stairs recipe efficiency // Increase stairs recipe efficiency
if (result.getResult().getType()==Material.WOOD_STAIRS) { if (result.getResult().getType()==Material.WOOD_STAIRS) {
result.setResult(new ItemStack(Material.WOOD_STAIRS, 8)); result.setResult(new ItemStack(Material.WOOD_STAIRS, 8));
@ -6672,7 +6851,7 @@ implements Listener
if (result.getResult().getType()==Material.SMOOTH_STAIRS) { if (result.getResult().getType()==Material.SMOOTH_STAIRS) {
result.setResult(new ItemStack(Material.SMOOTH_STAIRS, 8)); result.setResult(new ItemStack(Material.SMOOTH_STAIRS, 8));
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.11");}
if (result.getResult().getType()==Material.IRON_HELMET || if (result.getResult().getType()==Material.IRON_HELMET ||
result.getResult().getType()==Material.IRON_CHESTPLATE || result.getResult().getType()==Material.IRON_CHESTPLATE ||
result.getResult().getType()==Material.IRON_LEGGINGS || result.getResult().getType()==Material.IRON_LEGGINGS ||
@ -6823,6 +7002,7 @@ implements Listener
result.setResult(newarmor); result.setResult(newarmor);
} }
} }
//if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.12");}
} }
private void restoreItems(CraftingInventory craft, ClickType click, Player p, double restore_chance) { private void restoreItems(CraftingInventory craft, ClickType click, Player p, double restore_chance) {
@ -8470,6 +8650,42 @@ implements Listener
} }
e.getDrops().get(i).setAmount(newamt); e.getDrops().get(i).setAmount(newamt);
} }
if (e.getDrops().get(i).hasItemMeta() &&
e.getDrops().get(i).getItemMeta().hasLore()) {
//Look through the lore for any (Socket) entries.
//Count how many there are, and replace them with legitimate
//and random enchantments.
//Also divide the durability of the items by 12 or so. Make it MUCH smaller.
List<String> oldLore = new ArrayList<String>();
int socket_count=0;
for (int j=0;j<e.getDrops().get(i).getItemMeta().getLore().size();j++) {
if (e.getDrops().get(i).getItemMeta().getLore().get(j).contains("(Socket)")) {
socket_count++;
} else {
oldLore.add(e.getDrops().get(i).getItemMeta().getLore().get(j));
}
}
ItemMeta meta = e.getDrops().get(i).getItemMeta();
meta.setLore(oldLore);
e.getDrops().get(i).setItemMeta(meta);
for (int j=0;j<socket_count;j++) {
e.getDrops().get(i).setDurability((short)(e.getDrops().get(i).getDurability()/12));
//Main.addB
if (e.getDrops().get(i).getType().toString().toLowerCase().contains("sword") ||
e.getDrops().get(i).getType().toString().toLowerCase().contains("bow") ||
e.getDrops().get(i).getType().toString().toLowerCase().contains("spade") ||
e.getDrops().get(i).getType().toString().toLowerCase().contains("hoe") ||
e.getDrops().get(i).getType().toString().toLowerCase().contains("axe") ||
e.getDrops().get(i).getType().toString().toLowerCase().contains("rod") ||
e.getDrops().get(i).getType().toString().toLowerCase().contains("shears")) {
int enchantment_numb = (int)(Math.random()*Main.getBonusWeaponEnchantments().size());
e.getDrops().set(i, Main.addBonusEnchantment(e.getDrops().get(i), Main.getBonusWeaponEnchantments().get(enchantment_numb), Main.getBonusWeaponEnchantments().get(enchantment_numb).value_range.getMaximumInteger()/2+Main.getBonusWeaponEnchantments().get(enchantment_numb).value_range.getMinimumInteger()));
} else {
int enchantment_numb = (int)(Math.random()*Main.getBonusArmorEnchantments().size());
e.getDrops().set(i, Main.addBonusEnchantment(e.getDrops().get(i), Main.getBonusArmorEnchantments().get(enchantment_numb), Main.getBonusArmorEnchantments().get(enchantment_numb).value_range.getMaximumInteger()/2+Main.getBonusArmorEnchantments().get(enchantment_numb).value_range.getMinimumInteger()));
}
}
}
} }
if (Math.random()<=0.00390625) {e.getDrops().add(getGoodie(2));} if (Math.random()<=0.00390625) {e.getDrops().add(getGoodie(2));}
if (Math.random()<=0.00390625/4.0d) {e.getDrops().add(getGoodie(3));} if (Math.random()<=0.00390625/4.0d) {e.getDrops().add(getGoodie(3));}
@ -9136,6 +9352,8 @@ implements Listener
} }
} }
if (e.getState()==State.CAUGHT_FISH) { if (e.getState()==State.CAUGHT_FISH) {
PlayerData pd = this.plugin.getPlayerData(p);
pd.gameinteractions+=300;
if (this.plugin.getConfig().getBoolean("thanksgiving-enabled")) { if (this.plugin.getConfig().getBoolean("thanksgiving-enabled")) {
if (Math.random() < 0.50) { if (Math.random() < 0.50) {
// 50% chance of fishing up a chicken plus feathers // 50% chance of fishing up a chicken plus feathers
@ -9591,44 +9809,186 @@ implements Listener
@EventHandler @EventHandler
public void onHurt(EntityDamageEvent e) { public void onHurt(EntityDamageEvent e) {
final EntityDamageEvent f = e; final EntityDamageEvent f = e;
double maxgroup=4;
double groupmult=1.25d;
int totallvs=0;
List<Entity> nearbylist = e.getEntity().getNearbyEntities(30, 30, 30);
//Filter out all unrelated e.getEntity() types.
for (int k=0;k<nearbylist.size();k++) {
//See if human players are near. If so, factor that in for determining how many mobs may exist.
if (nearbylist.get(k).getType()==EntityType.PLAYER) {
//This is a player.
Player g = (Player)nearbylist.get(k);
//OLD LEVEL DETERMINING SYSTEM
//maxgroup+=plugin.getJobTotalLvs(g)/10;
//totallvs+=plugin.getJobTotalLvs(g);
if (g.getInventory().getHelmet()!=null) {
ItemStack equip = g.getInventory().getHelmet();
if (equip.getType().toString().toLowerCase().contains("leather")) {
maxgroup+=0.02d;
totallvs+=2;
}
if (equip.getType().toString().toLowerCase().contains("gold")) {
maxgroup+=0.03d;
totallvs+=3;
}
if (equip.getType().toString().toLowerCase().contains("chainmail")) {
maxgroup+=0.1d;
totallvs+=10;
}
if (equip.getType().toString().toLowerCase().contains("iron")) {
maxgroup+=0.1d;
totallvs+=10;
}
if (equip.getType().toString().toLowerCase().contains("diamond")) {
maxgroup+=0.3d;
totallvs+=30;
}
}
if (g.getInventory().getBoots()!=null) {
ItemStack equip = g.getInventory().getBoots();
if (equip.getType().toString().toLowerCase().contains("leather")) {
maxgroup+=0.02d;
totallvs+=2;
}
if (equip.getType().toString().toLowerCase().contains("gold")) {
maxgroup+=0.03d;
totallvs+=3;
}
if (equip.getType().toString().toLowerCase().contains("chainmail")) {
maxgroup+=0.1d;
totallvs+=10;
}
if (equip.getType().toString().toLowerCase().contains("iron")) {
maxgroup+=0.1d;
totallvs+=10;
}
if (equip.getType().toString().toLowerCase().contains("diamond")) {
maxgroup+=0.3d;
totallvs+=30;
}
}
if (g.getInventory().getLeggings()!=null) {
ItemStack equip = g.getInventory().getLeggings();
if (equip.getType().toString().toLowerCase().contains("leather")) {
maxgroup+=0.02d;
totallvs+=2;
}
if (equip.getType().toString().toLowerCase().contains("gold")) {
maxgroup+=0.03d;
totallvs+=3;
}
if (equip.getType().toString().toLowerCase().contains("chainmail")) {
maxgroup+=0.1d;
totallvs+=10;
}
if (equip.getType().toString().toLowerCase().contains("iron")) {
maxgroup+=0.1d;
totallvs+=10;
}
if (equip.getType().toString().toLowerCase().contains("diamond")) {
maxgroup+=0.3d;
totallvs+=30;
}
}
if (g.getInventory().getChestplate()!=null) {
ItemStack equip = g.getInventory().getChestplate();
if (equip.getType().toString().toLowerCase().contains("leather")) {
maxgroup+=0.02d;
totallvs+=2;
}
if (equip.getType().toString().toLowerCase().contains("gold")) {
maxgroup+=0.03d;
totallvs+=3;
}
if (equip.getType().toString().toLowerCase().contains("chainmail")) {
maxgroup+=0.1d;
totallvs+=10;
}
if (equip.getType().toString().toLowerCase().contains("iron")) {
maxgroup+=0.1d;
totallvs+=10;
}
if (equip.getType().toString().toLowerCase().contains("diamond")) {
maxgroup+=0.3d;
totallvs+=30;
}
}
if (g.getInventory().getItemInHand()!=null) {
ItemStack equip = g.getInventory().getItemInHand();
if (equip.getType().toString().toLowerCase().contains("bow")) {
maxgroup+=0.15d;
totallvs+=15;
}
if (equip.getType().toString().toLowerCase().contains("diamond")) {
maxgroup+=0.2d;
totallvs+=20;
}
}
////Bukkit.getLogger().info("Mob maxgroup increased to "+maxgroup+" down here.");
}
if (!(nearbylist.get(k) instanceof Monster)) {
nearbylist.remove(k);
k--;
}
}
boolean allow=true;
maxgroup*=groupmult;
int currentnearby = nearbylist.size();
if (currentnearby>maxgroup) {
allow=false; //Too many mobs, can't have more.
}
if (e.getEntity() instanceof Monster && e.getCause()==DamageCause.SUFFOCATION) { if (e.getEntity() instanceof Monster && e.getCause()==DamageCause.SUFFOCATION) {
LivingEntity l = (LivingEntity)e.getEntity(); LivingEntity l = (LivingEntity)e.getEntity();
if (l.getTicksLived()<60) { if (l.getTicksLived()<60) {
//Check around itself for other mobs. Teleport it there possibly. Higher chance //Check around itself for other mobs. Teleport it there possibly. Higher chance
//of teleporting to mobs of the same type. //of teleporting to mobs of the same type.
boolean mobfound=false; if (allow) {
List<Entity> nearby = l.getNearbyEntities(20, 20, 20); boolean mobfound=false;
for (int i=0;i<nearby.size();i++) { List<Entity> nearby = l.getNearbyEntities(20, 20, 20);
if (!(nearby.get(i) instanceof Monster)) { for (int i=0;i<nearby.size();i++) {
nearby.remove(i); if (!(nearby.get(i) instanceof Monster)) {
i--; nearby.remove(i);
} i--;
} }
for (int i=0;i<nearby.size();i++) {
double chancer=0;
if (nearby.get(i).getType()==l.getType()) {
chancer=0.5;
} }
final Entity teleport_entity = e.getEntity(); for (int i=0;i<nearby.size();i++) {
final Entity teleport_to = nearby.get(i); double chancer=0;
if (Math.random()<=chancer+0.25 && nearby.get(i).getTicksLived()>60 && (nearby.get(i).getLastDamageCause()==null || nearby.get(i).getLastDamageCause().getCause()!=DamageCause.SUFFOCATION)) { if (nearby.get(i).getType()==l.getType()) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { chancer=0.5;
@Override }
public void run() { final Entity teleport_entity = e.getEntity();
teleport_entity.teleport(teleport_to); final Entity teleport_to = nearby.get(i);
List<Entity> playercheck = nearby.get(i).getNearbyEntities(nearby.get(i).getLocation().getX(), nearby.get(i).getLocation().getY(), nearby.get(i).getLocation().getZ());
for (int j=0;j<playercheck.size();j++) {
if (!(playercheck.get(j) instanceof Player)) {
playercheck.remove(j);
j--;
} }
},1); }
mobfound=true; if (playercheck.size()>0) {
break; break;
}
if (Math.random()<=chancer+0.25 && !nearby.get(i).equals(teleport_entity) && nearby.get(i).getTicksLived()>60 && (nearby.get(i).getLastDamageCause()==null || nearby.get(i).getLastDamageCause().getCause()!=DamageCause.SUFFOCATION)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
teleport_entity.teleport(teleport_to);
}
},1);
mobfound=true;
break;
}
}
if (mobfound) {
e.setDamage(0);
e.setCancelled(true);
} else {
e.getEntity().remove();
} }
}
if (mobfound) {
e.setDamage(0);
e.setCancelled(true);
} else { } else {
e.getEntity().remove(); e.getEntity().remove();
e.setDamage(0);
e.setCancelled(true);
} }
} }
} }
@ -9980,6 +10340,9 @@ implements Listener
} }
} }
//**********************************//Player buffs end //**********************************//Player buffs end
if (e.getEntity() instanceof Player && e.getDamager() instanceof Monster) {
e.setDamage(e.getDamage()/1.3);
}
boolean hitByPoweredMob=false; boolean hitByPoweredMob=false;
if ((e.getDamager() instanceof WitherSkull) || (e.getDamager() instanceof Wither)) { if ((e.getDamager() instanceof WitherSkull) || (e.getDamager() instanceof Wither)) {
if (e.getEntity() instanceof Player) { if (e.getEntity() instanceof Player) {
@ -10041,34 +10404,47 @@ implements Listener
LivingEntity l2 = (LivingEntity)(((Projectile)e.getDamager()).getShooter()); LivingEntity l2 = (LivingEntity)(((Projectile)e.getDamager()).getShooter());
if (l2.hasPotionEffect(PotionEffectType.INVISIBILITY)) {l2.removePotionEffect(PotionEffectType.INVISIBILITY);} if (l2.hasPotionEffect(PotionEffectType.INVISIBILITY)) {l2.removePotionEffect(PotionEffectType.INVISIBILITY);}
for (int i=0;i<this.plugin.powered_mob_list.size();i++) { for (int i=0;i<this.plugin.powered_mob_list.size();i++) {
if (this.plugin.powered_mob_list.get(i).power_time+40<=Main.SERVER_TICK_TIME && this.plugin.powered_mob_list.get(i).power_time+140<=Main.SERVER_TICK_TIME && this.plugin.powered_mob_list.get(i).id.equals(l2.getUniqueId())) { if (this.plugin.powered_mob_list.get(i).power_time+40<=Main.SERVER_TICK_TIME && this.plugin.powered_mob_list.get(i).power_time+140>Main.SERVER_TICK_TIME && this.plugin.powered_mob_list.get(i).id.equals(l2.getUniqueId())) {
//This mob will damage you if you are not blocking. //This mob will damage you if you are not blocking.
if (l instanceof Player) { if (l instanceof Player) {
Player p = (Player)l; Player p = (Player)l;
if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { if (p.getNoDamageTicks()<=p.getMaximumNoDamageTicks()/2) {
if (l2.getCustomName()!=null) { /*if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) {
DecimalFormat df = new DecimalFormat("#0.0"); if (l2.getCustomName()!=null) {
DecimalFormat df2 = new DecimalFormat("#0"); DecimalFormat df = new DecimalFormat("#0.0");
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(e.getDamage()*2)+" damage from "+l2.getCustomName()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((e.getDamage()*2)/p.getMaxHealth())*100)+"%)"); DecimalFormat df2 = new DecimalFormat("#0");
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(e.getDamage()*2)+" damage from "+l2.getCustomName()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((e.getDamage()*2)/p.getMaxHealth())*100)+"%)");
} else {
DecimalFormat df = new DecimalFormat("#0.0");
DecimalFormat df2 = new DecimalFormat("#0");
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(e.getDamage()*2)+" damage from "+ChatColor.WHITE+""+l2.getType().name()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((e.getDamage()*2)/p.getMaxHealth())*100)+"%)");
}
}*/
if (!p.isBlocking()) {
//hitByPoweredMob=true;
/*if (p.getHealth()-e.getDamage()*2<0) {
p.setHealth(0);
} else {
p.setHealth(p.getHealth()-e.getDamage()*2);
}*/
e.setDamage(e.getDamage()*4);
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(3f);
l.setVelocity(knockback);
}
}, 1L);
//Main.playFirework(p.getLocation());
//Main.playFirework(p.getLocation());
//Main.playFirework(p.getLocation());
} else { } else {
DecimalFormat df = new DecimalFormat("#0.0"); p.playSound(p.getLocation(), Sound.ANVIL_LAND, 0.1f, 3.6f);
DecimalFormat df2 = new DecimalFormat("#0"); e.setDamage(e.getDamage()/8);
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(e.getDamage()*2)+" damage from "+ChatColor.WHITE+""+l2.getType().name()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((e.getDamage()*2)/p.getMaxHealth())*100)+"%)");
} }
} //p.setNoDamageTicks(p.getMaximumNoDamageTicks());
if (!p.isBlocking()) {
hitByPoweredMob=true;
if (p.getHealth()-e.getDamage()*4<0) {
p.setHealth(0);
} else {
p.setHealth(p.getHealth()-e.getDamage()*4);
}
Main.playFirework(p.getLocation());
Main.playFirework(p.getLocation());
Main.playFirework(p.getLocation());
} else {
p.playSound(p.getLocation(), Sound.ANVIL_LAND, 0.1f, 3.6f);
e.setDamage(e.getDamage()/8);
} }
} }
this.plugin.powered_mob_list.remove(i); this.plugin.powered_mob_list.remove(i);
@ -10082,34 +10458,47 @@ implements Listener
LivingEntity l2 = (LivingEntity)e.getDamager(); LivingEntity l2 = (LivingEntity)e.getDamager();
if (l2.hasPotionEffect(PotionEffectType.INVISIBILITY)) {l2.removePotionEffect(PotionEffectType.INVISIBILITY);} if (l2.hasPotionEffect(PotionEffectType.INVISIBILITY)) {l2.removePotionEffect(PotionEffectType.INVISIBILITY);}
for (int i=0;i<this.plugin.powered_mob_list.size();i++) { for (int i=0;i<this.plugin.powered_mob_list.size();i++) {
if (this.plugin.powered_mob_list.get(i).power_time+40<=Main.SERVER_TICK_TIME && this.plugin.powered_mob_list.get(i).power_time+140<=Main.SERVER_TICK_TIME && this.plugin.powered_mob_list.get(i).id.equals(l2.getUniqueId())) { if (this.plugin.powered_mob_list.get(i).power_time+40<=Main.SERVER_TICK_TIME && this.plugin.powered_mob_list.get(i).power_time+140>Main.SERVER_TICK_TIME && this.plugin.powered_mob_list.get(i).id.equals(l2.getUniqueId())) {
//This mob will damage you if you are not blocking. //This mob will damage you if you are not blocking.
if (l instanceof Player) { if (l instanceof Player) {
Player p = (Player)l; Player p = (Player)l;
if (!p.isBlocking()) { if (p.getNoDamageTicks()<=p.getMaximumNoDamageTicks()/2) {
hitByPoweredMob=true; if (!p.isBlocking()) {
if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { /*hitByPoweredMob=true;
if (l2.getCustomName()!=null) { if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) {
DecimalFormat df = new DecimalFormat("#0.0"); if (l2.getCustomName()!=null) {
DecimalFormat df2 = new DecimalFormat("#0"); DecimalFormat df = new DecimalFormat("#0.0");
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(e.getDamage()*2)+" damage from "+l2.getCustomName()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((e.getDamage()*2)/p.getMaxHealth())*100)+"%)"); DecimalFormat df2 = new DecimalFormat("#0");
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(e.getDamage()*2)+" damage from "+l2.getCustomName()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((e.getDamage()*2)/p.getMaxHealth())*100)+"%)");
} else {
DecimalFormat df = new DecimalFormat("#0.0");
DecimalFormat df2 = new DecimalFormat("#0");
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(e.getDamage()*2)+" damage from "+ChatColor.WHITE+""+l2.getType().name()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((e.getDamage()*2)/p.getMaxHealth())*100)+"%)");
}
}*/
/*if (p.getHealth()-e.getDamage()*2<0) {
p.setHealth(0);
} else { } else {
DecimalFormat df = new DecimalFormat("#0.0"); p.setHealth(p.getHealth()-e.getDamage()*2);
DecimalFormat df2 = new DecimalFormat("#0"); }*/
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(e.getDamage()*2)+" damage from "+ChatColor.WHITE+""+l2.getType().name()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((e.getDamage()*2)/p.getMaxHealth())*100)+"%)"); e.setDamage(e.getDamage()*3);
} //Main.playFirework(p.getLocation());
} //Main.playFirework(p.getLocation());
if (p.getHealth()-e.getDamage()*2<0) { //Main.playFirework(p.getLocation());
p.setHealth(0); 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(3f);
l.setVelocity(knockback);
}
}, 1L);
} else { } else {
p.setHealth(p.getHealth()-e.getDamage()*2); p.playSound(p.getLocation(), Sound.ANVIL_LAND, 0.1f, 3.6f);
e.setDamage(e.getDamage()/8);
} }
Main.playFirework(p.getLocation()); //p.setNoDamageTicks(p.getMaximumNoDamageTicks());
Main.playFirework(p.getLocation());
Main.playFirework(p.getLocation());
} else {
p.playSound(p.getLocation(), Sound.ANVIL_LAND, 0.1f, 3.6f);
e.setDamage(e.getDamage()/8);
} }
} }
this.plugin.powered_mob_list.remove(i); this.plugin.powered_mob_list.remove(i);
@ -14130,6 +14519,31 @@ implements Listener
//****************************//End job buffs. //****************************//End job buffs.
if (event.getCursor()!=null || event.getCurrentItem()!=null) { if (event.getCursor()!=null || event.getCurrentItem()!=null) {
if (event.getCursor().getType()==Material.DIAMOND ||
event.getCursor().getType()==Material.EMERALD ||
event.getCursor().getType()==Material.SKULL_ITEM) {
ItemStack check = new ItemStack(Material.AIR);
if (event.getCursor()!=null) {
check = event.getCursor();
} else {
check = event.getCurrentItem();
}
boolean is_socket=false;
if (check.hasItemMeta() && check.getItemMeta().hasLore()) {
List<String> newLore = new ArrayList<String>();
for (String s : check.getItemMeta().getLore()) {
//Bukkit.getLogger().info("OLD: "+s);
s=s.replace("Put in the","Put in a");
s=s.replace("bottom of a furnace", "crafting table with");
s=s.replace("with another item in the top","another item with (Socket)");
//Bukkit.getLogger().info("NEW: "+s);
newLore.add(s);
}
ItemMeta meta = check.getItemMeta();
meta.setLore(newLore);
check.setItemMeta(meta);
}
}
if (event.getCursor().getType()==Material.SULPHUR) { if (event.getCursor().getType()==Material.SULPHUR) {
//This is a broken Halloween item...Maybe. Let's find out. //This is a broken Halloween item...Maybe. Let's find out.
boolean is_halloween=false; boolean is_halloween=false;

Loading…
Cancel
Save