Patch reset

This commit is contained in:
Cryptite
2022-02-27 09:47:16 -06:00
parent 7a57b7161e
commit 9badc96ea9
30 changed files with 31 additions and 1950 deletions

View File

@@ -1,62 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Tue, 21 Sep 2021 08:33:45 -0500
Subject: [PATCH] Add PlayerShieldDisableEvent
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..f0f3a57a0ce76b4736219c6ece52b8bc47a7a4ec
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
@@ -0,0 +1,50 @@
+package io.papermc.paper.event.player;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Thrown whenever a Player's shield is disabled
+ */
+public class PlayerShieldDisableEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final Entity damager;
+ private boolean cancelled = false;
+
+ public PlayerShieldDisableEvent(@NotNull final Player player, @Nullable final Entity damager) {
+ super(player);
+ this.damager = damager;
+ }
+
+ @Nullable
+ public Entity getDamager() {
+ return damager;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+}

View File

@@ -1,58 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Tue, 21 Sep 2021 15:20:16 -0500
Subject: [PATCH] Multiple Entries with Scoreboards
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
index d5b39fb4fc16a342b5661e08df1506858168d20d..9ec00b045fe85701ce29c0ad10eb9921733107b3 100644
--- a/src/main/java/org/bukkit/scoreboard/Team.java
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
@@ -1,5 +1,6 @@
package org.bukkit.scoreboard;
+import java.util.Collection; // Paper
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
@@ -317,6 +318,20 @@ public interface Team {
*/
void addEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException;
+ // Paper start
+ /**
+ * This puts a collection of entries onto this team for the scoreboard which results in one
+ * packet for the updates rather than a packet-per-entry.
+ * <p>
+ * Entries on other teams will be removed from their respective teams.
+ *
+ * @param entries the entries to add
+ * @throws IllegalArgumentException if entries are null
+ * @throws IllegalStateException if this team has been unregistered
+ */
+ void addEntries(@NotNull Collection<String> entries) throws IllegalStateException, IllegalArgumentException;
+ // Paper end
+
/**
* Removes the player from this team.
*
@@ -340,6 +355,19 @@ public interface Team {
*/
boolean removeEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException;
+ // Paper start
+ /**
+ * Removes a collection of entries from this team which results in one
+ * packet for the updates rather than a packet-per-entry.
+ *
+ * @param entries the entries to remove
+ * @return if any of the entries were a part of this team
+ * @throws IllegalArgumentException if entry is null
+ * @throws IllegalStateException if this team has been unregistered
+ */
+ boolean removeEntries(@NotNull Collection<String> entries) throws IllegalStateException, IllegalArgumentException;
+ // Paper end
+
/**
* Unregisters this team from the Scoreboard
*

View File

@@ -1,39 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Wed, 22 Sep 2021 09:41:27 -0500
Subject: [PATCH] Set BlockData without light update
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index ad8bce01ba459a036cd4ebbbe4fc974021924fe2..6ef43ae39a8ad4ed0e9a7bf68c17840576e235ea 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -287,6 +287,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,79 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Sun, 26 Sep 2021 09:00:51 -0500
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
diff --git a/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java b/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..7db2789d54a609b023ea6deff87b45d717aabbf0
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java
@@ -0,0 +1,67 @@
+package io.papermc.paper.event.block;
+
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when a block is broken another block. This is generally the result of BlockPhysicsEvent propagation
+ */
+public class BlockDestroyedByNeighborEvent extends BlockEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final Player player;
+ private final Block sourceBlock;
+ private boolean cancel;
+
+ public BlockDestroyedByNeighborEvent(@NotNull final Block theBlock, @Nullable Player player, @NotNull final Block sourceBlock) {
+ super(theBlock);
+
+ this.player = player;
+ this.sourceBlock = sourceBlock;
+ }
+
+ /**
+ * Gets the Player that caused this
+ *
+ * @return The Player that is breaking the block involved in this event
+ */
+ @Nullable
+ public Player getPlayer() {
+ return player;
+ }
+
+ /**
+ * Gets the source block that caused this block break
+ *
+ * @return The Source Block which block is involved in this event
+ */
+ @NotNull
+ public final Block getSourceBlock() {
+ return sourceBlock;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancel;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancel = cancel;
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}

View File

@@ -1,52 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Sun, 26 Sep 2021 16:36:29 -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

@@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Wed, 29 Sep 2021 08:40:37 -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 cd63406809aadbcc53857aaef31053915278dfc0..ab4982d52185bbc80d506da2a961345d46710efa 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -602,6 +602,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

@@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Mon, 18 Oct 2021 08:52:40 -0500
Subject: [PATCH] World Instance Flag
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 4f673e9123145dc78564dc3eef0edf75795dafc2..c840fccc7d5eab215886c3281be3a6257fa01aad 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2606,6 +2606,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

@@ -1,52 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Tue, 30 Nov 2021 12:04:50 -0600
Subject: [PATCH] PlayerTrackEntityEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..0532a7986a8091e82f1fc64b9654be26d6c8ea5e
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java
@@ -0,0 +1,40 @@
+package org.bukkit.event.player;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a player tracks an entity.
+ */
+public class PlayerTrackEntityEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final Entity tracked;
+
+ public PlayerTrackEntityEvent(@NotNull final Player player, @NotNull final Entity tracked) {
+ super(player);
+ this.tracked = tracked;
+ }
+
+ /**
+ * Gets the entity newly tracked by the Player
+ *
+ * @return Entity the player is now tracking
+ */
+ @NotNull
+ public Entity getTracked() {
+ return tracked;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}

View File

@@ -1,133 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Tue, 7 Dec 2021 07:59:41 -0600
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;
+ }
+}