-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
2,812 additions
and
2,405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
name: Build | ||
on: [workflow_dispatch, push, pull_request] | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- "ver/**" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.commits[0].message, '[ci-skip]')" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 21 | ||
cache: 'gradle' | ||
- uses: gradle/wrapper-validation-action@v2 | ||
- uses: gradle/actions/setup-gradle@v3 | ||
- name: Configure Git | ||
run: git config --global user.email "[email protected]" && git config --global user.name "Github Actions" | ||
- name: Apply Patches | ||
run: ./gradlew applyPatches --no-daemon --stacktrace | ||
- name: Build | ||
run: ./gradlew build --no-daemon --stacktrace | ||
- name: Rebuild on Failure | ||
if: ${{ failure() }} | ||
run: | | ||
./gradlew clean cleanCache | ||
./gradlew applyPatches --no-daemon --stacktrace | ||
./gradlew build --no-daemon --stacktrace | ||
build: | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.commits[0].message, '[ci-skip]')" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 21 | ||
cache: 'gradle' | ||
- uses: gradle/actions/setup-gradle@v4 | ||
- name: Configure Git | ||
run: git config --global user.email "[email protected]" && git config --global user.name "Github Actions" | ||
- name: Apply Patches | ||
run: ./gradlew applyAllPatches --no-daemon --stacktrace | ||
- name: Build | ||
run: ./gradlew build --no-daemon --stacktrace | ||
- name: Rebuild on Failure | ||
if: ${{ failure() }} | ||
run: | | ||
./gradlew clean cleanCache --refresh-dependencies | ||
./gradlew applyAllPatches --no-daemon --stacktrace | ||
./gradlew build --no-daemon --stacktrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,5 @@ build | |
/purpur-api | ||
*.jar | ||
test-plugin.settings.gradle.kts | ||
|
||
ignored/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
198 changes: 198 additions & 0 deletions
198
...pi/paper-patches/features/0004-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Jake Potrebic <[email protected]> | ||
Date: Sat, 26 Feb 2022 16:43:33 -0800 | ||
Subject: [PATCH] Paper PR - Add FillBottleEvents for player and dispenser | ||
|
||
https://github.com/PaperMC/Paper/pull/7513 | ||
|
||
Adds 2 events, PlayerFillBottleEvent and BlockFillBottleEvent. These | ||
events do not have a common superclass due to needing to extend | ||
PlayerEvent and BlockEvent respectively. | ||
|
||
TODO: Add a common interface between Block and AreaEffectCloud, | ||
something like BottleSource to add a "source" field to each event to get | ||
the source of the bottle fill, water block, cauldron, beehive, or | ||
AreaEffectCloud. | ||
|
||
Co-authored-by: Dmitry Sidorov <[email protected]> | ||
|
||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockFillBottleEvent.java b/src/main/java/io/papermc/paper/event/block/BlockFillBottleEvent.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..77e34fb5115aa039f10176f815ba3a0f2094e909 | ||
--- /dev/null | ||
+++ b/src/main/java/io/papermc/paper/event/block/BlockFillBottleEvent.java | ||
@@ -0,0 +1,80 @@ | ||
+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.jspecify.annotations.NullMarked; | ||
+ | ||
+/** | ||
+ * Called when a {@link org.bukkit.block.Dispenser} fills up a bottle. | ||
+ */ | ||
+@NullMarked | ||
+public class BlockFillBottleEvent extends BlockEvent implements Cancellable { | ||
+ | ||
+ private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
+ | ||
+ private final ItemStack bottle; | ||
+ private ItemStack resultItem; | ||
+ private boolean cancelled; | ||
+ | ||
+ | ||
+ public BlockFillBottleEvent(Block block, ItemStack bottle, ItemStack resultItem) { | ||
+ super(block); | ||
+ this.bottle = bottle; | ||
+ this.resultItem = resultItem; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Gets the bottle item that's being filled. | ||
+ * | ||
+ * @return the bottle item | ||
+ */ | ||
+ public ItemStack getBottle() { | ||
+ return this.bottle; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Gets the result of the glass bottle that's being filled. | ||
+ * | ||
+ * @return the result of the filling | ||
+ */ | ||
+ public ItemStack getResultItem() { | ||
+ return this.resultItem; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Sets the result of the glass bottle being filled. | ||
+ * | ||
+ * @param resultItem the result of the filling | ||
+ */ | ||
+ public void setResultItem(ItemStack resultItem) { | ||
+ this.resultItem = resultItem; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public boolean isCancelled() { | ||
+ return this.cancelled; | ||
+ } | ||
+ | ||
+ /** | ||
+ * {@inheritDoc} | ||
+ * <p> | ||
+ * Cancelling this event will prevent {@link #getBottle()} from being | ||
+ * replaced/consumed. | ||
+ */ | ||
+ @Override | ||
+ public void setCancelled(boolean cancel) { | ||
+ this.cancelled = cancel; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public HandlerList getHandlers() { | ||
+ return HANDLER_LIST; | ||
+ } | ||
+ | ||
+ public static HandlerList getHandlerList() { | ||
+ return HANDLER_LIST; | ||
+ } | ||
+} | ||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFillBottleEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFillBottleEvent.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..c7e6e1b2e699f6c49921ef25ebd31e39fc6646b1 | ||
--- /dev/null | ||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerFillBottleEvent.java | ||
@@ -0,0 +1,88 @@ | ||
+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.EquipmentSlot; | ||
+import org.bukkit.inventory.ItemStack; | ||
+import org.jspecify.annotations.NullMarked; | ||
+ | ||
+@NullMarked | ||
+public class PlayerFillBottleEvent extends PlayerEvent implements Cancellable { | ||
+ | ||
+ private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
+ | ||
+ private final EquipmentSlot hand; | ||
+ private final ItemStack bottle; | ||
+ private ItemStack resultItem; | ||
+ private boolean cancelled; | ||
+ | ||
+ public PlayerFillBottleEvent(Player player, EquipmentSlot hand, ItemStack bottle, ItemStack resultItem) { | ||
+ super(player); | ||
+ this.hand = hand; | ||
+ this.bottle = bottle; | ||
+ this.resultItem = resultItem; | ||
+ } | ||
+ | ||
+ /** | ||
+ * The hand used to fill the bottle. | ||
+ * | ||
+ * @return the hand | ||
+ */ | ||
+ public EquipmentSlot getHand() { | ||
+ return this.hand; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Gets the bottle item that's being filled. | ||
+ * | ||
+ * @return the bottle item | ||
+ */ | ||
+ public ItemStack getBottle() { | ||
+ return this.bottle; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Gets the result of the bottle that's being filled. | ||
+ * | ||
+ * @return the result of the filling | ||
+ */ | ||
+ public ItemStack getResultItem() { | ||
+ return this.resultItem; | ||
+ } | ||
+ | ||
+ /** | ||
+ * Sets the result of the bottle being filled. | ||
+ * | ||
+ * @param resultItem the result of the filling | ||
+ */ | ||
+ public void setResultItem(ItemStack resultItem) { | ||
+ this.resultItem = resultItem; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public boolean isCancelled() { | ||
+ return this.cancelled; | ||
+ } | ||
+ | ||
+ /** | ||
+ * {@inheritDoc} | ||
+ * <p> | ||
+ * Cancelling this event will prevent {@link #getBottle()} from being | ||
+ * replaced/consumed. | ||
+ */ | ||
+ @Override | ||
+ public void setCancelled(boolean cancel) { | ||
+ this.cancelled = cancel; | ||
+ } | ||
+ | ||
+ @Override | ||
+ public HandlerList getHandlers() { | ||
+ return HANDLER_LIST; | ||
+ } | ||
+ | ||
+ public static HandlerList getHandlerList() { | ||
+ return HANDLER_LIST; | ||
+ } | ||
+} |
Oops, something went wrong.