Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
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.craftbukkit.CraftServer;
|
||||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@ -100,16 +101,21 @@ public class BlockCactus extends Block {
|
|||||||
|
|
||||||
if(entity instanceof EntityLiving) {
|
if(entity instanceof EntityLiving) {
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
CraftServer server = ((WorldServer) world).getServer();
|
||||||
CraftEntity toPassIn = new CraftLivingEntity(server, (EntityLiving) entity);
|
org.bukkit.block.Block damager = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||||
EntityDamageByBlockEvent edbbe = new EntityDamageByBlockEvent(((WorldServer) world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamageEvent.DamageCause.CONTACT, 1);
|
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);
|
server.getPluginManager().callEvent(edbbe);
|
||||||
|
|
||||||
if (!edbbe.isCancelled()){
|
if (!edbbe.isCancelled()){
|
||||||
entity.a(((Entity) (null)), edbbe.getDamage());
|
entity.a(((Entity) (null)), edbbe.getDamage());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
entity.a(((Entity) (null)), 1);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
entity.a(((Entity) (null)), 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,11 +256,12 @@ public abstract class Entity {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if(this instanceof EntityLiving) {
|
if(this instanceof EntityLiving) {
|
||||||
CraftServer server = ((WorldServer) l).getServer();
|
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();
|
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||||
DamageCause damageType = EntityDamageEvent.DamageCause.LAVA;
|
DamageCause damageType = EntityDamageEvent.DamageCause.LAVA;
|
||||||
int damageDone = 4;
|
int damageDone = 4;
|
||||||
|
|
||||||
EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone);
|
EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
|
||||||
server.getPluginManager().callEvent(ede);
|
server.getPluginManager().callEvent(ede);
|
||||||
if (!ede.isCancelled()){
|
if (!ede.isCancelled()){
|
||||||
a(((Entity) (null)), ede.getDamage());
|
a(((Entity) (null)), ede.getDamage());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren