tons of patches (#5835)
This commit is contained in:
parent
38e4dc3050
commit
d3424f4a8a
276 changed files with 1441 additions and 2130 deletions
|
@ -0,0 +1,19 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Wed, 20 Jan 2021 14:25:26 -0600
|
||||
Subject: [PATCH] Allow adding items to BlockDropItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
|
||||
index a0f6f1af304190b4c5db4b284d460f625eeb7801..3dd4bd38e72c04e74e5787fb38ca9abd10bad06b 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockDropItemEvent.java
|
||||
@@ -64,7 +64,7 @@ public class BlockDropItemEvent extends BlockEvent implements Cancellable {
|
||||
* Gets list of the Item drops caused by the block break.
|
||||
*
|
||||
* This list is mutable - removing an item from it will cause it to not
|
||||
- * drop. It is not legal however to add new items to the list.
|
||||
+ * drop. Adding to the list is allowed.
|
||||
*
|
||||
* @return The Item the block caused to drop
|
||||
*/
|
|
@ -0,0 +1,26 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksander Jagiello <themolkapl@gmail.com>
|
||||
Date: Sun, 24 Jan 2021 22:17:29 +0100
|
||||
Subject: [PATCH] Add getMainThreadExecutor to BukkitScheduler
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
|
||||
index ac140fc2c638e22e06b2920db3e376ab9e8c3733..f5e3bfd22d4d38182065b5215e5f78d9bb13381e 100644
|
||||
--- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
|
||||
+++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
|
||||
@@ -458,4 +458,15 @@ public interface BukkitScheduler {
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public BukkitTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay, long period) throws IllegalArgumentException;
|
||||
+
|
||||
+ // Paper start - add getMainThreadExecutor
|
||||
+ /**
|
||||
+ * Returns an executor that will run tasks on the next server tick.
|
||||
+ *
|
||||
+ * @param plugin the reference to the plugin scheduling tasks
|
||||
+ * @return an executor associated with the given plugin
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public java.util.concurrent.Executor getMainThreadExecutor(@NotNull Plugin plugin);
|
||||
+ // Paper end
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: ysl3000 <yannicklamprecht@live.de>
|
||||
Date: Sat, 24 Oct 2020 16:37:21 +0200
|
||||
Subject: [PATCH] living entity allow attribute registration
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/attribute/Attributable.java b/src/main/java/org/bukkit/attribute/Attributable.java
|
||||
index 0ed96b5af0e6e93590882e0ad8239221bcc3f688..474ed1df364a5ca18661d0fbc29901760e39cb07 100644
|
||||
--- a/src/main/java/org/bukkit/attribute/Attributable.java
|
||||
+++ b/src/main/java/org/bukkit/attribute/Attributable.java
|
||||
@@ -17,4 +17,14 @@ public interface Attributable {
|
||||
*/
|
||||
@Nullable
|
||||
AttributeInstance getAttribute(@NotNull Attribute attribute);
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Registers a generic attribute to that attributable instance.
|
||||
+ * Allows it to add attributes not registered by default to that entity.
|
||||
+ *
|
||||
+ * @param attribute the generic attribute to register
|
||||
+ */
|
||||
+ void registerAttribute(@NotNull Attribute attribute);
|
||||
+ // Paper end
|
||||
}
|
76
patches/api/0273-Add-missing-effects.patch
Normal file
76
patches/api/0273-Add-missing-effects.patch
Normal file
|
@ -0,0 +1,76 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Pekov <ivan@mrivanplays.com>
|
||||
Date: Tue, 5 Jan 2021 10:19:11 +0200
|
||||
Subject: [PATCH] Add missing effects
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
|
||||
index d0c812c72967469122f7f276ced31cfb0e9482dc..0f598fa0560d14b44dcc65205364870c0bbfa0d8 100644
|
||||
--- a/src/main/java/org/bukkit/Effect.java
|
||||
+++ b/src/main/java/org/bukkit/Effect.java
|
||||
@@ -201,6 +201,65 @@ public enum Effect {
|
||||
* The sound of an enderdragon growling
|
||||
*/
|
||||
ENDERDRAGON_GROWL(3001, Type.SOUND),
|
||||
+ // Paper start - add missing effects
|
||||
+ /**
|
||||
+ * The sound of a wither spawning
|
||||
+ */
|
||||
+ WITHER_SPAWNED(1023, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of an ender dragon dying
|
||||
+ */
|
||||
+ ENDER_DRAGON_DEATH(1028, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of an ender portal being created in the overworld
|
||||
+ */
|
||||
+ END_PORTAL_CREATED_IN_OVERWORLD(1038, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of phantom's bites
|
||||
+ */
|
||||
+ PHANTOM_BITES(1039, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of zombie converting to drowned zombie
|
||||
+ */
|
||||
+ ZOMBIE_CONVERTS_TO_DROWNED(1040, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of a husk converting to zombie by drowning
|
||||
+ */
|
||||
+ HUSK_CONVERTS_TO_ZOMBIE(1041, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of a grindstone being used
|
||||
+ */
|
||||
+ GRINDSTONE_USED(1042, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of a book page being turned
|
||||
+ */
|
||||
+ BOOK_PAGE_TURNED(1043, Type.SOUND),
|
||||
+ /**
|
||||
+ * Particles displayed when a composter composts
|
||||
+ */
|
||||
+ COMPOSTER_COMPOSTS(1500, Type.VISUAL),
|
||||
+ /**
|
||||
+ * Particles displayed when lava converts a block (either water to stone, or
|
||||
+ * removing existing blocks such as torches)
|
||||
+ */
|
||||
+ LAVA_CONVERTS_BLOCK(1501, Type.VISUAL),
|
||||
+ /**
|
||||
+ * Particles displayd when a redstone torch burns out
|
||||
+ */
|
||||
+ REDSTONE_TORCH_BURNS_OUT(1502, Type.VISUAL),
|
||||
+ /**
|
||||
+ * Particles displayed when an ender eye is placed
|
||||
+ */
|
||||
+ ENDER_EYE_PLACED(1503, Type.VISUAL),
|
||||
+ /**
|
||||
+ * Particles displayed when an ender dragon destroys block
|
||||
+ */
|
||||
+ ENDER_DRAGON_DESTROYS_BLOCK(2008, Type.VISUAL),
|
||||
+ /**
|
||||
+ * Particles displayed when a wet sponge vaporizes in nether.
|
||||
+ */
|
||||
+ WET_SPONGE_VAPORIZES_IN_NETHER(2009, Type.VISUAL)
|
||||
+ // Paper end
|
||||
;
|
||||
|
||||
private final int id;
|
33
patches/api/0274-Expose-Tracked-Players.patch
Normal file
33
patches/api/0274-Expose-Tracked-Players.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Fri, 26 Feb 2021 16:24:25 -0600
|
||||
Subject: [PATCH] Expose Tracked Players
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 9c7960f56733ff18b949cffe15f082c4cde28317..38003de85a8098fc78fc947dd975990d478ee908 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
+import java.util.Set; // Paper
|
||||
import java.util.UUID;
|
||||
import com.destroystokyo.paper.ClientOption; // Paper
|
||||
import com.destroystokyo.paper.Title; // Paper
|
||||
@@ -1969,6 +1970,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
void sendOpLevel(byte level);
|
||||
// Paper end
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * @return Returns a set of Players within this player's tracking range (that the player's client can "see")
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Set<Player> getTrackedPlayers();
|
||||
+ // Paper end
|
||||
+
|
||||
// Spigot start
|
||||
public class Spigot extends Entity.Spigot {
|
||||
|
38
patches/api/0275-Cache-the-result-of-Material-isBlock.patch
Normal file
38
patches/api/0275-Cache-the-result-of-Material-isBlock.patch
Normal file
|
@ -0,0 +1,38 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: jmp <jasonpenilla2@me.com>
|
||||
Date: Tue, 2 Mar 2021 15:24:58 -0800
|
||||
Subject: [PATCH] Cache the result of Material#isBlock
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
||||
index 1efc97d88c38863bcd6cd4c11c8b88a18ee06b25..5ff032f73d88dd91163ff3e6c89dcd0d1507228c 100644
|
||||
--- a/src/main/java/org/bukkit/Material.java
|
||||
+++ b/src/main/java/org/bukkit/Material.java
|
||||
@@ -3936,6 +3936,7 @@ public enum Material implements Keyed {
|
||||
public final Class<?> data;
|
||||
private final boolean legacy;
|
||||
private final NamespacedKey key;
|
||||
+ private boolean isBlock; // Paper
|
||||
|
||||
private Material(final int id) {
|
||||
this(id, 64);
|
||||
@@ -4133,6 +4134,11 @@ public enum Material implements Keyed {
|
||||
* @return true if this material is a block
|
||||
*/
|
||||
public boolean isBlock() {
|
||||
+ // Paper start - cache isBlock
|
||||
+ return this.isBlock;
|
||||
+ }
|
||||
+ private boolean isBlock0() {
|
||||
+ // Paper end
|
||||
switch (this) {
|
||||
//<editor-fold defaultstate="collapsed" desc="isBlock">
|
||||
case ACACIA_BUTTON:
|
||||
@@ -5214,6 +5220,7 @@ public enum Material implements Keyed {
|
||||
static {
|
||||
for (Material material : values()) {
|
||||
BY_NAME.put(material.name(), material);
|
||||
+ material.isBlock = material.isBlock0(); // Paper
|
||||
}
|
||||
}
|
||||
|
308
patches/api/0276-Add-worldborder-events.patch
Normal file
308
patches/api/0276-Add-worldborder-events.patch
Normal file
|
@ -0,0 +1,308 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 4 Jan 2021 22:40:26 -0800
|
||||
Subject: [PATCH] Add worldborder events
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..126fe50b519a8d7cd158f799058cb235f9c4cbdb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeEvent.java
|
||||
@@ -0,0 +1,114 @@
|
||||
+package io.papermc.paper.event.world.border;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.WorldBorder;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a world border changes its bounds, either over time, or instantly.
|
||||
+ */
|
||||
+public class WorldBorderBoundsChangeEvent extends WorldBorderEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private Type type;
|
||||
+ private final double oldSize;
|
||||
+ private double newSize;
|
||||
+ private long duration;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public WorldBorderBoundsChangeEvent(@NotNull World world, @NotNull WorldBorder worldBorder, @NotNull Type type, double oldSize, double newSize, long duration) {
|
||||
+ super(world, worldBorder);
|
||||
+ this.type = type;
|
||||
+ this.oldSize = oldSize;
|
||||
+ this.newSize = newSize;
|
||||
+ this.duration = duration;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if this change is an instant change or over-time change.
|
||||
+ *
|
||||
+ * @return the change type
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Type getType() {
|
||||
+ return type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the old size or the world border.
|
||||
+ *
|
||||
+ * @return the old size
|
||||
+ */
|
||||
+ public double getOldSize() {
|
||||
+ return oldSize;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the new size of the world border.
|
||||
+ *
|
||||
+ * @return the new size
|
||||
+ */
|
||||
+ public double getNewSize() {
|
||||
+ return newSize;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the new size of the world border.
|
||||
+ *
|
||||
+ * @param newSize the new size
|
||||
+ */
|
||||
+ public void setNewSize(double newSize) {
|
||||
+ // PAIL: TODO: Magic Values
|
||||
+ this.newSize = Math.min(6.0E7D, Math.max(1.0D, newSize));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the time in milliseconds for the change. Will be 0 if instant.
|
||||
+ *
|
||||
+ * @return the time in milliseconds for the change
|
||||
+ */
|
||||
+ public long getDuration() {
|
||||
+ return duration;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the time in milliseconds for the change. Will change {@link #getType()} to return
|
||||
+ * {@link Type#STARTED_MOVE}.
|
||||
+ *
|
||||
+ * @param duration the time in milliseconds for the change
|
||||
+ */
|
||||
+ public void setDuration(long duration) {
|
||||
+ // PAIL: TODO: Magic Values
|
||||
+ this.duration = Math.min(9223372036854775L, Math.max(0L, duration));
|
||||
+ if (duration >= 0 && type == Type.INSTANT_MOVE) type = Type.STARTED_MOVE;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum Type {
|
||||
+ STARTED_MOVE,
|
||||
+ INSTANT_MOVE
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c3d578ae2c5615b0ebace99d9bacf100b086c971
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderBoundsChangeFinishEvent.java
|
||||
@@ -0,0 +1,65 @@
|
||||
+package io.papermc.paper.event.world.border;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.WorldBorder;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a moving world border has finished it's move.
|
||||
+ */
|
||||
+public class WorldBorderBoundsChangeFinishEvent extends WorldBorderEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final double oldSize;
|
||||
+ private final double newSize;
|
||||
+ private final double duration;
|
||||
+
|
||||
+ public WorldBorderBoundsChangeFinishEvent(@NotNull World world, @NotNull WorldBorder worldBorder, double oldSize, double newSize, double duration) {
|
||||
+ super(world, worldBorder);
|
||||
+ this.oldSize = oldSize;
|
||||
+ this.newSize = newSize;
|
||||
+ this.duration = duration;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the old size of the worldborder.
|
||||
+ *
|
||||
+ * @return the old size
|
||||
+ */
|
||||
+ public double getOldSize() {
|
||||
+ return oldSize;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the new size of the worldborder.
|
||||
+ *
|
||||
+ * @return the new size
|
||||
+ */
|
||||
+ public double getNewSize() {
|
||||
+ return newSize;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the duration this worldborder took to make the change.
|
||||
+ * <p>
|
||||
+ * Can be 0 if handlers for {@link io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent} set the duration to 0.
|
||||
+ *
|
||||
+ * @return the duration of the transition
|
||||
+ */
|
||||
+ public double getDuration() {
|
||||
+ return duration;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4a10c773a8d05a596066e63306dead74c1363fd7
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java
|
||||
@@ -0,0 +1,77 @@
|
||||
+package io.papermc.paper.event.world.border;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.WorldBorder;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.world.WorldEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a world border's center is changed.
|
||||
+ */
|
||||
+public class WorldBorderCenterChangeEvent extends WorldBorderEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Location oldCenter;
|
||||
+ private Location newCenter;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public WorldBorderCenterChangeEvent(@NotNull World world, @NotNull WorldBorder worldBorder, @NotNull Location oldCenter, @NotNull Location newCenter) {
|
||||
+ super(world, worldBorder);
|
||||
+ this.oldCenter = oldCenter;
|
||||
+ this.newCenter = newCenter;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the original center location of the world border.
|
||||
+ *
|
||||
+ * @return the old center
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getOldCenter() {
|
||||
+ return oldCenter;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the new center location for the world border.
|
||||
+ *
|
||||
+ * @return the new center
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getNewCenter() {
|
||||
+ return newCenter;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the new center location for the world border. Y coordinate is ignored.
|
||||
+ *
|
||||
+ * @param newCenter the new center
|
||||
+ */
|
||||
+ public void setNewCenter(@NotNull Location newCenter) {
|
||||
+ this.newCenter = newCenter;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java b/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..67bd469d3680c9554ce6c1d5493826a252682835
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/border/WorldBorderEvent.java
|
||||
@@ -0,0 +1,22 @@
|
||||
+package io.papermc.paper.event.world.border;
|
||||
+
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.WorldBorder;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.world.WorldEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public abstract class WorldBorderEvent extends WorldEvent {
|
||||
+
|
||||
+ private final WorldBorder worldBorder;
|
||||
+
|
||||
+ public WorldBorderEvent(@NotNull World world, @NotNull WorldBorder worldBorder) {
|
||||
+ super(world);
|
||||
+ this.worldBorder = worldBorder;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public WorldBorder getWorldBorder() {
|
||||
+ return worldBorder;
|
||||
+ }
|
||||
+}
|
130
patches/api/0277-added-PlayerNameEntityEvent.patch
Normal file
130
patches/api/0277-added-PlayerNameEntityEvent.patch
Normal file
|
@ -0,0 +1,130 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 5 Jul 2020 00:34:24 -0700
|
||||
Subject: [PATCH] added PlayerNameEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java
|
||||
new file mode 100755
|
||||
index 0000000000000000000000000000000000000000..ef9e53a73eff469bbaa8fb20c634297acb9d1986
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerNameEntityEvent.java
|
||||
@@ -0,0 +1,118 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the player is attempting to rename a mob
|
||||
+ */
|
||||
+public class PlayerNameEntityEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private LivingEntity entity;
|
||||
+ private Component name;
|
||||
+ private boolean persistent;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public PlayerNameEntityEvent(@NotNull Player player, @NotNull LivingEntity entity, @NotNull Component name, boolean persistent) {
|
||||
+ super(player);
|
||||
+ this.entity = entity;
|
||||
+ this.name = name;
|
||||
+ this.persistent = persistent;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the name to be given to the entity.
|
||||
+ * @return the name
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Component getName() {
|
||||
+ return name;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the name to be given to the entity.
|
||||
+ *
|
||||
+ * @param name the name
|
||||
+ */
|
||||
+ public void setName(@Nullable Component name) {
|
||||
+ this.name = name;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity involved in this event.
|
||||
+ *
|
||||
+ * @return the entity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the entity involved in this event.
|
||||
+ *
|
||||
+ * @param entity the entity
|
||||
+ */
|
||||
+ public void setEntity(@NotNull LivingEntity entity) {
|
||||
+ this.entity = entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether this will set the mob to be persistent.
|
||||
+ *
|
||||
+ * @return persistent
|
||||
+ */
|
||||
+ public boolean isPersistent() {
|
||||
+ return persistent;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether this will set the mob to be persistent.
|
||||
+ *
|
||||
+ * @param persistent persistent
|
||||
+ */
|
||||
+ public void setPersistent(boolean persistent) {
|
||||
+ this.persistent = persistent;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ *
|
||||
+ * @return true if this event is cancelled
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins.
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
69
patches/api/0278-Add-recipe-to-cook-events.patch
Normal file
69
patches/api/0278-Add-recipe-to-cook-events.patch
Normal file
|
@ -0,0 +1,69 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
|
||||
Date: Wed, 6 Jan 2021 12:05:29 -0800
|
||||
Subject: [PATCH] Add recipe to cook events
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockCookEvent.java b/src/main/java/org/bukkit/event/block/BlockCookEvent.java
|
||||
index be7af5440bf9923f0c9c84efa4d70a89337a2f96..a3f1c9cb36c9069ed622985a525bfc2a7a27ab91 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockCookEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockCookEvent.java
|
||||
@@ -14,12 +14,21 @@ public class BlockCookEvent extends BlockEvent implements Cancellable {
|
||||
private final ItemStack source;
|
||||
private ItemStack result;
|
||||
private boolean cancelled;
|
||||
+ private final org.bukkit.inventory.CookingRecipe<?> recipe; // Paper
|
||||
|
||||
+ @Deprecated // Paper
|
||||
public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result) {
|
||||
+ // Paper start
|
||||
+ this(block, source, result, null);
|
||||
+ }
|
||||
+
|
||||
+ public BlockCookEvent(@NotNull final Block block, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe<?> recipe) {
|
||||
+ // Paper end
|
||||
super(block);
|
||||
this.source = source;
|
||||
this.result = result;
|
||||
this.cancelled = false;
|
||||
+ this.recipe = recipe; // Paper
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,6 +70,18 @@ public class BlockCookEvent extends BlockEvent implements Cancellable {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the cooking recipe associated with this event.
|
||||
+ *
|
||||
+ * @return the recipe
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ public org.bukkit.inventory.CookingRecipe<?> getRecipe() {
|
||||
+ return recipe;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java
|
||||
index 066e7dd9a34d35c8b643a5efcf95d6a5ef47c7ee..16b3ab8f525c4e863f804cc8460a330407d85478 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/FurnaceSmeltEvent.java
|
||||
@@ -10,7 +10,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class FurnaceSmeltEvent extends BlockCookEvent {
|
||||
|
||||
+ @Deprecated // Paper
|
||||
public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result) {
|
||||
super(furnace, source, result);
|
||||
}
|
||||
+ // Paper start
|
||||
+ public FurnaceSmeltEvent(@NotNull final Block furnace, @NotNull final ItemStack source, @NotNull final ItemStack result, @org.jetbrains.annotations.Nullable org.bukkit.inventory.CookingRecipe<?> recipe) {
|
||||
+ super(furnace, source, result, recipe);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
26
patches/api/0279-Add-Block-isValidTool.patch
Normal file
26
patches/api/0279-Add-Block-isValidTool.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 6 Jul 2020 12:44:23 -0700
|
||||
Subject: [PATCH] Add Block#isValidTool
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index b3c127a3d4c554c08e500497a54755e626342dd3..ca488173a20bcf3427906f0a6548f06a97c9dc36 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -219,6 +219,15 @@ public interface Block extends Metadatable {
|
||||
public static int getBlockKeyZ(long packed) {
|
||||
return (int) ((packed << 10) >> 37);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the itemstack is a valid tool to
|
||||
+ * break the block with
|
||||
+ *
|
||||
+ * @param itemStack The (tool) itemstack
|
||||
+ * @return whether the block will drop items
|
||||
+ */
|
||||
+ boolean isValidTool(@NotNull ItemStack itemStack);
|
||||
// Paper End
|
||||
|
||||
/**
|
164
patches/api/0280-Implement-Keyed-on-World.patch
Normal file
164
patches/api/0280-Implement-Keyed-on-World.patch
Normal file
|
@ -0,0 +1,164 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 6 Jan 2021 00:34:10 -0800
|
||||
Subject: [PATCH] Implement Keyed on World
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index bad4593447ca390b3e2f3bc71b4ea9f4dd673445..142050887ac02e36ae20e73a43ec698b6bab1947 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -639,6 +639,18 @@ public final class Bukkit {
|
||||
public static World getWorld(@NotNull UUID uid) {
|
||||
return server.getWorld(uid);
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the world from the given NamespacedKey
|
||||
+ *
|
||||
+ * @param worldKey the NamespacedKey of the world to retrieve
|
||||
+ * @return a world with the given NamespacedKey, or null if none exists
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public static World getWorld(@NotNull NamespacedKey worldKey) {
|
||||
+ return server.getWorld(worldKey);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Gets the map from the given item ID.
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 48c6434a6a5b1659d4cc8ddf8fe23806628c3b7e..0b3de184f7267543d693c45379bf5989303cf56a 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -541,6 +541,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@Nullable
|
||||
public World getWorld(@NotNull UUID uid);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the world from the given NamespacedKey
|
||||
+ *
|
||||
+ * @param worldKey the NamespacedKey of the world to retrieve
|
||||
+ * @return a world with the given NamespacedKey, or null if none exists
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public World getWorld(@NotNull NamespacedKey worldKey);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the map from the given item ID.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 27d97cde0fb5f6d727656c291e34dc468200f0c0..178a0853bd8136c6a7408f5d49604ceb2479f138 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -43,7 +43,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a world, which may contain entities, chunks and blocks
|
||||
*/
|
||||
-public interface World extends PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience { // Paper
|
||||
+public interface World extends PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience, Keyed { // Paper
|
||||
|
||||
// Paper start
|
||||
/**
|
||||
@@ -1534,6 +1534,15 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
|
||||
|
||||
@NotNull
|
||||
java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent);
|
||||
+
|
||||
+ /**
|
||||
+ * Get the world's key
|
||||
+ *
|
||||
+ * @return the world's key
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ NamespacedKey getKey();
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/WorldCreator.java b/src/main/java/org/bukkit/WorldCreator.java
|
||||
index 6e6945dd4c770be04ec09da3958fae751717527a..e6a83252f42da31ad38f8dc1beccc7aa2c3f54b8 100644
|
||||
--- a/src/main/java/org/bukkit/WorldCreator.java
|
||||
+++ b/src/main/java/org/bukkit/WorldCreator.java
|
||||
@@ -11,6 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* Represents various types of options that may be used to create a world.
|
||||
*/
|
||||
public class WorldCreator {
|
||||
+ private final NamespacedKey key; // Paper
|
||||
private final String name;
|
||||
private long seed;
|
||||
private World.Environment environment = World.Environment.NORMAL;
|
||||
@@ -26,13 +27,67 @@ public class WorldCreator {
|
||||
* @param name Name of the world that will be created
|
||||
*/
|
||||
public WorldCreator(@NotNull String name) {
|
||||
- if (name == null) {
|
||||
- throw new IllegalArgumentException("World name cannot be null");
|
||||
- }
|
||||
+ // Paper start
|
||||
+ this(name, NamespacedKey.minecraft(name.toLowerCase(java.util.Locale.ENGLISH).replace(" ", "_")));
|
||||
+ }
|
||||
|
||||
- this.name = name;
|
||||
+ /**
|
||||
+ * Creates an empty WorldCreator for the given world name and key
|
||||
+ *
|
||||
+ * @param levelName LevelName of the world that will be created
|
||||
+ * @param worldKey NamespacedKey of the world that will be created
|
||||
+ */
|
||||
+ public WorldCreator(@NotNull String levelName, @NotNull NamespacedKey worldKey) {
|
||||
+ if (levelName == null || worldKey == null) {
|
||||
+ throw new IllegalArgumentException("World name and key cannot be null");
|
||||
+ }
|
||||
+ this.name = levelName;
|
||||
this.seed = (new Random()).nextLong();
|
||||
+ this.key = worldKey;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates an empty WorldCreator for the given key.
|
||||
+ * LevelName will be the Key part of the NamespacedKey.
|
||||
+ *
|
||||
+ * @param worldKey NamespacedKey of the world that will be created
|
||||
+ */
|
||||
+ public WorldCreator(@NotNull NamespacedKey worldKey) {
|
||||
+ this(worldKey.getKey(), worldKey);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the key for this WorldCreator
|
||||
+ *
|
||||
+ * @return the key
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public NamespacedKey key() {
|
||||
+ return key;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates an empty WorldCreator for the given world name and key
|
||||
+ *
|
||||
+ * @param levelName LevelName of the world that will be created
|
||||
+ * @param worldKey NamespacedKey of the world that will be created
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static WorldCreator ofNameAndKey(@NotNull String levelName, @NotNull NamespacedKey worldKey) {
|
||||
+ return new WorldCreator(levelName, worldKey);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates an empty WorldCreator for the given key.
|
||||
+ * LevelName will be the Key part of the NamespacedKey.
|
||||
+ *
|
||||
+ * @param worldKey NamespacedKey of the world that will be created
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static WorldCreator ofKey(@NotNull NamespacedKey worldKey) {
|
||||
+ return new WorldCreator(worldKey);
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Copies the options from the specified world
|
|
@ -0,0 +1,22 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: CDFN <codefun@protonmail.com>
|
||||
Date: Fri, 12 Mar 2021 18:31:31 +0100
|
||||
Subject: [PATCH] fix Inventory#getContents null annotations
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
index 6386206188e820206bb1a9f516b5e194fdc9d952..7956aebcb390379677dccf7c9561866cf94c024c 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
@@ -158,9 +158,8 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
*
|
||||
* @return An array of ItemStacks from the inventory. Individual items may be null.
|
||||
*/
|
||||
- @NotNull
|
||||
- public ItemStack[] getContents();
|
||||
-
|
||||
+ public @org.checkerframework.checker.nullness.qual.Nullable ItemStack @org.checkerframework.checker.nullness.qual.NonNull [] getContents(); // Paper - make array elements nullable instead array
|
||||
+
|
||||
/**
|
||||
* Completely replaces the inventory's contents. Removes all existing
|
||||
* contents and replaces it with the ItemStacks given in the array.
|
109
patches/api/0282-Item-Rarity-API.patch
Normal file
109
patches/api/0282-Item-Rarity-API.patch
Normal file
|
@ -0,0 +1,109 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 12 Mar 2021 17:09:40 -0800
|
||||
Subject: [PATCH] Item Rarity API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/inventory/ItemRarity.java b/src/main/java/io/papermc/paper/inventory/ItemRarity.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..74ef8395cc040ce488c2acaa416db20272cc2734
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/inventory/ItemRarity.java
|
||||
@@ -0,0 +1,28 @@
|
||||
+package io.papermc.paper.inventory;
|
||||
+
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.format.TextColor;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public enum ItemRarity {
|
||||
+
|
||||
+ COMMON(NamedTextColor.WHITE),
|
||||
+ UNCOMMON(NamedTextColor.YELLOW),
|
||||
+ RARE(NamedTextColor.AQUA),
|
||||
+ EPIC(NamedTextColor.LIGHT_PURPLE);
|
||||
+
|
||||
+ TextColor color;
|
||||
+
|
||||
+ ItemRarity(TextColor color) {
|
||||
+ this.color = color;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the color formatting associated with the rarity.
|
||||
+ * @return
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public TextColor getColor() {
|
||||
+ return color;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
||||
index 5ff032f73d88dd91163ff3e6c89dcd0d1507228c..a9bcb123526da0881728070d36aea37612db8cf2 100644
|
||||
--- a/src/main/java/org/bukkit/Material.java
|
||||
+++ b/src/main/java/org/bukkit/Material.java
|
||||
@@ -4003,6 +4003,17 @@ public enum Material implements Keyed {
|
||||
public String getTranslationKey() {
|
||||
return Bukkit.getUnsafe().getTranslationKey(this);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the item rarity for the item. The Material <b>MUST</b> be an Item not a block.
|
||||
+ * Use {@link #isItem()} before this.
|
||||
+ *
|
||||
+ * @return the item rarity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public io.papermc.paper.inventory.ItemRarity getItemRarity() {
|
||||
+ return Bukkit.getUnsafe().getItemRarity(this);
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 84eda68281c6c6968d95b1313a33696c3a9980d4..bcd10b2c9255d778b678310febf1937301d01a50 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -137,5 +137,22 @@ public interface UnsafeValues {
|
||||
* Use this when sending custom packets, so that there are no collisions on the client or server.
|
||||
*/
|
||||
public int nextEntityId();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the item rarity of a material. The material <b>MUST</b> be an item.
|
||||
+ * Use {@link Material#isItem()} before this.
|
||||
+ *
|
||||
+ * @param material the material to get the rarity of
|
||||
+ * @return the item rarity
|
||||
+ */
|
||||
+ public io.papermc.paper.inventory.ItemRarity getItemRarity(Material material);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the item rarity of the itemstack. The rarity can change based on enchantements.
|
||||
+ *
|
||||
+ * @param itemStack the itemstack to get the rarity of
|
||||
+ * @return the itemstack rarity
|
||||
+ */
|
||||
+ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index bd96c06aca1fc18807e65c34f399ce2ebe891816..f72d3d62d61755bbaf1950ebcb228ce95d1faf58 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -863,5 +863,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||
public String getTranslationKey() {
|
||||
return Bukkit.getUnsafe().getTranslationKey(this);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the item rarity of the itemstack. The rarity can change based on enchantements.
|
||||
+ *
|
||||
+ * @return the itemstack rarity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public io.papermc.paper.inventory.ItemRarity getRarity() {
|
||||
+ return Bukkit.getUnsafe().getItemStackRarity(this);
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
23
patches/api/0283-Expose-protocol-version.patch
Normal file
23
patches/api/0283-Expose-protocol-version.patch
Normal file
|
@ -0,0 +1,23 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: KennyTV <jahnke.nassim@gmail.com>
|
||||
Date: Fri, 26 Mar 2021 11:23:27 +0100
|
||||
Subject: [PATCH] Expose protocol version
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index bcd10b2c9255d778b678310febf1937301d01a50..6dbd520182b1e7713a68baad09b7f613424ef619 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -154,5 +154,12 @@ public interface UnsafeValues {
|
||||
* @return the itemstack rarity
|
||||
*/
|
||||
public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the server's protocol version.
|
||||
+ *
|
||||
+ * @return the server's protocol version
|
||||
+ */
|
||||
+ int getProtocolVersion();
|
||||
// Paper end
|
||||
}
|
|
@ -0,0 +1,407 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: jmp <jasonpenilla2@me.com>
|
||||
Date: Thu, 1 Apr 2021 00:34:41 -0700
|
||||
Subject: [PATCH] Allow for Component suggestion tooltips in
|
||||
AsyncTabCompleteEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
|
||||
index 619ed37169c126a8c75d02699a04728bac49d10d..4cd97cb102e1ec53b3fe1a451b65b4b640fde099 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
|
||||
@@ -24,6 +24,11 @@
|
||||
package com.destroystokyo.paper.event.server;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
+import io.papermc.paper.util.TransformingRandomAccessList;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.examination.Examinable;
|
||||
+import net.kyori.examination.ExaminableProperty;
|
||||
+import net.kyori.examination.string.StringExaminer;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -34,6 +39,7 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
+import java.util.stream.Stream;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -48,15 +54,29 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable {
|
||||
private final boolean isCommand;
|
||||
@Nullable
|
||||
private final Location loc;
|
||||
- @NotNull private List<String> completions;
|
||||
+ private final List<Completion> completions = new ArrayList<>();
|
||||
+ private final List<String> stringCompletions = new TransformingRandomAccessList<>(
|
||||
+ this.completions,
|
||||
+ Completion::suggestion,
|
||||
+ Completion::completion
|
||||
+ );
|
||||
private boolean cancelled;
|
||||
private boolean handled = false;
|
||||
private boolean fireSyncHandler = true;
|
||||
|
||||
+ public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
|
||||
+ super(true);
|
||||
+ this.sender = sender;
|
||||
+ this.buffer = buffer;
|
||||
+ this.isCommand = isCommand;
|
||||
+ this.loc = loc;
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated
|
||||
public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull List<String> completions, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
|
||||
super(true);
|
||||
this.sender = sender;
|
||||
- this.completions = completions;
|
||||
+ this.completions.addAll(fromStrings(completions));
|
||||
this.buffer = buffer;
|
||||
this.isCommand = isCommand;
|
||||
this.loc = loc;
|
||||
@@ -84,7 +104,7 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable {
|
||||
*/
|
||||
@NotNull
|
||||
public List<String> getCompletions() {
|
||||
- return completions;
|
||||
+ return this.stringCompletions;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,8 +118,42 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable {
|
||||
* @param completions the new completions
|
||||
*/
|
||||
public void setCompletions(@NotNull List<String> completions) {
|
||||
+ if (completions == this.stringCompletions) {
|
||||
+ return;
|
||||
+ }
|
||||
Validate.notNull(completions);
|
||||
- this.completions = new ArrayList<>(completions);
|
||||
+ this.completions.clear();
|
||||
+ this.completions.addAll(fromStrings(completions));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The list of {@link Completion completions} which will be offered to the sender, in order.
|
||||
+ * This list is mutable and reflects what will be offered.
|
||||
+ * <p>
|
||||
+ * If this collection is not empty after the event is fired, then
|
||||
+ * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
|
||||
+ * or current player names will not be called.
|
||||
+ *
|
||||
+ * @return a list of offered completions
|
||||
+ */
|
||||
+ public @NotNull List<Completion> completions() {
|
||||
+ return this.completions;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set the {@link Completion completions} offered, overriding any already set.
|
||||
+ * If this collection is not empty after the event is fired, then
|
||||
+ * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
|
||||
+ * or current player names will not be called.
|
||||
+ * <p>
|
||||
+ * The passed collection will be cloned to a new List. You must call {{@link #completions()}} to mutate from here
|
||||
+ *
|
||||
+ * @param newCompletions the new completions
|
||||
+ */
|
||||
+ public void completions(final @NotNull List<Completion> newCompletions) {
|
||||
+ Validate.notNull(newCompletions, "new completions");
|
||||
+ this.completions.clear();
|
||||
+ this.completions.addAll(newCompletions);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,4 +228,102 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+
|
||||
+ private static @NotNull List<Completion> fromStrings(final @NotNull List<String> strings) {
|
||||
+ final List<Completion> list = new ArrayList<>();
|
||||
+ for (final String it : strings) {
|
||||
+ list.add(new CompletionImpl(it, null));
|
||||
+ }
|
||||
+ return list;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * A rich tab completion, consisting of a string suggestion, and a nullable {@link Component} tooltip.
|
||||
+ */
|
||||
+ public interface Completion extends Examinable {
|
||||
+ /**
|
||||
+ * Get the suggestion string for this {@link Completion}.
|
||||
+ *
|
||||
+ * @return suggestion string
|
||||
+ */
|
||||
+ @NotNull String suggestion();
|
||||
+
|
||||
+ /**
|
||||
+ * Get the suggestion tooltip for this {@link Completion}.
|
||||
+ *
|
||||
+ * @return tooltip component
|
||||
+ */
|
||||
+ @Nullable Component tooltip();
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull Stream<? extends ExaminableProperty> examinableProperties() {
|
||||
+ return Stream.of(ExaminableProperty.of("suggestion", this.suggestion()), ExaminableProperty.of("tooltip", this.tooltip()));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a new {@link Completion} from a suggestion string.
|
||||
+ *
|
||||
+ * @param suggestion suggestion string
|
||||
+ * @return new completion instance
|
||||
+ */
|
||||
+ static @NotNull Completion completion(final @NotNull String suggestion) {
|
||||
+ return new CompletionImpl(suggestion, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a new {@link Completion} from a suggestion string and a tooltip {@link Component}.
|
||||
+ *
|
||||
+ * <p>If the provided component is null, the suggestion will not have a tooltip.</p>
|
||||
+ *
|
||||
+ * @param suggestion suggestion string
|
||||
+ * @param tooltip tooltip component, or null
|
||||
+ * @return new completion instance
|
||||
+ */
|
||||
+ static @NotNull Completion completion(final @NotNull String suggestion, final @Nullable Component tooltip) {
|
||||
+ return new CompletionImpl(suggestion, tooltip);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static final class CompletionImpl implements Completion {
|
||||
+ private final String suggestion;
|
||||
+ private final Component tooltip;
|
||||
+
|
||||
+ CompletionImpl(final @NotNull String suggestion, final @Nullable Component tooltip) {
|
||||
+ this.suggestion = suggestion;
|
||||
+ this.tooltip = tooltip;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull String suggestion() {
|
||||
+ return this.suggestion;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @Nullable Component tooltip() {
|
||||
+ return this.tooltip;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(final @Nullable Object o) {
|
||||
+ if (this == o) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if (o == null || this.getClass() != o.getClass()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ final CompletionImpl that = (CompletionImpl) o;
|
||||
+ return this.suggestion.equals(that.suggestion)
|
||||
+ && java.util.Objects.equals(this.tooltip, that.tooltip);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return java.util.Objects.hash(this.suggestion, this.tooltip);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull String toString() {
|
||||
+ return StringExaminer.simpleEscaping().examine(this);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java b/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276118c1c7b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java
|
||||
@@ -0,0 +1,169 @@
|
||||
+package io.papermc.paper.util;
|
||||
+
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.AbstractList;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.List;
|
||||
+import java.util.ListIterator;
|
||||
+import java.util.RandomAccess;
|
||||
+import java.util.function.Function;
|
||||
+import java.util.function.Predicate;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Modified version of the Guava class with the same name to support add operations.
|
||||
+ *
|
||||
+ * @param <F> backing list element type
|
||||
+ * @param <T> transformed list element type
|
||||
+ */
|
||||
+public final class TransformingRandomAccessList<F, T> extends AbstractList<T> implements RandomAccess {
|
||||
+ final List<F> fromList;
|
||||
+ final Function<? super F, ? extends T> toFunction;
|
||||
+ final Function<? super T, ? extends F> fromFunction;
|
||||
+
|
||||
+ /**
|
||||
+ * Create a new {@link TransformingRandomAccessList}.
|
||||
+ *
|
||||
+ * @param fromList backing list
|
||||
+ * @param toFunction function mapping backing list element type to transformed list element type
|
||||
+ * @param fromFunction function mapping transformed list element type to backing list element type
|
||||
+ */
|
||||
+ public TransformingRandomAccessList(
|
||||
+ final @NonNull List<F> fromList,
|
||||
+ final @NonNull Function<? super F, ? extends T> toFunction,
|
||||
+ final @NonNull Function<? super T, ? extends F> fromFunction
|
||||
+ ) {
|
||||
+ this.fromList = checkNotNull(fromList);
|
||||
+ this.toFunction = checkNotNull(toFunction);
|
||||
+ this.fromFunction = checkNotNull(fromFunction);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void clear() {
|
||||
+ this.fromList.clear();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public T get(int index) {
|
||||
+ return this.toFunction.apply(this.fromList.get(index));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Iterator<T> iterator() {
|
||||
+ return this.listIterator();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull ListIterator<T> listIterator(int index) {
|
||||
+ return new TransformedListIterator<F, T>(this.fromList.listIterator(index)) {
|
||||
+ @Override
|
||||
+ T transform(F from) {
|
||||
+ return TransformingRandomAccessList.this.toFunction.apply(from);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ F transformBack(T from) {
|
||||
+ return TransformingRandomAccessList.this.fromFunction.apply(from);
|
||||
+ }
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isEmpty() {
|
||||
+ return this.fromList.isEmpty();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean removeIf(Predicate<? super T> filter) {
|
||||
+ checkNotNull(filter);
|
||||
+ return this.fromList.removeIf(element -> filter.test(this.toFunction.apply(element)));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public T remove(int index) {
|
||||
+ return this.toFunction.apply(this.fromList.remove(index));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int size() {
|
||||
+ return this.fromList.size();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public T set(int i, T t) {
|
||||
+ return this.toFunction.apply(this.fromList.set(i, this.fromFunction.apply(t)));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void add(int i, T t) {
|
||||
+ this.fromList.add(i, this.fromFunction.apply(t));
|
||||
+ }
|
||||
+
|
||||
+ static abstract class TransformedListIterator<F, T> implements ListIterator<T>, Iterator<T> {
|
||||
+ final Iterator<F> backingIterator;
|
||||
+
|
||||
+ TransformedListIterator(ListIterator<F> backingIterator) {
|
||||
+ this.backingIterator = checkNotNull((Iterator<F>) backingIterator);
|
||||
+ }
|
||||
+
|
||||
+ private ListIterator<F> backingIterator() {
|
||||
+ return cast(this.backingIterator);
|
||||
+ }
|
||||
+
|
||||
+ static <A> ListIterator<A> cast(Iterator<A> iterator) {
|
||||
+ return (ListIterator<A>) iterator;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final boolean hasPrevious() {
|
||||
+ return this.backingIterator().hasPrevious();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final T previous() {
|
||||
+ return this.transform(this.backingIterator().previous());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final int nextIndex() {
|
||||
+ return this.backingIterator().nextIndex();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final int previousIndex() {
|
||||
+ return this.backingIterator().previousIndex();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void set(T element) {
|
||||
+ this.backingIterator().set(this.transformBack(element));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void add(T element) {
|
||||
+ this.backingIterator().add(this.transformBack(element));
|
||||
+ }
|
||||
+
|
||||
+ abstract T transform(F from);
|
||||
+
|
||||
+ abstract F transformBack(T to);
|
||||
+
|
||||
+ @Override
|
||||
+ public final boolean hasNext() {
|
||||
+ return this.backingIterator.hasNext();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final T next() {
|
||||
+ return this.transform(this.backingIterator.next());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public final void remove() {
|
||||
+ this.backingIterator.remove();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 19271057cf24329757c9419fa6c97848e008a96c..82b2783497947f336b0dd95db61f31f8f77f446c 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -48,6 +48,8 @@ public class AnnotationTest {
|
||||
// Generic functional interface
|
||||
"org/bukkit/util/Consumer",
|
||||
// Paper start
|
||||
+ "io/papermc/paper/util/TransformingRandomAccessList",
|
||||
+ "io/papermc/paper/util/TransformingRandomAccessList$TransformedListIterator",
|
||||
// Timings history is broken in terms of nullability due to guavas Function defining that the param is NonNull
|
||||
"co/aikar/timings/TimingHistory$2",
|
||||
"co/aikar/timings/TimingHistory$2$1",
|
26
patches/api/0285-add-isDeeplySleeping-to-HumanEntity.patch
Normal file
26
patches/api/0285-add-isDeeplySleeping-to-HumanEntity.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 8 Apr 2021 17:36:15 -0700
|
||||
Subject: [PATCH] add isDeeplySleeping to HumanEntity
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
index 112c891e54e8f30ac10e6865efc2a8ee8d172188..0ad7a3d4d40d58eb950e34668f9554bb73f934fb 100644
|
||||
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
@@ -319,6 +319,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
|
||||
*/
|
||||
public void setCooldown(@NotNull Material material, int ticks);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * If the player has slept enough to count towards passing the night.
|
||||
+ *
|
||||
+ * @return true if the player has slept enough
|
||||
+ */
|
||||
+ public boolean isDeeplySleeping();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get the sleep ticks of the player. This value may be capped.
|
||||
*
|
44
patches/api/0286-add-consumeFuel-to-FurnaceBurnEvent.patch
Normal file
44
patches/api/0286-add-consumeFuel-to-FurnaceBurnEvent.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 22 Apr 2021 16:45:15 -0700
|
||||
Subject: [PATCH] add consumeFuel to FurnaceBurnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java b/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java
|
||||
index bc71bc2d3ace0d19d730c09f05f9e0655bcee8f5..caef53d0f6546516fa7aabb2cb3abed70808b3ba 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/FurnaceBurnEvent.java
|
||||
@@ -16,6 +16,7 @@ public class FurnaceBurnEvent extends BlockEvent implements Cancellable {
|
||||
private int burnTime;
|
||||
private boolean cancelled;
|
||||
private boolean burning;
|
||||
+ private boolean consumeFuel = true; // Paper
|
||||
|
||||
public FurnaceBurnEvent(@NotNull final Block furnace, @NotNull final ItemStack fuel, final int burnTime) {
|
||||
super(furnace);
|
||||
@@ -70,6 +71,25 @@ public class FurnaceBurnEvent extends BlockEvent implements Cancellable {
|
||||
public void setBurning(boolean burning) {
|
||||
this.burning = burning;
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets whether the furnace's fuel will be consumed or not.
|
||||
+ *
|
||||
+ * @return whether the furnace's fuel will be consumed
|
||||
+ */
|
||||
+ public boolean willConsumeFuel() {
|
||||
+ return consumeFuel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the furnace's fuel will be consumed or not.
|
||||
+ *
|
||||
+ * @param consumeFuel true to consume the fuel
|
||||
+ */
|
||||
+ public void setConsumeFuel(boolean consumeFuel) {
|
||||
+ this.consumeFuel = consumeFuel;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
|
@ -0,0 +1,43 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 22 Apr 2021 00:28:20 -0700
|
||||
Subject: [PATCH] add get-set drop chance to EntityEquipment
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/EntityEquipment.java b/src/main/java/org/bukkit/inventory/EntityEquipment.java
|
||||
index f905bf7a28a42d8bd2aecd42030d2b2092696fc3..58cfd450973f56bfbdd20f9dca8c1e7455260a55 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/EntityEquipment.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/EntityEquipment.java
|
||||
@@ -405,4 +405,32 @@ public interface EntityEquipment {
|
||||
*/
|
||||
@Nullable
|
||||
Entity getHolder();
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the drop chance of specified slot.
|
||||
+ *
|
||||
+ * <ul>
|
||||
+ * <li>A drop chance of 0.0F will never drop
|
||||
+ * <li>A drop chance of 1.0F will always drop
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param slot the slot to get the drop chance of
|
||||
+ * @return the drop chance for the slot
|
||||
+ */
|
||||
+ float getDropChance(@NotNull EquipmentSlot slot);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the drop chance of the specified slot.
|
||||
+ *
|
||||
+ * <ul>
|
||||
+ * <li>A drop chance of 0.0F will never drop
|
||||
+ * <li>A drop chance of 1.0F will always drop
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param slot the slot to set the drop chance of
|
||||
+ * @param chance the drop chance for the slot
|
||||
+ * @throws UnsupportedOperationException when called on players
|
||||
+ */
|
||||
+ void setDropChance(@NotNull EquipmentSlot slot, float chance);
|
||||
+ // Paper end
|
||||
}
|
58
patches/api/0288-Added-PlayerDeepSleepEvent.patch
Normal file
58
patches/api/0288-Added-PlayerDeepSleepEvent.patch
Normal file
|
@ -0,0 +1,58 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 21 Apr 2021 15:58:25 -0700
|
||||
Subject: [PATCH] Added PlayerDeepSleepEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e3ee540bb0a5bc578b148fbcf8b5e39ab9c8575c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerDeepSleepEvent.java
|
||||
@@ -0,0 +1,46 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player has slept long enough
|
||||
+ * to count as passing the night/storm.
|
||||
+ * <p>
|
||||
+ * Cancelling this event will prevent the player from being counted as deeply sleeping
|
||||
+ * unless they exit and re-enter the bed.
|
||||
+ */
|
||||
+public class PlayerDeepSleepEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public PlayerDeepSleepEvent(@NotNull Player player) {
|
||||
+ super(player);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
131
patches/api/0289-More-World-API.patch
Normal file
131
patches/api/0289-More-World-API.patch
Normal file
|
@ -0,0 +1,131 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 7 Jul 2020 10:53:22 -0700
|
||||
Subject: [PATCH] More World API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 178a0853bd8136c6a7408f5d49604ceb2479f138..244bb359492ae486f0610f5aea6b75997dbc4bdc 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -3482,6 +3482,120 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
|
||||
@Nullable
|
||||
public Location locateNearestStructure(@NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Locates the nearest biome based on an origin, biome type, and radius to search.
|
||||
+ * Step defaults to {@code 8}.
|
||||
+ *
|
||||
+ * @param origin Origin location
|
||||
+ * @param biome Biome to find
|
||||
+ * @param radius radius to search
|
||||
+ * @return Location of biome or null if not found in specified radius
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ Location locateNearestBiome(@NotNull Location origin, @NotNull Biome biome, int radius);
|
||||
+
|
||||
+ /**
|
||||
+ * Locates the nearest biome based on an origin, biome type, and radius to search
|
||||
+ * and step
|
||||
+ *
|
||||
+ * @param origin Origin location
|
||||
+ * @param biome Biome to find
|
||||
+ * @param radius radius to search
|
||||
+ * @param step Search step 1 would mean checking every block, 8 would be every 8th block
|
||||
+ * @return Location of biome or null if not found in specified radius
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ Location locateNearestBiome(@NotNull Location origin, @NotNull Biome biome, int radius, int step);
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the world:
|
||||
+ * <ul>
|
||||
+ * <li>evaporates water</li>
|
||||
+ * <li>dries sponges</li>
|
||||
+ * <li>has lava spread faster and further</li>
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @return true if ultrawarm, false if not
|
||||
+ */
|
||||
+ boolean isUltrawarm();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the world is natural.
|
||||
+ * <p>
|
||||
+ * If {@code false}, compasses will spin randomly in the world.
|
||||
+ * If {@code true}, nether portals will spawn zombified piglins.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @return true or false
|
||||
+ */
|
||||
+ boolean isNatural();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the coordinate scaling of this world.
|
||||
+ *
|
||||
+ * @return the coordinate scale
|
||||
+ */
|
||||
+ double getCoordinateScale();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the world has skylight access
|
||||
+ *
|
||||
+ * @return whether there is skylight
|
||||
+ */
|
||||
+ boolean hasSkylight();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the world has a bedrock ceiling
|
||||
+ *
|
||||
+ * @return whether the world has a bedrock ceiling
|
||||
+ */
|
||||
+ boolean hasBedrockCeiling();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if piglins will turn into Zombified Piglins in this world
|
||||
+ *
|
||||
+ * @return whether Piglins will <i>not</i> transform
|
||||
+ */
|
||||
+ boolean isPiglinSafe();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if beds work
|
||||
+ *
|
||||
+ * @return whether beds work
|
||||
+ */
|
||||
+ boolean doesBedWork();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if respawn anchors work
|
||||
+ *
|
||||
+ * @return whether respawn anchors work
|
||||
+ */
|
||||
+ boolean doesRespawnAnchorWork();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this world supports raids
|
||||
+ *
|
||||
+ * @return whether this world supports raids
|
||||
+ */
|
||||
+ boolean hasRaids();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this world has a fixed time
|
||||
+ *
|
||||
+ * @return whether this world has fixed time
|
||||
+ */
|
||||
+ boolean isFixedTime();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the collection of materials that burn infinitely in this world.
|
||||
+ *
|
||||
+ * @return the materials that will forever stay lit by fire
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Collection<Material> getInfiniburn();
|
||||
+ // Paper end
|
||||
+
|
||||
// Spigot start
|
||||
/**
|
||||
* Returns the view distance used for this world.
|
131
patches/api/0290-Added-PlayerBedFailEnterEvent.patch
Normal file
131
patches/api/0290-Added-PlayerBedFailEnterEvent.patch
Normal file
|
@ -0,0 +1,131 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 24 Dec 2020 12:27:49 -0800
|
||||
Subject: [PATCH] Added PlayerBedFailEnterEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e0028733615ddc9e34359f673ca1c3cadb133948
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerBedFailEnterEvent.java
|
||||
@@ -0,0 +1,119 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public class PlayerBedFailEnterEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final FailReason failReason;
|
||||
+ private final Block bed;
|
||||
+ private boolean willExplode;
|
||||
+ private Component message;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public PlayerBedFailEnterEvent(@NotNull Player player, @NotNull FailReason failReason, @NotNull Block bed, boolean willExplode, @Nullable Component message) {
|
||||
+ super(player);
|
||||
+ this.failReason = failReason;
|
||||
+ this.bed = bed;
|
||||
+ this.willExplode = willExplode;
|
||||
+ this.message = message;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public FailReason getFailReason() {
|
||||
+ return failReason;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Block getBed() {
|
||||
+ return bed;
|
||||
+ }
|
||||
+
|
||||
+ public boolean getWillExplode() {
|
||||
+ return willExplode;
|
||||
+ }
|
||||
+
|
||||
+ public void setWillExplode(boolean willExplode) {
|
||||
+ this.willExplode = willExplode;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Component getMessage() {
|
||||
+ return message;
|
||||
+ }
|
||||
+
|
||||
+ public void setMessage(@Nullable Component message) {
|
||||
+ this.message = message;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Cancel this event.
|
||||
+ * <p>
|
||||
+ * <b>NOTE: This does not cancel the player getting in the bed, but any messages/explosions
|
||||
+ * that may occur because of the interaction.</b>
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static enum FailReason {
|
||||
+ /**
|
||||
+ * The world doesn't allow sleeping (ex. Nether or The End). Entering
|
||||
+ * the bed is prevented and the bed explodes.
|
||||
+ */
|
||||
+ NOT_POSSIBLE_HERE,
|
||||
+ /**
|
||||
+ * Entering the bed is prevented due to it not being night nor
|
||||
+ * thundering currently.
|
||||
+ * <p>
|
||||
+ * If the event is forcefully allowed during daytime, the player will
|
||||
+ * enter the bed (and set its bed location), but might get immediately
|
||||
+ * thrown out again.
|
||||
+ */
|
||||
+ NOT_POSSIBLE_NOW,
|
||||
+ /**
|
||||
+ * Entering the bed is prevented due to the player being too far away.
|
||||
+ */
|
||||
+ TOO_FAR_AWAY,
|
||||
+ /**
|
||||
+ * Bed is obstructed.
|
||||
+ */
|
||||
+ OBSTRUCTED,
|
||||
+ /**
|
||||
+ * Entering the bed is prevented due to there being some other problem.
|
||||
+ */
|
||||
+ OTHER_PROBLEM,
|
||||
+ /**
|
||||
+ * Entering the bed is prevented due to there being monsters nearby.
|
||||
+ */
|
||||
+ NOT_SAFE;
|
||||
+
|
||||
+ public static final FailReason[] VALUES = values();
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,101 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spyridon Pagkalos <spyridon@ender.gr>
|
||||
Date: Thu, 25 Mar 2021 20:25:47 +0200
|
||||
Subject: [PATCH] Introduce beacon activation/deactivation events
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java b/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7575ca7dd84dee89528ec2e5e5f99f97d8a10f58
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BeaconActivatedEvent.java
|
||||
@@ -0,0 +1,40 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Beacon;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a beacon is activated.
|
||||
+ * Activation occurs when the beacon beam becomes visible.
|
||||
+ */
|
||||
+public class BeaconActivatedEvent extends BlockEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ public BeaconActivatedEvent(@NotNull Block block) {
|
||||
+ super(block);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the beacon that was activated.
|
||||
+ *
|
||||
+ * @return the beacon that was activated.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Beacon getBeacon() {
|
||||
+ return (Beacon) block.getState();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java b/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..34f18468b4cfc08717cc3442778c9e85124e5a22
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BeaconDeactivatedEvent.java
|
||||
@@ -0,0 +1,43 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
+import org.bukkit.block.Beacon;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a beacon is deactivated, either because its base block(s) or itself were destroyed.
|
||||
+ */
|
||||
+public class BeaconDeactivatedEvent extends BlockEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ public BeaconDeactivatedEvent(@NotNull Block block) {
|
||||
+ super(block);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the beacon that was deactivated.
|
||||
+ * This will return null if the beacon does not exist.
|
||||
+ * (which can occur after the deactivation of a now broken beacon)
|
||||
+ *
|
||||
+ * @return The beacon that got deactivated, or null if it does not exist.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Beacon getBeacon() {
|
||||
+ return block.getType() == Material.BEACON ? (Beacon) block.getState() : null;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
64
patches/api/0292-PlayerMoveEvent-Improvements.patch
Normal file
64
patches/api/0292-PlayerMoveEvent-Improvements.patch
Normal file
|
@ -0,0 +1,64 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HexedHero <6012891+HexedHero@users.noreply.github.com>
|
||||
Date: Thu, 29 Apr 2021 10:31:44 +0100
|
||||
Subject: [PATCH] PlayerMoveEvent Improvements
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
|
||||
index 1a58734d919fae247eeb85dd785fd59990856505..b484abf3b06b1fb3577b43d50d64498dcd7652c9 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
|
||||
@@ -93,6 +93,53 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
+ // Paper start - PlayerMoveEvent improvements
|
||||
+ /**
|
||||
+ * Check if the player has changed position (even within the same block) in the event
|
||||
+ *
|
||||
+ * @return whether the player has changed position or not
|
||||
+ */
|
||||
+ public boolean hasChangedPosition() {
|
||||
+ return hasExplicitlyChangedPosition() || !from.getWorld().equals(to.getWorld());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Check if the player has changed position (even within the same block) in the event, disregarding a possible world change
|
||||
+ *
|
||||
+ * @return whether the player has changed position or not
|
||||
+ */
|
||||
+ public boolean hasExplicitlyChangedPosition() {
|
||||
+ return from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Check if the player has moved to a new block in the event
|
||||
+ *
|
||||
+ * @return whether the player has moved to a new block or not
|
||||
+ */
|
||||
+ public boolean hasChangedBlock() {
|
||||
+ return hasExplicitlyChangedBlock() || !from.getWorld().equals(to.getWorld());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Check if the player has moved to a new block in the event, disregarding a possible world change
|
||||
+ *
|
||||
+ * @return whether the player has moved to a new block or not
|
||||
+ */
|
||||
+ public boolean hasExplicitlyChangedBlock() {
|
||||
+ return from.getBlockX() != to.getBlockX() || from.getBlockY() != to.getBlockY() || from.getBlockZ() != to.getBlockZ();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Check if the player has changed orientation in the event
|
||||
+ *
|
||||
+ * @return whether the player has changed orientation or not
|
||||
+ */
|
||||
+ public boolean hasChangedOrientation() {
|
||||
+ return from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
private void validateLocation(@NotNull Location loc) {
|
||||
Preconditions.checkArgument(loc != null, "Cannot use null location!");
|
||||
Preconditions.checkArgument(loc.getWorld() != null, "Cannot use null location with null world!");
|
|
@ -0,0 +1,73 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 22 Apr 2021 17:17:54 -0700
|
||||
Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java
|
||||
index d2be2ad2e3665728e614a89dd62ef9237f1d3ce6..359e385bd6854a4b146cd0a54badb9c3d31ca12d 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java
|
||||
@@ -14,17 +14,30 @@ public class PlayerRespawnEvent extends PlayerEvent {
|
||||
private Location respawnLocation;
|
||||
private final boolean isBedSpawn;
|
||||
private final boolean isAnchorSpawn;
|
||||
+ private final java.util.Set<RespawnFlag> respawnFlags; // Paper
|
||||
|
||||
@Deprecated
|
||||
public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn) {
|
||||
this(respawnPlayer, respawnLocation, isBedSpawn, false);
|
||||
}
|
||||
|
||||
+ @Deprecated // Paper
|
||||
public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn) {
|
||||
+ // Paper start
|
||||
+ this(respawnPlayer, respawnLocation, isBedSpawn, isAnchorSpawn, com.google.common.collect.ImmutableSet.builder());
|
||||
+ }
|
||||
+
|
||||
+ public PlayerRespawnEvent(@NotNull final Player respawnPlayer, @NotNull final Location respawnLocation, final boolean isBedSpawn, final boolean isAnchorSpawn, @NotNull final com.google.common.collect.ImmutableSet.Builder<org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag> respawnFlags) {
|
||||
+ // Paper end
|
||||
super(respawnPlayer);
|
||||
this.respawnLocation = respawnLocation;
|
||||
this.isBedSpawn = isBedSpawn;
|
||||
this.isAnchorSpawn = isAnchorSpawn;
|
||||
+ // Paper start
|
||||
+ if (this.isBedSpawn) { respawnFlags.add(RespawnFlag.BED_SPAWN); }
|
||||
+ if (this.isAnchorSpawn) { respawnFlags.add(RespawnFlag.ANCHOR_SPAWN); }
|
||||
+ this.respawnFlags = respawnFlags.build();
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,4 +90,31 @@ public class PlayerRespawnEvent extends PlayerEvent {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get the set of flags that apply to this respawn.
|
||||
+ *
|
||||
+ * @return an immutable set of the flags that apply to this respawn
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public java.util.Set<RespawnFlag> getRespawnFlags() {
|
||||
+ return respawnFlags;
|
||||
+ }
|
||||
+
|
||||
+ public enum RespawnFlag {
|
||||
+ /**
|
||||
+ * Will use the bed spawn location
|
||||
+ */
|
||||
+ BED_SPAWN,
|
||||
+ /**
|
||||
+ * Will use the respawn anchor location
|
||||
+ */
|
||||
+ ANCHOR_SPAWN,
|
||||
+ /**
|
||||
+ * Is caused by going to the end portal in the end.
|
||||
+ */
|
||||
+ END_PORTAL,
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
41
patches/api/0294-Add-more-WanderingTrader-API.patch
Normal file
41
patches/api/0294-Add-more-WanderingTrader-API.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HexedHero <6012891+HexedHero@users.noreply.github.com>
|
||||
Date: Thu, 6 May 2021 14:56:26 +0100
|
||||
Subject: [PATCH] Add more WanderingTrader API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/WanderingTrader.java b/src/main/java/org/bukkit/entity/WanderingTrader.java
|
||||
index 55394ed5c68cb0bf4333fc918e3b4c8c4e3db0c6..da76e1ed5406322073dd8c7a89ca55aa68620ac4 100644
|
||||
--- a/src/main/java/org/bukkit/entity/WanderingTrader.java
|
||||
+++ b/src/main/java/org/bukkit/entity/WanderingTrader.java
|
||||
@@ -28,4 +28,30 @@ public interface WanderingTrader extends AbstractVillager {
|
||||
* {@link WanderingTrader} is forcibly despawned
|
||||
*/
|
||||
public void setDespawnDelay(int despawnDelay);
|
||||
+
|
||||
+ // Paper start - Add more WanderingTrader API
|
||||
+ /**
|
||||
+ * Set if the Wandering Trader can and will drink an invisibility potion.
|
||||
+ * @param bool whether the mob will drink
|
||||
+ */
|
||||
+ public void setCanDrinkPotion(boolean bool);
|
||||
+
|
||||
+ /**
|
||||
+ * Get if the Wandering Trader can and will drink an invisibility potion.
|
||||
+ * @return whether the mob will drink
|
||||
+ */
|
||||
+ public boolean canDrinkPotion();
|
||||
+
|
||||
+ /**
|
||||
+ * Set if the Wandering Trader can and will drink milk.
|
||||
+ * @param bool whether the mob will drink
|
||||
+ */
|
||||
+ public void setCanDrinkMilk(boolean bool);
|
||||
+
|
||||
+ /**
|
||||
+ * Get if the Wandering Trader can and will drink milk.
|
||||
+ * @return whether the mob will drink
|
||||
+ */
|
||||
+ public boolean canDrinkMilk();
|
||||
+ // Paper end
|
||||
}
|
22
patches/api/0295-Add-EntityBlockStorage-clearEntities.patch
Normal file
22
patches/api/0295-Add-EntityBlockStorage-clearEntities.patch
Normal file
|
@ -0,0 +1,22 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Mon, 5 Apr 2021 18:12:06 -0400
|
||||
Subject: [PATCH] Add EntityBlockStorage#clearEntities()
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/EntityBlockStorage.java b/src/main/java/org/bukkit/block/EntityBlockStorage.java
|
||||
index f3f8d765d5d487aa14edf0b88c32608fb804c331..739911cda33b373f99df627a3a378b37d7d461aa 100644
|
||||
--- a/src/main/java/org/bukkit/block/EntityBlockStorage.java
|
||||
+++ b/src/main/java/org/bukkit/block/EntityBlockStorage.java
|
||||
@@ -53,4 +53,11 @@ public interface EntityBlockStorage<T extends Entity> extends TileState {
|
||||
* @param entity Entity to add to the block
|
||||
*/
|
||||
void addEntity(@NotNull T entity);
|
||||
+
|
||||
+ // Paper start - Add EntityBlockStorage clearEntities
|
||||
+ /**
|
||||
+ * Clear all currently stored entities in the block.
|
||||
+ */
|
||||
+ void clearEntities();
|
||||
+ // Paper end
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com>
|
||||
Date: Fri, 8 Jan 2021 20:29:58 +0100
|
||||
Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java
|
||||
index 21ff095afb434d15babcdbe85fa0b94cbb7e75a7..6f618bb140a901c5c1cd08210978a6a651677ba4 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java
|
||||
@@ -4,6 +4,10 @@ import org.bukkit.advancement.Advancement;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+// Paper start
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+// Paper end
|
||||
|
||||
/**
|
||||
* Called when a player has completed all criteria in an advancement.
|
||||
@@ -13,10 +17,17 @@ public class PlayerAdvancementDoneEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
//
|
||||
private final Advancement advancement;
|
||||
+ private Component message; // Paper - Add Adventure message
|
||||
|
||||
public PlayerAdvancementDoneEvent(@NotNull Player who, @NotNull Advancement advancement) {
|
||||
+ // Paper start - Add Adventure message
|
||||
+ this(who, advancement, null);
|
||||
+ }
|
||||
+ public PlayerAdvancementDoneEvent(@NotNull Player who, @NotNull Advancement advancement, @Nullable Component message) {
|
||||
+ // Paper end
|
||||
super(who);
|
||||
this.advancement = advancement;
|
||||
+ this.message = message; // Paper - Add Adventure message
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,6 +40,31 @@ public class PlayerAdvancementDoneEvent extends PlayerEvent {
|
||||
return advancement;
|
||||
}
|
||||
|
||||
+ // Paper start - Add Adventure message
|
||||
+ /**
|
||||
+ * Gets the message to send to all online players.
|
||||
+ * <p>
|
||||
+ * Will be null if the advancement does not announce to chat, for example if
|
||||
+ * it is a recipe unlock or a root advancement.
|
||||
+ *
|
||||
+ * @return The announcement message, or null
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Component message() {
|
||||
+ return this.message;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the message to send to all online players.
|
||||
+ * <p>
|
||||
+ * If set to null the message will not be sent.
|
||||
+ *
|
||||
+ * @param message The new message
|
||||
+ */
|
||||
+ public void message(@Nullable Component message) {
|
||||
+ this.message = message;
|
||||
+ }
|
||||
+ // Paper end
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
|
@ -0,0 +1,50 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Connor Linfoot <connorlinfoot@me.com>
|
||||
Date: Wed, 12 May 2021 08:09:19 +0100
|
||||
Subject: [PATCH] Add raw address to AsyncPlayerPreLoginEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
index c9af02b0f62b3d18da1e91d1ea02ce0864fc60b9..77aefda5aac4602bf5bf71c29600e7450defdd4e 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
@@ -20,6 +20,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
private net.kyori.adventure.text.Component message; // Paper
|
||||
//private String name; // Paper - Not used anymore
|
||||
private final InetAddress ipAddress;
|
||||
+ private final InetAddress rawAddress; // Paper
|
||||
//private UUID uniqueId; // Paper - Not used anymore
|
||||
|
||||
@Deprecated
|
||||
@@ -49,7 +50,23 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
+ // Paper Start
|
||||
+ /**
|
||||
+ * Gets the raw address of the player logging in
|
||||
+ * @return The address
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public InetAddress getRawAddress() {
|
||||
+ return rawAddress;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+ @Deprecated
|
||||
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
|
||||
+ this(name, ipAddress, ipAddress, uniqueId, profile);
|
||||
+ }
|
||||
+
|
||||
+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final InetAddress rawAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
|
||||
super(true);
|
||||
this.profile = profile;
|
||||
// Paper end
|
||||
@@ -57,6 +74,7 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
this.message = net.kyori.adventure.text.Component.empty(); // Paper
|
||||
//this.name = name; // Paper - Not used anymore
|
||||
this.ipAddress = ipAddress;
|
||||
+ this.rawAddress = rawAddress; // Paper
|
||||
//this.uniqueId = uniqueId; // Paper - Not used anymore
|
||||
}
|
||||
|
26
patches/api/0298-Inventory-close.patch
Normal file
26
patches/api/0298-Inventory-close.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 11 May 2021 14:54:20 -0700
|
||||
Subject: [PATCH] Inventory#close
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
index 7956aebcb390379677dccf7c9561866cf94c024c..8f00cb2e3bc9963e9657c1b2493e8b015a6664d0 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
|
||||
@@ -353,6 +353,15 @@ public interface Inventory extends Iterable<ItemStack> {
|
||||
*/
|
||||
public void clear();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Closes the inventory for all viewers.
|
||||
+ *
|
||||
+ * @return the number if viewers the inventory was closed for
|
||||
+ */
|
||||
+ public int close();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets a list of players viewing the inventory. Note that a player is
|
||||
* considered to be viewing their own inventory and internal crafting
|
|
@ -0,0 +1,55 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MeFisto94 <MeFisto94@users.noreply.github.com>
|
||||
Date: Tue, 11 May 2021 00:48:51 +0200
|
||||
Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and
|
||||
Skeletons
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java
|
||||
index ed4d417c2deefb78807cb61b01df5afcd334d754..a40b045f08b85e22e75459b547e7e7c0b95103ed 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Phantom.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Phantom.java
|
||||
@@ -26,5 +26,19 @@ public interface Phantom extends Flying {
|
||||
*/
|
||||
@Nullable
|
||||
public java.util.UUID getSpawningEntity();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if this phantom will burn in the sunlight
|
||||
+ *
|
||||
+ * @return True if phantom will burn in sunlight
|
||||
+ */
|
||||
+ public boolean shouldBurnInDay();
|
||||
+
|
||||
+ /**
|
||||
+ * Set if this phantom should burn in the sunlight
|
||||
+ *
|
||||
+ * @param shouldBurnInDay True to burn in sunlight
|
||||
+ */
|
||||
+ public void setShouldBurnInDay(boolean shouldBurnInDay);
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
index b7e424ea8a282f45fb8b91c919e4e4526c00be8b..2ca7c040270fa1b0fe623a0a779879783201a2f1 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
@@ -64,4 +64,19 @@ public interface Skeleton extends AbstractSkeleton, com.destroystokyo.paper.enti
|
||||
*/
|
||||
STRAY;
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Check if this skeleton will burn in the sunlight
|
||||
+ *
|
||||
+ * @return True if skeleton will burn in sunlight
|
||||
+ */
|
||||
+ boolean shouldBurnInDay();
|
||||
+
|
||||
+ /**
|
||||
+ * Set if this skeleton should burn in the sunlight
|
||||
+ *
|
||||
+ * @param shouldBurnInDay True to burn in sunlight
|
||||
+ */
|
||||
+ void setShouldBurnInDay(boolean shouldBurnInDay);
|
||||
+ // Paper end
|
||||
}
|
106
patches/api/0300-Add-basic-Datapack-API.patch
Normal file
106
patches/api/0300-Add-basic-Datapack-API.patch
Normal file
|
@ -0,0 +1,106 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Connor Linfoot <connorlinfoot@me.com>
|
||||
Date: Sun, 16 May 2021 15:07:34 +0100
|
||||
Subject: [PATCH] Add basic Datapack API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/datapack/Datapack.java b/src/main/java/io/papermc/paper/datapack/Datapack.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7b2ab0be10a21e0496ad1d485ff8cb2c0b92a2cb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datapack/Datapack.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+package io.papermc.paper.datapack;
|
||||
+
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+
|
||||
+public interface Datapack {
|
||||
+
|
||||
+ /**
|
||||
+ * @return the name of the pack
|
||||
+ */
|
||||
+ @NonNull
|
||||
+ String getName();
|
||||
+
|
||||
+ /**
|
||||
+ * @return the compatibility of the pack
|
||||
+ */
|
||||
+ @NonNull
|
||||
+ Compatibility getCompatibility();
|
||||
+
|
||||
+ /**
|
||||
+ * @return whether or not the pack is currently enabled
|
||||
+ */
|
||||
+ boolean isEnabled();
|
||||
+
|
||||
+ void setEnabled(boolean enabled);
|
||||
+
|
||||
+ enum Compatibility {
|
||||
+ TOO_OLD,
|
||||
+ TOO_NEW,
|
||||
+ COMPATIBLE,
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datapack/DatapackManager.java b/src/main/java/io/papermc/paper/datapack/DatapackManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f70d08b2a2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datapack/DatapackManager.java
|
||||
@@ -0,0 +1,21 @@
|
||||
+package io.papermc.paper.datapack;
|
||||
+
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+
|
||||
+public interface DatapackManager {
|
||||
+
|
||||
+ /**
|
||||
+ * @return all the packs known to the server
|
||||
+ */
|
||||
+ @NonNull
|
||||
+ Collection<Datapack> getPacks();
|
||||
+
|
||||
+ /**
|
||||
+ * @return all the packs which are currently enabled
|
||||
+ */
|
||||
+ @NonNull
|
||||
+ Collection<Datapack> getEnabledPacks();
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 142050887ac02e36ae20e73a43ec698b6bab1947..e8414592b3afeb1e5db2b817b8fb7c13e073b9aa 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1949,6 +1949,14 @@ public final class Bukkit {
|
||||
public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
|
||||
return server.getMobGoals();
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * @return the datapack manager
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static io.papermc.paper.datapack.DatapackManager getDatapackManager() {
|
||||
+ return server.getDatapackManager();
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@NotNull
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 0b3de184f7267543d693c45379bf5989303cf56a..e88b47a838dc472ad64271a518ee1789f7be19fa 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1709,5 +1709,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
@NotNull
|
||||
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
|
||||
+
|
||||
+ /**
|
||||
+ * @return the datapack manager
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ io.papermc.paper.datapack.DatapackManager getDatapackManager();
|
||||
// Paper end
|
||||
}
|
111
patches/api/0301-additions-to-PlayerGameModeChangeEvent.patch
Normal file
111
patches/api/0301-additions-to-PlayerGameModeChangeEvent.patch
Normal file
|
@ -0,0 +1,111 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 15 May 2021 10:04:50 -0700
|
||||
Subject: [PATCH] additions to PlayerGameModeChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java
|
||||
index 4b96e0573c7ce32ad8c41124ee9ecab8359318a5..b71f37dc8ac00175efd9275e9d8988bb5f2d9c47 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerGameModeChangeEvent.java
|
||||
@@ -13,10 +13,22 @@ public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellabl
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private final GameMode newGameMode;
|
||||
+ // Paper start
|
||||
+ private final Cause cause;
|
||||
+ private net.kyori.adventure.text.Component cancelMessage;
|
||||
|
||||
+ @Deprecated // Paper end
|
||||
public PlayerGameModeChangeEvent(@NotNull final Player player, @NotNull final GameMode newGameMode) {
|
||||
+ // Paper start
|
||||
+ this(player, newGameMode, Cause.UNKNOWN, null);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerGameModeChangeEvent(@NotNull final Player player, @NotNull final GameMode newGameMode, @NotNull Cause cause, @org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component cancelMessage) {
|
||||
+ // Paper end
|
||||
super(player);
|
||||
this.newGameMode = newGameMode;
|
||||
+ this.cause = cause; // Paper
|
||||
+ this.cancelMessage = cancelMessage; // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,4 +61,77 @@ public class PlayerGameModeChangeEvent extends PlayerEvent implements Cancellabl
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the cause of this gamemode change.
|
||||
+ *
|
||||
+ * @return the cause
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return cause;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * <b>Only valid if the cause of the gamemode change was directly due to a command.</b>.
|
||||
+ * Gets the message shown to the command user if the event is cancelled
|
||||
+ * as a notification that a player's gamemode was not changed.
|
||||
+ * <p>
|
||||
+ * This returns {@code null} if the gamemode change was due to a plugin, or a
|
||||
+ * player joining the game with a gamemode not equal to the server default gamemode
|
||||
+ * and {@code force-gamemode} is set to true.
|
||||
+ *
|
||||
+ * @return the error message shown to the command user, null if not directly caused by a command
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ public net.kyori.adventure.text.Component cancelMessage() {
|
||||
+ return cancelMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the message shown to the command user if the event was cancelled.
|
||||
+ * <b>The message is only shown to cancelled events that are directly called by a command
|
||||
+ * not by a plugin or a player joining with the wrong gamemode.</b>
|
||||
+ *
|
||||
+ * @param message the error message shown to the command user, null to show no message.
|
||||
+ */
|
||||
+ public void cancelMessage(@org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component message) {
|
||||
+ this.cancelMessage = message;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+
|
||||
+ /**
|
||||
+ * A plugin changed the player's gamemode with
|
||||
+ * {@link Player#setGameMode(GameMode)}.
|
||||
+ */
|
||||
+ PLUGIN,
|
||||
+
|
||||
+ /**
|
||||
+ * The {@code /gamemode} command was used.
|
||||
+ */
|
||||
+ COMMAND,
|
||||
+
|
||||
+ /**
|
||||
+ * A player had their gamemode changed as a result of
|
||||
+ * the {@code /defaultgamemode} command, or they joined
|
||||
+ * with a gamemode that was not the default gamemode and
|
||||
+ * {@code force-gamemode} in {@code server.properties} is set to true.
|
||||
+ */
|
||||
+ DEFAULT_GAMEMODE,
|
||||
+
|
||||
+ /**
|
||||
+ * When the player dies in a hardcore world and has their gamemode
|
||||
+ * changed to {@link GameMode#SPECTATOR}.
|
||||
+ */
|
||||
+ HARDCORE_DEATH,
|
||||
+
|
||||
+ /**
|
||||
+ * This cause is only used if a plugin fired their own
|
||||
+ * {@link PlayerGameModeChangeEvent} and did not include a
|
||||
+ * cause. Can usually be ignored.
|
||||
+ */
|
||||
+ UNKNOWN,
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
59
patches/api/0302-ItemStack-repair-check-API.patch
Normal file
59
patches/api/0302-ItemStack-repair-check-API.patch
Normal file
|
@ -0,0 +1,59 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 15 May 2021 22:10:50 -0700
|
||||
Subject: [PATCH] ItemStack repair check API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 6dbd520182b1e7713a68baad09b7f613424ef619..e504567cf755557be8511f2c93c171572b78e722 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -155,6 +155,16 @@ public interface UnsafeValues {
|
||||
*/
|
||||
public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);
|
||||
|
||||
+ /**
|
||||
+ * Checks if an itemstack can be repaired with another itemstack.
|
||||
+ * Returns false if either argument's type is not an item ({@link Material#isItem()}).
|
||||
+ *
|
||||
+ * @param itemToBeRepaired the itemstack to be repaired
|
||||
+ * @param repairMaterial the repair material
|
||||
+ * @return true if valid repair, false if not
|
||||
+ */
|
||||
+ public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial);
|
||||
+
|
||||
/**
|
||||
* Returns the server's protocol version.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index f72d3d62d61755bbaf1950ebcb228ce95d1faf58..1bd9f7582bb907ff178fd110fdc92834885d1d78 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -873,5 +873,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||
public io.papermc.paper.inventory.ItemRarity getRarity() {
|
||||
return Bukkit.getUnsafe().getItemStackRarity(this);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if an itemstack can repair this itemstack.
|
||||
+ * Returns false if {@code this} or {@code repairMaterial}'s type is not an item ({@link Material#isItem()}).
|
||||
+ *
|
||||
+ * @param repairMaterial the repair material
|
||||
+ * @return true if it is repairable by, false if not
|
||||
+ */
|
||||
+ public boolean isRepairableBy(@NotNull ItemStack repairMaterial) {
|
||||
+ return Bukkit.getUnsafe().isValidRepairItemStack(this, repairMaterial);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this itemstack can repair another.
|
||||
+ * Returns false if {@code this} or {@code toBeRepaired}'s type is not an item ({@link Material#isItem()}).
|
||||
+ *
|
||||
+ * @param toBeRepaired the itemstack to be repaired
|
||||
+ * @return true if it can repair, false if not
|
||||
+ */
|
||||
+ public boolean canRepair(@NotNull ItemStack toBeRepaired) {
|
||||
+ return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this);
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
124
patches/api/0303-More-Enchantment-API.patch
Normal file
124
patches/api/0303-More-Enchantment-API.patch
Normal file
|
@ -0,0 +1,124 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 6 May 2021 19:58:03 -0700
|
||||
Subject: [PATCH] More Enchantment API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java b/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e6a40c1fcea761bd66743b50e3da3d14797d05b0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java
|
||||
@@ -0,0 +1,24 @@
|
||||
+package io.papermc.paper.enchantments;
|
||||
+
|
||||
+public enum EnchantmentRarity {
|
||||
+
|
||||
+ COMMON(10),
|
||||
+ UNCOMMON(5),
|
||||
+ RARE(2),
|
||||
+ VERY_RARE(1);
|
||||
+
|
||||
+ private final int weight;
|
||||
+
|
||||
+ EnchantmentRarity(int weight) {
|
||||
+ this.weight = weight;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the weight for the rarity.
|
||||
+ *
|
||||
+ * @return the weight
|
||||
+ */
|
||||
+ public int getWeight() {
|
||||
+ return weight;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java
|
||||
index 8eb0497c81744874809ebc4bc2e28b128e66a926..799813410f40589ba1d7d530a47d87f609764705 100644
|
||||
--- a/src/main/java/org/bukkit/enchantments/Enchantment.java
|
||||
+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java
|
||||
@@ -306,6 +306,46 @@ public abstract class Enchantment implements Keyed {
|
||||
* @return the name of the enchantment with {@code level} applied
|
||||
*/
|
||||
public abstract @NotNull net.kyori.adventure.text.Component displayName(int level);
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this enchantment can be found in villager trades.
|
||||
+ *
|
||||
+ * @return true if the enchantment can be found in trades
|
||||
+ */
|
||||
+ public abstract boolean isTradeable();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this enchantment can be found in an enchanting table
|
||||
+ * or use to enchant items generated by loot tables.
|
||||
+ *
|
||||
+ * @return true if the enchantment can be found in a table or by loot tables
|
||||
+ */
|
||||
+ public abstract boolean isDiscoverable();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the rarity of this enchantment.
|
||||
+ *
|
||||
+ * @return the rarity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public abstract io.papermc.paper.enchantments.EnchantmentRarity getRarity();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the damage increase as a result of the level and entity category specified
|
||||
+ *
|
||||
+ * @param level the level of enchantment
|
||||
+ * @param entityCategory the category of entity
|
||||
+ * @return the damage increase
|
||||
+ */
|
||||
+ public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the equipment slots where this enchantment is considered "active".
|
||||
+ *
|
||||
+ * @return the equipment slots
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public abstract java.util.Set<org.bukkit.inventory.EquipmentSlot> getActiveSlots();
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
|
||||
index 4d5f0837bd0e02a30c943d8969fb6b13452322e0..ca097db904db96e81c0ea4b06b445a13e9333cfe 100644
|
||||
--- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
|
||||
+++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
|
||||
@@ -69,5 +69,32 @@ public class EnchantmentWrapper extends Enchantment {
|
||||
public net.kyori.adventure.text.Component displayName(int level) {
|
||||
return getEnchantment().displayName(level);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isTradeable() {
|
||||
+ return getEnchantment().isTradeable();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isDiscoverable() {
|
||||
+ return getEnchantment().isDiscoverable();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public io.papermc.paper.enchantments.EnchantmentRarity getRarity() {
|
||||
+ return getEnchantment().getRarity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory) {
|
||||
+ return getEnchantment().getDamageIncrease(level, entityCategory);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public java.util.Set<org.bukkit.inventory.EquipmentSlot> getActiveSlots() {
|
||||
+ return getEnchantment().getActiveSlots();
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: jmp <jasonpenilla2@me.com>
|
||||
Date: Tue, 18 May 2021 14:42:26 -0700
|
||||
Subject: [PATCH] Add command line option to load extra plugin jars not in the
|
||||
plugins folder
|
||||
|
||||
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 49e5d49eb09bb966e47d6a03ac08a527c963b43d..f988705a3cd3943b2f6f952b4f8b5ec014722978 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -60,6 +60,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
private final Map<String, Map<Permissible, Boolean>> permSubs = new HashMap<String, Map<Permissible, Boolean>>();
|
||||
private final Map<Boolean, Map<Permissible, Boolean>> defSubs = new HashMap<Boolean, Map<Permissible, Boolean>>();
|
||||
private boolean useTimings = false;
|
||||
+ private File pluginsDirectory; public @Nullable File pluginsDirectory() { return this.pluginsDirectory; } // Paper
|
||||
|
||||
public SimplePluginManager(@NotNull Server instance, @NotNull SimpleCommandMap commandMap) {
|
||||
server = instance;
|
||||
@@ -115,6 +116,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
@NotNull
|
||||
public Plugin[] loadPlugins(@NotNull File directory) {
|
||||
+ // Paper start - extra jars
|
||||
+ return this.loadPlugins(directory, java.util.Collections.emptyList());
|
||||
+ }
|
||||
+ @NotNull
|
||||
+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List<File> extraPluginJars) {
|
||||
+ this.pluginsDirectory = directory;
|
||||
+ // Paper end
|
||||
Validate.notNull(directory, "Directory cannot be null");
|
||||
Validate.isTrue(directory.isDirectory(), "Directory must be a directory");
|
||||
|
||||
@@ -132,7 +140,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
Map<String, Collection<String>> softDependencies = new HashMap<String, Collection<String>>();
|
||||
|
||||
// This is where it figures out all possible plugins
|
||||
- for (File file : directory.listFiles()) {
|
||||
+ // Paper start - extra jars
|
||||
+ final List<File> pluginJars = new ArrayList<>(java.util.Arrays.asList(directory.listFiles()));
|
||||
+ pluginJars.addAll(extraPluginJars);
|
||||
+ for (File file : pluginJars) {
|
||||
+ // Paper end
|
||||
PluginLoader loader = null;
|
||||
for (Pattern filter : filters) {
|
||||
Matcher match = filter.matcher(file.getName());
|
||||
@@ -148,14 +160,14 @@ public final class SimplePluginManager implements PluginManager {
|
||||
description = loader.getPluginDescription(file);
|
||||
String name = description.getName();
|
||||
if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': Restricted Name"); // Paper
|
||||
continue;
|
||||
} else if (description.rawName.indexOf(' ') != -1) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': uses the space-character (0x20) in its name");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': uses the space-character (0x20) in its name"); // Paper
|
||||
continue;
|
||||
}
|
||||
} catch (InvalidDescriptionException ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -166,7 +178,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
description.getName(),
|
||||
file.getPath(),
|
||||
replacedFile.getPath(),
|
||||
- directory.getPath()
|
||||
+ file.getParentFile().getPath() // Paper
|
||||
));
|
||||
}
|
||||
|
||||
@@ -187,7 +199,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
file.getPath(),
|
||||
provided,
|
||||
pluginFile.getPath(),
|
||||
- directory.getPath()
|
||||
+ file.getParentFile().getPath() // Paper
|
||||
));
|
||||
} else {
|
||||
String replacedPlugin = pluginsProvided.put(provided, description.getName());
|
||||
@@ -269,7 +281,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
server.getLogger().log(
|
||||
Level.SEVERE,
|
||||
- "Could not load '" + entry.getValue().getPath() + "' in folder '" + directory.getPath() + "'",
|
||||
+ "Could not load '" + entry.getValue().getPath() + "' in folder '" + entry.getValue().getParentFile().getPath() + "'", // Paper
|
||||
new UnknownDependencyException("Unknown dependency " + dependency + ". Please download and install " + dependency + " to run this plugin."));
|
||||
break;
|
||||
}
|
||||
@@ -308,11 +320,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
loadedPlugins.add(loadedPlugin.getName());
|
||||
loadedPlugins.addAll(loadedPlugin.getDescription().getProvides());
|
||||
} else {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'"); // Paper
|
||||
}
|
||||
continue;
|
||||
} catch (InvalidPluginException ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,11 +351,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
loadedPlugins.add(loadedPlugin.getName());
|
||||
loadedPlugins.addAll(loadedPlugin.getDescription().getProvides());
|
||||
} else {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'"); // Paper
|
||||
}
|
||||
break;
|
||||
} catch (InvalidPluginException ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -356,7 +368,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
while (failedPluginIterator.hasNext()) {
|
||||
File file = failedPluginIterator.next();
|
||||
failedPluginIterator.remove();
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': circular dependency detected");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': circular dependency detected"); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 31793f46e5623729dfb4048e901f274082f57826..d3812d8cd195017841ee08ffbc53a5748fcc74ec 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -94,7 +94,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
throw new InvalidPluginException(ex);
|
||||
}
|
||||
|
||||
- final File parentFile = file.getParentFile();
|
||||
+ final File parentFile = ((SimplePluginManager) this.server.getPluginManager()).pluginsDirectory(); // Paper
|
||||
final File dataFolder = new File(parentFile, description.getName());
|
||||
@SuppressWarnings("deprecation")
|
||||
final File oldDataFolder = new File(parentFile, description.getRawName());
|
|
@ -0,0 +1,91 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 18 May 2021 10:38:10 -0700
|
||||
Subject: [PATCH] List all missing hard depends not just first
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index f988705a3cd3943b2f6f952b4f8b5ec014722978..0e25119564dfa9cb12f3c5dc5f653d7f2c147a9d 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -264,6 +264,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
if (dependencies.containsKey(plugin)) {
|
||||
Iterator<String> dependencyIterator = dependencies.get(plugin).iterator();
|
||||
+ final Set<String> missingHardDependencies = new HashSet<>(dependencies.get(plugin).size()); // Paper - list all missing hard depends
|
||||
|
||||
while (dependencyIterator.hasNext()) {
|
||||
String dependency = dependencyIterator.next();
|
||||
@@ -274,6 +275,12 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
// We have a dependency not found
|
||||
} else if (!plugins.containsKey(dependency) && !pluginsProvided.containsKey(dependency)) {
|
||||
+ // Paper start
|
||||
+ missingHardDependencies.add(dependency);
|
||||
+ }
|
||||
+ }
|
||||
+ if (!missingHardDependencies.isEmpty()) {
|
||||
+ // Paper end
|
||||
missingDependency = false;
|
||||
pluginIterator.remove();
|
||||
softDependencies.remove(plugin);
|
||||
@@ -282,9 +289,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
server.getLogger().log(
|
||||
Level.SEVERE,
|
||||
"Could not load '" + entry.getValue().getPath() + "' in folder '" + entry.getValue().getParentFile().getPath() + "'", // Paper
|
||||
- new UnknownDependencyException("Unknown dependency " + dependency + ". Please download and install " + dependency + " to run this plugin."));
|
||||
- break;
|
||||
- }
|
||||
+ new UnknownDependencyException(missingHardDependencies, plugin)); // Paper
|
||||
}
|
||||
|
||||
if (dependencies.containsKey(plugin) && dependencies.get(plugin).isEmpty()) {
|
||||
diff --git a/src/main/java/org/bukkit/plugin/UnknownDependencyException.java b/src/main/java/org/bukkit/plugin/UnknownDependencyException.java
|
||||
index a80251eff75430863b37db1c131e22593f3fcd5e..7b2e607a21f1173d98ee84581881411176380625 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/UnknownDependencyException.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/UnknownDependencyException.java
|
||||
@@ -26,6 +26,19 @@ public class UnknownDependencyException extends RuntimeException {
|
||||
super(message);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Create a new {@link UnknownDependencyException} with a message informing
|
||||
+ * about which dependencies are missing for what plugin.
|
||||
+ *
|
||||
+ * @param missingDependencies missing dependencies
|
||||
+ * @param pluginName plugin which is missing said dependencies
|
||||
+ */
|
||||
+ public UnknownDependencyException(final @org.jetbrains.annotations.NotNull java.util.Collection<String> missingDependencies, final @org.jetbrains.annotations.NotNull String pluginName) {
|
||||
+ this("Unknown/missing dependency plugins: [" + String.join(", ", missingDependencies) + "]. Please download and install these plugins to run '" + pluginName + "'.");
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Constructs a new UnknownDependencyException based on the given
|
||||
* Exception
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index d3812d8cd195017841ee08ffbc53a5748fcc74ec..b622cedeeee017f042bcf92485d81832030a8030 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -132,13 +132,19 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
));
|
||||
}
|
||||
|
||||
+ Set<String> missingHardDependencies = new HashSet<>(description.getDepend().size()); // Paper - list all missing hard depends
|
||||
for (final String pluginName : description.getDepend()) {
|
||||
Plugin current = server.getPluginManager().getPlugin(pluginName);
|
||||
|
||||
if (current == null) {
|
||||
- throw new UnknownDependencyException("Unknown dependency " + pluginName + ". Please download and install " + pluginName + " to run this plugin.");
|
||||
+ missingHardDependencies.add(pluginName); // Paper - list all missing hard depends
|
||||
}
|
||||
}
|
||||
+ // Paper start - list all missing hard depends
|
||||
+ if (!missingHardDependencies.isEmpty()) {
|
||||
+ throw new UnknownDependencyException(missingHardDependencies, description.getFullName());
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
server.getUnsafe().checkSupported(description);
|
||||
|
99
patches/api/0306-Add-Mob-lookAt-API.patch
Normal file
99
patches/api/0306-Add-Mob-lookAt-API.patch
Normal file
|
@ -0,0 +1,99 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 14 May 2021 13:42:06 -0500
|
||||
Subject: [PATCH] Add Mob#lookAt API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
|
||||
index d726453c041a980576312b6bee96a07837f37974..7d4ce660adb21e579e564796568945ee20f0ca59 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Mob.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Mob.java
|
||||
@@ -23,6 +23,88 @@ public interface Mob extends LivingEntity, Lootable {
|
||||
* @return True if mob is exposed to daylight
|
||||
*/
|
||||
boolean isInDaylight();
|
||||
+
|
||||
+ /**
|
||||
+ * Instruct this Mob to look at a specific Location
|
||||
+ * <p>
|
||||
+ * Useful when implementing custom mob goals
|
||||
+ *
|
||||
+ * @param location location to look at
|
||||
+ */
|
||||
+ void lookAt(@NotNull org.bukkit.Location location);
|
||||
+
|
||||
+ /**
|
||||
+ * Instruct this Mob to look at a specific Location
|
||||
+ * <p>
|
||||
+ * Useful when implementing custom mob goals
|
||||
+ *
|
||||
+ * @param location location to look at
|
||||
+ * @param headRotationSpeed head rotation speed
|
||||
+ * @param maxHeadPitch max head pitch rotation
|
||||
+ */
|
||||
+ void lookAt(@NotNull org.bukkit.Location location, float headRotationSpeed, float maxHeadPitch);
|
||||
+
|
||||
+ /**
|
||||
+ * Instruct this Mob to look at a specific Entity
|
||||
+ * <p>
|
||||
+ * If a LivingEntity, look at eye location
|
||||
+ * <p>
|
||||
+ * Useful when implementing custom mob goals
|
||||
+ *
|
||||
+ * @param entity entity to look at
|
||||
+ */
|
||||
+ void lookAt(@NotNull Entity entity);
|
||||
+
|
||||
+ /**
|
||||
+ * Instruct this Mob to look at a specific Entity
|
||||
+ * <p>
|
||||
+ * If a LivingEntity, look at eye location
|
||||
+ * <p>
|
||||
+ * Useful when implementing custom mob goals
|
||||
+ *
|
||||
+ * @param entity entity to look at
|
||||
+ * @param headRotationSpeed head rotation speed
|
||||
+ * @param maxHeadPitch max head pitch rotation
|
||||
+ */
|
||||
+ void lookAt(@NotNull Entity entity, float headRotationSpeed, float maxHeadPitch);
|
||||
+
|
||||
+ /**
|
||||
+ * Instruct this Mob to look at a specific position
|
||||
+ * <p>
|
||||
+ * Useful when implementing custom mob goals
|
||||
+ *
|
||||
+ * @param x x coordinate
|
||||
+ * @param y y coordinate
|
||||
+ * @param z z coordinate
|
||||
+ */
|
||||
+ void lookAt(double x, double y, double z);
|
||||
+
|
||||
+ /**
|
||||
+ * Instruct this Mob to look at a specific position
|
||||
+ * <p>
|
||||
+ * Useful when implementing custom mob goals
|
||||
+ *
|
||||
+ * @param x x coordinate
|
||||
+ * @param y y coordinate
|
||||
+ * @param z z coordinate
|
||||
+ * @param headRotationSpeed head rotation speed
|
||||
+ * @param maxHeadPitch max head pitch rotation
|
||||
+ */
|
||||
+ void lookAt(double x, double y, double z, float headRotationSpeed, float maxHeadPitch);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the head rotation speed
|
||||
+ *
|
||||
+ * @return the head rotation speed
|
||||
+ */
|
||||
+ int getHeadRotationSpeed();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the max head pitch rotation
|
||||
+ *
|
||||
+ * @return the max head pitch rotation
|
||||
+ */
|
||||
+ int getMaxHeadPitch();
|
||||
// Paper end
|
||||
|
||||
/**
|
42
patches/api/0307-ItemStack-editMeta.patch
Normal file
42
patches/api/0307-ItemStack-editMeta.patch
Normal file
|
@ -0,0 +1,42 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Riley Park <riley.park@meino.net>
|
||||
Date: Sun, 23 May 2021 05:04:28 -0700
|
||||
Subject: [PATCH] ItemStack#editMeta
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index 1bd9f7582bb907ff178fd110fdc92834885d1d78..a7909406e9d54c1ab4789b984ed6b1da50837fce 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -542,6 +542,31 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||
return result.ensureServerConversions(); // Paper
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Edits the {@link ItemMeta} of this stack.
|
||||
+ * <p>
|
||||
+ * The {@link java.util.function.Consumer} must only interact
|
||||
+ * with this stack's {@link ItemMeta} through the provided {@link ItemMeta} instance.
|
||||
+ * Calling this method or any other meta-related method of the {@link ItemStack} class
|
||||
+ * (such as {@link #getItemMeta()}, {@link #addItemFlags(ItemFlag...)}, {@link #lore()}, etc.)
|
||||
+ * from inside the consumer is disallowed and will produce undefined results or exceptions.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @param consumer the meta consumer
|
||||
+ * @return {@code true} if the edit was successful, {@code false} otherwise
|
||||
+ */
|
||||
+ public boolean editMeta(final @NotNull java.util.function.Consumer<? super ItemMeta> consumer) {
|
||||
+ final ItemMeta meta = this.getItemMeta();
|
||||
+ if (meta != null) {
|
||||
+ consumer.accept(meta);
|
||||
+ this.setItemMeta(meta);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get a copy of this ItemStack's {@link ItemMeta}.
|
||||
*
|
92
patches/api/0308-Add-EntityInsideBlockEvent.patch
Normal file
92
patches/api/0308-Add-EntityInsideBlockEvent.patch
Normal file
|
@ -0,0 +1,92 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 8 May 2021 18:02:06 -0700
|
||||
Subject: [PATCH] Add EntityInsideBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..94e8b6f6501c92711bd0bc9ee0f67e28f85a605f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java
|
||||
@@ -0,0 +1,80 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity enters the hitbox of a block.
|
||||
+ * Only called for blocks that react when an entity is inside.
|
||||
+ * If cancelled, any action that would have resulted from that entity
|
||||
+ * being in the block will not happen (such as extinguishing an entity in a cauldron).
|
||||
+ * <p>
|
||||
+ * Blocks this is currently called for:
|
||||
+ * <ul>
|
||||
+ * <li>Bubble column</li>
|
||||
+ * <li>Buttons</li>
|
||||
+ * <li>Cactus</li>
|
||||
+ * <li>Campfire</li>
|
||||
+ * <li>Cauldron</li>
|
||||
+ * <li>Crops</li>
|
||||
+ * <li>Ender Portal</li>
|
||||
+ * <li>Fires</li>
|
||||
+ * <li>Honey</li>
|
||||
+ * <li>Hopper</li>
|
||||
+ * <li>Detector rails</li>
|
||||
+ * <li>Nether portals</li>
|
||||
+ * <li>Pressure plates</li>
|
||||
+ * <li>Sweet berry bush</li>
|
||||
+ * <li>Tripwire</li>
|
||||
+ * <li>Waterlily</li>
|
||||
+ * <li>Web</li>
|
||||
+ * <li>Wither rose</li>
|
||||
+ * </ul>
|
||||
+ */
|
||||
+public class EntityInsideBlockEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Block block;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public EntityInsideBlockEvent(@NotNull Entity entity, @NotNull Block block) {
|
||||
+ super(entity);
|
||||
+ this.block = block;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block.
|
||||
+ *
|
||||
+ * @return the block
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Block getBlock() {
|
||||
+ return block;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
53
patches/api/0309-Attributes-API-for-item-defaults.patch
Normal file
53
patches/api/0309-Attributes-API-for-item-defaults.patch
Normal file
|
@ -0,0 +1,53 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 8 May 2021 15:02:00 -0700
|
||||
Subject: [PATCH] Attributes API for item defaults
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
||||
index a9bcb123526da0881728070d36aea37612db8cf2..d635c4fb85d3eeea3853037b2da5881c4853b193 100644
|
||||
--- a/src/main/java/org/bukkit/Material.java
|
||||
+++ b/src/main/java/org/bukkit/Material.java
|
||||
@@ -4014,6 +4014,19 @@ public enum Material implements Keyed {
|
||||
public io.papermc.paper.inventory.ItemRarity getItemRarity() {
|
||||
return Bukkit.getUnsafe().getItemRarity(this);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Returns an immutable multimap of attributes for the slot.
|
||||
+ * {@link #isItem()} must be true for this material.
|
||||
+ *
|
||||
+ * @param equipmentSlot the slot to get the attributes for
|
||||
+ * @throws IllegalArgumentException if {@link #isItem()} is false
|
||||
+ * @return an immutable multimap of attributes
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public com.google.common.collect.Multimap<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
|
||||
+ return Bukkit.getUnsafe().getItemAttributes(this, equipmentSlot);
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index e504567cf755557be8511f2c93c171572b78e722..379acee1b5f2d06e6a96f3444783f4a29ca24095 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -165,6 +165,18 @@ public interface UnsafeValues {
|
||||
*/
|
||||
public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial);
|
||||
|
||||
+ /**
|
||||
+ * Returns an immutable multimap of attributes for the material and slot.
|
||||
+ * {@link Material#isItem()} must be true for this material.
|
||||
+ *
|
||||
+ * @param material the material
|
||||
+ * @param equipmentSlot the slot to get the attributes for
|
||||
+ * @throws IllegalArgumentException if {@link Material#isItem()} is false
|
||||
+ * @return an immutable multimap of attributes
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.NotNull
|
||||
+ public com.google.common.collect.Multimap<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> getItemAttributes(@org.jetbrains.annotations.NotNull Material material, @org.jetbrains.annotations.NotNull org.bukkit.inventory.EquipmentSlot equipmentSlot);
|
||||
+
|
||||
/**
|
||||
* Returns the server's protocol version.
|
||||
*
|
104
patches/api/0310-Add-cause-to-Weather-ThunderChangeEvents.patch
Normal file
104
patches/api/0310-Add-cause-to-Weather-ThunderChangeEvents.patch
Normal file
|
@ -0,0 +1,104 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 2 Dec 2020 18:25:31 -0800
|
||||
Subject: [PATCH] Add cause to Weather/ThunderChangeEvents
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java
|
||||
index 6cdf83476b4e366bed79960e3706bea5ebe56788..032395c7114b6d757acf1918ce2b014870e85fcd 100644
|
||||
--- a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java
|
||||
@@ -12,10 +12,20 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean canceled;
|
||||
private final boolean to;
|
||||
+ // Paper start
|
||||
+ private final Cause cause;
|
||||
|
||||
+ public ThunderChangeEvent(@NotNull final World world, final boolean to, @NotNull final Cause cause) {
|
||||
+ super(world);
|
||||
+ this.to = to;
|
||||
+ this.cause = cause;
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated // Paper end
|
||||
public ThunderChangeEvent(@NotNull final World world, final boolean to) {
|
||||
super(world);
|
||||
this.to = to;
|
||||
+ this.cause = Cause.UNKNOWN; // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,4 +57,23 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the cause of the weather change.
|
||||
+ *
|
||||
+ * @return the weather change cause
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return this.cause;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ COMMAND,
|
||||
+ NATURAL,
|
||||
+ SLEEP,
|
||||
+ PLUGIN,
|
||||
+ UNKNOWN
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java
|
||||
index d562d87e7418641e52f4dae44f573eaa31add44a..dabd390b84354c14c269c03cbed2006014d004b2 100644
|
||||
--- a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java
|
||||
@@ -12,10 +12,20 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean canceled;
|
||||
private final boolean to;
|
||||
+ // Paper start
|
||||
+ private final Cause cause;
|
||||
|
||||
+ public WeatherChangeEvent(@NotNull final World world, final boolean to, @NotNull Cause cause) {
|
||||
+ super(world);
|
||||
+ this.to = to;
|
||||
+ this.cause = cause;
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated // Paper end
|
||||
public WeatherChangeEvent(@NotNull final World world, final boolean to) {
|
||||
super(world);
|
||||
this.to = to;
|
||||
+ this.cause = Cause.UNKNOWN; // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,4 +57,23 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the cause of the weather change.
|
||||
+ *
|
||||
+ * @return the weather change cause
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return cause;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ COMMAND,
|
||||
+ NATURAL,
|
||||
+ SLEEP,
|
||||
+ PLUGIN,
|
||||
+ UNKNOWN
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
34
patches/api/0311-More-Lidded-Block-API.patch
Normal file
34
patches/api/0311-More-Lidded-Block-API.patch
Normal file
|
@ -0,0 +1,34 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: LemonCaramel <admin@caramel.moe>
|
||||
Date: Sun, 23 May 2021 17:49:31 +0900
|
||||
Subject: [PATCH] More Lidded Block API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/EnderChest.java b/src/main/java/org/bukkit/block/EnderChest.java
|
||||
index 17843e338f2cbccfa9342b420c62d0e4d6eec31d..ebae4e660244df15bf93a78d41f8c0c5c7083b27 100644
|
||||
--- a/src/main/java/org/bukkit/block/EnderChest.java
|
||||
+++ b/src/main/java/org/bukkit/block/EnderChest.java
|
||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
||||
/**
|
||||
* Represents a captured state of an ender chest.
|
||||
*/
|
||||
-public interface EnderChest extends TileState { }
|
||||
+public interface EnderChest extends TileState, Lidded { } // Paper - More Lidded Block API
|
||||
diff --git a/src/main/java/org/bukkit/block/Lidded.java b/src/main/java/org/bukkit/block/Lidded.java
|
||||
index 9da2566e02e63be1a0188deaa27b841fa61688ea..30c7df0021df44a411e50636d906d4a1d30fd927 100644
|
||||
--- a/src/main/java/org/bukkit/block/Lidded.java
|
||||
+++ b/src/main/java/org/bukkit/block/Lidded.java
|
||||
@@ -13,4 +13,13 @@ public interface Lidded {
|
||||
* viewing this block.
|
||||
*/
|
||||
void close();
|
||||
+
|
||||
+ // Paper start - More Lidded Block API
|
||||
+ /**
|
||||
+ * Checks if the block's animation state.
|
||||
+ *
|
||||
+ * @return true if the block's animation state is set to open.
|
||||
+ */
|
||||
+ boolean isOpen();
|
||||
+ // Paper end - More Lidded Block API
|
||||
}
|
92
patches/api/0312-Add-PufferFishStateChangeEvent.patch
Normal file
92
patches/api/0312-Add-PufferFishStateChangeEvent.patch
Normal file
|
@ -0,0 +1,92 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HexedHero <6012891+HexedHero@users.noreply.github.com>
|
||||
Date: Mon, 10 May 2021 16:58:38 +0100
|
||||
Subject: [PATCH] Add PufferFishStateChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3585457b21aca2a2f1779868a0fa91f8011ad3c9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java
|
||||
@@ -0,0 +1,80 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.PufferFish;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called just before a {@link PufferFish} inflates or deflates.
|
||||
+ */
|
||||
+public class PufferFishStateChangeEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private int newPuffState;
|
||||
+
|
||||
+ public PufferFishStateChangeEvent(@NotNull PufferFish entity, int newPuffState) {
|
||||
+ super(entity);
|
||||
+ this.newPuffState = newPuffState;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public PufferFish getEntity() {
|
||||
+ return (PufferFish) entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the <strong>new</strong> puff state of the {@link PufferFish}.
|
||||
+ * <p>
|
||||
+ * This is what the {@link PufferFish}'s new puff state will be after this event if it isn't cancelled.<br>
|
||||
+ * Refer to {@link PufferFish#getPuffState()} to get the current puff state.
|
||||
+ * @return The <strong>new</strong> puff state, 0 being not inflated, 1 being slightly inflated and 2 being fully inflated
|
||||
+ */
|
||||
+ public int getNewPuffState() {
|
||||
+ return this.newPuffState;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get if the {@link PufferFish} is going to inflate.
|
||||
+ * @return If its going to inflate
|
||||
+ */
|
||||
+ public boolean isInflating() {
|
||||
+ return getNewPuffState() > getEntity().getPuffState();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get if the {@link PufferFish} is going to deflate.
|
||||
+ * @return If its going to deflate
|
||||
+ */
|
||||
+ public boolean isDeflating() {
|
||||
+ return getNewPuffState() < getEntity().getPuffState();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether or not to cancel the {@link PufferFish} (in/de)flating.
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel the (in/de)flation
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
Loading…
Add table
Add a link
Reference in a new issue