Revert "Fire modifications. Move of tick code."

This reverts commit 35c249bc8f.
dev
sigonasr2 11 years ago
parent 35c249bc8f
commit df4a0b905a
  1. 2610
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 97
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  3. 6
      BankEconomyMod/src/me/kaZep/Base/RecyclingCenterNode.java

File diff suppressed because it is too large Load Diff

@ -3646,7 +3646,6 @@ implements Listener
e.getBlock().getType()==Material.SAND ||
e.getBlock().getType()==Material.GRAVEL && Math.random()<=0.0025 /*0.25% chance*/) {
ItemStack artifact = new ItemStack(Material.CLAY_BALL);
artifact.addEnchantment(Enchantment.LOOT_BONUS_MOBS, 0);
ItemMeta meta = artifact.getItemMeta();
List<String> lore = new ArrayList<String>();
lore.add("This clump of material seems to");
@ -7108,59 +7107,6 @@ implements Listener
ev.event=0;
this.plugin.explorers.add(ev);
}
final public void doFireAspectDamage(final LivingEntity l, final Main plug) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
@Override
public void run() {
if (l.getHealth()!=0 && l.getFireTicks()>60 && !l.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) {
double firedmg=1;
double oldfireticks=l.getFireTicks();
DecimalFormat df = new DecimalFormat("#0.0");
DecimalFormat df2 = new DecimalFormat("#0");
//Bukkit.getLogger().info(l.getType().name()+" health: "+l.getHealth()+", Fire ticks:"+l.getFireTicks());
//Get all fire protection values.
if (l.getEquipment().getBoots()!=null) {
for (int i=0;i<l.getEquipment().getBoots().getEnchantmentLevel(Enchantment.PROTECTION_FIRE);i++) {
firedmg*=0.92;
oldfireticks*=0.92;
}
}
if (l.getEquipment().getLeggings()!=null) {
for (int i=0;i<l.getEquipment().getLeggings().getEnchantmentLevel(Enchantment.PROTECTION_FIRE);i++) {
firedmg*=0.92;
oldfireticks*=0.92;
}
}
if (l.getEquipment().getChestplate()!=null) {
for (int i=0;i<l.getEquipment().getChestplate().getEnchantmentLevel(Enchantment.PROTECTION_FIRE);i++) {
firedmg*=0.92;
oldfireticks*=0.92;
}
}
if (l.getEquipment().getHelmet()!=null) {
for (int i=0;i<l.getEquipment().getHelmet().getEnchantmentLevel(Enchantment.PROTECTION_FIRE);i++) {
firedmg*=0.92;
oldfireticks*=0.92;
}
}
l.setFireTicks((int)oldfireticks);
l.getWorld().playSound(l.getLocation(), Sound.FIZZ, 0.2f, 1);
if (l.getHealth()-firedmg>0) {
l.setHealth(l.getHealth()-firedmg);
} else {
l.setHealth(0);
}
if (l instanceof Player) {
if (plug.getAccountsConfig().getBoolean(((Player)l).getName()+".settings.notify5")) {
((Player)l).sendMessage(ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+"Took "+df.format(firedmg)+" damage from "+ChatColor.WHITE+"FIRE_TICK"+ChatColor.DARK_PURPLE+""+ChatColor.ITALIC+" (-"+df2.format(((firedmg)/l.getMaxHealth())*100)+"%)");
}
}
doFireAspectDamage(l, plug);
}
}
},(int)(20/((double)l.getFireTicks()/60))+1);
}
@EventHandler
public void onHurt(EntityDamageEvent e) {
@ -7177,7 +7123,7 @@ implements Listener
}
},5);
//p.sendMessage("Your Health: "+p.getHealth()+", Damage: "+e.getDamage()+", Actual: "+this.plugin.DMGCALC.getDamage(p, e.getDamage(), DamageCause.ENTITY_ATTACK));
//double actualdmg = this.plugin.DMGCALC.getDamage(p, e.getDamage(), e.getCause());
double actualdmg = this.plugin.DMGCALC.getDamage(p, e.getDamage(), e.getCause());
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) {
@ -7254,11 +7200,14 @@ implements Listener
}
}
EntityType allowedtypes[] = {EntityType.BAT,EntityType.BLAZE,EntityType.CAVE_SPIDER,EntityType.ENDERMAN,EntityType.GHAST,EntityType.MAGMA_CUBE,EntityType.PIG_ZOMBIE,EntityType.SILVERFISH,EntityType.SLIME,EntityType.SPIDER,EntityType.ZOMBIE,EntityType.SKELETON,EntityType.CREEPER};
boolean contains=e.getEntity() instanceof LivingEntity;
boolean contains=e.getEntity() instanceof Monster;
if (contains) {
LivingEntity l = (LivingEntity)e.getEntity();
if (l.getFireTicks()>60 && e.getCause()==DamageCause.LAVA && !l.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) {
l.setFireTicks(l.getFireTicks()+20);
if ((l.getCustomName()==null || (!l.getCustomName().contains(ChatColor.DARK_PURPLE+"") && !l.getCustomName().contains(ChatColor.DARK_AQUA+""))) && l.getType()!=EntityType.ENDER_DRAGON) {
if ((l.getTicksLived()<120 && e.getCause()==DamageCause.SUFFOCATION)) {
l.remove();
e.setCancelled(true);
}
}
}
}
@ -7322,9 +7271,6 @@ implements Listener
@EventHandler
public void onPlayerOnFire(EntityCombustEvent e) {
if (e.getEntity() instanceof LivingEntity) {
doFireAspectDamage(((LivingEntity)e.getEntity()), this.plugin);
}
if (e.getEntity().getType()==EntityType.PLAYER) {
Player p = (Player)e.getEntity();
if (this.plugin.getAccountsConfig().getInt(p.getName()+".stats.stat6")>0) {
@ -7399,16 +7345,6 @@ implements Listener
if (e.getEntity() instanceof LivingEntity) {
final LivingEntity l = (LivingEntity)e.getEntity();
if (e.getDamager() instanceof LivingEntity) {
//They are both living entities. Check if damager has fire aspect.
LivingEntity l2 = (LivingEntity)e.getDamager();
if (l2.getEquipment().getItemInHand().getEnchantmentLevel(Enchantment.FIRE_ASPECT)>0) {
l.setFireTicks(l.getFireTicks()+l2.getEquipment().getItemInHand().getEnchantmentLevel(Enchantment.FIRE_ASPECT)*60);
}
if (l2.getEquipment().getItemInHand().getEnchantmentLevel(Enchantment.ARROW_FIRE)>0) {
l.setFireTicks(l.getFireTicks()+l2.getEquipment().getItemInHand().getEnchantmentLevel(Enchantment.ARROW_FIRE)*60);
}
}
if (l instanceof Player) {
e.setDamage(e.getDamage()*1.45d);
if (e.getDamager() instanceof Wither) {
@ -10955,7 +10891,7 @@ implements Listener
}
//There is a small chance we can swap items between two centers.
if (Math.random()<=0.1) {
if (Math.random()<=0.01) {
//Get the first center. It's randomly picked.
if (this.plugin.recycling_center_list.size()<=2) {
//If there are only two centers in the list, it has to be those two...
@ -11815,7 +11751,6 @@ implements Listener
final Player p = e.getEntity();
e.setDeathMessage(e.getDeathMessage().replace(p.getScoreboard().getTeam(p.getName()).getPrefix()+p.getName()+p.getScoreboard().getTeam(p.getName()).getSuffix(),p.getName()));
p.getScoreboard().getTeam(p.getName()).setSuffix("");
this.plugin.last_player_death_time = Main.SERVER_TICK_TIME;
boolean survivor=false;
if (this.plugin.PlayerinJob(p, "Explorer")) {
if (this.plugin.getJobLv("Explorer", p)>=10) {
@ -12621,6 +12556,10 @@ implements Listener
//******************************//All Job Buff related items go in here.
if (e.getAction()==Action.LEFT_CLICK_BLOCK || e.getAction()==Action.RIGHT_CLICK_AIR) {
if (this.plugin.hasJobBuff("Builder", p, Job.JOB10)) {
if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) {
p.removePotionEffect(PotionEffectType.JUMP);
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9));
}
if (this.plugin.hasJobBuff("Builder", p, Job.JOB40) && !p.getAllowFlight()) {
p.setAllowFlight(true);
p.sendMessage(ChatColor.DARK_GRAY+""+ChatColor.ITALIC+"Flight enabled...");
@ -12646,10 +12585,6 @@ implements Listener
pd.SetClickedBlock(checkblock.getLocation());
} else {
if (pd.GetClickedBlock().distance(checkblock.getLocation())<=500) {//Make sure the range is small enough.
if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) {
p.removePotionEffect(PotionEffectType.JUMP);
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9));
}
//Compare the blocks and see if they are the same.
boolean successful=true;
int expbefore = (int)this.plugin.getPlayerCurrentJobExp(p, "Builder");
@ -12782,6 +12717,10 @@ implements Listener
}
}
if (e.getAction()==Action.LEFT_CLICK_BLOCK && this.plugin.hasJobBuff("Builder", p, Job.JOB5)) {
if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) {
p.removePotionEffect(PotionEffectType.JUMP);
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9));
}
if (this.plugin.hasJobBuff("Builder", p, Job.JOB40) && !p.getAllowFlight()) {
p.setAllowFlight(true);
p.sendMessage(ChatColor.DARK_GRAY+""+ChatColor.ITALIC+"Flight enabled...");
@ -12800,10 +12739,6 @@ implements Listener
pd.SetClickedBlock(e.getClickedBlock().getLocation());
} else {
if (pd.GetClickedBlock().distance(e.getClickedBlock().getLocation())<=500) {//Make sure the range is small enough.
if (this.plugin.hasJobBuff("Builder", p, Job.JOB30B)) {
p.removePotionEffect(PotionEffectType.JUMP);
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,200,9));
}
int expbefore = (int)this.plugin.getPlayerCurrentJobExp(p, "Builder");
//Compare the blocks and see if they are the same.
boolean successful=true;

@ -15,8 +15,8 @@ import org.bukkit.plugin.Plugin;
//deposit, choosing the closest one.
public class RecyclingCenterNode {
public static double chanceincrease = 1.5; //The amount of chance that each item will increase the chest as it gets placed. Increase this for less items.
public static double chestdecrease = 0.25; //The amount of chance that each item will decrease the chest. Increase this for more items.
public static double chanceincrease = 3.0; //The amount of chance that each item will increase the chest as it gets placed. Increase this for less items.
public static double chestdecrease = 0.05; //The amount of chance that each item will decrease the chest. Increase this for more items.
//Store our items we can give out array along with our rare items we might potentially track.
public static int[] items = {1,3,4,5,6,12,13,14,15,17,18,20,22,23,24,25,27,28,39,31,32,33,35,37,38,39,40,41,42,44,45,46,47,48,49,50,53,54,57,58,61,65,66,67,69,70,72,76,77,78,80,81,82,84,85,86,87,88,89,91,96,98,101,102,103,106,107,108,109,111,112,113,114,116,121,122,123,126,128,130,131,133,134,135,136,138,139,143,145,146,147,148,151,152,154,155,156,157,158,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267};
//Rare items can only be given out in quantities of 1. To prevent massive amounts of OP.
@ -102,7 +102,7 @@ public class RecyclingCenterNode {
tempchance*=2.0d;
}
}
if (Math.random()*tempchance<1.0d || (Main.SERVER_TICK_TIME-this.plugin.last_player_death_time<=12000 && Math.random()*tempchance<4.0d) /*Drop items frequently for the next 10 minutes if someone just died.*/) {
if (Math.random()*tempchance<1.0d) {
boolean contains=false;
for (int k=0;k<unalloweditems.length;k++) {
if (itemslot==unalloweditems[k]) {

Loading…
Cancel
Save