SPIGOT-7475: Don't fire SculkBloomEvent during world generation

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2023-09-06 19:09:38 +02:00
parent 2402d5edb4
commit dc3bd245f7

View file

@ -41,24 +41,27 @@
Logger logger = SculkSpreader.LOGGER;
Objects.requireNonNull(logger);
@@ -146,6 +155,16 @@
@@ -146,6 +155,19 @@
private void addCursor(SculkSpreader.a sculkspreader_a) {
if (this.cursors.size() < 32) {
+ // CraftBukkit start
+ CraftBlock bukkitBlock = CraftBlock.at(level, sculkspreader_a.pos);
+ SculkBloomEvent event = new SculkBloomEvent(bukkitBlock, sculkspreader_a.getCharge());
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled())
+ return;
+ if (!isWorldGeneration()) { // CraftBukkit - SPIGOT-7475: Don't call event during world generation
+ CraftBlock bukkitBlock = CraftBlock.at(level, sculkspreader_a.pos);
+ SculkBloomEvent event = new SculkBloomEvent(bukkitBlock, sculkspreader_a.getCharge());
+ Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+
+ sculkspreader_a.charge = event.getCharge();
+ sculkspreader_a.charge = event.getCharge();
+ }
+ // CraftBukkit end
+
this.cursors.add(sculkspreader_a);
}
}
@@ -241,7 +260,7 @@
@@ -241,7 +263,7 @@
this.charge = i;
this.decayDelay = j;
this.updateDelay = k;