mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Pufferfish Changes: pufferfish-gg/Pufferfish@c9f4e20 Final 1.20.4 Update pufferfish-gg/Pufferfish@1f3ad02 Final 1.20.4 update, for realzies pufferfish-gg/Pufferfish@b1ab664 Enable SIMD on java 21 pufferfish-gg/Pufferfish@0674c2b 1.21 compiles pufferfish-gg/Pufferfish@98ea973 Fix 1.21 version checkers pufferfish-gg/Pufferfish@68f859c Fix lambda/tick guard patch pufferfish-gg/Pufferfish@eaa18d5 Updated Upstream (Paper) pufferfish-gg/Pufferfish@1d72eea Updated Upstream (Paper) pufferfish-gg/Pufferfish@1d3c743 Update pufferfish version detector stuff pufferfish-gg/Pufferfish@5e30963 Fix crash bug pufferfish-gg/Pufferfish@12571eb Use mojmapped paperclip jar instead (CI only) pufferfish-gg/Pufferfish@4d16ae0 Drop a patch - moonrise includes it pufferfish-gg/Pufferfish@52c2d05 Revert "Drop a patch - moonrise includes it" pufferfish-gg/Pufferfish@bdb56f1 Fix entity interactions with fluids pufferfish-gg/Pufferfish@469e5c1 Updated Upstream (Paper) pufferfish-gg/Pufferfish@d75961f 1.21.1 Update (Updated Upstream (Paper))
192 lines
6.7 KiB
Diff
192 lines
6.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Sun, 19 Apr 2020 00:25:09 -0500
|
|
Subject: [PATCH] Anvil API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java
|
|
index f1f97a85ec713c05c882d7588f4a3e4a017f4795..813f6cd253322538bdf96eb323dd23a7809a1c1e 100644
|
|
--- a/src/main/java/org/bukkit/inventory/AnvilInventory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/AnvilInventory.java
|
|
@@ -138,4 +138,42 @@ public interface AnvilInventory extends Inventory {
|
|
setItem(2, result);
|
|
}
|
|
// Paper end
|
|
+
|
|
+ // Purpur start
|
|
+ /**
|
|
+ * Gets if the player viewing the anvil inventory can bypass experience cost
|
|
+ *
|
|
+ * @return whether the player viewing the anvil inventory can bypass the experience cost
|
|
+ * @deprecated use {@link AnvilView#canBypassCost()}.
|
|
+ */
|
|
+ @Deprecated(forRemoval = true, since = "1.21")
|
|
+ boolean canBypassCost();
|
|
+
|
|
+ /**
|
|
+ * Set if the player viewing the anvil inventory can bypass the experience cost
|
|
+ *
|
|
+ * @param bypassCost whether the player viewing the anvil inventory can bypass the experience cost
|
|
+ * @deprecated use {@link AnvilView#setBypassCost(boolean)}.
|
|
+ */
|
|
+ @Deprecated(forRemoval = true, since = "1.21")
|
|
+ void setBypassCost(boolean bypassCost);
|
|
+
|
|
+ /**
|
|
+ * Gets if the player viewing the anvil inventory can do unsafe enchants
|
|
+ *
|
|
+ * @return whether the player viewing the anvil inventory can do unsafe enchants
|
|
+ * @deprecated use {@link AnvilView#canDoUnsafeEnchants()}.
|
|
+ */
|
|
+ @Deprecated(forRemoval = true, since = "1.21")
|
|
+ boolean canDoUnsafeEnchants();
|
|
+
|
|
+ /**
|
|
+ * Set if the player viewing the anvil inventory can do unsafe enchants
|
|
+ *
|
|
+ * @param canDoUnsafeEnchants whether the player viewing the anvil inventory can do unsafe enchants
|
|
+ * @deprecated use {@link AnvilView#setDoUnsafeEnchants(boolean)}.
|
|
+ */
|
|
+ @Deprecated(forRemoval = true, since = "1.21")
|
|
+ void setDoUnsafeEnchants(boolean canDoUnsafeEnchants);
|
|
+ // Purpur end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/inventory/view/AnvilView.java b/src/main/java/org/bukkit/inventory/view/AnvilView.java
|
|
index 0344b3db789baf1da0b59f2d2cd66154b69b38a9..4b130327c84b05938d21d563f78361f9483a6a4e 100644
|
|
--- a/src/main/java/org/bukkit/inventory/view/AnvilView.java
|
|
+++ b/src/main/java/org/bukkit/inventory/view/AnvilView.java
|
|
@@ -59,4 +59,34 @@ public interface AnvilView extends InventoryView {
|
|
* @param levels the levels to set
|
|
*/
|
|
void setMaximumRepairCost(int levels);
|
|
+
|
|
+ // Purpur start
|
|
+ /**
|
|
+ * Gets if the player viewing the anvil inventory can bypass experience cost
|
|
+ *
|
|
+ * @return whether the player viewing the anvil inventory can bypass the experience cost
|
|
+ */
|
|
+ boolean canBypassCost();
|
|
+
|
|
+ /**
|
|
+ * Set if the player viewing the anvil inventory can bypass the experience cost
|
|
+ *
|
|
+ * @param bypassCost whether the player viewing the anvil inventory can bypass the experience cost
|
|
+ */
|
|
+ void setBypassCost(boolean bypassCost);
|
|
+
|
|
+ /**
|
|
+ * Gets if the player viewing the anvil inventory can do unsafe enchants
|
|
+ *
|
|
+ * @return whether the player viewing the anvil inventory can do unsafe enchants
|
|
+ */
|
|
+ boolean canDoUnsafeEnchants();
|
|
+
|
|
+ /**
|
|
+ * Set if the player viewing the anvil inventory can do unsafe enchants
|
|
+ *
|
|
+ * @param canDoUnsafeEnchants whether the player viewing the anvil inventory can do unsafe enchants
|
|
+ */
|
|
+ void setDoUnsafeEnchants(boolean canDoUnsafeEnchants);
|
|
+ // Purpur end
|
|
}
|
|
diff --git a/src/main/java/org/purpurmc/purpur/event/inventory/AnvilTakeResultEvent.java b/src/main/java/org/purpurmc/purpur/event/inventory/AnvilTakeResultEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..b363c91a29f826910db22f2643decf996a067ab5
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/purpurmc/purpur/event/inventory/AnvilTakeResultEvent.java
|
|
@@ -0,0 +1,52 @@
|
|
+package org.purpurmc.purpur.event.inventory;
|
|
+
|
|
+import org.bukkit.entity.HumanEntity;
|
|
+import org.bukkit.entity.Player;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.inventory.InventoryEvent;
|
|
+import org.bukkit.inventory.AnvilInventory;
|
|
+import org.bukkit.inventory.InventoryView;
|
|
+import org.bukkit.inventory.ItemStack;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Called when a player takes the result item out of an anvil
|
|
+ */
|
|
+public class AnvilTakeResultEvent extends InventoryEvent {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private final Player player;
|
|
+ private final ItemStack result;
|
|
+
|
|
+ public AnvilTakeResultEvent(@NotNull HumanEntity player, @NotNull InventoryView view, @NotNull ItemStack result) {
|
|
+ super(view);
|
|
+ this.player = (Player) player;
|
|
+ this.result = result;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public Player getPlayer() {
|
|
+ return player;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public ItemStack getResult() {
|
|
+ return result;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public AnvilInventory getInventory() {
|
|
+ return (AnvilInventory) super.getInventory();
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/purpurmc/purpur/event/inventory/AnvilUpdateResultEvent.java b/src/main/java/org/purpurmc/purpur/event/inventory/AnvilUpdateResultEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..fd6a5a3589d436c2aaf988fd305899695799d3bb
|
|
--- /dev/null
|
|
+++ b/src/main/java/org/purpurmc/purpur/event/inventory/AnvilUpdateResultEvent.java
|
|
@@ -0,0 +1,35 @@
|
|
+package org.purpurmc.purpur.event.inventory;
|
|
+
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.inventory.InventoryEvent;
|
|
+import org.bukkit.inventory.AnvilInventory;
|
|
+import org.bukkit.inventory.InventoryView;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Called when anvil slots change, triggering the result slot to be updated
|
|
+ */
|
|
+public class AnvilUpdateResultEvent extends InventoryEvent {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+
|
|
+ public AnvilUpdateResultEvent(@NotNull InventoryView view) {
|
|
+ super(view);
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public AnvilInventory getInventory() {
|
|
+ return (AnvilInventory) super.getInventory();
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|