small change to block event with lava and cactus, to improve
readability and consistency
Dieser Commit ist enthalten in:
Ursprung
26a590f030
Commit
e275f727d0
@ -9,6 +9,7 @@ import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
// CraftBukkit end
|
||||
|
||||
import java.util.Random;
|
||||
@ -100,16 +101,21 @@ public class BlockCactus extends Block {
|
||||
|
||||
if(entity instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) world).getServer();
|
||||
CraftEntity toPassIn = new CraftLivingEntity(server, (EntityLiving) entity);
|
||||
EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(((WorldServer) world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamageEvent.DamageCause.CONTACT, 1);
|
||||
org.bukkit.block.Block damager = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.entity.Entity damagee = entity.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.CONTACT;
|
||||
int damageDone = 1;
|
||||
|
||||
EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(edbbe);
|
||||
|
||||
if (!edbbe.isCancelled()){
|
||||
entity.a(((Entity) (null)), edbbe.getDamage());
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
entity.a(((Entity) (null)), 1);
|
||||
}
|
||||
// CraftBukkit end
|
||||
entity.a(((Entity) (null)), 1);
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
@ -256,11 +256,12 @@ public abstract class Entity {
|
||||
// CraftBukkit start
|
||||
if(this instanceof EntityLiving) {
|
||||
CraftServer server = ((WorldServer) l).getServer();
|
||||
org.bukkit.block.Block damager = null;//((WorldServer) l).getWorld().getBlockAt(i, j, k);
|
||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||
DamageCause damageType = EntityDamageEvent.DamageCause.LAVA;
|
||||
int damageDone = 4;
|
||||
|
||||
EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone);
|
||||
EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
|
||||
server.getPluginManager().callEvent(ede);
|
||||
if (!ede.isCancelled()){
|
||||
a(((Entity) (null)), ede.getDamage());
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren