diff --git a/BankEconomyMod/src/me/kaZep/Base/Main.java b/BankEconomyMod/src/me/kaZep/Base/Main.java
index defb3ee..0dfa6df 100644
--- a/BankEconomyMod/src/me/kaZep/Base/Main.java
+++ b/BankEconomyMod/src/me/kaZep/Base/Main.java
@@ -22,6 +22,7 @@ import java.util.logging.Logger;
import java.text.*;
import me.kaZep.Base.BonusEnchantment.ItemType;
+import me.kaZep.Base.PlayerListener.Cube;
import me.kaZep.Commands.JobsDataInfo;
import me.kaZep.Commands.JobsDataInfo.Job;
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_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_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_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));
@@ -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.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
=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) {
for (int i=-15;i<=15;i++) {
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 y=5;y<96;y++) {
for (int z=0;z<16;z++) {
Block b = Bukkit.getWorld("world").getBlockAt(x+c.getX()*16,y,z+c.getZ()*16);
- if (b!=null && (b.getType()==Material.COAL_ORE ||
- b.getType()==Material.IRON_ORE ||
- b.getType()==Material.GOLD_ORE ||
- b.getType()==Material.REDSTONE_ORE ||
- b.getType()==Material.LAPIS_ORE ||
- b.getType()==Material.DIAMOND_ORE)) {
- newore++;
+ if (b!=null && (b.getType()==Material.DIAMOND_ORE)) {
+ if (Math.random()<=0.60) {
+ removeore++;
+ b.setType(Material.STONE);
+ }
+ totalore++;
}
}
}
@@ -5061,7 +5084,7 @@ public void payDay(int time)
}
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 false;
@@ -5101,7 +5124,10 @@ public void payDay(int time)
if (chest.hasItemMeta() && chest.getItemMeta().hasLore()) {
//Check to see if the Lore contains anything.
for (int i=0;i newlore = item.getItemMeta().getLore();
for (int i=0;i newlore = item.getItemMeta().getLore();
for (int i=0;i lore = null;
String enchant_string = enchant.name;
boolean percent=enchant.percent, enchant_format=enchant.enchant_format;
@@ -5554,7 +5643,7 @@ public void payDay(int time)
//replace it.
boolean added=false;
for (int i=0;i nearents = f.getNearbyEntities(20, 20, 20);
for (int i=0;i0) {
- if (p.getHealth()-(poisonlevel/1.5d)>0) {
- p.setHealth(p.getHealth()-(poisonlevel/1.5d));
+ if (p.getHealth()-(poisonlevel/1.15d)>0) {
+ p.setHealth(p.getHealth()-(poisonlevel/1.15d));
} else {
p.setHealth(0);
}
@@ -8215,8 +8273,8 @@ implements Listener
if (f instanceof Zombie) {
Zombie z = (Zombie)f;
if (z.isBaby()) {
- //Randomly drop a loot chest sometimes. (4.5% of the time.)
- if (Math.random() <= 0.045) {
+ //Randomly drop a loot chest sometimes. (10.5% of the time.)
+ if (Math.random() <= 0.105) {
z.getWorld().dropItemNaturally(z.getLocation(), this.plugin.generate_LootChest());
}
}
@@ -8311,15 +8369,30 @@ implements Listener
}
if (f.getCustomName().contains("Mega Wither")) {
e.setDroppedExp(e.getDroppedExp()*500);
- for (int j=0;j<4;j++) {
- Location dd = f.getLocation().add(Math.random()*4,Math.random()*4,Math.random()*4);
- Bukkit.getWorld("world").getBlockAt(dd).setType(Material.CHEST);
- Chest c=(Chest)Bukkit.getWorld("world").getBlockAt(dd).getState();
- for (int i=0;i<27;i++) {
- ItemStack item = null;
- if (Math.random()<=0.3) {
- item = getGoodie();
- c.getBlockInventory().setItem(i, item);
+ if (f.getKiller()!=null) {
+ Item id = f.getKiller().getWorld().dropItemNaturally(f.getKiller().getLocation(), this.plugin.generate_LootChest(6));id.setPickupDelay(0);
+ id = f.getKiller().getWorld().dropItemNaturally(f.getKiller().getLocation(), this.plugin.generate_LootChest(6));id.setPickupDelay(0);
+ id = f.getKiller().getWorld().dropItemNaturally(f.getKiller().getLocation(), this.plugin.generate_LootChest(6));id.setPickupDelay(0);
+ }
+ for (int i=0;i nearby = l.getNearbyEntities(20, 20, 20);
for (int i=0;i60) {
- e.getEntity().teleport(nearby.get(i).getLocation());
+ final Entity teleport_entity = e.getEntity();
+ 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;
}
}
- e.setDamage(0);
- //e.setCancelled(true);
+ if (mobfound) {
+ e.setDamage(0);
+ e.setCancelled(true);
+ } else {
+ e.getEntity().remove();
+ e.setDamage(0);
+ e.setCancelled(true);
+ }
}
}
if (e.getEntity().getType()==EntityType.PLAYER) {
@@ -9417,6 +9523,7 @@ implements Listener
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.RED+"Lightning Mage")) {
e.setDamage(0);
e.setCancelled(true);
+ return;
}
}
}
@@ -9427,7 +9534,14 @@ implements Listener
e.setCancelled(true);
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);
}
Collection effects = p.getActivePotionEffects();
@@ -9451,9 +9565,12 @@ implements Listener
}
}
//**********************************//Player buffs end
-
+ boolean hitByPoweredMob=false;
if (e.getEntity() instanceof LivingEntity) {
final LivingEntity l = (LivingEntity)e.getEntity();
+ if (e.getDamager() instanceof Monster) {
+ e.getDamager().teleport(e.getDamager());
+ }
if (e.getDamager() instanceof Projectile) {
if (((Projectile)e.getDamager()).getShooter() instanceof LivingEntity) {
LivingEntity l2 = ((Projectile)e.getDamager()).getShooter();
@@ -9474,7 +9591,8 @@ implements Listener
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()) {
+ if (!p.isBlocking()) {
+ hitByPoweredMob=true;
if (p.getHealth()-e.getDamage()*4<0) {
p.setHealth(0);
} else {
@@ -9504,6 +9622,7 @@ implements Listener
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");
@@ -9745,6 +9864,7 @@ implements Listener
DecimalFormat df = new DecimalFormat("#0.0");
DecimalFormat df2 = new DecimalFormat("#0");
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)+"%)");
}
}
@@ -9756,6 +9876,7 @@ implements Listener
DecimalFormat df = new DecimalFormat("#0.0");
DecimalFormat df2 = new DecimalFormat("#0");
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)+"%)");
}
}
@@ -9999,24 +10120,28 @@ implements Listener
for (int i=-20;i<21;i++) {
for (int j=-20;j<21;j++) {
for (int k=-20;k<21;k++) {
- if (Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.COMMAND) {
- Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).setType(Material.COBBLESTONE);
- }
- if (Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.TORCH || Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.GLOWSTONE) {
- Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).breakNaturally();
+ 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) {
+ Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).setType(Material.COBBLESTONE);
+ }
+ if (Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.TORCH || Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.GLOWSTONE) {
+ Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).breakNaturally();
+ }
}
}
}
}
} else {
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++) {
- if (Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.COMMAND) {
- Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).setType(Material.COBBLESTONE);
- }
- if (Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.SAND && Math.random()<=0.1) {
- Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).breakNaturally();
+ 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) {
+ Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).setType(Material.COBBLESTONE);
+ }
+ if (Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).getType()==Material.SAND && Math.random()<=0.1) {
+ Bukkit.getWorld("world").getBlockAt(l.getLocation().add(i,j,k)).breakNaturally();
+ }
}
}
}
@@ -10087,45 +10212,55 @@ implements Listener
final LivingEntity l = (LivingEntity)e.getDamager();
if (p.getNoDamageTicks()=10) {
- //Check to see if our "fatal s urvivor" effect is available.
- boolean survivor=false;
- for (int i=0;i=10) {
+ //Check to see if our "fatal s urvivor" effect is available.
+ boolean survivor=false;
+ for (int i=0;i0) {
final Player p2 = p;
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
@@ -10136,7 +10271,7 @@ implements Listener
p2.setVelocity(knockback);
}
}, 1L);
- e.setDamage(e.getDamage()/2.0d);}
+ }
p.getScoreboard().getTeam(p.getName().toLowerCase()).setSuffix(healthbar(p.getHealth(),p.getMaxHealth(),p.getFoodLevel()));
int slot=0;
for (int i=0;i