geforkt von Mirrors/Paper
[Bleeding] Call a LAVA BlockIgniteEvent in another place in BlockStationary. Fixes BUKKIT-970
Also adds CraftEventFactory.callEvent(Event), which returns the event called. Currently only used for n.m.s.BlockStationary's lava BlockIgniteEvent calls.
Dieser Commit ist enthalten in:
Ursprung
2a4167d8a5
Commit
868eaf571c
@ -56,12 +56,8 @@ public class BlockStationary extends BlockFluids {
|
|||||||
if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) {
|
if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) {
|
||||||
// CraftBukkit start - prevent lava putting something on fire.
|
// CraftBukkit start - prevent lava putting something on fire.
|
||||||
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
|
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
|
||||||
|
|
||||||
if (block.getTypeId() != Block.FIRE.id) {
|
if (block.getTypeId() != Block.FIRE.id) {
|
||||||
BlockIgniteEvent event = new BlockIgniteEvent(block, igniteCause, null);
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEvent(new BlockIgniteEvent(block, igniteCause, null)).isCancelled()) {
|
||||||
world.getServer().getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,6 +79,15 @@ public class BlockStationary extends BlockFluids {
|
|||||||
i = i1 + random.nextInt(3) - 1;
|
i = i1 + random.nextInt(3) - 1;
|
||||||
k = j1 + random.nextInt(3) - 1;
|
k = j1 + random.nextInt(3) - 1;
|
||||||
if (world.isEmpty(i, j + 1, k) && this.j(world, i, j, k)) {
|
if (world.isEmpty(i, j + 1, k) && this.j(world, i, j, k)) {
|
||||||
|
// CraftBukkit start - prevent lava putting something on fire.
|
||||||
|
org.bukkit.block.Block block = bworld.getBlockAt(i, j + 1, k);
|
||||||
|
if (block.getTypeId() != Block.FIRE.id) {
|
||||||
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEvent(new BlockIgniteEvent(block, igniteCause, null)).isCancelled()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
world.setTypeId(i, j + 1, k, Block.FIRE.id);
|
world.setTypeId(i, j + 1, k, Block.FIRE.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ import org.bukkit.entity.PigZombie;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.ThrownPotion;
|
import org.bukkit.entity.ThrownPotion;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
import org.bukkit.event.entity.*;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
@ -72,6 +73,11 @@ public class CraftEventFactory {
|
|||||||
return distanceFromSpawn > spawnSize;
|
return distanceFromSpawn > spawnSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T extends Event> T callEvent(T event) {
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block place methods
|
* Block place methods
|
||||||
*/
|
*/
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren