Add in new fire mechanics. Increase Recycling Center numbers.

master_event
sigonasr2 11 years ago
parent 61ed29266b
commit b9d1039844
  1. 1
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 69
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java
  3. 6
      BankEconomyMod/src/me/kaZep/Base/RecyclingCenterNode.java
  4. 6
      Plugin/.classpath
  5. 17
      Plugin/.project
  6. 11
      Plugin/.settings/org.eclipse.jdt.core.prefs

@ -109,6 +109,7 @@ public class Main extends JavaPlugin
public long last_bank_withdraw_use_time=0;
public String last_bank_withdraw_user="";
public long last_boss_dungeon_time=0;
public long last_player_death_time=0;
public long check_nether_time=0;
public long check_lights_time=0;
public long check_spleef_game=0;

@ -6701,6 +6701,60 @@ 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) {
@ -6794,14 +6848,11 @@ 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 Monster;
boolean contains=e.getEntity() instanceof LivingEntity;
if (contains) {
LivingEntity l = (LivingEntity)e.getEntity();
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);
}
if (l.getFireTicks()>60 && e.getCause()==DamageCause.LAVA && !l.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE)) {
l.setFireTicks(l.getFireTicks()+20);
}
}
}
@ -6865,6 +6916,9 @@ 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) {
@ -10880,7 +10934,7 @@ implements Listener
}
//There is a small chance we can swap items between two centers.
if (Math.random()<=0.01) {
if (Math.random()<=0.15) {
//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...
@ -11738,6 +11792,7 @@ implements Listener
//If we have Fatal Survivor, use the force! Otherwise, uh, you're dead.
final Player p = e.getEntity();
this.plugin.last_player_death_time = Main.SERVER_TICK_TIME;
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("");
boolean survivor=false;

@ -15,8 +15,8 @@ import org.bukkit.plugin.Plugin;
//deposit, choosing the closest one.
public class RecyclingCenterNode {
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.
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.
//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) {
if (Math.random()*tempchance<1.0d || (Main.SERVER_TICK_TIME-this.plugin.last_player_death_time<=12000 && Math.random()*tempchance<3.0d)) {
boolean contains=false;
for (int k=0;k<unalloweditems.length;k++) {
if (itemslot==unalloweditems[k]) {

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Plugin</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
Loading…
Cancel
Save