more patches
This commit is contained in:
parent
b2a63428c8
commit
09ead8b043
38 changed files with 277 additions and 476 deletions
28
patches/api/0259-Add-sendOpLevel-API.patch
Normal file
28
patches/api/0259-Add-sendOpLevel-API.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Tue, 29 Dec 2020 15:02:57 +0100
|
||||
Subject: [PATCH] Add sendOpLevel API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index d281d270bba71da5a7d1326112e73d9cdb1ed57b..9c7960f56733ff18b949cffe15f082c4cde28317 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1956,6 +1956,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
@Nullable
|
||||
Firework boostElytra(@NotNull ItemStack firework);
|
||||
+
|
||||
+ /**
|
||||
+ * Send a packet to the player indicating its operator status level.
|
||||
+ * <p>
|
||||
+ * <b>Note:</b> This will not persist across more than the current connection, and setting the player's operator
|
||||
+ * status as a later point <i>will</i> override the effects of this.
|
||||
+ *
|
||||
+ * @param level The level to send to the player. Must be in {@code [0, 4]}.
|
||||
+ * @throws IllegalArgumentException If the level is negative or greater than {@code 4} (i.e. not within {@code [0, 4]}).
|
||||
+ */
|
||||
+ void sendOpLevel(byte level);
|
||||
// Paper end
|
||||
|
||||
// Spigot start
|
167
patches/api/0260-Add-StructureLocateEvent.patch
Normal file
167
patches/api/0260-Add-StructureLocateEvent.patch
Normal file
|
@ -0,0 +1,167 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: dfsek <dfsek@protonmail.com>
|
||||
Date: Tue, 15 Sep 2020 21:59:16 -0700
|
||||
Subject: [PATCH] Add StructureLocateEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..45b6694fc5741831e2df638b1f760a3ca28a4907
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java
|
||||
@@ -0,0 +1,155 @@
|
||||
+package io.papermc.paper.event.world;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.StructureType;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.world.WorldEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called <b>before</b> a structure/feature is located.
|
||||
+ * This happens when:
|
||||
+ * <ul>
|
||||
+ * <li>The /locate command is used.<br></li>
|
||||
+ * <li>An Eye of Ender is used.</li>
|
||||
+ * <li>An Explorer/Treasure Map is activated.</li>
|
||||
+ * <li>{@link World#locateNearestStructure(Location, StructureType, int, boolean)} is invoked.</li>
|
||||
+ * </ul>
|
||||
+ */
|
||||
+public class StructureLocateEvent extends WorldEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Location origin;
|
||||
+ private Location result = null;
|
||||
+ private StructureType type;
|
||||
+ private int radius;
|
||||
+ private boolean findUnexplored;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public StructureLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored) {
|
||||
+ super(world);
|
||||
+ this.origin = origin;
|
||||
+ this.type = structureType;
|
||||
+ this.radius = radius;
|
||||
+ this.findUnexplored = findUnexplored;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location set as the structure location, if it was defined.
|
||||
+ * <p>
|
||||
+ * Returns {@code null} if it has not been set by {@link StructureLocateEvent#setResult(Location)}.
|
||||
+ * Since this event fires <i>before</i> the search is done, the actual location is unknown at this point.
|
||||
+ *
|
||||
+ * @return The result location, if it has been set. null if it has not.
|
||||
+ * @see World#locateNearestStructure(Location, StructureType, int, boolean)
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getResult() {
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the result {@link Location}. This causes the search to be skipped, and the location passed here to be used as the result.
|
||||
+ *
|
||||
+ * @param result the {@link Location} of the structure.
|
||||
+ */
|
||||
+ public void setResult(@Nullable Location result) {
|
||||
+ this.result = result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link StructureType} that is to be located.
|
||||
+ *
|
||||
+ * @return the structure type.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public StructureType getType() {
|
||||
+ return type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the {@link StructureType} that is to be located.
|
||||
+ *
|
||||
+ * @param type the structure type.
|
||||
+ */
|
||||
+ public void setType(@NotNull StructureType type) {
|
||||
+ this.type = type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link Location} from which the search is to be conducted.
|
||||
+ *
|
||||
+ * @return {@link Location} where search begins
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getOrigin() {
|
||||
+ return origin;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the search radius in which to attempt locating the structure.
|
||||
+ * <p>
|
||||
+ * This radius may not always be obeyed during the structure search!
|
||||
+ *
|
||||
+ * @return the search radius.
|
||||
+ */
|
||||
+ public int getRadius() {
|
||||
+ return radius;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the search radius in which to attempt locating the structure.
|
||||
+ * <p>
|
||||
+ * This radius may not always be obeyed during the structure search!
|
||||
+ *
|
||||
+ * @param radius the search radius.
|
||||
+ */
|
||||
+ public void setRadius(int radius) {
|
||||
+ this.radius = radius;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether to search exclusively for unexplored structures.
|
||||
+ * <p>
|
||||
+ * As with the search radius, this value is not always obeyed.
|
||||
+ *
|
||||
+ * @return Whether to search for only unexplored structures.
|
||||
+ */
|
||||
+ public boolean shouldFindUnexplored() {
|
||||
+ return findUnexplored;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether to search exclusively for unexplored structures.
|
||||
+ * <p>
|
||||
+ * As with the search radius, this value is not always obeyed.
|
||||
+ *
|
||||
+ * @param findUnexplored Whether to search for only unexplored structures.
|
||||
+ */
|
||||
+ public void setFindUnexplored(boolean findUnexplored) {
|
||||
+ this.findUnexplored = findUnexplored;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,20 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: CDFN <codefun@protonmail.com>
|
||||
Date: Tue, 7 Jul 2020 17:53:23 +0200
|
||||
Subject: [PATCH] Return chat component with empty text instead of throwing
|
||||
exception
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
index 664de64b020cf9090a2fbee0afe2bfaf150adc3c..b06995aa57aa9cba0bb59f1d26d81015619a08e6 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
|
||||
@@ -450,7 +450,7 @@ public abstract class InventoryView {
|
||||
/**
|
||||
* Get the title of this inventory window.
|
||||
*
|
||||
- * @return The title.
|
||||
+ * @return The title or empty string when title is {@code null}. <!-- Paper -->
|
||||
*/
|
||||
@NotNull
|
||||
public /*abstract*/ net.kyori.adventure.text.Component title() {
|
72
patches/api/0262-Add-BlockPreDispenseEvent.patch
Normal file
72
patches/api/0262-Add-BlockPreDispenseEvent.patch
Normal file
|
@ -0,0 +1,72 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Miller <mnmiller1@me.com>
|
||||
Date: Sun, 17 Jan 2021 13:15:54 +1000
|
||||
Subject: [PATCH] Add BlockPreDispenseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..07aad3f4ff60a6a6de69634b0d31926e9c00e77b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java
|
||||
@@ -0,0 +1,60 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class BlockPreDispenseEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled = false;
|
||||
+ private final ItemStack itemStack;
|
||||
+ private final int slot;
|
||||
+
|
||||
+ public BlockPreDispenseEvent(@NotNull Block block, @NotNull ItemStack itemStack, int slot) {
|
||||
+ super(block);
|
||||
+ this.itemStack = itemStack;
|
||||
+ this.slot = slot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link ItemStack} to be dispensed.
|
||||
+ *
|
||||
+ * @return The item to be dispensed
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the inventory slot of the dispenser to dispense from.
|
||||
+ *
|
||||
+ * @return The inventory slot
|
||||
+ */
|
||||
+ public int getSlot() {
|
||||
+ return slot;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+}
|
43
patches/api/0263-Added-Vanilla-Entity-Tags.patch
Normal file
43
patches/api/0263-Added-Vanilla-Entity-Tags.patch
Normal file
|
@ -0,0 +1,43 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 3 Jan 2021 20:03:40 -0800
|
||||
Subject: [PATCH] Added Vanilla Entity Tags
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java
|
||||
index 88ea8b6c5c2c4d2116f646341de62590718bc28c..a2da2cbef6c09b9defbdf97e79cfb3efd742d439 100644
|
||||
--- a/src/main/java/org/bukkit/Tag.java
|
||||
+++ b/src/main/java/org/bukkit/Tag.java
|
||||
@@ -589,6 +589,32 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
* Vanilla fluid tag representing water and flowing water.
|
||||
*/
|
||||
Tag<Fluid> FLUIDS_WATER = Bukkit.getTag(REGISTRY_FLUIDS, NamespacedKey.minecraft("water"), Fluid.class);
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Key for the build in entity registry
|
||||
+ */
|
||||
+ String REGISTRY_ENTITIES = "entities";
|
||||
+ /**
|
||||
+ * Vanilla entity tag representing arrow entities.
|
||||
+ */
|
||||
+ Tag<org.bukkit.entity.EntityType> ARROWS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("arrows"), org.bukkit.entity.EntityType.class);
|
||||
+ /**
|
||||
+ * Vanilla entity tag representing entities that live in beehives
|
||||
+ */
|
||||
+ Tag<org.bukkit.entity.EntityType> BEEHIVE_INHABITORS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("beehive_inhabitors"), org.bukkit.entity.EntityType.class);
|
||||
+ /**
|
||||
+ * Vanilla entity tag representing projectiles that impact
|
||||
+ */
|
||||
+ Tag<org.bukkit.entity.EntityType> IMPACT_PROJECTILES = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("impact_projectiles"), org.bukkit.entity.EntityType.class);
|
||||
+ /**
|
||||
+ * Vanilla entity tag for village raiders
|
||||
+ */
|
||||
+ Tag<org.bukkit.entity.EntityType> RAIDERS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("raiders"), org.bukkit.entity.EntityType.class);
|
||||
+ /**
|
||||
+ * Vanilla entity tag for skeleton types
|
||||
+ */
|
||||
+ Tag<org.bukkit.entity.EntityType> SKELETONS = Bukkit.getTag(REGISTRY_ENTITIES, NamespacedKey.minecraft("skeletons"), org.bukkit.entity.EntityType.class);
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Returns whether or not this tag has an entry for the specified item.
|
45
patches/api/0264-added-Wither-API.patch
Normal file
45
patches/api/0264-added-Wither-API.patch
Normal file
|
@ -0,0 +1,45 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 5 Jul 2020 15:39:40 -0700
|
||||
Subject: [PATCH] added Wither API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
|
||||
index 426d3693317cd303d35d8203026b528d87e401d5..8c95cd6933f11076de936854f379e6fc8600b525 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Wither.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Wither.java
|
||||
@@ -6,4 +6,34 @@ import com.destroystokyo.paper.entity.RangedEntity;
|
||||
* Represents a Wither boss
|
||||
*/
|
||||
public interface Wither extends Monster, Boss, RangedEntity { // Paper
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * @return whether the wither is charged
|
||||
+ */
|
||||
+ boolean isCharged();
|
||||
+
|
||||
+ /**
|
||||
+ * @return ticks the wither is invulnerable for
|
||||
+ */
|
||||
+ int getInvulnerableTicks();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets for how long in the future, the wither should be invulnerable.
|
||||
+ *
|
||||
+ * @param ticks ticks the wither is invulnerable for
|
||||
+ */
|
||||
+ void setInvulnerableTicks(int ticks);
|
||||
+
|
||||
+ /**
|
||||
+ * @return whether the wither can travel through portals
|
||||
+ */
|
||||
+ boolean canTravelThroughPortals();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the wither can travel through portals.
|
||||
+ *
|
||||
+ * @param value whether the wither can travel through portals
|
||||
+ */
|
||||
+ void setCanTravelThroughPortals(boolean value);
|
||||
+ // Paper end
|
||||
}
|
153
patches/api/0265-Added-PlayerChangeBeaconEffectEvent.patch
Normal file
153
patches/api/0265-Added-PlayerChangeBeaconEffectEvent.patch
Normal file
|
@ -0,0 +1,153 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 24 Jun 2020 15:12:18 -0600
|
||||
Subject: [PATCH] Added PlayerChangeBeaconEffectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c80183a79713b1e73549911e474a8c585cfdeb52
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerChangeBeaconEffectEvent.java
|
||||
@@ -0,0 +1,141 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+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.bukkit.potion.PotionEffectType;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player sets the effect for a beacon
|
||||
+ */
|
||||
+public class PlayerChangeBeaconEffectEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private PotionEffectType primary;
|
||||
+ private PotionEffectType secondary;
|
||||
+ private final Block beacon;
|
||||
+ private boolean consumeItem = true;
|
||||
+
|
||||
+ private boolean isCancelled;
|
||||
+
|
||||
+ public PlayerChangeBeaconEffectEvent(@NotNull Player player, @Nullable PotionEffectType primary, @Nullable PotionEffectType secondary, @Nullable Block beacon) {
|
||||
+ super(player);
|
||||
+ this.primary = primary;
|
||||
+ this.secondary = secondary;
|
||||
+ this.isCancelled = false;
|
||||
+ this.beacon = beacon;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the primary effect
|
||||
+ */
|
||||
+ @Nullable public PotionEffectType getPrimary() {
|
||||
+ return primary;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the primary effect
|
||||
+ * <p>
|
||||
+ * NOTE: The primary effect still has to be one of the valid effects for a beacon.
|
||||
+ *
|
||||
+ * @param primary the primary effect
|
||||
+ */
|
||||
+ public void setPrimary(@Nullable PotionEffectType primary) {
|
||||
+ this.primary = primary;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the secondary effect
|
||||
+ */
|
||||
+ @Nullable public PotionEffectType getSecondary() {
|
||||
+ return secondary;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the secondary effect
|
||||
+ * <p>
|
||||
+ * This only has an effect when the beacon is able to accept a secondary effect.
|
||||
+ * NOTE: The secondary effect still has to be a valid effect for a beacon.
|
||||
+ *
|
||||
+ * @param secondary the secondary effect
|
||||
+ */
|
||||
+ public void setSecondary(@Nullable PotionEffectType secondary) {
|
||||
+ this.secondary = secondary;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the beacon block associated with this event, or null if not found
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Block getBeacon() {
|
||||
+ return beacon;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if the item used to change the beacon will be consume.
|
||||
+ * <p>
|
||||
+ * Independant of {@link #isCancelled()}. If the event is cancelled
|
||||
+ * the item will <b>NOT</b> be consumed.
|
||||
+ *
|
||||
+ * @return true if item will be consumed
|
||||
+ */
|
||||
+ public boolean willConsumeItem() {
|
||||
+ return consumeItem;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if the item used to change the beacon should be consumed.
|
||||
+ * <p>
|
||||
+ * Independant of {@link #isCancelled()}. If the event is cancelled
|
||||
+ * the item will <b>NOT</b> be consumed.
|
||||
+ *
|
||||
+ * @param consumeItem true if item should be consumed
|
||||
+ */
|
||||
+ public void setConsumeItem(boolean consumeItem) {
|
||||
+ this.consumeItem = consumeItem;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ * <p>
|
||||
+ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will
|
||||
+ * not take effect
|
||||
+ *
|
||||
+ * @return true if this event is cancelled
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.isCancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ * <p>
|
||||
+ * If cancelled, the item will <b>NOT</b> be consumed regardless of what {@link #willConsumeItem()} says
|
||||
+ * <p>
|
||||
+ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will not be applied
|
||||
+ * or saved.
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.isCancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,71 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 27 Nov 2020 17:13:59 -0800
|
||||
Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fb1bca3a9d12096c9a2b2663f466a8ff5f2b4319
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerStonecutterRecipeSelectEvent.java
|
||||
@@ -0,0 +1,59 @@
|
||||
+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.bukkit.inventory.StonecutterInventory;
|
||||
+import org.bukkit.inventory.StonecuttingRecipe;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class PlayerStonecutterRecipeSelectEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+ private final StonecutterInventory stonecutterInventory;
|
||||
+ private StonecuttingRecipe stonecuttingRecipe;
|
||||
+
|
||||
+ public PlayerStonecutterRecipeSelectEvent(@NotNull Player player, @NotNull StonecutterInventory stonecutterInventory, @NotNull StonecuttingRecipe stonecuttingRecipe) {
|
||||
+ super(player);
|
||||
+ this.stonecutterInventory = stonecutterInventory;
|
||||
+ this.stonecuttingRecipe = stonecuttingRecipe;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public StonecutterInventory getStonecutterInventory() {
|
||||
+ return stonecutterInventory;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public StonecuttingRecipe getStonecuttingRecipe() {
|
||||
+ return stonecuttingRecipe;
|
||||
+ }
|
||||
+
|
||||
+ public void setStonecuttingRecipe(@NotNull StonecuttingRecipe stonecuttingRecipe) {
|
||||
+ this.stonecuttingRecipe = stonecuttingRecipe;
|
||||
+ }
|
||||
+
|
||||
+ @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;
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,78 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: KennyTV <jahnke.nassim@gmail.com>
|
||||
Date: Fri, 29 Jan 2021 15:13:04 +0100
|
||||
Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
|
||||
index a33986a0c437a673435206fc337031a7eebdab3b..e0e068799a1868c8e561869015f41f553ef4fbdb 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
|
||||
@@ -10,10 +10,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class EntityUnleashEvent extends EntityEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final UnleashReason reason;
|
||||
+ private boolean dropLeash; // Paper
|
||||
|
||||
+ // Paper start - drop leash variable
|
||||
+ @Deprecated
|
||||
public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason) {
|
||||
+ this(entity, reason, false);
|
||||
+ }
|
||||
+
|
||||
+ public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason, boolean dropLeash) {
|
||||
super(entity);
|
||||
+ // Paper end
|
||||
this.reason = reason;
|
||||
+ this.dropLeash = dropLeash; // Paper
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,6 +35,26 @@ public class EntityUnleashEvent extends EntityEvent {
|
||||
return reason;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Returns whether a leash item will be dropped.
|
||||
+ *
|
||||
+ * @return Whether the leash item will be dropped
|
||||
+ */
|
||||
+ public boolean isDropLeash() {
|
||||
+ return dropLeash;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether a leash item should be dropped.
|
||||
+ *
|
||||
+ * @param dropLeash Whether the leash item should be dropped
|
||||
+ */
|
||||
+ public void setDropLeash(boolean dropLeash) {
|
||||
+ this.dropLeash = dropLeash;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
index cf78950b56d4977f6c4d9d98d183bfc5ba3bacc0..68eab1563caba1ee4f52b308f390e4e172667fc5 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
@@ -13,8 +13,15 @@ public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Canc
|
||||
private final Player player;
|
||||
private boolean cancelled = false;
|
||||
|
||||
+ // Paper start - drop leash variable
|
||||
+ @Deprecated
|
||||
public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player) {
|
||||
- super(entity, UnleashReason.PLAYER_UNLEASH);
|
||||
+ this(entity, player, false);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, boolean dropLeash) {
|
||||
+ super(entity, UnleashReason.PLAYER_UNLEASH, dropLeash);
|
||||
+ // Paper end
|
||||
this.player = player;
|
||||
}
|
||||
|
152
patches/api/0268-EntityMoveEvent.patch
Normal file
152
patches/api/0268-EntityMoveEvent.patch
Normal file
|
@ -0,0 +1,152 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Tue, 11 Feb 2020 21:56:38 -0600
|
||||
Subject: [PATCH] EntityMoveEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..fae0b1daf733e85d8f691f5ef934b8c0b51db194
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java
|
||||
@@ -0,0 +1,140 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Holds information for living entity movement events
|
||||
+ */
|
||||
+public class EntityMoveEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean canceled;
|
||||
+ private Location from;
|
||||
+ private Location to;
|
||||
+
|
||||
+ public EntityMoveEvent(@NotNull LivingEntity entity, @NotNull Location from, @NotNull Location to) {
|
||||
+ super(entity);
|
||||
+ this.from = from;
|
||||
+ this.to = to;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) entity;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return canceled;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ canceled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location this entity moved from
|
||||
+ *
|
||||
+ * @return Location the entity moved from
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getFrom() {
|
||||
+ return from;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the location to mark as where the entity moved from
|
||||
+ *
|
||||
+ * @param from New location to mark as the entity's previous location
|
||||
+ */
|
||||
+ public void setFrom(@NotNull Location from) {
|
||||
+ validateLocation(from);
|
||||
+ this.from = from;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location this entity moved to
|
||||
+ *
|
||||
+ * @return Location the entity moved to
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getTo() {
|
||||
+ return to;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the location that this entity will move to
|
||||
+ *
|
||||
+ * @param to New Location this entity will move to
|
||||
+ */
|
||||
+ public void setTo(@NotNull Location to) {
|
||||
+ validateLocation(to);
|
||||
+ this.to = to;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Check if the entity has changed position (even within the same block) in the event
|
||||
+ *
|
||||
+ * @return whether the entity has changed position or not
|
||||
+ */
|
||||
+ public boolean hasChangedPosition() {
|
||||
+ return hasExplicitlyChangedPosition() || !from.getWorld().equals(to.getWorld());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Check if the entity has changed position (even within the same block) in the event, disregarding a possible world change
|
||||
+ *
|
||||
+ * @return whether the entity has changed position or not
|
||||
+ */
|
||||
+ public boolean hasExplicitlyChangedPosition() {
|
||||
+ return from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Check if the entity has moved to a new block in the event
|
||||
+ *
|
||||
+ * @return whether the entity has moved to a new block or not
|
||||
+ */
|
||||
+ public boolean hasChangedBlock() {
|
||||
+ return hasExplicitlyChangedBlock() || !from.getWorld().equals(to.getWorld());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Check if the entity has moved to a new block in the event, disregarding a possible world change
|
||||
+ *
|
||||
+ * @return whether the entity 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 entity has changed orientation in the event
|
||||
+ *
|
||||
+ * @return whether the entity has changed orientation or not
|
||||
+ */
|
||||
+ public boolean hasChangedOrientation() {
|
||||
+ return from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw();
|
||||
+ }
|
||||
+
|
||||
+ 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!");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
75
patches/api/0269-add-DragonEggFormEvent.patch
Normal file
75
patches/api/0269-add-DragonEggFormEvent.patch
Normal file
|
@ -0,0 +1,75 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Trigary <trigary0@gmail.com>
|
||||
Date: Mon, 25 Jan 2021 14:53:49 +0100
|
||||
Subject: [PATCH] add DragonEggFormEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java b/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5495b87330518363498e1ac5d8f0a832be35fefb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/DragonEggFormEvent.java
|
||||
@@ -0,0 +1,63 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.boss.DragonBattle;
|
||||
+import org.bukkit.entity.EnderDragon;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockFormEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the {@link EnderDragon} is defeated (killed) in a {@link DragonBattle},
|
||||
+ * causing a {@link Material#DRAGON_EGG} (more formally: {@link #getNewState()})
|
||||
+ * to possibly appear depending on {@link #isCancelled()}.
|
||||
+ * <b>This event might be cancelled by default depending on
|
||||
+ * eg. {@link DragonBattle#hasBeenPreviouslyKilled()} and server configuration.</b>
|
||||
+ */
|
||||
+public class DragonEggFormEvent extends BlockFormEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final DragonBattle dragonBattle;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public DragonEggFormEvent(@NotNull Block block, @NotNull BlockState newState,
|
||||
+ @NotNull DragonBattle dragonBattle) {
|
||||
+ super(block, newState);
|
||||
+ this.dragonBattle = dragonBattle;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link DragonBattle} associated with this event.
|
||||
+ * Keep in mind that the {@link EnderDragon} is already dead
|
||||
+ * when this event is called.
|
||||
+ *
|
||||
+ * @return the dragon battle
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public DragonBattle getDragonBattle() {
|
||||
+ return dragonBattle;
|
||||
+ }
|
||||
+
|
||||
+ @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