fixes to combust event so that it is raised only once on combustion.

minor fixes to imports
This commit is contained in:
Andrew Ardill 2011-01-18 16:30:01 +11:00
parent ddc30dd6e3
commit d7d7a68f91
8 changed files with 44 additions and 26 deletions

View file

@ -1,14 +1,12 @@
package net.minecraft.server;
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
// CraftBukkit end
import java.util.List;
@ -221,9 +219,12 @@ public abstract class Entity {
if (Z % 20 == 0) {
// CraftBukkit start
if(this instanceof EntityLiving) {
CraftServer server = ((WorldServer)l).getServer();
CraftServer server = ((WorldServer) l).getServer();
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.DROWNING;
int damageDone = 1;
EntityDamageEvent ede = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.DROWNING, 1);
EntityDamageEvent ede = new EntityDamageEvent(damagee, damageType, damageDone);
server.getPluginManager().callEvent(ede);
if (!ede.isCancelled()){
@ -254,19 +255,30 @@ public abstract class Entity {
if (!ae) {
// CraftBukkit start
if(this instanceof EntityLiving) {
CraftServer server = ((WorldServer)l).getServer();
CraftServer server = ((WorldServer) l).getServer();
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.LAVA;
int damageDone = 4;
EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(null, this.getBukkitEntity(), EntityDamageEvent.DamageCause.LAVA, 4);
EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone);
server.getPluginManager().callEvent(ede);
if (!ede.isCancelled()){
a(((Entity) (null)), ede.getDamage());
}
EntityCombustEvent ece = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity());
server.getPluginManager().callEvent(ece);
if (!ece.isCancelled()){
if(Z <= 0){
// not on fire yet
Type eventType = Type.ENTITY_COMBUST;
EntityCombustEvent ece = new EntityCombustEvent(eventType, damagee);
server.getPluginManager().callEvent(ece);
if (!ece.isCancelled()){
Z = 600;
}
} else {
// reset fire level back to max
Z = 600;
}
} else {
a(((Entity) (null)), 4);
Z = 600;
@ -473,9 +485,24 @@ public abstract class Entity {
b(1);
if (!flag2) {
Z++;
if (Z == 0) {
//CraftBukkit start
if(Z <= 0){
// not on fire yet
CraftServer server = ((WorldServer) l).getServer();
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
Type eventType = Type.ENTITY_COMBUST;
EntityCombustEvent ece = new EntityCombustEvent(eventType, damagee);
server.getPluginManager().callEvent(ece);
if (!ece.isCancelled()){
Z = 300;
}
} else {
// reset fire level back to max
Z = 300;
}
//CraftBukkit end
}
} else if (Z <= 0) {
Z = -Y;
@ -505,9 +532,12 @@ public abstract class Entity {
if (!ae) {
// CraftBukkit start
if(this instanceof EntityLiving) {
CraftServer server = ((WorldServer)l).getServer();
CraftServer server = ((WorldServer) l).getServer();
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.FIRE;
int damageDone = i1;
EntityDamageEvent ede = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE, i1);
EntityDamageEvent ede = new EntityDamageEvent(damagee, damageType, damageDone);
server.getPluginManager().callEvent(ede);
if (!ede.isCancelled()){

View file

@ -1,12 +1,9 @@
package net.minecraft.server;
import java.util.List;
import java.util.Random;
//CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftArrow;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;

View file

@ -5,7 +5,6 @@ import java.util.Random;
// CraftBukkit start
import org.bukkit.Location;
import org.bukkit.craftbukkit.entity.CraftArrow;
import org.bukkit.craftbukkit.entity.CraftBoat;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.CraftMappable;

View file

@ -3,11 +3,7 @@ package net.minecraft.server;
import java.util.List;
import java.util.Random;
//CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftEgg;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftFireball;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;

View file

@ -4,7 +4,6 @@ import java.util.List;
import java.util.Random;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftAnimals;
import org.bukkit.craftbukkit.entity.CraftGhast;
public class EntityGhast extends EntityFlying implements IMobs {

View file

@ -3,7 +3,6 @@ package net.minecraft.server;
import java.util.Random;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftAnimals;
import org.bukkit.craftbukkit.entity.CraftItem;
public class EntityItem extends Entity {

View file

@ -4,7 +4,6 @@ import java.util.List;
import java.util.Random;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftAnimals;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
public abstract class EntityLiving extends Entity {

View file

@ -5,7 +5,6 @@ import java.util.Random;
// CraftBukkit start
import org.bukkit.Location;
import org.bukkit.craftbukkit.entity.CraftEgg;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftPoweredMinecart;
import org.bukkit.craftbukkit.entity.CraftStorageMinecart;