no guarantees this patch works but who knows

This commit is contained in:
Ben Kerllenevich
2021-11-30 08:14:03 -05:00
parent c687099ad1
commit 21dde20b3d
123 changed files with 206 additions and 207 deletions

View File

@@ -0,0 +1,112 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nahuel <nahueldolores@hotmail.com>
Date: Sat, 9 Jan 2021 15:33:52 +0100
Subject: [PATCH] Add StructureGenerateEvent
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
diff --git a/src/main/java/org/bukkit/event/world/WorldEvent.java b/src/main/java/org/bukkit/event/world/WorldEvent.java
index cffeff33f007d3b03b7c862b25be453f705da739..1fa083d53dce161ef9e9f19407f230c94b2d7d15 100644
--- a/src/main/java/org/bukkit/event/world/WorldEvent.java
+++ b/src/main/java/org/bukkit/event/world/WorldEvent.java
@@ -10,6 +10,13 @@ import org.jetbrains.annotations.NotNull;
public abstract class WorldEvent extends Event {
private final World world;
+ // Purpur start
+ public WorldEvent(boolean isAsync, @NotNull final World world) {
+ super(isAsync);
+ this.world = world;
+ }
+ // Purpur end
+
public WorldEvent(@NotNull final World world) {
this.world = world;
}
diff --git a/src/main/java/org/purpurmc/purpur/event/world/StructureGenerateEvent.java b/src/main/java/org/purpurmc/purpur/event/world/StructureGenerateEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..c49d0da74f59e06176e616f80dffd65c918e1389
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/event/world/StructureGenerateEvent.java
@@ -0,0 +1,68 @@
+package org.purpurmc.purpur.event.world;
+
+import org.bukkit.Bukkit;
+import org.bukkit.StructureType;
+import org.bukkit.World;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.world.WorldEvent;
+import org.jetbrains.annotations.NotNull;
+
+public class StructureGenerateEvent extends WorldEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+
+ @NotNull
+ private final StructureType structureType;
+ private final int chunkX;
+ private final int chunkZ;
+
+ private boolean cancel = false;
+
+ public StructureGenerateEvent(@NotNull World world,
+ @NotNull StructureType structureType, int chunkX, int chunkZ) {
+ super(!Bukkit.isPrimaryThread(), world); // Structure generation is not necessarily on the main thread as of 1.16.
+ this.structureType = structureType;
+ this.chunkX = chunkX;
+ this.chunkZ = chunkZ;
+ }
+
+ @NotNull
+ @Override
+ public World getWorld() {
+ return super.getWorld();
+ }
+
+ @NotNull
+ public StructureType getStructureType() {
+ return structureType;
+ }
+
+ public int getChunkX() {
+ return chunkX;
+ }
+
+ public int getChunkZ() {
+ return chunkZ;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.cancel;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Added the ability to add combustible items
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 167d8fa9f8cb5ee67149da3b9b63c613668f20b0..cdfda28119cb1c1f22ec42a37546413b3e4af8da 100644
index 4ef8c75df64e670c55f13efaa69651fd636d5f12..c98794dff18890fc2fe964238e06c0e20e58750f 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2139,5 +2139,24 @@ public final class Bukkit {