r261. Finally fixed Super-mobs. Other bugfixes to improve stability.

anvil_rework
sigonasr2 11 years ago
parent 255c3c3ef4
commit 1a418e7650
  1. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$1.class
  2. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$2.class
  3. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$3.class
  4. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main$4.class
  5. BIN
      BankEconomyMod/bin/me/kaZep/Base/Main.class
  6. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$1.class
  7. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$2.class
  8. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$3.class
  9. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$4.class
  10. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$5.class
  11. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener$6.class
  12. BIN
      BankEconomyMod/bin/me/kaZep/Base/PlayerListener.class
  13. BIN
      BankEconomyMod/bin/me/kaZep/Commands/commandBankEconomy.class
  14. 2
      BankEconomyMod/plugin.yml
  15. 29
      BankEconomyMod/src/me/kaZep/Base/Main.java
  16. 136
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  17. 3
      BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java

@ -1,6 +1,6 @@
name: BankEconomy name: BankEconomy
main: me.kaZep.Base.Main main: me.kaZep.Base.Main
version: 259 version: 261
description: Bank plugin which stores money. description: Bank plugin which stores money.
commands: commands:
bankeconomy: bankeconomy:

@ -179,6 +179,15 @@ public class Main extends JavaPlugin
String pluginPrefix = "§2[BankEconomy]"; String pluginPrefix = "§2[BankEconomy]";
public double Warning(LivingEntity l,int id) {
double hp = l.getHealth();
if (hp>65) {
//Bukkit.broadcastMessage("HP too high for ID "+id+". Removing entity "+l.getType().getName()+" with "+hp+" health.");
l.remove();
}
return hp;
}
public double Warning(double hp,int id) { public double Warning(double hp,int id) {
if (hp>65) { 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);
@ -1511,9 +1520,15 @@ public void runTick() {
l.setCustomName(ChatColor.GOLD+"Charge Zombie II"); l.setCustomName(ChatColor.GOLD+"Charge Zombie II");
l.setCustomNameVisible(false); l.setCustomNameVisible(false);
//l.setCustomNameVisible(true); //l.setCustomNameVisible(true);
l.setMaxHealth(Warning(l.getMaxHealth()+20,13)); Warning(l,13);
if (l!=null && l.isValid()) {
l.setMaxHealth(l.getMaxHealth()+20);
}
}
Warning(l,23);
if (l!=null && l.isValid()) {
l.setMaxHealth(l.getMaxHealth());
} }
l.setHealth(Warning(l.getMaxHealth(),23));
} else { } else {
if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) { if (Math.random()<=0.10+((heightmodifier-l.getLocation().getY())*0.01d)) {
if (Math.random()<=0.25) { if (Math.random()<=0.25) {
@ -1529,8 +1544,14 @@ public void runTick() {
l.getEquipment().setHelmet(new ItemStack(Material.AIR)); l.getEquipment().setHelmet(new ItemStack(Material.AIR));
Zombie g = (Zombie)l; Zombie g = (Zombie)l;
g.setBaby(true); g.setBaby(true);
l.setMaxHealth(Warning(l.getMaxHealth()*0.65d,14)); Warning(l,14);
l.setHealth(Warning(l.getMaxHealth(),15)); if (l!=null && l.isValid()) {
l.setMaxHealth(l.getMaxHealth()*0.65d);
Warning(l,15);
if (l!=null && l.isValid()) {
l.setHealth(l.getMaxHealth());
}
}
} }
} }
} }

@ -268,7 +268,7 @@ public class PlayerListener
@EventHandler @EventHandler
public void onServerListPing(ServerListPingEvent e) { public void onServerListPing(ServerListPingEvent e) {
e.setMaxPlayers(15); e.setMaxPlayers(16);
if (this.plugin.getConfig().getBoolean("maintenance-mode")) { if (this.plugin.getConfig().getBoolean("maintenance-mode")) {
e.setMotd(ChatColor.RED+"Currently in Maintenance Mode."); e.setMotd(ChatColor.RED+"Currently in Maintenance Mode.");
} else { } else {
@ -1867,9 +1867,13 @@ public class PlayerListener
} }
} }
public double Warning(LivingEntity l,int id) {
return this.plugin.Warning(l, id);
}
public double Warning(double hp,int id) { public double Warning(double hp,int id) {
if (hp>65) { if (hp>65) {
Bukkit.broadcastMessage("HP too high for ID "+id+". HP was "+hp); Bukkit.broadcastMessage("PlayerListener: HP too high for ID "+id+". HP was "+hp);
} }
return hp; return hp;
} }
@ -1919,8 +1923,11 @@ public class PlayerListener
boolean despawn=true; boolean despawn=true;
if (entity instanceof Monster) { if (entity instanceof Monster) {
LivingEntity test = (LivingEntity)entity; LivingEntity test = (LivingEntity)entity;
test.setMaxHealth(10); /*test.setMaxHealth(10);
test.setHealth(Warning(test.getMaxHealth(),1)); Warning(test,1);
if (test!=null && test.isValid()) {
test.setHealth(test.getMaxHealth());
}*/
boolean block=false; boolean block=false;
if (test.getCustomName()!=null && (test.getCustomName().contains(ChatColor.DARK_PURPLE+"") || test.getCustomName().contains(ChatColor.DARK_AQUA+"Polymorphed Creature"))) { if (test.getCustomName()!=null && (test.getCustomName().contains(ChatColor.DARK_PURPLE+"") || test.getCustomName().contains(ChatColor.DARK_AQUA+"Polymorphed Creature"))) {
for (int i=-2;i<3;i++) { for (int i=-2;i<3;i++) {
@ -1935,13 +1942,6 @@ public class PlayerListener
} }
} }
} }
if (test.getCustomName()!=null && !test.getCustomName().contains(ChatColor.DARK_PURPLE+"") && !test.getCustomName().contains(ChatColor.DARK_AQUA+"Polymorphed Creature")) {
if (test.getMaxHealth()>50) {
Bukkit.getPlayer("sigonasr2").sendMessage("Mob had "+test.getMaxHealth()+" health. Lowering to max cap of 50.");
test.setMaxHealth(50);
test.setHealth(Warning(test.getMaxHealth(),2));
}
}
List<Entity> entities = Bukkit.getWorld("world").getEntities(); List<Entity> entities = Bukkit.getWorld("world").getEntities();
for (int i=0;i<entities.size();i++) { for (int i=0;i<entities.size();i++) {
if (entities.get(i) instanceof LivingEntity) { if (entities.get(i) instanceof LivingEntity) {
@ -1969,8 +1969,14 @@ public class PlayerListener
boolean contains=entity instanceof Monster; boolean contains=entity instanceof Monster;
if (contains) { if (contains) {
Monster m = (Monster)entity; Monster m = (Monster)entity;
m.setMaxHealth(Warning(m.getMaxHealth()*1.15d,3)); //Increase all mobs' HP by 15%. Warning(m,3);
m.setHealth(Warning(m.getMaxHealth(),4)); if (m!=null && m.isValid()) {
m.setMaxHealth(m.getMaxHealth()*1.15d); //Increase all mobs' HP by 15%.
Warning(m,4);
if (m!=null && m.isValid()) {
m.setHealth(m.getMaxHealth());
}
}
} }
//Mobs have more health when they are farther away, to make the mobs harder in general. //Mobs have more health when they are farther away, to make the mobs harder in general.
float groupmult=0.25f; //Change this to modify the global grouping multiplier. float groupmult=0.25f; //Change this to modify the global grouping multiplier.
@ -6156,7 +6162,7 @@ public ItemStack getGoodie() {
} }
} }
public void FatalSurvivor(Player p) { final public void FatalSurvivor(Player p) {
p.setHealth(p.getMaxHealth()); p.setHealth(p.getMaxHealth());
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."); 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!"); Bukkit.broadcastMessage(ChatColor.YELLOW+p.getName()+ChatColor.WHITE+" has died...and revived through sheer willpower!");
@ -6211,18 +6217,14 @@ public ItemStack getGoodie() {
eve.data2=p.getLevel(); eve.data2=p.getLevel();
eve.expiretime=Bukkit.getWorld("world").getFullTime()+1200; eve.expiretime=Bukkit.getWorld("world").getFullTime()+1200;
this.plugin.explorers.add(eve); this.plugin.explorers.add(eve);
if (!survivor && p.getHealth()-actualdmg<=0) { Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
e.setDamage(0); @Override
FatalSurvivor(p); //Run fatal survivor. They lived! public void run() {
} else { if (p.getHealth()<=0) {
/*if (p.getHealth()-actualdmg<=0) { FatalSurvivor(p);
PersistentExplorerList ev = new PersistentExplorerList(p.getName()); }
ev.event=1;
ev.data=p.getExp();
ev.data2=p.getLevel();
this.plugin.explorers.add(ev);
}*/
} }
},1);
} }
} }
//e.getCause()==DamageCause. //e.getCause()==DamageCause.
@ -6236,6 +6238,9 @@ public ItemStack getGoodie() {
if (player_starthp-p.getHealth()>=0.5) { if (player_starthp-p.getHealth()>=0.5) {
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(player_starthp-p.getHealth())+" damage from "+ChatColor.WHITE+f.getCause().toString()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((player_starthp-p.getHealth())/p.getMaxHealth())*100)+"%)"); p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(player_starthp-p.getHealth())+" damage from "+ChatColor.WHITE+f.getCause().toString()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((player_starthp-p.getHealth())/p.getMaxHealth())*100)+"%)");
} }
if (p.getHealth()<=0) {
FatalSurvivor(p);
}
} }
},1); },1);
} }
@ -6283,11 +6288,24 @@ public ItemStack getGoodie() {
} }
} }
} }
boolean same=false;
for (int i=0;i<e.getPlayer().getInventory().getContents().length;i++) {
if (hasSameItem(e.getItem().getItemStack(),e.getPlayer().getInventory().getContents()[i])) {
same=true;
break;
}
}
if (this.plugin.inventoryFull(e.getPlayer())) {
if (e.getRemaining()==0 && same) {
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Picked up "+e.getItem().getItemStack().getAmount()+" "+String.valueOf(mod)+".");
}
} else {
if (e.getRemaining()==0) { if (e.getRemaining()==0) {
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Picked up "+e.getItem().getItemStack().getAmount()+" "+String.valueOf(mod)+"."); p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"Picked up "+e.getItem().getItemStack().getAmount()+" "+String.valueOf(mod)+".");
} }
} }
} }
}
@EventHandler @EventHandler
public void onPlayerOnFire(EntityCombustEvent e) { public void onPlayerOnFire(EntityCombustEvent e) {
@ -6346,64 +6364,10 @@ public ItemStack getGoodie() {
@EventHandler @EventHandler
public void onEnemyHit(EntityDamageByEntityEvent e) { public void onEnemyHit(EntityDamageByEntityEvent e) {
if (e.getDamager() instanceof Monster) {
//e.setDamage(e.getDamage()*1.45d); //Damage of ALL mobs multiplied by x1.45.
Monster m = (Monster)e.getDamager();
if (m.getType()!=EntityType.ENDER_DRAGON && m.getType()!=EntityType.WITHER) {
if (m.getCustomName()==null) {
if (m.getMaxHealth()>65) {
Bukkit.broadcastMessage("This mob had too much HP. HP: "+m.getMaxHealth());
m.setMaxHealth(65); //65 HP cap.
m.setHealth(65);
m.setCustomName("Super Mob");
m.setCustomNameVisible(true);
Bukkit.broadcastMessage("This mob had too much HP. Lowered to "+m.getHealth()+"/"+m.getMaxHealth());
}
} else {
if (!m.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { //Make sure it's not a boss.
if (m.getMaxHealth()>65) {
Bukkit.broadcastMessage("This mob had too much HP. HP: "+m.getMaxHealth());
m.setMaxHealth(65); //65 HP cap.
m.setHealth(65);
m.setCustomName("Super Mob");
m.setCustomNameVisible(true);
Bukkit.broadcastMessage("This mob had too much HP. Lowered to "+m.getHealth()+"/"+m.getMaxHealth());
}
}
}
}
}
if (e.getEntity() instanceof LivingEntity) { if (e.getEntity() instanceof LivingEntity) {
if (e.getDamager() instanceof Monster) {
//e.setDamage(e.getDamage()*1.45d); //Damage of ALL mobs multiplied by x1.65.
Monster m = (Monster)e.getDamager();
if (m.getType()!=EntityType.ENDER_DRAGON && m.getType()!=EntityType.WITHER) {
if (m.getCustomName()==null) {
if (m.getMaxHealth()>65) {
Bukkit.broadcastMessage("This mob had too much HP. HP: "+m.getMaxHealth());
m.setMaxHealth(65); //65 HP cap.
//m.setHealth(65);
m.setCustomName("Super Mob");
m.setCustomNameVisible(true);
Bukkit.broadcastMessage("This mob had too much HP. Lowered to "+m.getHealth()+"/"+m.getMaxHealth());
}
} else {
if (!m.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { //Make sure it's not a boss.
if (m.getMaxHealth()>65) {
Bukkit.broadcastMessage("This mob had too much HP. HP: "+m.getMaxHealth());
m.setMaxHealth(65); //65 HP cap.
m.setHealth(65);
m.setCustomName("Super Mob");
m.setCustomNameVisible(true);
Bukkit.broadcastMessage("This mob had too much HP. Lowered to "+m.getHealth()+"/"+m.getMaxHealth());
}
}
}
}
}
final LivingEntity l = (LivingEntity)e.getEntity(); final LivingEntity l = (LivingEntity)e.getEntity();
if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.DARK_PURPLE+"")) { if (l.getCustomName()!=null && l.getCustomName().contains(ChatColor.DARK_PURPLE+"")) {
Bukkit.getPlayer("sigonasr2").sendMessage("Entered Boss Entity hit loop."); //Bukkit.getPlayer("sigonasr2").sendMessage("Entered Boss Entity hit loop.");
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
@ -6543,6 +6507,15 @@ public ItemStack getGoodie() {
} }
if (e.getEntity().getType()==EntityType.PLAYER) { if (e.getEntity().getType()==EntityType.PLAYER) {
final Player p = (Player)e.getEntity(); final Player p = (Player)e.getEntity();
List<Entity> nearby = p.getNearbyEntities(10, 10, 10);
for (int i=0;i<nearby.size();i++) {
if (nearby.get(i).getType()==EntityType.PLAYER && this.plugin.PlayerinJob((Player)nearby.get(i), "Support") && this.plugin.getJobLv("Support", (Player)nearby.get(i))>=20) {
//A support with the Lv20 buff is detected. If health is less than 8, take half damage.
if (p.getHealth()<=8) {
e.setDamage(e.getDamage()/2.0d);
}
}
}
if (e.getDamager() instanceof LivingEntity) { if (e.getDamager() instanceof LivingEntity) {
final double player_starthp = p.getHealth(); final double player_starthp = p.getHealth();
final LivingEntity l = (LivingEntity)e.getDamager(); final LivingEntity l = (LivingEntity)e.getDamager();
@ -6558,6 +6531,9 @@ public ItemStack getGoodie() {
} else { } else {
p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(player_starthp-p.getHealth())+" damage from "+ChatColor.WHITE+l.getType()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((player_starthp-p.getHealth())/p.getMaxHealth())*100)+"%)"); p.sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(player_starthp-p.getHealth())+" damage from "+ChatColor.WHITE+l.getType()+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((player_starthp-p.getHealth())/p.getMaxHealth())*100)+"%)");
} }
if (p.getHealth()<=0) {
FatalSurvivor(p);
}
} }
},1); },1);

@ -7,7 +7,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import me.kaZep.Base.Dungeon;
import me.kaZep.Base.Main; import me.kaZep.Base.Main;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
@ -1143,7 +1142,7 @@ public String convertToItemName(String val) {
} }
} else } else
if (cmd.getName().equalsIgnoreCase("dungeon") && p.hasPermission("maintenance-mode-admin") && args.length==1) { if (cmd.getName().equalsIgnoreCase("dungeon") && p.hasPermission("maintenance-mode-admin") && args.length==1) {
Dungeon x = new Dungeon(new Location(Bukkit.getWorld("world"),-8990,0,-4),new Location(Bukkit.getWorld("world"),50,255,50),Integer.valueOf(args[0])); //Dungeon x = new Dungeon(new Location(Bukkit.getWorld("world"),-8990,0,-4),new Location(Bukkit.getWorld("world"),50,255,50),Integer.valueOf(args[0]));
} else } else
if (cmd.getName().equalsIgnoreCase("transfer") && args.length==1) { if (cmd.getName().equalsIgnoreCase("transfer") && args.length==1) {
p.sendMessage("Usage: "+ChatColor.RED+"/transfer name money"+ChatColor.WHITE+" - Transfer money to a player."); p.sendMessage("Usage: "+ChatColor.RED+"/transfer name money"+ChatColor.WHITE+" - Transfer money to a player.");

Loading…
Cancel
Save