Update to 1.19.2

This commit is contained in:
Cryptite
2022-08-12 12:06:07 -05:00
parent 19995071a3
commit a85661d795
24 changed files with 1371 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Sun, 27 Feb 2022 09:47:57 -0600
Date: Fri, 12 Aug 2022 08:16:16 -0500
Subject: [PATCH] Add PlayerShieldDisableEvent

View File

@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 08:20:02 -0500
Subject: [PATCH] Set BlockData without light updates
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 9930ebe7a23d306c602840fd43652fbdaba481b3..ed65bb8867bc2b8e67726dee07a82ac3671b0306 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -297,6 +297,28 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
*/
void setBlockData(@NotNull BlockData data, boolean applyPhysics);
+ /**
+ * Sets the complete data for this block
+ *
+ * <br>
+ * Note that applyPhysics = false is not in general safe. It should only be
+ * used when you need to avoid triggering a physics update of neighboring
+ * blocks, for example when creating a {@link Bisected} block. If you are
+ * using a custom populator, then this parameter may also be required to
+ * prevent triggering infinite chunk loads on border blocks. This method
+ * should NOT be used to "hack" physics by placing blocks in impossible
+ * locations. Such blocks are liable to be removed on various events such as
+ * world upgrades. Furthermore setting large amounts of such blocks in close
+ * proximity may overload the server physics engine if an update is
+ * triggered at a later point. If this occurs, the resulting behavior is
+ * undefined.
+ *
+ * @param data new block specific data
+ * @param applyPhysics false to cancel physics from the changed block
+ * @param checkLight false to prevent a light-check update
+ */
+ void setBlockData(@NotNull BlockData data, boolean applyPhysics, boolean checkLight);
+
/**
* Sets the type of this block
*

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Mon, 28 Feb 2022 08:54:52 -0600
Date: Fri, 12 Aug 2022 09:54:07 -0500
Subject: [PATCH] Add BlockDestroyedByNeighborEvent

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:40:48 -0500
Subject: [PATCH] Add provided Material to getDrops
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index ed65bb8867bc2b8e67726dee07a82ac3671b0306..3da43fba552b1cb16b9a5480c46a5d0ea0f9c087 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -639,6 +639,20 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
@NotNull
Collection<ItemStack> getDrops(@NotNull ItemStack tool, @Nullable Entity entity);
+ // Slice start
+ /**
+ * Returns a list of items which would drop by the entity destroying this
+ * block as though it were a given Material with a specific tool
+ *
+ * @param blockType The block type to use as the source loot
+ * @param tool The tool or item in hand used for digging
+ * @param entity the entity destroying the block
+ * @return a list of dropped items for this type of block
+ */
+ @NotNull
+ Collection<ItemStack> getDrops(@NotNull Material blockType, @NotNull ItemStack tool, @Nullable Entity entity);
+ // Slice end
+
/**
* Returns if the given item is a preferred choice to break this Block.
*

View File

@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:41:44 -0500
Subject: [PATCH] Add Player to SpongeAbsorbEvent
diff --git a/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java b/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java
index 7029cfcd00ed5d9c7f06898ec2b81238ec775a70..0e2f21e0f1983d2e8b67deebf4d12d25107d1582 100644
--- a/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java
+++ b/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java
@@ -7,6 +7,7 @@ import org.bukkit.block.BlockState;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable; // Paper
/**
* Called when a sponge absorbs water from the world.
@@ -21,11 +22,13 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
+ private final org.bukkit.entity.Player player; // Paper
private final List<BlockState> blocks;
- public SpongeAbsorbEvent(@NotNull Block block, @NotNull List<BlockState> waterblocks) {
+ public SpongeAbsorbEvent(@NotNull Block block, @Nullable org.bukkit.entity.Player player, @NotNull List<BlockState> waterblocks) { // Paper
super(block);
this.blocks = waterblocks;
+ this.player = player; // Paper
}
/**
@@ -41,6 +44,18 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable {
return blocks;
}
+ // Paper start
+ /**
+ * Gets the Player that placed the Sponge Block
+ *
+ * @return The Player that placed the sponge block causing the absorb event, or null if no Player was involved
+ */
+ @Nullable
+ public org.bukkit.entity.Player getPlayer() {
+ return player;
+ }
+ // Paper end
+
@Override
public boolean isCancelled() {
return cancelled;

View File

@@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:45:51 -0500
Subject: [PATCH] Add World Instance flag
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index e8c0c853eb52d1473c20231660355f77b1f7e016..02e524f718566a13880c9417518ebaeca816a8fc 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2591,6 +2591,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
*/
public void setAutoSave(boolean value);
+ // Slice start
+ public boolean isInstance();
+ public void setInstance(boolean value);
+ // Slice end
+
/**
* Sets the Difficulty of the world.
*

View File

@@ -0,0 +1,133 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 10:52:37 -0500
Subject: [PATCH] Add player data saving events
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..ae0132d9c7ae17b478d1d504961e1fd6b479f6d0
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java
@@ -0,0 +1,63 @@
+package com.destroystokyo.paper.event.player;
+
+import com.google.gson.JsonObject;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.UUID;
+
+/**
+ * Calls an event in which playerdata can be provided. If null, will load from disk, otherwise will use provided data
+ */
+public class PlayerLoadDataEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ private final UUID playerId;
+ private Object playerData;
+ private JsonObject statistics;
+
+ public PlayerLoadDataEvent(@NotNull UUID playerId) {
+ super();
+ this.playerId = playerId;
+ }
+
+ /**
+ * Gets the player's unique ID.
+ *
+ * @return The unique ID
+ */
+ @NotNull
+ public UUID getUniqueId() {
+ return playerId;
+ }
+
+ @Nullable
+ public Object getPlayerData() {
+ return playerData;
+ }
+
+ public void setPlayerData(@NotNull Object playerData) {
+ this.playerData = playerData;
+ }
+
+ @Nullable
+ public JsonObject getStatistics() {
+ return statistics;
+ }
+
+ public void setStatistics(@NotNull JsonObject statistics) {
+ this.statistics = statistics;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..c706201394d89f4a6f795ebbbac3d1041f395104
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java
@@ -0,0 +1,52 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Calls whenever playerdata is attempted to be saved. This is fired even if SpigotConfig.disablePlayerDataSaving is true
+ */
+public class PlayerSaveDataEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final Player player;
+ private boolean cancel;
+
+ public PlayerSaveDataEvent(@NotNull Player player) {
+ super();
+ this.player = player;
+ }
+
+ /**
+ * Gets the player
+ *
+ * @return The player
+ */
+ @NotNull
+ public Player getPlayer() {
+ return player;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+}

View File

@@ -0,0 +1,65 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Fri, 12 Aug 2022 11:00:39 -0500
Subject: [PATCH] Add PlayerGetRespawnLocationEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..7eca4d6929fc7a75974d182c1ea692d3823a19c0
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
@@ -0,0 +1,53 @@
+package org.bukkit.event.player;
+
+import org.apache.commons.lang3.Validate;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when a respawn event tries to determine the location of a respawn
+ */
+public class PlayerGetRespawnLocationEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private Location respawnLocation;
+
+ public PlayerGetRespawnLocationEvent(@NotNull final Player respawnPlayer) {
+ super(respawnPlayer);
+ }
+
+ /**
+ * Gets the current respawn location
+ *
+ * @return Location current respawn location
+ */
+ @Nullable
+ public Location getRespawnLocation() {
+ return this.respawnLocation;
+ }
+
+ /**
+ * Sets the new respawn location
+ *
+ * @param respawnLocation new location for the respawn
+ */
+ public void setRespawnLocation(@NotNull Location respawnLocation) {
+ Validate.notNull(respawnLocation, "Respawn location can not be null");
+ Validate.notNull(respawnLocation.getWorld(), "Respawn world can not be null");
+
+ this.respawnLocation = respawnLocation;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}