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.
This commit is contained in:
parent
9819405e9d
commit
25f10a7a46
@ -2431,6 +2431,13 @@ implements Listener
|
|||||||
double levelsmult=1.0;
|
double levelsmult=1.0;
|
||||||
if (totallvs>20*levelsmult) {
|
if (totallvs>20*levelsmult) {
|
||||||
if (totallvs<40*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.
|
//Sometimes wear leather armor. Only for Skeletons and Zombies.
|
||||||
if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) {
|
if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) {
|
||||||
LivingEntity l = (LivingEntity) e.getEntity();
|
LivingEntity l = (LivingEntity) e.getEntity();
|
||||||
@ -2449,6 +2456,13 @@ implements Listener
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (totallvs<60*levelsmult) {
|
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.
|
//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) {
|
if (e.getEntity().getType()==EntityType.SKELETON || e.getEntity().getType()==EntityType.ZOMBIE) {
|
||||||
LivingEntity l = (LivingEntity) e.getEntity();
|
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) {
|
if (e.getEntity().getType()==EntityType.EXPERIENCE_ORB) {
|
||||||
Bukkit.getWorld("world").spawnEntity(e.getEntity().getLocation(),e.getEntity().getType());
|
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.PIG || e.getEntity().getType()==EntityType.COW || e.getEntity().getType()==EntityType.OCELOT || e.getEntity().getType()==EntityType.WOLF
|
||||||
|| e.getEntity().getType()==EntityType.MUSHROOM_COW) {
|
|| e.getEntity().getType()==EntityType.MUSHROOM_COW) {
|
||||||
LivingEntity f = e.getEntity();
|
LivingEntity f = e.getEntity();
|
||||||
if (f.getType()==EntityType.ZOMBIE ||
|
if (f instanceof Monster) {
|
||||||
f.getType()==EntityType.SKELETON ||
|
|
||||||
f.getType()==EntityType.PIG_ZOMBIE ||
|
|
||||||
f.getType()==EntityType.SPIDER ||
|
|
||||||
f.getType()==EntityType.CREEPER ||
|
|
||||||
f.getType()==EntityType.ENDERMAN) {
|
|
||||||
|
|
||||||
|
|
||||||
if (this.plugin.getConfig().getBoolean("thanksgiving-enabled") && Math.random()<=0.01) {
|
if (this.plugin.getConfig().getBoolean("thanksgiving-enabled") && Math.random()<=0.01) {
|
||||||
// 0.5% chance of loot chest dropping
|
// 0.5% chance of loot chest dropping
|
||||||
f.getWorld().dropItemNaturally(f.getLocation(), this.plugin.generate_LootChest());
|
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) {
|
||||||
/*
|
/*
|
||||||
if (Math.random()<=0.005) {
|
if (Math.random()<=0.005) {
|
||||||
@ -9887,6 +9912,17 @@ implements Listener
|
|||||||
store.setItemMeta(meta);
|
store.setItemMeta(meta);
|
||||||
p.sendMessage("Your "+meta.getDisplayName()+ChatColor.RESET+" has been repaired!");
|
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")) {
|
if (storename.contains("Diamond Helmet")) {
|
||||||
store.setType(Material.DIAMOND_HELMET);
|
store.setType(Material.DIAMOND_HELMET);
|
||||||
ItemMeta meta = store.getItemMeta();
|
ItemMeta meta = store.getItemMeta();
|
||||||
@ -12224,10 +12260,11 @@ implements Listener
|
|||||||
list[i].playSound(list[i].getLocation(), Sound.NOTE_PLING, 8, 0.7f);
|
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")) {
|
if (!this.plugin.getAccountsConfig().getBoolean(p.getName().toLowerCase()+".revived")) {
|
||||||
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".revived", Boolean.valueOf(true));
|
this.plugin.getAccountsConfig().set(p.getName().toLowerCase() + ".revived", Boolean.valueOf(true));
|
||||||
//this.plugin.saveAccountsConfig();
|
//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)) {
|
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.
|
//This player was in spleef. End the spleef session as if this player lost.
|
||||||
//We lose. Other player wins.
|
//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)) {
|
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 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.";
|
String message = "You lost $%amount because you died.";
|
||||||
DecimalFormat df = new DecimalFormat("#0.00");
|
DecimalFormat df = new DecimalFormat("#0.00");
|
||||||
loseAmount = Double.parseDouble(df.format(loseAmount));
|
loseAmount = Double.parseDouble(df.format(loseAmount));
|
||||||
if (Main.economy.has(p.getName().toLowerCase(), loseAmount)) {
|
if (Main.economy.has(p.getName().toLowerCase(), loseAmount)) {
|
||||||
plugin.getLogger().info("Player " + p.getName() + "'s getting withdrawed with " + 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));
|
message = message.replaceAll("%amount", String.valueOf(loseAmount));
|
||||||
} else {
|
} else {
|
||||||
plugin.getLogger().info("Player " + p.getName() + "'s getting withdrawed with " + balance + "$");
|
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));
|
message = message.replaceAll("%amount", String.valueOf(balance));
|
||||||
}
|
}
|
||||||
p.sendMessage(message);
|
p.sendMessage(message);
|
||||||
|
@ -75,9 +75,9 @@ public class commandBankEconomy
|
|||||||
String notEnoughMoney = "<EFBFBD>˜aYou do not own that amount of money.";
|
String notEnoughMoney = "<EFBFBD>˜aYou do not own that amount of money.";
|
||||||
String succesfullDeposited = "<EFBFBD>˜aYou have deposited<65>˜b";
|
String succesfullDeposited = "<EFBFBD>˜aYou have deposited<65>˜b";
|
||||||
String succesfullWithdraw = "<EFBFBD>˜aYou have withdrawn<77>˜b";
|
String succesfullWithdraw = "<EFBFBD>˜aYou have withdrawn<77>˜b";
|
||||||
String cmdTransferToPlayer1 = "<EFBFBD>˜aYou have transfered<EFBFBD>˜b";
|
String cmdTransferToPlayer1 = "<EFBFBD>˜aYou have transferred<EFBFBD>˜b";
|
||||||
String cmdTransferToPlayer2 = "<EFBFBD>˜ato<EFBFBD>˜b";
|
String cmdTransferToPlayer2 = "<EFBFBD>˜ato<EFBFBD>˜b";
|
||||||
String cmdTransferToTarget1 = "<EFBFBD>˜ahas transfered to you<6F>˜b";
|
String cmdTransferToTarget1 = "<EFBFBD>˜ahas transferred to you<6F>˜b";
|
||||||
String cmdTransferSameNick = "<EFBFBD>˜aYou can't transfer money to yourself.";
|
String cmdTransferSameNick = "<EFBFBD>˜aYou can't transfer money to yourself.";
|
||||||
String cmdEditAvaibleActions = "<EFBFBD>˜aAvaible actions: status, balance";
|
String cmdEditAvaibleActions = "<EFBFBD>˜aAvaible actions: status, balance";
|
||||||
String cmdEditDisabledToPlayer1 = "<EFBFBD>˜aYou have disabled";
|
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 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);
|
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 *= 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");
|
//finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax");
|
||||||
if (mymoney>=finalcost) {
|
if (mymoney>=finalcost) {
|
||||||
//Allow teleport to occur.
|
//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 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);
|
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 *= 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");
|
//finalcost += mymoney*this.plugin.getConfig().getDouble("teleport-cost-tax");
|
||||||
if (mymoney>=finalcost) {
|
if (mymoney>=finalcost) {
|
||||||
//Allow teleport to occur.
|
//Allow teleport to occur.
|
||||||
@ -1719,10 +1721,11 @@ public String convertToItemName(String val) {
|
|||||||
if (this.plugin.getConfig().contains("jobs."+job+"_members")) {
|
if (this.plugin.getConfig().contains("jobs."+job+"_members")) {
|
||||||
p.sendMessage("Players in the "+job_color+job+" job:");
|
p.sendMessage("Players in the "+job_color+job+" job:");
|
||||||
String[] players = this.plugin.getConfig().getString("jobs."+job+"_members").split(", ");
|
String[] players = this.plugin.getConfig().getString("jobs."+job+"_members").split(", ");
|
||||||
int lowest = 40;
|
int lowest = 999999;
|
||||||
List<String> sorted_players = new ArrayList<String>();
|
List<String> sorted_players = new ArrayList<String>();
|
||||||
for (int i=0;i<players.length;i++) {
|
for (int i=0;i<players.length;i++) {
|
||||||
sorted_players.add(players[i]); //Add everyone to the list.
|
sorted_players.add(players[i]); //Add everyone to the list.
|
||||||
|
Bukkit.getLogger().info("Add player "+players[i]);
|
||||||
}
|
}
|
||||||
//Sort them.
|
//Sort them.
|
||||||
List<String> sorted_list_players = new ArrayList<String>();
|
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_list_players.add(sorted_players.get(lowest_slot));
|
||||||
sorted_players.remove(lowest_slot);
|
sorted_players.remove(lowest_slot);
|
||||||
lowest_slot=-1;
|
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) {
|
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. -");
|
p.sendMessage(ChatColor.GRAY+""+ChatColor.ITALIC+"- No one in this job yet. -");
|
||||||
}
|
}
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
p.sendMessage(ChatColor.RED+"Sorry, that is not a valid job!");
|
p.sendMessage(ChatColor.RED+"Sorry, that is not a valid job!");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user