more patches & fixes to existing patches
This commit is contained in:
parent
5dce4d9178
commit
f777faa8c1
44 changed files with 244 additions and 365 deletions
60
patches/api/0253-Added-ServerResourcesReloadedEvent.patch
Normal file
60
patches/api/0253-Added-ServerResourcesReloadedEvent.patch
Normal file
|
@ -0,0 +1,60 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 2 Dec 2020 20:04:16 -0800
|
||||
Subject: [PATCH] Added ServerResourcesReloadedEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java b/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7a8d6815c17a107039399298f7ac9f0612faee02
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/server/ServerResourcesReloadedEvent.java
|
||||
@@ -0,0 +1,48 @@
|
||||
+package io.papermc.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.server.ServerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when resources such as datapacks are reloaded (e.g. /minecraft:reload)
|
||||
+ * <p>
|
||||
+ * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this.
|
||||
+ * </p>
|
||||
+ */
|
||||
+public class ServerResourcesReloadedEvent extends ServerEvent {
|
||||
+
|
||||
+ public static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Cause cause;
|
||||
+
|
||||
+ public ServerResourcesReloadedEvent(@NotNull Cause cause) {
|
||||
+ this.cause = cause;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cause of the resource reload.
|
||||
+ *
|
||||
+ * @return the reload cause
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return cause;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ COMMAND,
|
||||
+ PLUGIN,
|
||||
+ }
|
||||
+}
|
69
patches/api/0254-Add-BlockFailedDispenseEvent.patch
Normal file
69
patches/api/0254-Add-BlockFailedDispenseEvent.patch
Normal file
|
@ -0,0 +1,69 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TheViperShow <29604693+TheViperShow@users.noreply.github.com>
|
||||
Date: Wed, 22 Apr 2020 09:40:23 +0200
|
||||
Subject: [PATCH] Add BlockFailedDispenseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dab794341170ed10d5a05c1b4c180d164e0f70e2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java
|
||||
@@ -0,0 +1,57 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a block tries to dispense an item, but its inventory is empty.
|
||||
+ */
|
||||
+public class BlockFailedDispenseEvent extends BlockEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private boolean shouldPlayEffect = true;
|
||||
+
|
||||
+ public BlockFailedDispenseEvent(@NotNull Block theBlock) {
|
||||
+ super(theBlock);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return if the effect should be played
|
||||
+ */
|
||||
+ public boolean shouldPlayEffect() {
|
||||
+ return this.shouldPlayEffect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if the effect for empty dispensers should be played
|
||||
+ *
|
||||
+ * @param playEffect if the effect should be played
|
||||
+ */
|
||||
+ public void shouldPlayEffect(boolean playEffect) {
|
||||
+ this.shouldPlayEffect = playEffect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * @return {@link #shouldPlayEffect()}
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean callEvent() {
|
||||
+ super.callEvent();
|
||||
+ return this.shouldPlayEffect();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull
|
||||
+ HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull
|
||||
+ HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
127
patches/api/0255-Added-PlayerLecternPageChangeEvent.patch
Normal file
127
patches/api/0255-Added-PlayerLecternPageChangeEvent.patch
Normal file
|
@ -0,0 +1,127 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 23 Nov 2020 12:58:16 -0800
|
||||
Subject: [PATCH] Added PlayerLecternPageChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..26370e46e4a12e3470e9bb747fac5786a7305810
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerLecternPageChangeEvent.java
|
||||
@@ -0,0 +1,115 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.block.Lectern;
|
||||
+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.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public class PlayerLecternPageChangeEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+ private final Lectern lectern;
|
||||
+ private final ItemStack book;
|
||||
+ private final PageChangeDirection pageChangeDirection;
|
||||
+ private final int oldPage;
|
||||
+ private int newPage;
|
||||
+
|
||||
+ public PlayerLecternPageChangeEvent(@NotNull Player player, @NotNull Lectern lectern, @NotNull ItemStack book, @NotNull PageChangeDirection pageChangeDirection, int oldPage, int newPage) {
|
||||
+ super(player);
|
||||
+ this.lectern = lectern;
|
||||
+ this.book = book;
|
||||
+ this.pageChangeDirection = pageChangeDirection;
|
||||
+ this.oldPage = oldPage;
|
||||
+ this.newPage = newPage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the lectern involved.
|
||||
+ *
|
||||
+ * @return the Lectern
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Lectern getLectern() {
|
||||
+ return lectern;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the current ItemStack on the lectern.
|
||||
+ *
|
||||
+ * @return the ItemStack on the Lectern
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getBook() {
|
||||
+ return this.book;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the page change direction. This is essentially returns which button the player clicked, left or right.
|
||||
+ *
|
||||
+ * @return the page change direction
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PageChangeDirection getPageChangeDirection() {
|
||||
+ return pageChangeDirection;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the page changed from. <i>Pages are 0-indexed.</i>
|
||||
+ *
|
||||
+ * @return the page changed from
|
||||
+ */
|
||||
+ public int getOldPage() {
|
||||
+ return oldPage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the page changed to. <i>Pages are 0-indexed.</i>
|
||||
+ *
|
||||
+ * @return the page changed to
|
||||
+ */
|
||||
+ public int getNewPage() {
|
||||
+ return newPage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the page changed to. <i>Pages are 0-indexed.</i>
|
||||
+ * Page indices that are greater than the number of pages will show the last page.
|
||||
+ *
|
||||
+ * @param newPage the new paged changed to
|
||||
+ */
|
||||
+ public void setNewPage(int newPage) {
|
||||
+ this.newPage = newPage;
|
||||
+ }
|
||||
+
|
||||
+ @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 PageChangeDirection {
|
||||
+ LEFT,
|
||||
+ RIGHT,
|
||||
+ }
|
||||
+}
|
89
patches/api/0256-Added-PlayerLoomPatternSelectEvent.patch
Normal file
89
patches/api/0256-Added-PlayerLoomPatternSelectEvent.patch
Normal file
|
@ -0,0 +1,89 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 25 Nov 2020 16:33:42 -0800
|
||||
Subject: [PATCH] Added PlayerLoomPatternSelectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8cb05709f7cb5dee993ff6fea1626c41b90a7d8b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerLoomPatternSelectEvent.java
|
||||
@@ -0,0 +1,77 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.block.banner.PatternType;
|
||||
+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.LoomInventory;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player selects a banner patten in a loom inventory.
|
||||
+ */
|
||||
+public class PlayerLoomPatternSelectEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+ private final LoomInventory loomInventory;
|
||||
+ private PatternType patternType;
|
||||
+
|
||||
+ public PlayerLoomPatternSelectEvent(@NotNull Player player, @NotNull LoomInventory loomInventory, @NotNull PatternType patternType) {
|
||||
+ super(player);
|
||||
+ this.loomInventory = loomInventory;
|
||||
+ this.patternType = patternType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the loom inventory involved.
|
||||
+ *
|
||||
+ * @return the loom inventory
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public LoomInventory getLoomInventory() {
|
||||
+ return loomInventory;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the pattern type selected.
|
||||
+ *
|
||||
+ * @return the pattern type
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PatternType getPatternType() {
|
||||
+ return patternType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the pattern type selected.
|
||||
+ *
|
||||
+ * @param patternType the pattern type
|
||||
+ */
|
||||
+ public void setPatternType(@NotNull PatternType patternType) {
|
||||
+ this.patternType = patternType;
|
||||
+ }
|
||||
+
|
||||
+ @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;
|
||||
+ }
|
||||
+}
|
69
patches/api/0257-Better-AnnotationTest-printout.patch
Normal file
69
patches/api/0257-Better-AnnotationTest-printout.patch
Normal file
|
@ -0,0 +1,69 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 3 Dec 2020 14:04:57 -0800
|
||||
Subject: [PATCH] Better AnnotationTest printout
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index aefaeec678b2f6b5ba1c15e43c4886eb9af6b143..33771618d2fd7591db020af57df358c891b11d6d 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -250,6 +250,19 @@
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
</configuration>
|
||||
</plugin>
|
||||
+ <plugin>
|
||||
+ <groupId>org.apache.maven.plugins</groupId>
|
||||
+ <artifactId>maven-surefire-plugin</artifactId>
|
||||
+ <version>2.22.2</version>
|
||||
+ <configuration>
|
||||
+ <properties>
|
||||
+ <property>
|
||||
+ <name>listener</name>
|
||||
+ <value>io.papermc.paper.JunitEventListener</value>
|
||||
+ </property>
|
||||
+ </properties>
|
||||
+ </configuration>
|
||||
+ </plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
diff --git a/src/test/java/io/papermc/paper/JunitEventListener.java b/src/test/java/io/papermc/paper/JunitEventListener.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..072ac1a96394b8d494f42fca8dfe08115eaed3fe
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/JunitEventListener.java
|
||||
@@ -0,0 +1,6 @@
|
||||
+package io.papermc.paper;
|
||||
+
|
||||
+import org.junit.runner.notification.RunListener;
|
||||
+
|
||||
+public class JunitEventListener extends RunListener {
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 03229d5f4ec36a82197beb391356d791ff67fb2f..19271057cf24329757c9419fa6c97848e008a96c 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -107,13 +107,18 @@ public class AnnotationTest {
|
||||
|
||||
Collections.sort(errors);
|
||||
|
||||
- System.out.println(errors.size() + " missing annotation(s):");
|
||||
+ StringBuilder builder = new StringBuilder()
|
||||
+ .append("There ")
|
||||
+ .append(errors.size() != 1 ? "are " : "is ")
|
||||
+ .append(errors.size())
|
||||
+ .append(" missing annotation")
|
||||
+ .append(errors.size() != 1 ? "s:\n" : ":\n");
|
||||
+
|
||||
for (String message : errors) {
|
||||
- System.out.print("\t");
|
||||
- System.out.println(message);
|
||||
+ builder.append("\t").append(message).append("\n");
|
||||
}
|
||||
|
||||
- Assert.fail("There " + errors.size() + " are missing annotation(s)");
|
||||
+ Assert.fail(builder.toString());
|
||||
}
|
||||
|
||||
private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException {
|
|
@ -0,0 +1,67 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Miller <mnmiller1@me.com>
|
||||
Date: Mon, 4 Jan 2021 16:40:55 +1000
|
||||
Subject: [PATCH] Add API to get exact interaction point in PlayerInteractEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
|
||||
index 1208e1f8c2163d83c5b12bbb9b7ac044c72380e0..a01f86e6aba8b66ecc713da0787cd861e2930a2a 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
+import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@@ -34,22 +35,30 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
private Result useClickedBlock;
|
||||
private Result useItemInHand;
|
||||
private EquipmentSlot hand;
|
||||
+ private Location interactionPoint; // Paper
|
||||
|
||||
public PlayerInteractEvent(@NotNull final Player who, @NotNull final Action action, @Nullable final ItemStack item, @Nullable final Block clickedBlock, @NotNull final BlockFace clickedFace) {
|
||||
this(who, action, item, clickedBlock, clickedFace, EquipmentSlot.HAND);
|
||||
}
|
||||
|
||||
public PlayerInteractEvent(@NotNull final Player who, @NotNull final Action action, @Nullable final ItemStack item, @Nullable final Block clickedBlock, @NotNull final BlockFace clickedFace, @Nullable final EquipmentSlot hand) {
|
||||
+ // Paper start - Add interactionPoint
|
||||
+ this(who, action, item, clickedBlock, clickedFace, hand, null);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerInteractEvent(@NotNull final Player who, @NotNull final Action action, @Nullable final ItemStack item, @Nullable final Block clickedBlock, @NotNull final BlockFace clickedFace, @Nullable final EquipmentSlot hand, @Nullable final Location interactionPoint) {
|
||||
super(who);
|
||||
this.action = action;
|
||||
this.item = item;
|
||||
this.blockClicked = clickedBlock;
|
||||
this.blockFace = clickedFace;
|
||||
this.hand = hand;
|
||||
+ this.interactionPoint = interactionPoint;
|
||||
|
||||
useItemInHand = Result.DEFAULT;
|
||||
useClickedBlock = clickedBlock == null ? Result.DENY : Result.ALLOW;
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Returns the action type
|
||||
@@ -221,6 +230,18 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
return hand;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * The exact point at which the interaction occurred. May be null.
|
||||
+ *
|
||||
+ * @return the exact interaction point. May be null.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getInteractionPoint() {
|
||||
+ return interactionPoint;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
Loading…
Add table
Add a link
Reference in a new issue