mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-18 22:03:51 -07:00
SPIGOT-4372: LightningStrikeEvent cause API
This commit is contained in:
@@ -305,7 +305,7 @@
|
||||
|
||||
return false;
|
||||
} else {
|
||||
@@ -316,7 +485,7 @@
|
||||
@@ -316,10 +485,10 @@
|
||||
entityhorseskeleton.s(true);
|
||||
entityhorseskeleton.setAgeRaw(0);
|
||||
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
@@ -313,7 +313,11 @@
|
||||
+ this.addEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
|
||||
}
|
||||
|
||||
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, flag2));
|
||||
- this.strikeLightning(new EntityLightning(this, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, flag2));
|
||||
+ this.strikeLightning(new EntityLightning(this, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, flag2), org.bukkit.event.weather.LightningStrikeEvent.Cause.WEATHER); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,11 +501,11 @@
|
||||
BiomeBase biomebase = this.getBiome(blockposition);
|
||||
|
||||
@@ -473,12 +477,17 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -786,8 +999,16 @@
|
||||
@@ -785,9 +998,21 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
public boolean strikeLightning(Entity entity) {
|
||||
+ // CraftBukkit start
|
||||
+ LightningStrikeEvent lightning = new LightningStrikeEvent(this.getWorld(), (org.bukkit.entity.LightningStrike) entity.getBukkitEntity());
|
||||
+ return this.strikeLightning(entity, LightningStrikeEvent.Cause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ public boolean strikeLightning(Entity entity, LightningStrikeEvent.Cause cause) {
|
||||
+ LightningStrikeEvent lightning = new LightningStrikeEvent(this.getWorld(), (org.bukkit.entity.LightningStrike) entity.getBukkitEntity(), cause);
|
||||
+ this.getServer().getPluginManager().callEvent(lightning);
|
||||
+
|
||||
+ if (lightning.isCancelled()) {
|
||||
@@ -491,7 +500,7 @@
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -803,6 +1024,14 @@
|
||||
@@ -803,6 +1028,14 @@
|
||||
}
|
||||
|
||||
public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
|
||||
@@ -506,7 +515,7 @@
|
||||
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, flag1);
|
||||
|
||||
if (damagesource != null) {
|
||||
@@ -811,6 +1040,8 @@
|
||||
@@ -811,6 +1044,8 @@
|
||||
|
||||
explosion.a();
|
||||
explosion.a(false);
|
||||
@@ -515,7 +524,7 @@
|
||||
if (!flag1) {
|
||||
explosion.clearBlocks();
|
||||
}
|
||||
@@ -837,7 +1068,8 @@
|
||||
@@ -837,7 +1072,8 @@
|
||||
BlockActionData blockactiondata = (BlockActionData) this.d.removeFirst();
|
||||
|
||||
if (this.a(blockactiondata)) {
|
||||
@@ -525,7 +534,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -858,6 +1090,7 @@
|
||||
@@ -858,6 +1094,7 @@
|
||||
boolean flag = this.isRaining();
|
||||
|
||||
super.w();
|
||||
@@ -533,7 +542,7 @@
|
||||
if (this.o != this.p) {
|
||||
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.p)), this.worldProvider.getDimensionManager());
|
||||
}
|
||||
@@ -876,6 +1109,21 @@
|
||||
@@ -876,6 +1113,21 @@
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.p));
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.r));
|
||||
}
|
||||
@@ -555,7 +564,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -909,13 +1157,20 @@
|
||||
@@ -909,13 +1161,20 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
|
Reference in New Issue
Block a user