13
0
geforkt von Mirrors/Paper

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

By: DerFrZocker <derrieple@gmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2023-09-06 19:09:38 +02:00
Ursprung 2402d5edb4
Commit dc3bd245f7

Datei anzeigen

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