Fix major crash issue with '/jobs members'. Added Scaling health with

the teleporting command. Baby zombies are much less frequent and now
drop loot sometimes.
master_event
sigonasr2 11 years ago
parent 9819405e9d
commit 25f10a7a46
  1. 63
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  2. 16
      BankEconomyMod/src/me/kaZep/Commands/commandBankEconomy.java

@ -2431,6 +2431,13 @@ implements Listener
double levelsmult=1.0;
if (totallvs>20*levelsmult) {
if (totallvs<40*levelsmult) {
//Can't have baby zombies at this level.
if (e.getEntity().getType()==EntityType.ZOMBIE) {
Zombie z = (Zombie)e.getEntity();
if (z.isBaby()) {
z.setBaby(false);
}
}
//Sometimes wear leather armor. Only for Skeletons and Zombies.
if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) {
LivingEntity l = (LivingEntity) e.getEntity();
@ -2449,6 +2456,13 @@ implements Listener
}
} else
if (totallvs<60*levelsmult) {
//Can't have baby zombies at this level.
if (e.getEntity().getType()==EntityType.ZOMBIE) {
Zombie z = (Zombie)e.getEntity();
if (z.isBaby()) {
z.setBaby(false);
}
}
//Wear leather armor a bit more often. Sometimes a chain piece here or there. Include a Wooden sword usually.
if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) {
LivingEntity l = (LivingEntity) e.getEntity();
@ -3022,6 +3036,15 @@ implements Listener
}
}
}
if (e.getEntity() instanceof Zombie) {
Zombie z = (Zombie)e.getEntity();
if (z.isBaby() && z.getCustomName()!=null) {
//Can't have weird special baby zombies.
z.setBaby(false);
}
}
if (e.getEntity().getType()==EntityType.EXPERIENCE_ORB) {
Bukkit.getWorld("world").spawnEntity(e.getEntity().getLocation(),e.getEntity().getType());
}
@ -6046,18 +6069,20 @@ implements Listener
|| e.getEntity().getType()==EntityType.PIG || e.getEntity().getType()==EntityType.COW || e.getEntity().getType()==EntityType.OCELOT || e.getEntity().getType()==EntityType.WOLF
|| e.getEntity().getType()==EntityType.MUSHROOM_COW) {
LivingEntity f = e.getEntity();
if (f.getType()==EntityType.ZOMBIE ||
f.getType()==EntityType.SKELETON ||
f.getType()==EntityType.PIG_ZOMBIE ||
f.getType()==EntityType.SPIDER ||
f.getType()==EntityType.CREEPER ||
f.getType()==EntityType.ENDERMAN) {
if (f instanceof Monster) {
if (this.plugin.getConfig().getBoolean("thanksgiving-enabled") && Math.random()<=0.01) {
// 0.5% chance of loot chest dropping
f.getWorld().dropItemNaturally(f.getLocation(), this.plugin.generate_LootChest());
}
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) {
z.getWorld().dropItemNaturally(z.getLocation(), this.plugin.generate_LootChest());
}
}
}
//if (Math.random()<=0.005) {
/*
if (Math.random()<=0.005) {
@ -9887,6 +9912,17 @@ implements Listener
store.setItemMeta(meta);
p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!");
}
if (storename.toLowerCase().contains("null")) {
store.setType(Material.DIAMOND_LEGGINGS);
ItemMeta meta = store.getItemMeta();
meta.setDisplayName(meta.getDisplayName().replace(ChatColor.DARK_GRAY+"[BROKEN] ",""));
List<String> lore = store.getItemMeta().getLore();
lore.remove(repairline);
lore.remove(repairline-1);
meta.setLore(lore);
store.setItemMeta(meta);
p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!");
}
if (storename.contains("Diamond Helmet")) {
store.setType(Material.DIAMOND_HELMET);
ItemMeta meta = store.getItemMeta();
@ -12224,10 +12260,11 @@ implements Listener
list[i].playSound(list[i].getLocation(), Sound.NOTE_PLING, 8, 0.7f);
}
}
/*Makes no sense as to why this is here.
if (!this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".revived")) {
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".revived", Boolean.valueOf(true));
//this.plugin.saveAccountsConfig();
}
}*/
if (this.plugin.getConfig().getBoolean("spleefinsession") && (p.getName().toLowerCase().compareTo(this.plugin.getConfig().getString("spleefrequestaplayer"))==0 || p.getName().compareTo(this.plugin.getConfig().getString("spleefrequestbplayer"))==0)) {
//This player was in spleef. End the spleef session as if this player lost.
//We lose. Other player wins.
@ -12506,19 +12543,19 @@ implements Listener
}
}
if (!plugin.PlayerinJob(p, "Explorer") || (plugin.PlayerinJob(p, "Explorer") && plugin.getJobLv("Explorer", p)<20)) {
double balance = Main.economy.getBalance(p.getName().toLowerCase());
double balance = Main.economy.getBalance(p.getName());
double lose = plugin.getConfig().getDouble("losemoney.LoseAmount");
double loseAmount = Main.economy.getBalance(p.getName().toLowerCase()) / 100.0D * lose;
double loseAmount = Main.economy.getBalance(p.getName()) / 100.0D * lose;
String message = "You lost $%amount because you died.";
DecimalFormat df = new DecimalFormat("#0.00");
loseAmount = Double.parseDouble(df.format(loseAmount));
if (Main.economy.has(p.getName().toLowerCase(), loseAmount)) {
plugin.getLogger().info("Player " + p.getName() + "'s getting withdrawed with " + loseAmount + "$");
Main.economy.withdrawPlayer(p.getName().toLowerCase(), loseAmount);
Main.economy.withdrawPlayer(p.getName(), loseAmount);
message = message.replaceAll("%amount", String.valueOf(loseAmount));
} else {
plugin.getLogger().info("Player " + p.getName() + "'s getting withdrawed with " + balance + "$");
Main.economy.withdrawPlayer(p.getName().toLowerCase(), balance);
Main.economy.withdrawPlayer(p.getName(), balance);
message = message.replaceAll("%amount", String.valueOf(balance));
}
p.sendMessage(message);

@ -75,9 +75,9 @@ public class commandBankEconomy
String notEnoughMoney = "<EFBFBD>˜aYou do not own that amount of money.";
String succesfullDeposited = "<EFBFBD>˜aYou have deposited<EFBFBD>˜b";
String succesfullWithdraw = "<EFBFBD>˜aYou have withdrawn<EFBFBD>˜b";
String cmdTransferToPlayer1 = "<EFBFBD>˜aYou have transfered<EFBFBD>˜b";
String cmdTransferToPlayer1 = "<EFBFBD>˜aYou have transferred<EFBFBD>˜b";
String cmdTransferToPlayer2 = "<EFBFBD>˜ato<EFBFBD>˜b";
String cmdTransferToTarget1 = "<EFBFBD>˜ahas transfered to you<EFBFBD>˜b";
String cmdTransferToTarget1 = "<EFBFBD>˜ahas transferred to you<EFBFBD>˜b";
String cmdTransferSameNick = "<EFBFBD>˜aYou can't transfer money to yourself.";
String cmdEditAvaibleActions = "<EFBFBD>˜aAvaible actions: status, balance";
String cmdEditDisabledToPlayer1 = "<EFBFBD>˜aYou have disabled";
@ -1580,6 +1580,7 @@ public String convertToItemName(String val) {
double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money");
double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz);
finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate");
finalcost = finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth());
//finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax");
if (mymoney>=finalcost) {
//Allow teleport to occur.
@ -1626,6 +1627,7 @@ public String convertToItemName(String val) {
double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName().toLowerCase().toLowerCase() + ".money");
double finalcost = Math.abs(p.getLocation().getX()-otherx)+Math.abs(p.getLocation().getY()-othery)+Math.abs(p.getLocation().getZ()-otherz);
finalcost *= this.plugin.getConfig().getDouble("teleport-cost-rate");
finalcost = finalcost * 15 * ((p.getMaxHealth()-p.getHealth())/p.getMaxHealth());
//finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax");
if (mymoney>=finalcost) {
//Allow teleport to occur.
@ -1719,10 +1721,11 @@ public String convertToItemName(String val) {
if (this.plugin.getConfig().contains("jobs."+job+"_members")) {
p.sendMessage("Players in the "+job_color+job+" job:");
String[] players = this.plugin.getConfig().getString("jobs."+job+"_members").split(", ");
int lowest = 40;
int lowest = 999999;
List<String> sorted_players = new ArrayList<String>();
for (int i=0;i<players.length;i++) {
sorted_players.add(players[i]); //Add everyone to the list.
Bukkit.getLogger().info("Add player "+players[i]);
}
//Sort them.
List<String> sorted_list_players = new ArrayList<String>();
@ -1740,7 +1743,10 @@ public String convertToItemName(String val) {
sorted_list_players.add(sorted_players.get(lowest_slot));
sorted_players.remove(lowest_slot);
lowest_slot=-1;
lowest=40;
lowest=999999;
} else {
p.sendMessage(ChatColor.GOLD+"Sorry, something bad happened! Please report this to an administrator. (EC1)");
break; //Something bad happened.
}
}
if (sorted_list_players.size()>0) {
@ -1752,7 +1758,7 @@ public String convertToItemName(String val) {
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"- No one in this job yet. -");
}
} else {
p.sendMessage(ChatColor.GOLD+"Sorry, something bad happened! Please report this to an administrator.");
p.sendMessage(ChatColor.GOLD+"Sorry, something bad happened! Please report this to an administrator. (EC0)");
}
} else {
p.sendMessage(ChatColor.RED+"Sorry, that is not a valid job!");

Loading…
Cancel
Save