Fix more side-related things to combat.

anvil_rework
sigonasr2 11 years ago
parent dd15623364
commit be149f3252
  1. 51
      BankEconomyMod/src/me/kaZep/Base/EnchantLevelDatabase.java
  2. 13
      BankEconomyMod/src/me/kaZep/Base/Main.java
  3. 82
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java

@ -414,5 +414,56 @@ public class EnchantLevelDatabase {
diamond_chestplate.add(new StoreValues(0.081,Enchantment.PROTECTION_PROJECTILE,2,10));
diamond_chestplate.add(new StoreValues(0.026,Enchantment.PROTECTION_FIRE,1,10));
diamond_chestplate.add(new StoreValues(0.021,Enchantment.THORNS,1,10));
chain_helmet.add(new StoreValues(0.471,Enchantment.PROTECTION_ENVIRONMENTAL,1,5));
chain_helmet.add(new StoreValues(0.161,Enchantment.WATER_WORKER,1,5));
chain_helmet.add(new StoreValues(0.16,Enchantment.PROTECTION_PROJECTILE,1,5));
chain_helmet.add(new StoreValues(0.092,Enchantment.PROTECTION_EXPLOSIONS,1,5));
chain_helmet.add(new StoreValues(0.072,Enchantment.PROTECTION_PROJECTILE,2,5));
chain_helmet.add(new StoreValues(0.022,Enchantment.PROTECTION_FIRE,1,5));
chain_helmet.add(new StoreValues(0.015,Enchantment.OXYGEN,1,5));
chain_boots.add(new StoreValues(0.41,Enchantment.PROTECTION_ENVIRONMENTAL,1,5));
chain_boots.add(new StoreValues(0.265,Enchantment.PROTECTION_FALL,1,5));
chain_boots.add(new StoreValues(0.143,Enchantment.PROTECTION_PROJECTILE,1,5));
chain_boots.add(new StoreValues(0.082,Enchantment.PROTECTION_EXPLOSIONS,1,5));
chain_boots.add(new StoreValues(0.065,Enchantment.PROTECTION_PROJECTILE,2,5));
chain_boots.add(new StoreValues(0.022,Enchantment.PROTECTION_FIRE,1,5));
chain_boots.add(new StoreValues(0.006,Enchantment.PROTECTION_FALL,2,5));
chain_leggings.add(new StoreValues(0.523,Enchantment.PROTECTION_ENVIRONMENTAL,1,5));
chain_leggings.add(new StoreValues(0.178,Enchantment.PROTECTION_PROJECTILE,1,5));
chain_leggings.add(new StoreValues(0.101,Enchantment.PROTECTION_EXPLOSIONS,1,5));
chain_leggings.add(new StoreValues(0.083,Enchantment.PROTECTION_PROJECTILE,2,5));
chain_leggings.add(new StoreValues(0.025,Enchantment.PROTECTION_FIRE,1,5));
chain_chestplate.add(new StoreValues(0.525,Enchantment.PROTECTION_ENVIRONMENTAL,1,5));
chain_chestplate.add(new StoreValues(0.172,Enchantment.PROTECTION_PROJECTILE,1,5));
chain_chestplate.add(new StoreValues(0.10,Enchantment.PROTECTION_EXPLOSIONS,1,5));
chain_chestplate.add(new StoreValues(0.083,Enchantment.PROTECTION_PROJECTILE,2,5));
chain_chestplate.add(new StoreValues(0.025,Enchantment.PROTECTION_FIRE,1,5));
chain_chestplate.add(new StoreValues(0.019,Enchantment.THORNS,1,5));
chain_boots.add(new StoreValues(0.41,Enchantment.PROTECTION_ENVIRONMENTAL,1,10));
chain_boots.add(new StoreValues(0.265,Enchantment.PROTECTION_FALL,1,10));
chain_boots.add(new StoreValues(0.143,Enchantment.PROTECTION_PROJECTILE,1,10));
chain_boots.add(new StoreValues(0.082,Enchantment.PROTECTION_EXPLOSIONS,1,10));
chain_boots.add(new StoreValues(0.065,Enchantment.PROTECTION_PROJECTILE,2,10));
chain_boots.add(new StoreValues(0.022,Enchantment.PROTECTION_FIRE,1,10));
chain_boots.add(new StoreValues(0.006,Enchantment.PROTECTION_FALL,2,10));
chain_helmet.add(new StoreValues(0.471,Enchantment.PROTECTION_ENVIRONMENTAL,1,10));
chain_helmet.add(new StoreValues(0.161,Enchantment.WATER_WORKER,1,10));
chain_helmet.add(new StoreValues(0.16,Enchantment.PROTECTION_PROJECTILE,1,10));
chain_helmet.add(new StoreValues(0.092,Enchantment.PROTECTION_EXPLOSIONS,1,10));
chain_helmet.add(new StoreValues(0.072,Enchantment.PROTECTION_PROJECTILE,2,10));
chain_helmet.add(new StoreValues(0.022,Enchantment.PROTECTION_FIRE,1,10));
chain_helmet.add(new StoreValues(0.015,Enchantment.OXYGEN,1,10));
chain_leggings.add(new StoreValues(0.523,Enchantment.PROTECTION_ENVIRONMENTAL,1,10));
chain_leggings.add(new StoreValues(0.178,Enchantment.PROTECTION_PROJECTILE,1,10));
chain_leggings.add(new StoreValues(0.101,Enchantment.PROTECTION_EXPLOSIONS,1,10));
chain_leggings.add(new StoreValues(0.083,Enchantment.PROTECTION_PROJECTILE,2,10));
chain_leggings.add(new StoreValues(0.025,Enchantment.PROTECTION_FIRE,1,10));
chain_chestplate.add(new StoreValues(0.525,Enchantment.PROTECTION_ENVIRONMENTAL,1,10));
chain_chestplate.add(new StoreValues(0.172,Enchantment.PROTECTION_PROJECTILE,1,10));
chain_chestplate.add(new StoreValues(0.10,Enchantment.PROTECTION_EXPLOSIONS,1,10));
chain_chestplate.add(new StoreValues(0.083,Enchantment.PROTECTION_PROJECTILE,2,10));
chain_chestplate.add(new StoreValues(0.025,Enchantment.PROTECTION_FIRE,1,10));
chain_chestplate.add(new StoreValues(0.019,Enchantment.THORNS,1,10));
}
}

@ -194,7 +194,7 @@ public class Main extends JavaPlugin
public double Warning(double hp,int id) {
if (hp>65) {
Bukkit.broadcastMessage("Main: HP too high for ID "+id+". HP was "+hp);
//Bukkit.broadcastMessage("Main: HP too high for ID "+id+". HP was "+hp);
}
return hp;
}
@ -2883,6 +2883,7 @@ public void checkJukeboxes() {
}
}
}
/* Kind of an out-of-date way to spawn things. Don't need anymore.
//Find out how much a player is worth.
if (list[i].getWorld().getName().compareTo("world")==0 && list[i].getLocation().getY()<=50) {
double value=0;
@ -3021,7 +3022,7 @@ public void checkJukeboxes() {
}break;
}
}
}
}*/
list[i].getScoreboard().getTeam(list[i].getName()).setSuffix(healthbar(list[i].getHealth(),list[i].getMaxHealth(),list[i].getFoodLevel()));
}
LOGGING_UPDATE_COUNTS++; //3
@ -3999,10 +4000,6 @@ public void payDay(int time)
if (item.getType()==Material.IRON_AXE) {enchant_data=ENCHANTMENT_DATA.iron_axe;} else
if (item.getType()==Material.GOLD_SPADE) {enchant_data=ENCHANTMENT_DATA.golden_shovel;} else
if (item.getType()==Material.GOLD_AXE) {enchant_data=ENCHANTMENT_DATA.golden_axe;} else
if (item.getType()==Material.CHAINMAIL_HELMET) {enchant_data=ENCHANTMENT_DATA.chain_helmet;} else
if (item.getType()==Material.CHAINMAIL_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.chain_chestplate;} else
if (item.getType()==Material.CHAINMAIL_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.chain_leggings;} else
if (item.getType()==Material.CHAINMAIL_BOOTS) {enchant_data=ENCHANTMENT_DATA.chain_boots;} else
if (item.getType()==Material.IRON_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.iron_leggings;} else
if (item.getType()==Material.DIAMOND_SPADE) {enchant_data=ENCHANTMENT_DATA.diamond_shovel;} else
if (item.getType()==Material.GOLD_BOOTS) {enchant_data=ENCHANTMENT_DATA.golden_boots;} else
@ -4016,6 +4013,10 @@ public void payDay(int time)
if (item.getType()==Material.DIAMOND_HELMET) {enchant_data=ENCHANTMENT_DATA.diamond_helmet;} else
if (item.getType()==Material.DIAMOND_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.diamond_leggings;} else
if (item.getType()==Material.DIAMOND_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.diamond_chestplate;}
if (item.getType()==Material.CHAINMAIL_HELMET) {enchant_data=ENCHANTMENT_DATA.chain_helmet;} else
if (item.getType()==Material.CHAINMAIL_CHESTPLATE) {enchant_data=ENCHANTMENT_DATA.chain_chestplate;} else
if (item.getType()==Material.CHAINMAIL_LEGGINGS) {enchant_data=ENCHANTMENT_DATA.chain_leggings;} else
if (item.getType()==Material.CHAINMAIL_BOOTS) {enchant_data=ENCHANTMENT_DATA.chain_boots;}
int enchantments=0;
int iterations=0;
while (enchantments==0 && iterations<100) { //Attempt to enchant it, up to 100 tries.

@ -1852,7 +1852,7 @@ public class PlayerListener
public double Warning(double hp,int id) {
if (hp>65) {
Bukkit.broadcastMessage("PlayerListener: HP too high for ID "+id+". HP was "+hp);
//Bukkit.broadcastMessage("PlayerListener: HP too high for ID "+id+". HP was "+hp);
}
return hp;
}
@ -2260,6 +2260,36 @@ public class PlayerListener
if (spawners==0 && (Math.random()<=despawnchancer || (torches+glowstone>=3))) {
allow=false;
} else {
allow=true;
}
int totallvs=0;
List<Entity> nearbylist = e.getEntity().getNearbyEntities(30, 30, 30);
//Filter out all unrelated e.getEntity() types.
for (int k=0;k<nearbylist.size();k++) {
//See if human players are near. If so, factor that in for determining how many mobs may exist.
if (nearbylist.get(k).getType()==EntityType.PLAYER) {
//This is a player.
Player g = (Player)nearbylist.get(k);
maxgroup+=plugin.getJobTotalLvs(g)/20;
totallvs+=plugin.getJobTotalLvs(g);
////Bukkit.getLogger().info("Mob maxgroup increased to "+maxgroup+" down here.");
}
if (nearbylist.get(k).getType()!=EntityType.SKELETON &&
nearbylist.get(k).getType()!=EntityType.ZOMBIE &&
nearbylist.get(k).getType()!=EntityType.CREEPER &&
nearbylist.get(k).getType()!=EntityType.SPIDER &&
nearbylist.get(k).getType()!=EntityType.ENDERMAN) {
nearbylist.remove(k);
k--;
}
}
maxgroup/=groupmult;
int currentnearby = nearbylist.size();
if (currentnearby>maxgroup) {
allow=false; //Too many mobs, can't have more.
}
if (!allow) {
@ -2303,50 +2333,7 @@ public class PlayerListener
}
}
int totallvs=0;
List<Entity> nearbylist = e.getEntity().getNearbyEntities(30, 30, 30);
//Filter out all unrelated e.getEntity() types.
for (int k=0;k<nearbylist.size();k++) {
//See if human players are near. If so, factor that in for determining how many mobs may exist.
if (nearbylist.get(k).getType()==EntityType.PLAYER) {
//This is a player.
Player g = (Player)nearbylist.get(k);
maxgroup+=plugin.getJobTotalLvs(g)/20;
totallvs+=plugin.getJobTotalLvs(g);
////Bukkit.getLogger().info("Mob maxgroup increased to "+maxgroup+" down here.");
}
if (nearbylist.get(k).getType()!=EntityType.SKELETON &&
nearbylist.get(k).getType()!=EntityType.ZOMBIE &&
nearbylist.get(k).getType()!=EntityType.CREEPER &&
nearbylist.get(k).getType()!=EntityType.SPIDER &&
nearbylist.get(k).getType()!=EntityType.ENDERMAN) {
nearbylist.remove(k);
k--;
}
}
maxgroup/=groupmult;
int currentnearby = nearbylist.size();
int k = currentnearby;
if (Main.SERVER_TICK_TIME-plugin.last_mob_random_time>10) {
while (k<maxgroup-currentnearby+1) {
if (Math.random()<=chancer) {
Location testloc = e.getEntity().getLocation().add(Math.random()*4.0d-Math.random()*4.0d,Math.random()*4.0d,Math.random()*4.0d-Math.random()*4.0d);
if (Bukkit.getWorld("world").getBlockAt(testloc).getType()==Material.AIR) {
Bukkit.getWorld("world").spawnEntity(testloc, e.getEntity().getType());
plugin.last_mob_random_time=Main.SERVER_TICK_TIME;
k++;
//Bukkit.getPlayer("AaMay").sendMessage(ChatColor.RED+e.getEntity().getType().getName()+": Spawned extra mob.");
/*int j=0;
while (j<10) {
Bukkit.getWorld("world").spawnEntity(testloc, e.getEntity().getType());
j++;
}*/
}
}
k++;
}
}
double levelsmult=1.5;
double levelsmult=1.0;
if (totallvs>20*levelsmult) {
if (totallvs<40*levelsmult) {
//Sometimes wear leather armor. Only for Skeletons and Zombies.
@ -6478,6 +6465,7 @@ public ItemStack getGoodie() {
final public void FatalSurvivor(Player p) {
p.setHealth(p.getMaxHealth());
p.setNoDamageTicks(100);
p.sendMessage("You used your "+ChatColor.YELLOW+"Lv10 Fatal Survivor"+ChatColor.WHITE+" buff. Your health has been restored."+ChatColor.AQUA+" It will be recharged in one hour.");
Bukkit.broadcastMessage(ChatColor.YELLOW+p.getName()+ChatColor.WHITE+" has died...and revived through sheer willpower!");
p.setFireTicks(0);
@ -6859,9 +6847,9 @@ public ItemStack getGoodie() {
}
}
////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);
}
}*/
if (e.getEntity().getType()==EntityType.PLAYER) {
final Player p = (Player)e.getEntity();
List<Entity> nearby = p.getNearbyEntities(10, 10, 10);

Loading…
Cancel
Save