diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java index f85194f..b223bf0 100644 --- a/BankEconomyMod/src/me/kaZep/Base/Main.java +++ b/BankEconomyMod/src/me/kaZep/Base/Main.java @@ -504,9 +504,9 @@ public class Main extends JavaPlugin ShapelessRecipe portable_table = new ShapelessRecipe(table); - portable_table.addIngredient(Material.WORKBENCH); - portable_table.addIngredient(Material.CHEST); - portable_table.addIngredient(Material.IRON_AXE); + portable_table.addIngredient(1,Material.WORKBENCH); + portable_table.addIngredient(1,Material.CHEST); + portable_table.addIngredient(1,Material.IRON_AXE); Bukkit.addRecipe(portable_table); @@ -750,6 +750,80 @@ public class Main extends JavaPlugin Bukkit.addRecipe(powered_rare_heads); } + List equip_list = new ArrayList(); + List sockets_list = new ArrayList(); + + 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;i0) { - 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); LivingEntity l = (LivingEntity)nearby.get(i); l.damage(aoedmg); @@ -2338,17 +2416,25 @@ public void runTick() { for (int i=0;i"); 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")))); } //Main.economy.depositPlayer(allOnlineP.getName().toLowerCase(), (Main.this.getConfig().getDouble("payday.amount")*Main.economy.bankBalance(allOnlineP.getName().toLowerCase()).balance)); - } + }*/ //saveAccountsConfig() //Commented out; List expired_uuids = new ArrayList(); String moblist = getConfig().getString("fed.mobs"); @@ -5605,7 +5698,7 @@ public void payDay(int time) 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. //Useful for checking what to remove and not remove from lore. List permanent_properties = new ArrayList(); @@ -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. String[] enchant = s.split(" "); 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. * @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[] tens = {"X","XX","XXX","XL","L","LX","LXX","LXXX","XC"}; 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. * @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[] tens = {"X","XX","XXX","XL","L","LX","LXX","LXXX","XC"}; 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. * @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); } @@ -5933,7 +6026,7 @@ public void payDay(int time) * @param override Whether or not the enchantment should be overwritten. * @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()); if (amt<=0) {return item;} //Cannot have a negative number or 0 for an enchantment. Just return the item itself instead. List lore = null; @@ -5951,12 +6044,20 @@ public void payDay(int time) //Take that old amount and add onto it. double 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); } else { double oldamt=0; String parser = lore.get(i); parser.replace(enchant_string, ""); 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))); } added=true; @@ -5995,7 +6096,7 @@ public void payDay(int time) * @param item The item to sort Enchantments on. * @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. //(All Enchantments with Roman numerals are first.) //(All bonus enchantments are sorted via their ID.) diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java index 04009a1..6591b0e 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerBuffData.java @@ -164,11 +164,11 @@ public class PlayerBuffData { 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 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+=zombiepoweredheads; base_hplv+=zombiepoweredrareheads*4; - Bukkit.getLogger().info("Base Health is "+base_hplv+"."); + //Bukkit.getLogger().info("Base Health is "+base_hplv+"."); } extra_hp=0; //p.setMaxHealth(base_hplv); diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index a2fd971..d603835 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -245,6 +245,7 @@ implements Listener this.plugin = plugin; } + enum SocketColor { RED, GREEN, BLUE } enum Cube { SMALL, LARGE, ENDER } enum SpecialMob { COUNTER_SLIME, VIRAL_SPIDER, SILENCER, 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() + ".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() + ".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() + ".spleefwins", 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("----------------------------"); 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")) { this.plugin.getAccountsConfig().set(p.getName().toLowerCase()+".interestdistributedtime", Long.valueOf(Main.SERVER_TICK_TIME)); //this.plugin.saveAccountsConfig(); @@ -2635,7 +2655,7 @@ implements Listener l.setHealth(l.getMaxHealth()); } } 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) { l.setCustomName(ChatColor.GRAY+"Zombie Ninja"); l.setCustomNameVisible(false); @@ -2765,8 +2785,8 @@ implements Listener } } else { - float groupmult=1.0f; //Change this to modify the global grouping multiplier. - int maxgroup=(int)(10*groupmult); + float groupmult=1.25f; //Change this to modify the global grouping multiplier. + double maxgroup=(int)(4); double chancer=0.10d; double despawnchancer=0.25d; @@ -2774,6 +2794,14 @@ implements Listener e.getEntity().remove(); //Too much HP. Nothing should have this much. 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. @@ -2835,7 +2863,7 @@ implements Listener int totallvs=0; - List nearbylist = e.getEntity().getNearbyEntities(30, 30, 30); + List nearbylist = e.getEntity().getNearbyEntities(20, 20, 20); //Filter out all unrelated e.getEntity() types. for (int k=0;kmaxgroup) { allow=false; //Too many mobs, can't have more. @@ -5352,6 +5376,58 @@ implements Listener @EventHandler public void onItemPickup(PlayerPickupItemEvent e) { 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 oldLore = new ArrayList(); + int socket_count=0; + for (int j=0;j newLore = new ArrayList(); + 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())) { boolean alreadyhas=false; for (int i=0;i newLore = new ArrayList(); + 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. boolean check=false; @@ -6418,8 +6578,17 @@ implements Listener result.getMatrix()[i].getType().name().toLowerCase().contains("hoe")) { check=true; 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) { //Bukkit.getLogger().info("Found only 1 piece inside."); @@ -6480,7 +6649,8 @@ implements Listener result.setResult(offering); } } - + + //if (!result.getResult().getType().toString().contains("AIR")) {Bukkit.getLogger().info("Got to here.5");} Player p = null; for (int i=0;i oldLore = new ArrayList(); + int socket_count=0; + for (int j=0;j nearbylist = e.getEntity().getNearbyEntities(30, 30, 30); + //Filter out all unrelated e.getEntity() types. + for (int k=0;kmaxgroup) { + allow=false; //Too many mobs, can't have more. + } if (e.getEntity() instanceof Monster && e.getCause()==DamageCause.SUFFOCATION) { LivingEntity l = (LivingEntity)e.getEntity(); if (l.getTicksLived()<60) { //Check around itself for other mobs. Teleport it there possibly. Higher chance //of teleporting to mobs of the same type. - boolean mobfound=false; - List nearby = l.getNearbyEntities(20, 20, 20); - for (int i=0;i nearby = l.getNearbyEntities(20, 20, 20); + for (int i=0;i60 && (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); + for (int i=0;i playercheck = nearby.get(i).getNearbyEntities(nearby.get(i).getLocation().getX(), nearby.get(i).getLocation().getY(), nearby.get(i).getLocation().getZ()); + for (int j=0;j0) { + 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 { e.getEntity().remove(); - e.setDamage(0); - e.setCancelled(true); } } } @@ -9980,6 +10340,9 @@ implements Listener } } //**********************************//Player buffs end + if (e.getEntity() instanceof Player && e.getDamager() instanceof Monster) { + e.setDamage(e.getDamage()/1.3); + } boolean hitByPoweredMob=false; if ((e.getDamager() instanceof WitherSkull) || (e.getDamager() instanceof Wither)) { if (e.getEntity() instanceof Player) { @@ -10041,34 +10404,47 @@ implements Listener LivingEntity l2 = (LivingEntity)(((Projectile)e.getDamager()).getShooter()); if (l2.hasPotionEffect(PotionEffectType.INVISIBILITY)) {l2.removePotionEffect(PotionEffectType.INVISIBILITY);} for (int i=0;iMain.SERVER_TICK_TIME && this.plugin.powered_mob_list.get(i).id.equals(l2.getUniqueId())) { //This mob will damage you if you are not blocking. if (l instanceof Player) { Player p = (Player)l; - if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { - if (l2.getCustomName()!=null) { - 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 "+l2.getCustomName()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((e.getDamage()*2)/p.getMaxHealth())*100)+"%)"); + if (p.getNoDamageTicks()<=p.getMaximumNoDamageTicks()/2) { + /*if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { + if (l2.getCustomName()!=null) { + 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 "+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 { - 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)+"%)"); + p.playSound(p.getLocation(), Sound.ANVIL_LAND, 0.1f, 3.6f); + e.setDamage(e.getDamage()/8); } - } - 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); + //p.setNoDamageTicks(p.getMaximumNoDamageTicks()); } } this.plugin.powered_mob_list.remove(i); @@ -10082,34 +10458,47 @@ implements Listener LivingEntity l2 = (LivingEntity)e.getDamager(); if (l2.hasPotionEffect(PotionEffectType.INVISIBILITY)) {l2.removePotionEffect(PotionEffectType.INVISIBILITY);} for (int i=0;iMain.SERVER_TICK_TIME && this.plugin.powered_mob_list.get(i).id.equals(l2.getUniqueId())) { //This mob will damage you if you are not blocking. if (l instanceof Player) { Player p = (Player)l; - if (!p.isBlocking()) { - hitByPoweredMob=true; - if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { - if (l2.getCustomName()!=null) { - 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 "+l2.getCustomName()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((e.getDamage()*2)/p.getMaxHealth())*100)+"%)"); + if (p.getNoDamageTicks()<=p.getMaximumNoDamageTicks()/2) { + if (!p.isBlocking()) { + /*hitByPoweredMob=true; + if (this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".settings.notify5")) { + if (l2.getCustomName()!=null) { + 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 "+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 { - 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); + p.setHealth(p.getHealth()-e.getDamage()*2); + }*/ + e.setDamage(e.getDamage()*3); + //Main.playFirework(p.getLocation()); + //Main.playFirework(p.getLocation()); + //Main.playFirework(p.getLocation()); + 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 { - 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()); - 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); + //p.setNoDamageTicks(p.getMaximumNoDamageTicks()); } } this.plugin.powered_mob_list.remove(i); @@ -14130,6 +14519,31 @@ implements Listener //****************************//End job buffs. 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 newLore = new ArrayList(); + 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) { //This is a broken Halloween item...Maybe. Let's find out. boolean is_halloween=false;