Added new enchantments functionality.

dev
sigonasr2 11 years ago
parent 6942dbfadd
commit 4a9ee5da19
  1. 119
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 294
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java

@ -22,6 +22,7 @@ import java.util.logging.Logger;
import java.text.*; import java.text.*;
import me.kaZep.Base.BonusEnchantment.ItemType; import me.kaZep.Base.BonusEnchantment.ItemType;
import me.kaZep.Base.PlayerListener.Cube;
import me.kaZep.Commands.JobsDataInfo; import me.kaZep.Commands.JobsDataInfo;
import me.kaZep.Commands.JobsDataInfo.Job; import me.kaZep.Commands.JobsDataInfo.Job;
import me.kaZep.Commands.commandBankEconomy; import me.kaZep.Commands.commandBankEconomy;
@ -823,7 +824,7 @@ public class Main extends JavaPlugin
ENCHANT_DAMAGE = new BonusEnchantment("Damage",false,false,ItemType.WEAPONS,new IntRange(0,40)); ENCHANT_DAMAGE = new BonusEnchantment("Damage",false,false,ItemType.WEAPONS,new IntRange(0,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(0,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(0,100));
ENCHANT_DURABILITY = new BonusEnchantment("Durability",false,false,ItemType.ARMOR,new IntRange(0,2000)); ENCHANT_DURABILITY = new BonusEnchantment("Durability",true,false,ItemType.ARMOR,new IntRange(0,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(0,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(0,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(0,10));
@ -1672,6 +1673,22 @@ public void runTick() {
i=Bukkit.getWorld("world").dropItemNaturally(p.getLocation().add((int)(Math.random()*20)-(int)(Math.random()*20), 256, (int)(Math.random()*20)-(int)(Math.random()*20)),new ItemStack(Material.EGG)); i=Bukkit.getWorld("world").dropItemNaturally(p.getLocation().add((int)(Math.random()*20)-(int)(Math.random()*20), 256, (int)(Math.random()*20)-(int)(Math.random()*20)),new ItemStack(Material.EGG));
i.setTicksLived(3600); i.setTicksLived(3600);
} }
if (Main.SERVER_TICK_TIME%1200==0) {
//Check items in player's inventory for Repair. If it exists, lower durability by 1.
for (int i=0;i<p.getInventory().getSize();i++) {
if (p.getInventory().getItem(i)!=null) {
if (hasBonusEnchantment(p.getInventory().getItem(i),ENCHANT_REPAIR)) {
if (p.getInventory().getItem(i).getDurability()!=0 && (short)(p.getInventory().getItem(i).getDurability()-getBonusEnchantmentLevel(p.getInventory().getItem(i),ENCHANT_REPAIR))>=0) {
p.getInventory().getItem(i).setDurability((short)(p.getInventory().getItem(i).getDurability()-getBonusEnchantmentLevel(p.getInventory().getItem(i),ENCHANT_REPAIR)));
//Bukkit.getLogger().info("Healed "+p.getInventory().getItem(i).toString()+" to "+p.getInventory().getItem(i).getDurability());
} else {
p.getInventory().getItem(i).setDurability((short)0);
//Bukkit.getLogger().info("Healed "+p.getInventory().getItem(i).toString()+" to "+p.getInventory().getItem(i).getDurability());
}
}
}
}
}
if (Main.SERVER_TICK_TIME%90==0) { if (Main.SERVER_TICK_TIME%90==0) {
for (int i=-15;i<=15;i++) { for (int i=-15;i<=15;i++) {
for (int j=-15;j<=15;j++) { for (int j=-15;j<=15;j++) {
@ -2000,17 +2017,23 @@ public void runTick() {
} }
} }
} }
////Bukkit.getLogger().info("Removed "+removeore+"/"+totalore+" ore for chunk "+e.getChunk().getX()+","+e.getChunk().getZ()+". There are now "+newore+" ores left.");
debugmessages.add(" Removed: "+removeore+"/"+totalore+" ores.");
}
if (!customchunk.contains("limit-ore-generation2")) {
customchunk.set("limit-ore-generation2", Boolean.valueOf(true));
Chunk c = chunk_queue_list.get(0);
int removeore=0,totalore=0,newore=0;
for (int x=0;x<16;x++) { for (int x=0;x<16;x++) {
for (int y=5;y<96;y++) { for (int y=5;y<96;y++) {
for (int z=0;z<16;z++) { for (int z=0;z<16;z++) {
Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16); Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16);
if (b!=null && (b.getType()==Material.COAL_ORE || if (b!=null && (b.getType()==Material.DIAMOND_ORE)) {
b.getType()==Material.IRON_ORE || if (Math.random()<=0.60) {
b.getType()==Material.GOLD_ORE || removeore++;
b.getType()==Material.REDSTONE_ORE || b.setType(Material.STONE);
b.getType()==Material.LAPIS_ORE || }
b.getType()==Material.DIAMOND_ORE)) { totalore++;
newore++;
} }
} }
} }
@ -5061,7 +5084,7 @@ public void payDay(int time)
} }
public boolean containsEnchantment(String s, String enchant) { public boolean containsEnchantment(String s, String enchant) {
if (s.contains(enchant) && (!enchant.equals("Durability") || (enchant.equals("Durability") && !s.contains(ChatColor.RED+"-400% Durability")))) { if (s.contains(enchant) && (!enchant.equals("Durability") || (enchant.equals("Durability") && !s.contains(ChatColor.RED+"-400% Durability"))) && !is_PermanentProperty(s)) {
return true; return true;
} }
return false; return false;
@ -5101,7 +5124,10 @@ public void payDay(int time)
if (chest.hasItemMeta() && chest.getItemMeta().hasLore()) { if (chest.hasItemMeta() && chest.getItemMeta().hasLore()) {
//Check to see if the Lore contains anything. //Check to see if the Lore contains anything.
for (int i=0;i<chest.getItemMeta().getLore().size();i++) { for (int i=0;i<chest.getItemMeta().getLore().size();i++) {
if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!")) { if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"A mysterious chest!") ||
chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"A reward for defeating a mighty") ||
chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"It has a stronger energy to it") ||
chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"A reward for helping to take on")) {
return true; return true;
} }
} }
@ -5128,6 +5154,15 @@ public void payDay(int time)
if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"A torrential flow of dark")) { if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"A torrential flow of dark")) {
return 5; // Chaos loot return 5; // Chaos loot
} }
if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"A reward for defeating a mighty")) {
return 6; // Boss loot
}
if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"It has a stronger energy to it")) {
return 7; // Mythic Boss loot
}
if (chest.getItemMeta().getLore().get(i).equalsIgnoreCase(ChatColor.GRAY+""+ChatColor.ITALIC+"A reward for helping to take on")) {
return 8; // Boss Assist loot
}
} }
@ -5203,6 +5238,39 @@ public void payDay(int time)
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"items rattling around inside."); chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"items rattling around inside.");
chest_name.setLore(chestlore); chest_name.setLore(chestlore);
chest.setItemMeta(chest_name);
} else if (tier == 6) {
chest_name.setDisplayName(ChatColor.AQUA+"Boss Chest");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A chest obtained from a boss.");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A reward for defeating a mighty");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"boss. There are many goodies");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"inside.");
chest_name.setLore(chestlore);
chest.setItemMeta(chest_name);
} else if (tier == 7) {
chest_name.setDisplayName(ChatColor.AQUA+"Boss Chest");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A chest obtained from a boss.");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"It has a stronger energy to it");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"than most chests of its kind.");
chest_name.setLore(chestlore);
chest.setItemMeta(chest_name);
} else if (tier == 8) {
chest_name.setDisplayName(ChatColor.BLUE+"Boss Assist Chest");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A chest obtained from a boss.");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"A reward for helping to take on");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"a mighty boss. There are a few");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"goodies inside to commend you for");
chestlore.add(ChatColor.GRAY+""+ChatColor.ITALIC+"your hard work and bravery.");
chest_name.setLore(chestlore);
chest.setItemMeta(chest_name); chest.setItemMeta(chest_name);
} else { } else {
chest_name.setDisplayName(ChatColor.YELLOW+"Closed Chest"); chest_name.setDisplayName(ChatColor.YELLOW+"Closed Chest");
@ -5220,7 +5288,7 @@ public void payDay(int time)
return chest; return chest;
} }
public PlayerListener.Cube get_ItemCubeType(ItemStack item_cube) { public Cube get_ItemCubeType(ItemStack item_cube) {
if (item_cube.hasItemMeta() && item_cube.getItemMeta().hasLore()) { if (item_cube.hasItemMeta() && item_cube.getItemMeta().hasLore()) {
//Check to see if the Lore contains anything. //Check to see if the Lore contains anything.
for (int i=0;i<item_cube.getItemMeta().getLore().size();i++) { for (int i=0;i<item_cube.getItemMeta().getLore().size();i++) {
@ -5397,34 +5465,52 @@ public void payDay(int time)
//We have to find a matching hundreds value and replace it. //We have to find a matching hundreds value and replace it.
for (int j=0;j<hundreds.length;j++) { for (int j=0;j<hundreds.length;j++) {
if (roman_numeral.contains(hundreds[hundreds.length-j-1])) { if (roman_numeral.contains(hundreds[hundreds.length-j-1])) {
boolean allow=true;
if (j==4 && roman_numeral.contains("CD")) {
allow=false;
}
if (allow) {
roman_numeral = roman_numeral.replaceFirst(hundreds[hundreds.length-j-1], ""); roman_numeral = roman_numeral.replaceFirst(hundreds[hundreds.length-j-1], "");
//Bukkit.getLogger().info("Found "+hundreds[hundreds.length-j-1]+", converting to "+(100*(hundreds.length-j))+". New String is "+roman_numeral); //Bukkit.getLogger().info("Found "+hundreds[hundreds.length-j-1]+", converting to "+(100*(hundreds.length-j))+". New String is "+roman_numeral);
finalval+=100*(hundreds.length-j); finalval+=100*(hundreds.length-j);
break; //There is only one hundreds place. break; //There is only one hundreds place.
} }
} }
}
}break; }break;
case 1:{ case 1:{
//We have to find a matching tens value and replace it. //We have to find a matching tens value and replace it.
for (int j=0;j<tens.length;j++) { for (int j=0;j<tens.length;j++) {
if (roman_numeral.contains(tens[tens.length-j-1])) { if (roman_numeral.contains(tens[tens.length-j-1])) {
boolean allow=true;
if (j==4 && roman_numeral.contains("XL")) {
allow=false;
}
if (allow) {
roman_numeral = roman_numeral.replaceFirst(tens[tens.length-j-1], ""); roman_numeral = roman_numeral.replaceFirst(tens[tens.length-j-1], "");
//Bukkit.getLogger().info("Found "+tens[tens.length-j-1]+", converting to "+(10*(tens.length-j))+". New String is "+roman_numeral); //Bukkit.getLogger().info("Found "+tens[tens.length-j-1]+", converting to "+(10*(tens.length-j))+". New String is "+roman_numeral);
finalval+=10*(tens.length-j); finalval+=10*(tens.length-j);
break; //There is only one tens place. break; //There is only one tens place.
} }
} }
}
}break; }break;
case 2:{ case 2:{
//We have to find a matching ones value and replace it. //We have to find a matching ones value and replace it.
for (int j=0;j<ones.length;j++) { for (int j=0;j<ones.length;j++) {
if (roman_numeral.contains(ones[ones.length-j-1])) { if (roman_numeral.contains(ones[ones.length-j-1])) {
boolean allow=true;
if (j==4 && roman_numeral.contains("IV")) {
allow=false;
}
if (allow) {
roman_numeral = roman_numeral.replaceFirst(ones[ones.length-j-1], ""); roman_numeral = roman_numeral.replaceFirst(ones[ones.length-j-1], "");
//Bukkit.getLogger().info("Found "+ones[ones.length-j-1]+", converting to "+((ones.length-j))+". New String is "+roman_numeral); //Bukkit.getLogger().info("Found "+ones[ones.length-j-1]+", converting to "+((ones.length-j))+". New String is "+roman_numeral);
finalval+=ones.length-j; finalval+=ones.length-j;
break; //There is only one ones place. break; //There is only one ones place.
} }
} }
}
}break; }break;
} }
} }
@ -5459,7 +5545,8 @@ public void payDay(int time)
return (int)getEnchantmentNumb(lore.get(i)); return (int)getEnchantmentNumb(lore.get(i));
} else { } else {
String parser = lore.get(i); String parser = lore.get(i);
parser.replace(enchant_string, ""); parser = parser.replace(enchant_string, "");
//Bukkit.getLogger().info("parser is sending down "+parser+".");
return toNumber(parser); return toNumber(parser);
} }
} }
@ -5478,7 +5565,7 @@ public void payDay(int time)
if (item.hasItemMeta() && item.getItemMeta().hasLore()) { if (item.hasItemMeta() && item.getItemMeta().hasLore()) {
List<String> newlore = item.getItemMeta().getLore(); List<String> newlore = item.getItemMeta().getLore();
for (int i=0;i<item.getItemMeta().getLore().size();i++) { for (int i=0;i<item.getItemMeta().getLore().size();i++) {
if (item.getItemMeta().getLore().get(i).contains(enchant.name)) { if (item.getItemMeta().getLore().get(i).contains(enchant.name) && !is_PermanentProperty(item.getItemMeta().getLore().get(i))) {
return true; return true;
} }
} }
@ -5501,7 +5588,7 @@ public void payDay(int time)
if (item.hasItemMeta() && item.getItemMeta().hasLore()) { if (item.hasItemMeta() && item.getItemMeta().hasLore()) {
List<String> newlore = item.getItemMeta().getLore(); List<String> newlore = item.getItemMeta().getLore();
for (int i=0;i<item.getItemMeta().getLore().size();i++) { for (int i=0;i<item.getItemMeta().getLore().size();i++) {
if (item.getItemMeta().getLore().get(i).contains(enchant.name)) { if (item.getItemMeta().getLore().get(i).contains(enchant.name) && !is_PermanentProperty(item.getItemMeta().getLore().get(i))) {
//Include it in the new meta. //Include it in the new meta.
newlore.remove(i); newlore.remove(i);
break; break;
@ -5544,6 +5631,8 @@ public void payDay(int time)
* @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 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());
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;
String enchant_string = enchant.name; String enchant_string = enchant.name;
boolean percent=enchant.percent, enchant_format=enchant.enchant_format; boolean percent=enchant.percent, enchant_format=enchant.enchant_format;
@ -5554,7 +5643,7 @@ public void payDay(int time)
//replace it. //replace it.
boolean added=false; boolean added=false;
for (int i=0;i<lore.size();i++) { for (int i=0;i<lore.size();i++) {
if (lore.get(i).contains(enchant_string)) { if (lore.get(i).contains(enchant_string) && !is_PermanentProperty(lore.get(i))) {
if (!enchant_format) { if (!enchant_format) {
//Take that old amount and add onto it. //Take that old amount and add onto it.
double oldamt=0; double oldamt=0;

@ -3001,7 +3001,7 @@ implements Listener
//l.getEquipment().setHelmetDropChance(0.002f); //l.getEquipment().setHelmetDropChance(0.002f);
//l.getEquipment().setItemInHand(new ItemStack(Material.BOW)); //l.getEquipment().setItemInHand(new ItemStack(Material.BOW));
//w.setAngry(true); //w.setAngry(true);
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 4)); l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 5));
l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, 1)); l.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, 1));
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 1)); l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 1));
} }
@ -3059,7 +3059,8 @@ implements Listener
//Bukkit.getLogger().info("Suicidal Creeper spawned at "+l.getLocation().toString()); //Bukkit.getLogger().info("Suicidal Creeper spawned at "+l.getLocation().toString());
l.setMaxHealth(105); l.setMaxHealth(105);
l.setHealth(105); l.setHealth(105);
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 4)); l.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 999999, 4));
l.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 999999, 5));
l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 1)); l.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 999999, 1));
} }
} }
@ -3071,7 +3072,7 @@ implements Listener
//Can't have baby zombies at this level. //Can't have baby zombies at this level.
if (e.getEntity().getType()==EntityType.ZOMBIE) { if (e.getEntity().getType()==EntityType.ZOMBIE) {
Zombie z = (Zombie)e.getEntity(); Zombie z = (Zombie)e.getEntity();
if (z.isBaby()) { if (z.isBaby() && e.getEntity().getCustomName()==null) {
z.setBaby(false); z.setBaby(false);
} }
} }
@ -3096,7 +3097,7 @@ implements Listener
//Can't have baby zombies at this level. //Can't have baby zombies at this level.
if (e.getEntity().getType()==EntityType.ZOMBIE) { if (e.getEntity().getType()==EntityType.ZOMBIE) {
Zombie z = (Zombie)e.getEntity(); Zombie z = (Zombie)e.getEntity();
if (z.isBaby()) { if (z.isBaby() && e.getEntity().getCustomName()==null) {
z.setBaby(false); z.setBaby(false);
} }
} }
@ -7564,6 +7565,9 @@ implements Listener
// 3 = plentiful items // 3 = plentiful items
// 4 = multiple items // 4 = multiple items
// 5 = chaos items (diablodrops items) // 5 = chaos items (diablodrops items)
// 6 = boss items
// 7 = mythic boss items
// 8 = boss assist items
// 999 = Survivor's kit // 999 = Survivor's kit
switch (tier) { switch (tier) {
case 1: { case 1: {
@ -7629,7 +7633,50 @@ implements Listener
} }
}break; }break;
case 6: { case 6: {
// OMG NOT CODED YET WTF THIS SHOULDN'T HAPPEN for (int i=0;i<27;i++) {
if (Math.random()<=0.3) {
ItemStack dropitem = null;
if ((dropitem=getGoodie())!=null) {
loc.getWorld().dropItemNaturally(loc, dropitem);
}
}
}
}break;
case 7: {
boolean dropMythical=false;
boolean dropMythical2=false;
for (int i=0;i<27;i++) {
if (Math.random()<=0.1 && !dropMythical) {
dropMythical=true;
ItemStack dropitem = null;
if ((dropitem=getGoodie(1))!=null) {
loc.getWorld().dropItemNaturally(loc, dropitem);
}
} else
if (Math.random()<=0.03 && !dropMythical2) {
dropMythical2=true;
ItemStack dropitem = null;
if ((dropitem=getGoodie(1))!=null) {
loc.getWorld().dropItemNaturally(loc, dropitem);
}
}
if (Math.random()<=0.2) {
ItemStack dropitem = null;
if ((dropitem=getGoodie())!=null) {
loc.getWorld().dropItemNaturally(loc, dropitem);
}
}
}
}break;
case 8: {
for (int i=0;i<8;i++) {
if (Math.random()<=0.75) {
ItemStack dropitem = null;
if ((dropitem=getGoodie())!=null) {
loc.getWorld().dropItemNaturally(loc, dropitem);
}
}
}
}break; }break;
case 999: { case 999: {
// Not yet obtainable // Not yet obtainable
@ -7859,13 +7906,13 @@ implements Listener
//Select a random enchantment. //Select a random enchantment.
//This is a mythical. Random amount is 70% guaranteed + 30% random. //This is a mythical. Random amount is 70% guaranteed + 30% random.
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.7), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.7), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} else } else
if (rarity==2) { if (rarity==2) {
//This is a legendary. Random amount is 30% guaranteed + 60% random. //This is a legendary. Random amount is 30% guaranteed + 60% random.
int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size()); int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size());
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.6))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.6))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} else } else
if (rarity==1) { if (rarity==1) {
//This is a rare. Random amount is 20% guaranteed + 40% random. //This is a rare. Random amount is 20% guaranteed + 40% random.
@ -7876,14 +7923,14 @@ implements Listener
choice2=(int)(Math.random()*Main.getBonusWeaponEnchantments().size()); choice2=(int)(Math.random()*Main.getBonusWeaponEnchantments().size());
} }
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice2), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.4))+Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.2), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice2), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.4))+Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.2), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} }
else { else {
//This is a normal item. Random amount is 5% guaranteed + 20% random. //This is a normal item. Random amount is 5% guaranteed + 20% random.
//It is also irrepairable. //It is also irrepairable.
int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size()); int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size());
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.2))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.05), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.2))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.05), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
ourLore.add(ChatColor.RED+"Irrepairable"); ourLore.add(ChatColor.RED+"Irrepairable");
} }
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
@ -7922,13 +7969,13 @@ implements Listener
//Select a random enchantment. //Select a random enchantment.
//This is a mythical. Random amount is 70% guaranteed + 30% random. //This is a mythical. Random amount is 70% guaranteed + 30% random.
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.7), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.7), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} else } else
if (rarity==2) { if (rarity==2) {
//This is a legendary. Random amount is 30% guaranteed + 60% random. //This is a legendary. Random amount is 30% guaranteed + 60% random.
int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size()); int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size());
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.6))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.6))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} else } else
if (rarity==1) { if (rarity==1) {
//This is a rare. Random amount is 20% guaranteed + 40% random. //This is a rare. Random amount is 20% guaranteed + 40% random.
@ -7939,14 +7986,14 @@ implements Listener
choice2=(int)(Math.random()*Main.getBonusWeaponEnchantments().size()); choice2=(int)(Math.random()*Main.getBonusWeaponEnchantments().size());
} }
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice2), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.4))+Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.2), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice2), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.4))+Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.2), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} }
else { else {
//This is a normal item. Random amount is 5% guaranteed + 20% random. //This is a normal item. Random amount is 5% guaranteed + 20% random.
//It is also irrepairable. //It is also irrepairable.
int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size()); int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size());
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.2))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.05), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.2))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.05), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
ourLore.add(ChatColor.RED+"Irrepairable"); ourLore.add(ChatColor.RED+"Irrepairable");
} }
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
@ -8005,13 +8052,13 @@ implements Listener
//Select a random enchantment. //Select a random enchantment.
//This is a mythical. Random amount is 70% guaranteed + 30% random. //This is a mythical. Random amount is 70% guaranteed + 30% random.
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.7), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.7), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} else } else
if (rarity==2) { if (rarity==2) {
//This is a legendary. Random amount is 30% guaranteed + 60% random. //This is a legendary. Random amount is 30% guaranteed + 60% random.
int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size()); int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size());
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.6))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.6))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.3), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} else } else
if (rarity==1) { if (rarity==1) {
//This is a rare. Random amount is 20% guaranteed + 40% random. //This is a rare. Random amount is 20% guaranteed + 40% random.
@ -8022,14 +8069,14 @@ implements Listener
choice2=(int)(Math.random()*Main.getBonusWeaponEnchantments().size()); choice2=(int)(Math.random()*Main.getBonusWeaponEnchantments().size());
} }
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice2), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.4))+Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.2), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice2), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.4))+Main.getBonusWeaponEnchantments().get(choice2).value_range.getMaximumInteger()*0.2), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} }
else { else {
//This is a normal item. Random amount is 5% guaranteed + 20% random. //This is a normal item. Random amount is 5% guaranteed + 20% random.
//It is also irrepairable. //It is also irrepairable.
int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size()); int choice1=(int)(Math.random()*Main.getBonusWeaponEnchantments().size());
item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.2))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.05), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusWeaponEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.2))+Main.getBonusWeaponEnchantments().get(choice1).value_range.getMaximumInteger()*0.05), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
ourLore.add(ChatColor.RED+"Irrepairable"); ourLore.add(ChatColor.RED+"Irrepairable");
} }
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
@ -8066,13 +8113,13 @@ implements Listener
//Select a random enchantment. //Select a random enchantment.
//This is a mythical. Random amount is 70% guaranteed + 30% random. //This is a mythical. Random amount is 70% guaranteed + 30% random.
item = this.plugin.addBonusEnchantment(item, Main.getBonusArmorEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.3))+Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.7), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusArmorEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.3))+Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.7), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} else } else
if (rarity==2) { if (rarity==2) {
//This is a legendary. Random amount is 30% guaranteed + 60% random. //This is a legendary. Random amount is 30% guaranteed + 60% random.
int choice1=(int)(Math.random()*Main.getBonusArmorEnchantments().size()); int choice1=(int)(Math.random()*Main.getBonusArmorEnchantments().size());
item = this.plugin.addBonusEnchantment(item, Main.getBonusArmorEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.6))+Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.3), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusArmorEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.6))+Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.3), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} else } else
if (rarity==1) { if (rarity==1) {
//This is a rare. Random amount is 20% guaranteed + 40% random. //This is a rare. Random amount is 20% guaranteed + 40% random.
@ -8083,14 +8130,14 @@ implements Listener
choice2=(int)(Math.random()*Main.getBonusArmorEnchantments().size()); choice2=(int)(Math.random()*Main.getBonusArmorEnchantments().size());
} }
item = this.plugin.addBonusEnchantment(item, Main.getBonusArmorEnchantments().get(choice2), (int)((Math.random()*(Main.getBonusArmorEnchantments().get(choice2).value_range.getMaximumInteger()*0.4))+Main.getBonusArmorEnchantments().get(choice2).value_range.getMaximumInteger()*0.2), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusArmorEnchantments().get(choice2), (int)((Math.random()*(Main.getBonusArmorEnchantments().get(choice2).value_range.getMaximumInteger()*0.4))+Main.getBonusArmorEnchantments().get(choice2).value_range.getMaximumInteger()*0.2), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
} }
else { else {
//This is a normal item. Random amount is 5% guaranteed + 20% random. //This is a normal item. Random amount is 5% guaranteed + 20% random.
//It is also irrepairable. //It is also irrepairable.
int choice1=(int)(Math.random()*Main.getBonusArmorEnchantments().size()); int choice1=(int)(Math.random()*Main.getBonusArmorEnchantments().size());
item = this.plugin.addBonusEnchantment(item, Main.getBonusArmorEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.2))+Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.05), true); item = this.plugin.addBonusEnchantment(item, Main.getBonusArmorEnchantments().get(choice1), (int)((Math.random()*(Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.2))+Main.getBonusArmorEnchantments().get(choice1).value_range.getMaximumInteger()*0.05), true);
ourLore = item.getItemMeta().getLore(); if (item.getItemMeta().hasLore()) {ourLore = item.getItemMeta().getLore();}
ourLore.add(ChatColor.RED+"Irrepairable"); ourLore.add(ChatColor.RED+"Irrepairable");
} }
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
@ -8177,9 +8224,20 @@ implements Listener
LivingEntity f = e.getEntity(); LivingEntity f = e.getEntity();
if (f instanceof Monster) { if (f instanceof Monster) {
if (this.plugin.getConfig().getBoolean("thanksgiving-enabled") && Math.random()<=0.01) { if (this.plugin.getConfig().getBoolean("thanksgiving-enabled") && Math.random()<=0.01) {
// 0.5% chance of loot chest dropping //1% chance of loot chest dropping
f.getWorld().dropItemNaturally(f.getLocation(), this.plugin.generate_LootChest()); f.getWorld().dropItemNaturally(f.getLocation(), this.plugin.generate_LootChest());
} }
if (f.getCustomName()!=null && f.getCustomName().contains(ChatColor.RED+"Counter Slime")) {
if (f.getLastDamageCause().getEntity() instanceof Player) {
Player p = (Player)f.getLastDamageCause().getEntity();
p.damage(f.getLastDamage()*2);
DecimalFormat df = new DecimalFormat("#0.0");
DecimalFormat df2 = new DecimalFormat("#0");
if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) {
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(f.getLastDamage()*2)+" damage from "+ChatColor.RED+"COUNTER SLIME"+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((f.getLastDamage()*2)/p.getMaxHealth())*100)+"%)");
}
}
}
if (f.getCustomName()!=null && f.getCustomName().contains(ChatColor.RED+"Viral Spider")) { if (f.getCustomName()!=null && f.getCustomName().contains(ChatColor.RED+"Viral Spider")) {
List<Entity> nearents = f.getNearbyEntities(20, 20, 20); List<Entity> nearents = f.getNearbyEntities(20, 20, 20);
for (int i=0;i<nearents.size();i++) { for (int i=0;i<nearents.size();i++) {
@ -8195,8 +8253,8 @@ implements Listener
} }
} }
if (poisonlevel>0) { if (poisonlevel>0) {
if (p.getHealth()-(poisonlevel/1.5d)>0) { if (p.getHealth()-(poisonlevel/1.15d)>0) {
p.setHealth(p.getHealth()-(poisonlevel/1.5d)); p.setHealth(p.getHealth()-(poisonlevel/1.15d));
} else { } else {
p.setHealth(0); p.setHealth(0);
} }
@ -8215,8 +8273,8 @@ implements Listener
if (f instanceof Zombie) { if (f instanceof Zombie) {
Zombie z = (Zombie)f; Zombie z = (Zombie)f;
if (z.isBaby()) { if (z.isBaby()) {
//Randomly drop a loot chest sometimes. (4.5% of the time.) //Randomly drop a loot chest sometimes. (10.5% of the time.)
if (Math.random() <= 0.045) { if (Math.random() <= 0.105) {
z.getWorld().dropItemNaturally(z.getLocation(), this.plugin.generate_LootChest()); z.getWorld().dropItemNaturally(z.getLocation(), this.plugin.generate_LootChest());
} }
} }
@ -8311,15 +8369,30 @@ implements Listener
} }
if (f.getCustomName().contains("Mega Wither")) { if (f.getCustomName().contains("Mega Wither")) {
e.setDroppedExp(e.getDroppedExp()*500); e.setDroppedExp(e.getDroppedExp()*500);
for (int j=0;j<4;j++) { if (f.getKiller()!=null) {
Location dd = f.getLocation().add(Math.random()*4,Math.random()*4,Math.random()*4); Item id = f.getKiller().getWorld().dropItemNaturally(f.getKiller().getLocation(), this.plugin.generate_LootChest(6));id.setPickupDelay(0);
Bukkit.getWorld("world").getBlockAt(dd).setType(Material.CHEST); id = f.getKiller().getWorld().dropItemNaturally(f.getKiller().getLocation(), this.plugin.generate_LootChest(6));id.setPickupDelay(0);
Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(dd).getState(); id = f.getKiller().getWorld().dropItemNaturally(f.getKiller().getLocation(), this.plugin.generate_LootChest(6));id.setPickupDelay(0);
for (int i=0;i<27;i++) { }
ItemStack item = null; for (int i=0;i<this.plugin.hitmoblist.size();i++) {
if (Math.random()<=0.3) { for (int j=0;j<this.plugin.hitmoblist.get(i).id.size();j++) {
item = getGoodie(); if (!this.plugin.hitmoblist.get(i).p.equals(f.getKiller()) && this.plugin.hitmoblist.get(i).id.contains(e.getEntity().getUniqueId())) {
c.getBlockInventory().setItem(i, item); //Award the assisting player.
Item id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
break;
}
}
}
for (int i=0;i<this.plugin.supportmoblist.size();i++) {
for (int j=0;j<this.plugin.supportmoblist.get(i).id.size();j++) {
if (!this.plugin.supportmoblist.get(i).p.equals(f.getKiller()) && this.plugin.supportmoblist.get(i).id.contains(e.getEntity().getUniqueId())) {
//Award the supporting assisting player.
Item id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
break;
} }
} }
} }
@ -8329,41 +8402,59 @@ implements Listener
e.setDroppedExp(e.getDroppedExp()*4000); e.setDroppedExp(e.getDroppedExp()*4000);
boolean dropMythical=false; boolean dropMythical=false;
boolean dropMythical2=false; boolean dropMythical2=false;
for (int j=0;j<10;j++) { if (f.getKiller()!=null) {
Location dd = f.getLocation().add(Math.random()*4,Math.random()*4,Math.random()*4); Item id = f.getKiller().getWorld().dropItemNaturally(f.getKiller().getLocation(), this.plugin.generate_LootChest(7));id.setPickupDelay(0);
Bukkit.getWorld("world").getBlockAt(dd).setType(Material.CHEST); id = f.getKiller().getWorld().dropItemNaturally(f.getKiller().getLocation(), this.plugin.generate_LootChest(6));id.setPickupDelay(0);
Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(dd).getState(); id = f.getKiller().getWorld().dropItemNaturally(f.getKiller().getLocation(), this.plugin.generate_LootChest(6));id.setPickupDelay(0);
for (int i=0;i<27;i++) {
ItemStack item = null;
if (Math.random()<=0.1 && !dropMythical) {
dropMythical=true;
item = getGoodie(1);
} else
if (Math.random()<=0.03 && !dropMythical2) {
dropMythical2=true;
item = getGoodie(1);
} }
if (Math.random()<=0.2) { for (int i=0;i<this.plugin.hitmoblist.size();i++) {
item = getGoodie(); for (int j=0;j<this.plugin.hitmoblist.get(i).id.size();j++) {
c.getBlockInventory().setItem(i, item); if (!this.plugin.hitmoblist.get(i).p.equals(f.getKiller()) && this.plugin.hitmoblist.get(i).id.contains(e.getEntity().getUniqueId())) {
//Award the assisting player.
Item id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
break;
} }
} }
} }
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "gamerule mobGriefing false"); for (int i=0;i<this.plugin.supportmoblist.size();i++) {
for (int j=0;j<this.plugin.supportmoblist.get(i).id.size();j++) {
if (!this.plugin.supportmoblist.get(i).p.equals(f.getKiller()) && this.plugin.supportmoblist.get(i).id.contains(e.getEntity().getUniqueId())) {
//Award the supporting assisting player.
Item id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
break;
}
}
}
//Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "gamerule mobGriefing false");
} }
if (f.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { if (f.getCustomName().contains(ChatColor.DARK_PURPLE+"")) {
e.setDroppedExp(e.getDroppedExp()*20); e.setDroppedExp(e.getDroppedExp()*20);
f.setHealth(0); f.setHealth(0);
this.plugin.BOSS_DEFEAT=100; this.plugin.BOSS_DEFEAT=100;
this.plugin.BOSS_DEFEAT_LOC=f.getLocation(); this.plugin.BOSS_DEFEAT_LOC=f.getLocation();
//Create a chest at the death spot. if (f.getKiller()!=null) {
Bukkit.getWorld("world").getBlockAt(f.getLocation()).setType(Material.CHEST); Item id = f.getKiller().getWorld().dropItemNaturally(f.getKiller().getLocation(), this.plugin.generate_LootChest(6));id.setPickupDelay(0);
Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(f.getLocation()).getState(); }
for (int i=0;i<27;i++) { for (int i=0;i<this.plugin.hitmoblist.size();i++) {
ItemStack item = null; for (int j=0;j<this.plugin.hitmoblist.get(i).id.size();j++) {
if (Math.random()<=0.3) { if (!this.plugin.hitmoblist.get(i).p.equals(f.getKiller()) && this.plugin.hitmoblist.get(i).id.contains(e.getEntity().getUniqueId())) {
item = getGoodie(); //Award the assisting player.
c.getBlockInventory().setItem(i, item); Item id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
break;
}
}
}
for (int i=0;i<this.plugin.supportmoblist.size();i++) {
for (int j=0;j<this.plugin.supportmoblist.get(i).id.size();j++) {
if (!this.plugin.supportmoblist.get(i).p.equals(f.getKiller()) && this.plugin.supportmoblist.get(i).id.contains(e.getEntity().getUniqueId())) {
//Award the supporting assisting player.
Item id = this.plugin.hitmoblist.get(i).p.getWorld().dropItemNaturally(this.plugin.hitmoblist.get(i).p.getLocation(), this.plugin.generate_LootChest(8));id.setPickupDelay(0);
break;
}
} }
} }
} }
@ -9132,6 +9223,7 @@ implements Listener
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;
List<Entity> nearby = l.getNearbyEntities(20, 20, 20); List<Entity> nearby = l.getNearbyEntities(20, 20, 20);
for (int i=0;i<nearby.size();i++) { for (int i=0;i<nearby.size();i++) {
if (!(nearby.get(i) instanceof Monster)) { if (!(nearby.get(i) instanceof Monster)) {
@ -9144,13 +9236,27 @@ implements Listener
if (nearby.get(i).getType()==l.getType()) { if (nearby.get(i).getType()==l.getType()) {
chancer=0.5; chancer=0.5;
} }
if (Math.random()<=chancer+0.25 && nearby.get(i).getTicksLived()>60) { final Entity teleport_entity = e.getEntity();
e.getEntity().teleport(nearby.get(i).getLocation()); final Entity teleport_to = nearby.get(i);
if (Math.random()<=chancer+0.25 && 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; break;
} }
} }
if (mobfound) {
e.setDamage(0); e.setDamage(0);
//e.setCancelled(true); e.setCancelled(true);
} else {
e.getEntity().remove();
e.setDamage(0);
e.setCancelled(true);
}
} }
} }
if (e.getEntity().getType()==EntityType.PLAYER) { if (e.getEntity().getType()==EntityType.PLAYER) {
@ -9417,6 +9523,7 @@ implements Listener
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Lightning Mage")) { if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Lightning Mage")) {
e.setDamage(0); e.setDamage(0);
e.setCancelled(true); e.setCancelled(true);
return;
} }
} }
} }
@ -9427,7 +9534,14 @@ implements Listener
e.setCancelled(true); e.setCancelled(true);
return; return;
} }
if (p.getItemInHand().getType().name().toLowerCase().contains("axe") && !p.getItemInHand().getType().name().toLowerCase().contains("pickaxe") && this.plugin.hasJobBuff("Woodcutter", p, Job.JOB30A)) { if (p.getItemInHand()!=null && this.plugin.hasBonusEnchantment(p.getItemInHand(), this.plugin.ENCHANT_EXECUTE)) {
if (e.getEntity() instanceof LivingEntity) {
LivingEntity l = (LivingEntity)e.getEntity();
e.setDamage(e.getDamage()+(5-((l.getHealth()/l.getMaxHealth())*100/20))*(0.5*this.plugin.getBonusEnchantmentLevel(p.getItemInHand(), this.plugin.ENCHANT_EXECUTE)));
Bukkit.getLogger().info("Dealt "+((5-((l.getHealth()/l.getMaxHealth())*100/20))*(0.5*this.plugin.getBonusEnchantmentLevel(p.getItemInHand(), this.plugin.ENCHANT_EXECUTE)))+" extra damage to target.");
}
}
if (p.getItemInHand()!=null && p.getItemInHand().getType().name().toLowerCase().contains("axe") && !p.getItemInHand().getType().name().toLowerCase().contains("pickaxe") && this.plugin.hasJobBuff("Woodcutter", p, Job.JOB30A)) {
p.getItemInHand().setDurability((short)0); p.getItemInHand().setDurability((short)0);
} }
Collection<PotionEffect> effects = p.getActivePotionEffects(); Collection<PotionEffect> effects = p.getActivePotionEffects();
@ -9451,9 +9565,12 @@ implements Listener
} }
} }
//**********************************//Player buffs end //**********************************//Player buffs end
boolean hitByPoweredMob=false;
if (e.getEntity() instanceof LivingEntity) { if (e.getEntity() instanceof LivingEntity) {
final LivingEntity l = (LivingEntity)e.getEntity(); final LivingEntity l = (LivingEntity)e.getEntity();
if (e.getDamager() instanceof Monster) {
e.getDamager().teleport(e.getDamager());
}
if (e.getDamager() instanceof Projectile) { if (e.getDamager() instanceof Projectile) {
if (((Projectile)e.getDamager()).getShooter() instanceof LivingEntity) { if (((Projectile)e.getDamager()).getShooter() instanceof LivingEntity) {
LivingEntity l2 = ((Projectile)e.getDamager()).getShooter(); LivingEntity l2 = ((Projectile)e.getDamager()).getShooter();
@ -9475,6 +9592,7 @@ implements Listener
} }
} }
if (!p.isBlocking()) { if (!p.isBlocking()) {
hitByPoweredMob=true;
if (p.getHealth()-e.getDamage()*4<0) { if (p.getHealth()-e.getDamage()*4<0) {
p.setHealth(0); p.setHealth(0);
} else { } else {
@ -9504,6 +9622,7 @@ implements Listener
if (l instanceof Player) { if (l instanceof Player) {
Player p = (Player)l; Player p = (Player)l;
if (!p.isBlocking()) { if (!p.isBlocking()) {
hitByPoweredMob=true;
if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) {
if (l2.getCustomName()!=null) { if (l2.getCustomName()!=null) {
DecimalFormat df = new DecimalFormat("#0.0"); DecimalFormat df = new DecimalFormat("#0.0");
@ -9745,6 +9864,7 @@ implements Listener
DecimalFormat df = new DecimalFormat("#0.0"); DecimalFormat df = new DecimalFormat("#0.0");
DecimalFormat df2 = new DecimalFormat("#0"); DecimalFormat df2 = new DecimalFormat("#0");
if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) {
hitByPoweredMob=true;
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(dmg)+" damage from "+ChatColor.RED+"COUNTER SLIME"+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((dmg)/p.getMaxHealth())*100)+"%)"); p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(dmg)+" damage from "+ChatColor.RED+"COUNTER SLIME"+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((dmg)/p.getMaxHealth())*100)+"%)");
} }
} }
@ -9756,6 +9876,7 @@ implements Listener
DecimalFormat df = new DecimalFormat("#0.0"); DecimalFormat df = new DecimalFormat("#0.0");
DecimalFormat df2 = new DecimalFormat("#0"); DecimalFormat df2 = new DecimalFormat("#0");
if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) {
hitByPoweredMob=true;
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(dmg)+" damage from "+ChatColor.RED+"COUNTER SLIME"+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((dmg)/p.getMaxHealth())*100)+"%)"); p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(dmg)+" damage from "+ChatColor.RED+"COUNTER SLIME"+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((dmg)/p.getMaxHealth())*100)+"%)");
} }
} }
@ -9999,6 +10120,7 @@ implements Listener
for (int i=-20;i<21;i++) { for (int i=-20;i<21;i++) {
for (int j=-20;j<21;j++) { for (int j=-20;j<21;j++) {
for (int k=-20;k<21;k++) { for (int k=-20;k<21;k++) {
if (l.getLocation().add(i,j,k).getY()>0 && l.getLocation().add(i,j,k).getY()<50) {
if (Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.COMMAND) { 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); Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).setType(Material.COBBLESTONE);
} }
@ -10008,10 +10130,12 @@ implements Listener
} }
} }
} }
}
} else { } else {
for (int i=-20;i<21;i++) { for (int i=-20;i<21;i++) {
for (int j=-20;j<21;j++) { for (int j=0;j<10;j++) {
for (int k=-20;k<21;k++) { for (int k=-20;k<21;k++) {
if (l.getLocation().add(i,j,k).getY()>0 && l.getLocation().add(i,j,k).getY()<50) {
if (Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.COMMAND) { 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); Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).setType(Material.COBBLESTONE);
} }
@ -10024,6 +10148,7 @@ implements Listener
} }
} }
} }
}
////Bukkit.getLogger().info("Made it through 1."); ////Bukkit.getLogger().info("Made it through 1.");
/*if (e.getDamager().getType()==EntityType.CREEPER) { /*if (e.getDamager().getType()==EntityType.CREEPER) {
e.setDamage(e.getDamage()/2.0d); e.setDamage(e.getDamage()/2.0d);
@ -10087,6 +10212,7 @@ implements Listener
final LivingEntity l = (LivingEntity)e.getDamager(); final LivingEntity l = (LivingEntity)e.getDamager();
if (p.getNoDamageTicks()<p.getMaximumNoDamageTicks()/2.0f && this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { if (p.getNoDamageTicks()<p.getMaximumNoDamageTicks()/2.0f && this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) {
final Main plug = this.plugin; final Main plug = this.plugin;
if (!hitByPoweredMob) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
@ -10125,7 +10251,16 @@ implements Listener
},1); },1);
} }
} }
}
int knockbacklevels = 0;
if (p.getInventory().getBoots()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getBoots(), this.plugin.ENCHANT_STURDY)) {knockbacklevels+=this.plugin.getBonusEnchantmentLevel(p.getInventory().getBoots(), this.plugin.ENCHANT_STURDY);}
if (p.getInventory().getChestplate()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getChestplate(), this.plugin.ENCHANT_STURDY)) {knockbacklevels+=this.plugin.getBonusEnchantmentLevel(p.getInventory().getChestplate(), this.plugin.ENCHANT_STURDY);}
if (p.getInventory().getLeggings()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getLeggings(), this.plugin.ENCHANT_STURDY)) {knockbacklevels+=this.plugin.getBonusEnchantmentLevel(p.getInventory().getLeggings(), this.plugin.ENCHANT_STURDY);}
if (p.getInventory().getHelmet()!=null && this.plugin.hasBonusEnchantment(p.getInventory().getHelmet(), this.plugin.ENCHANT_STURDY)) {knockbacklevels+=this.plugin.getBonusEnchantmentLevel(p.getInventory().getHelmet(), this.plugin.ENCHANT_STURDY);}
if (p.isBlocking()) { if (p.isBlocking()) {
knockbacklevels+=8;
e.setDamage(e.getDamage()/2.0d);}
if (knockbacklevels>0) {
final Player p2 = p; final Player p2 = p;
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override @Override
@ -10136,7 +10271,7 @@ implements Listener
p2.setVelocity(knockback); p2.setVelocity(knockback);
} }
}, 1L); }, 1L);
e.setDamage(e.getDamage()/2.0d);} }
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel()));
int slot=0; int slot=0;
for (int i=0;i<this.plugin.SPEED_CONTROL.size();i++) { for (int i=0;i<this.plugin.SPEED_CONTROL.size();i++) {
@ -10201,7 +10336,7 @@ implements Listener
} }
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,200,2)); p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,200,2));
} }
if (Math.random()<=block_chance/100.0d) { if (Math.random()<=(block_chance/100.0d)/2) {
e.setDamage(0); e.setDamage(0);
//Choose a random set to mark off. //Choose a random set to mark off.
blocked_attack=true; blocked_attack=true;
@ -10231,6 +10366,7 @@ implements Listener
p.playSound(p.getLocation(), Sound.ANVIL_LAND, 0.1f, 3.6f); p.playSound(p.getLocation(), Sound.ANVIL_LAND, 0.1f, 3.6f);
e.setDamage(0); e.setDamage(0);
e.setCancelled(true); e.setCancelled(true);
return;
} }
//Bukkit.getLogger().info("Made it through 4."); //Bukkit.getLogger().info("Made it through 4.");
//p.updateInventory(); //p.updateInventory();
@ -10389,18 +10525,18 @@ implements Listener
if (!enemy.isDead()) { if (!enemy.isDead()) {
for (int k=-1;k<2;k++) { for (int k=-1;k<2;k++) {
for (int j=-1;j<2;j++) { for (int j=-1;j<2;j++) {
Location checkloc = enemy.getLocation().add(k,1,j); Location checkloc = new Location(enemy.getLocation().getWorld(),enemy.getLocation().getX()+k,enemy.getLocation().getY()+1,enemy.getLocation().getZ()+j);
Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); Block bl = Bukkit.getWorld("world").getBlockAt(checkloc);
if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) { if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) {
bl.breakNaturally(); bl.breakNaturally();
} }
bl = Bukkit.getWorld("world").getBlockAt(checkloc); bl = Bukkit.getWorld("world").getBlockAt(checkloc);
checkloc = enemy.getLocation().add(k,2,j); checkloc = new Location(enemy.getLocation().getWorld(),enemy.getLocation().getX()+k,enemy.getLocation().getY()+2,enemy.getLocation().getZ()+j);
if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) { if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) {
bl.breakNaturally(); bl.breakNaturally();
} }
bl = Bukkit.getWorld("world").getBlockAt(checkloc); bl = Bukkit.getWorld("world").getBlockAt(checkloc);
checkloc = enemy.getLocation().add(k,0,j); checkloc = new Location(enemy.getLocation().getWorld(),enemy.getLocation().getX()+k,enemy.getLocation().getY(),enemy.getLocation().getZ()+j);
if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) { if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) {
bl.breakNaturally(); bl.breakNaturally();
} }
@ -10490,18 +10626,18 @@ implements Listener
if (!enemy.isDead()) { if (!enemy.isDead()) {
for (int k=-2;k<3;k++) { for (int k=-2;k<3;k++) {
for (int j=-2;j<3;j++) { for (int j=-2;j<3;j++) {
Location checkloc = enemy.getLocation().add(k,1,j); Location checkloc = new Location(enemy.getLocation().getWorld(),enemy.getLocation().getX()+k,enemy.getLocation().getY()+1,enemy.getLocation().getZ()+j);
Block bl = Bukkit.getWorld("world").getBlockAt(checkloc); Block bl = Bukkit.getWorld("world").getBlockAt(checkloc);
if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) { if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) {
bl.breakNaturally(); bl.breakNaturally();
} }
bl = Bukkit.getWorld("world").getBlockAt(checkloc); bl = Bukkit.getWorld("world").getBlockAt(checkloc);
checkloc = enemy.getLocation().add(k,2,j); checkloc = new Location(enemy.getLocation().getWorld(),enemy.getLocation().getX()+k,enemy.getLocation().getY()+2,enemy.getLocation().getZ()+j);
if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) { if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) {
bl.breakNaturally(); bl.breakNaturally();
} }
bl = Bukkit.getWorld("world").getBlockAt(checkloc); bl = Bukkit.getWorld("world").getBlockAt(checkloc);
checkloc = enemy.getLocation().add(k,0,j); checkloc = new Location(enemy.getLocation().getWorld(),enemy.getLocation().getX()+k,enemy.getLocation().getY(),enemy.getLocation().getZ()+j);
if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) { if (bl.getType()!=Material.BEDROCK && bl.getType()!=Material.ENDER_PORTAL_FRAME && bl.getType()!=Material.ENDER_PORTAL && bl.getType()!=Material.MOB_SPAWNER && naturalBlock(bl.getType())) {
bl.breakNaturally(); bl.breakNaturally();
} }
@ -10585,6 +10721,7 @@ implements Listener
if (p.getItemInHand().hasItemMeta() && p.getItemInHand().getItemMeta().getDisplayName()!=null && p.getItemInHand().getItemMeta().getDisplayName().contains(ChatColor.DARK_GRAY+"[BROKEN]")) { if (p.getItemInHand().hasItemMeta() && p.getItemInHand().getItemMeta().getDisplayName()!=null && p.getItemInHand().getItemMeta().getDisplayName().contains(ChatColor.DARK_GRAY+"[BROKEN]")) {
e.setDamage(0); e.setDamage(0);
e.setCancelled(true); e.setCancelled(true);
return;
} }
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel())); p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel()));
//p.sendMessage("No Damage Ticks: "+f.getNoDamageTicks()); //p.sendMessage("No Damage Ticks: "+f.getNoDamageTicks());
@ -11023,6 +11160,10 @@ implements Listener
if (p.getEquipment().getChestplate()!=null ) {chest_dura=p.getEquipment().getChestplate().getDurability();} if (p.getEquipment().getChestplate()!=null ) {chest_dura=p.getEquipment().getChestplate().getDurability();}
if (p.getEquipment().getLeggings()!=null) {legs_dura=p.getEquipment().getLeggings().getDurability();} if (p.getEquipment().getLeggings()!=null) {legs_dura=p.getEquipment().getLeggings().getDurability();}
if (p.getEquipment().getBoots()!=null) {boots_dura=p.getEquipment().getBoots().getDurability();} if (p.getEquipment().getBoots()!=null) {boots_dura=p.getEquipment().getBoots().getDurability();}
if (helm_dura<=prev_helm_dura) {helm_dura=-1;}
if (chest_dura<=prev_chest_dura) {chest_dura=-1;}
if (legs_dura<=prev_legs_dura) {legs_dura=-1;}
if (boots_dura<=prev_boots_dura) {boots_dura=-1;}
Bukkit.getLogger().info("Durability of items are: "+helm_dura+","+chest_dura+","+legs_dura+","+boots_dura); Bukkit.getLogger().info("Durability of items are: "+helm_dura+","+chest_dura+","+legs_dura+","+boots_dura);
int gained_back=0; int gained_back=0;
if (p.getEquipment().getHelmet()!=null && helm_dura!=-1 && p.getEquipment().getHelmet().hasItemMeta() && if (p.getEquipment().getHelmet()!=null && helm_dura!=-1 && p.getEquipment().getHelmet().hasItemMeta() &&
@ -11428,7 +11569,8 @@ implements Listener
return; return;
} }
if (this.plugin.is_LootChest(e.getItemInHand())) { if (this.plugin.is_LootChest(e.getItemInHand())) {
open_LootChest(this.plugin.get_LootChestTier(e.getItemInHand()), e.getBlockPlaced().getLocation()); int tier = -1;
open_LootChest(tier = this.plugin.get_LootChestTier(e.getItemInHand()), e.getBlockPlaced().getLocation());
e.setCancelled(true); e.setCancelled(true);
@ -11439,7 +11581,9 @@ implements Listener
} }
// e.getPlayer().getWorld().dropItemNaturally(e.getBlockPlaced().getLocation(), getGoodie()); // e.getPlayer().getWorld().dropItemNaturally(e.getBlockPlaced().getLocation(), getGoodie());
if (tier<=5) {
p.sendMessage(ChatColor.GREEN+"You open the chest and find treasure inside!"); p.sendMessage(ChatColor.GREEN+"You open the chest and find treasure inside!");
}
p.playSound(p.getLocation(), Sound.ORB_PICKUP, 10, 1); p.playSound(p.getLocation(), Sound.ORB_PICKUP, 10, 1);
p.updateInventory(); p.updateInventory();
return; return;

Loading…
Cancel
Save