Fix typos, mob head properties, add in Airborne effect for Blaze heads.

dev
sigonasr2 11 years ago
parent 950b85cf34
commit f9b2fb23d9
  1. 36
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 10
      BankEconomyMod/src/me/kaZep/Base/MobHead.java
  3. 92
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java

@ -2363,6 +2363,25 @@ public void runTick() {
if (Main.SERVER_TICK_TIME%36000==0) { if (Main.SERVER_TICK_TIME%36000==0) {
//Every 30 minutes, clear out the list of poisoned mobs, in case some are non-existent now. //Every 30 minutes, clear out the list of poisoned mobs, in case some are non-existent now.
mob_list.clear(); mob_list.clear();
//Report player incomes.
for (int i=0;i<SPEED_CONTROL.size();i++) {
SPEED_CONTROL.get(i).updatePlayerSpd();
try
{
String filename= "PlayerBuffData.txt";
FileWriter fw = new FileWriter(filename,true); //the true will append the new data
DecimalFormat df = new DecimalFormat("#0.00");
fw.write(SPEED_CONTROL.get(i).p.getName()+" has earned: $"+df.format(SPEED_CONTROL.get(i).money_gained)+"\n");//appends the string to the file
if (i+1==SPEED_CONTROL.size()) {
fw.write("========\n");
}
fw.close();
}
catch(IOException ioe)
{
System.err.println("IOException: " + ioe.getMessage());
}
}
} }
if (Main.SERVER_TICK_TIME%600==0) { if (Main.SERVER_TICK_TIME%600==0) {
saveAccountsConfig(); //Save account data once every 30 seconds. saveAccountsConfig(); //Save account data once every 30 seconds.
@ -2970,23 +2989,6 @@ public void checkJukeboxes() {
Bukkit.getWorld("world").setThunderDuration((int)(Math.random()*6000)); Bukkit.getWorld("world").setThunderDuration((int)(Math.random()*6000));
} }
LOGGING_UPDATE_COUNTS=0; LOGGING_UPDATE_COUNTS=0;
for (int i=0;i<SPEED_CONTROL.size();i++) {
SPEED_CONTROL.get(i).updatePlayerSpd();
try
{
String filename= "PlayerBuffData.txt";
FileWriter fw = new FileWriter(filename,true); //the true will append the new data
fw.write("["+SERVER_TICK_TIME+"]"+"PlayerBuffData for "+SPEED_CONTROL.get(i).p.getName()+": "+SPEED_CONTROL.get(i).toString()+"\n");//appends the string to the file
if (i+1==SPEED_CONTROL.size()) {
fw.write("========\n");
}
fw.close();
}
catch(IOException ioe)
{
System.err.println("IOException: " + ioe.getMessage());
}
}
if (SPEED_CONTROL.size()!=Bukkit.getOnlinePlayers().length) { if (SPEED_CONTROL.size()!=Bukkit.getOnlinePlayers().length) {
Bukkit.getLogger().warning("["+SERVER_TICK_TIME+"]SPEED_CONTROL and ONLINE PLAYERS list length don't match! ("+SPEED_CONTROL.size()+"/"+Bukkit.getOnlinePlayers().length+")"); Bukkit.getLogger().warning("["+SERVER_TICK_TIME+"]SPEED_CONTROL and ONLINE PLAYERS list length don't match! ("+SPEED_CONTROL.size()+"/"+Bukkit.getOnlinePlayers().length+")");
} }

@ -354,11 +354,11 @@ public class MobHead {
skullMeta.setOwner("MHF_Blaze"); skullMeta.setOwner("MHF_Blaze");
List<String> newlore = new ArrayList<String>(); List<String> newlore = new ArrayList<String>();
if (rare_head_type==MobHeadRareType.RARE_TYPE_A) { if (rare_head_type==MobHeadRareType.RARE_TYPE_A) {
newlore.add(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send enemy");
newlore.add(ChatColor.GOLD+" airborne.");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second ignite duration"); newlore.add(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second ignite duration");
newlore.add(ChatColor.GOLD+" on hit."); newlore.add(ChatColor.GOLD+" on hit.");
} else {
newlore.add(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send enemy");
newlore.add(ChatColor.GOLD+" airborne.");
} }
skullMeta.setLore(newlore); skullMeta.setLore(newlore);
newhead.setItemMeta(skullMeta); newhead.setItemMeta(skullMeta);
@ -590,12 +590,12 @@ public class MobHead {
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send enemy")) { if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send enemy")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_A); //return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_A);
headtype=MobHeadType.BLAZE; headtype=MobHeadType.BLAZE;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;} if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;}
} }
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second ignite duration")) { if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3 "+ChatColor.GOLD+"second ignite duration")) {
//return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B); //return new MobHead(MobHeadType.BLAZE, true, MobHeadRareType.RARE_TYPE_B);
headtype=MobHeadType.BLAZE; headtype=MobHeadType.BLAZE;
if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_B;} if (!ampersand) {raretype=MobHeadRareType.RARE_TYPE_A;}
} }
if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send down")) { if (getLore.contains(ChatColor.LIGHT_PURPLE+"+3% "+ChatColor.GOLD+"chance to send down")) {
//return new MobHead(MobHeadType.GHAST, true, MobHeadRareType.RARE_TYPE_A); //return new MobHead(MobHeadType.GHAST, true, MobHeadRareType.RARE_TYPE_A);

@ -11088,12 +11088,48 @@ implements Listener
ignitedur+=blazerareheads*3; ignitedur+=blazerareheads*3;
ignitedur+=blazepoweredheads; ignitedur+=blazepoweredheads;
ignitedur+=blazepoweredrareheads*5; ignitedur+=blazepoweredrareheads*5;
blazerareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.BLAZE,true,MobHeadRareType.RARE_TYPE_B), playerheads);
int airbornechance=0;
airbornechance+=blazerareheads*3;
airbornechance+=blazepoweredheads;
airbornechance+=blazepoweredrareheads*10;
if (Math.random()*100<=critchance) { if (Math.random()*100<=critchance) {
e.setDamage(e.getDamage()*2); e.setDamage(e.getDamage()*2);
} }
if (Math.random()*100<=snarechance) { if (Math.random()*100<=snarechance) {
m.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100,7,true)); m.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100,7,true));
}
if (Math.random()*100<=airbornechance) {
//m.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100,7,true));
final LivingEntity l = (LivingEntity)e.getEntity();
Location airborne_loc = l.getLocation();
//Check upwards. Stop if we hit a solid block.
int starty=l.getLocation().getBlockY();
int checky=l.getLocation().getBlockY();
/*16 is max height that a mob will be set to.*/
while (checky-starty<19 && l.getWorld().getBlockAt(l.getLocation().getBlockX(),l.getLocation().getBlockY()+checky,l.getLocation().getBlockZ()).getType()==Material.AIR) {
checky++;
}
if (checky-starty>3) {
checky-=3;
} else {
checky=starty;
}
final Location teleport_to = new Location(l.getWorld(),l.getLocation().getBlockX(),checky,l.getLocation().getBlockZ());
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
l.teleport(teleport_to);
}
},1);
} }
if (ignitedur>0) { if (ignitedur>0) {
@ -11127,10 +11163,12 @@ implements Listener
i--; i--;
} }
} }
for (int i=0;i<nearby_mobs.size();i++) { if (aoedmg>0) {
if (!nearby_mobs.get(i).getUniqueId().equals(m)) { for (int i=0;i<nearby_mobs.size();i++) {
LivingEntity m2 = (LivingEntity)nearby_mobs.get(i); if (!nearby_mobs.get(i).getUniqueId().equals(m)) {
m2.damage(e.getDamage()*(aoedmg/100.0d)); LivingEntity m2 = (LivingEntity)nearby_mobs.get(i);
m2.damage(e.getDamage()*(aoedmg/100.0d));
}
} }
} }
/*if (m.hasPotionEffect(PotionEffectType.SLOW) && Main.SERVER_TICK_TIME-this.plugin.getPlayerData(p).lastsneaktime<=60) { /*if (m.hasPotionEffect(PotionEffectType.SLOW) && Main.SERVER_TICK_TIME-this.plugin.getPlayerData(p).lastsneaktime<=60) {
@ -11447,12 +11485,48 @@ implements Listener
ignitedur+=blazerareheads*3; ignitedur+=blazerareheads*3;
ignitedur+=blazepoweredheads; ignitedur+=blazepoweredheads;
ignitedur+=blazepoweredrareheads*5; ignitedur+=blazepoweredrareheads*5;
blazerareheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.BLAZE,true,MobHeadRareType.RARE_TYPE_B), playerheads);
int airbornechance=0;
airbornechance+=blazerareheads*3;
airbornechance+=blazepoweredheads;
airbornechance+=blazepoweredrareheads*10;
if (Math.random()*100<=critchance) { if (Math.random()*100<=critchance) {
e.setDamage(e.getDamage()*2); e.setDamage(e.getDamage()*2);
} }
if (Math.random()*100<=snarechance) { if (Math.random()*100<=snarechance) {
m.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100,7,true)); m.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100,7,true));
}
if (Math.random()*100<=airbornechance) {
//m.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100,7,true));
final LivingEntity l = (LivingEntity)e.getEntity();
Location airborne_loc = l.getLocation();
//Check upwards. Stop if we hit a solid block.
int starty=l.getLocation().getBlockY();
int checky=l.getLocation().getBlockY();
/*16 is max height that a mob will be set to.*/
while (checky-starty<19 && l.getWorld().getBlockAt(l.getLocation().getBlockX(),l.getLocation().getBlockY()+checky,l.getLocation().getBlockZ()).getType()==Material.AIR) {
checky++;
}
if (checky-starty>3) {
checky-=3;
} else {
checky=starty;
}
final Location teleport_to = new Location(l.getWorld(),l.getLocation().getBlockX(),checky,l.getLocation().getBlockZ());
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
l.teleport(teleport_to);
}
},1);
} }
if (ignitedur>0) { if (ignitedur>0) {
@ -11487,10 +11561,12 @@ implements Listener
i--; i--;
} }
} }
for (int i=0;i<nearby_mobs.size();i++) { if (aoedmg>0) {
if (!nearby_mobs.get(i).getUniqueId().equals(m)) { for (int i=0;i<nearby_mobs.size();i++) {
LivingEntity m2 = (LivingEntity)nearby_mobs.get(i); if (!nearby_mobs.get(i).getUniqueId().equals(m)) {
m2.damage(e.getDamage()*(aoedmg/100.0d)); LivingEntity m2 = (LivingEntity)nearby_mobs.get(i);
m2.damage(e.getDamage()*(aoedmg/100.0d));
}
} }
} }
int witherskeletonheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON), playerheads); int witherskeletonheads = this.plugin.getMobHeadAmt(new MobHead(MobHeadType.WITHER_SKELETON), playerheads);

Loading…
Cancel
Save