mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
That's a really hard fork!
This commit is contained in:
parent
c2ef6cc45a
commit
e479485578
1543 changed files with 0 additions and 208791 deletions
12
.gitmodules
vendored
12
.gitmodules
vendored
|
@ -1,12 +0,0 @@
|
|||
[submodule "work/Bukkit"]
|
||||
path = work/Bukkit
|
||||
url = https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
|
||||
[submodule "work/CraftBukkit"]
|
||||
path = work/CraftBukkit
|
||||
url = https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
|
||||
[submodule "work/BuildData"]
|
||||
path = work/BuildData
|
||||
url = https://hub.spigotmc.org/stash/scm/spigot/builddata.git
|
||||
[submodule "work/Spigot"]
|
||||
path = work/Spigot
|
||||
url = https://hub.spigotmc.org/stash/scm/spigot/spigot.git
|
|
@ -1,28 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 9 Jul 2023 11:54:54 -0700
|
||||
Subject: [PATCH] API for an entity's scoreboard name
|
||||
|
||||
Was obtainable through different methods, but you had to use different
|
||||
methods depending on the implementation of Entity you were working with.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
@NotNull io.papermc.paper.threadedregions.scheduler.EntityScheduler getScheduler();
|
||||
// Paper end - Folia schedulers
|
||||
+
|
||||
+ // Paper start - entity scoreboard name
|
||||
+ /**
|
||||
+ * Gets the string name of the entity used to track it in {@link org.bukkit.scoreboard.Scoreboard Scoreboards}.
|
||||
+ *
|
||||
+ * @return the scoreboard entry name
|
||||
+ * @see org.bukkit.scoreboard.Scoreboard#getScores(String)
|
||||
+ * @see org.bukkit.scoreboard.Scoreboard#getEntries()
|
||||
+ */
|
||||
+ @NotNull String getScoreboardEntryName();
|
||||
+ // Paper end - entity scoreboard name
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Flo0 <flo.roma@web.de>
|
||||
Date: Mon, 8 Apr 2024 16:22:07 +0200
|
||||
Subject: [PATCH] API for checking sent chunks
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
void resetIdleDuration();
|
||||
// Paper end
|
||||
|
||||
+ // Paper start - Add chunk view API
|
||||
+ /**
|
||||
+ * Gets the a set of chunk keys for all chunks that have been sent to the player.
|
||||
+ *
|
||||
+ * @return an immutable set of chunk keys
|
||||
+ * @apiNote currently marked as experimental to gather feedback regarding the returned set being an immutable copy
|
||||
+ * vs it potentially being an unmodifiable view of the set chunks.
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable Set<Long> getSentChunkKeys();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the set of chunks that have been sent to the player.
|
||||
+ *
|
||||
+ * @return an immutable set of chunks
|
||||
+ * @apiNote currently marked as experimental to gather feedback regarding the returned set being an immutable copy
|
||||
+ * vs it potentially being an unmodifiable view of the set chunks.
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ java.util.@NotNull @org.jetbrains.annotations.Unmodifiable Set<org.bukkit.Chunk> getSentChunks();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the player has been sent a specific chunk.
|
||||
+ *
|
||||
+ * @param chunk the chunk to check
|
||||
+ * @return true if the player has been sent the chunk, false otherwise
|
||||
+ */
|
||||
+ default boolean isChunkSent(@NotNull org.bukkit.Chunk chunk) {
|
||||
+ return this.isChunkSent(chunk.getChunkKey());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the player has been sent a specific chunk.
|
||||
+ *
|
||||
+ * @param chunkKey the chunk key to check
|
||||
+ * @return true if the player has been sent the chunk, false otherwise
|
||||
+ * @see org.bukkit.Chunk#getChunkKey()
|
||||
+ */
|
||||
+ boolean isChunkSent(long chunkKey);
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
Spigot spigot();
|
|
@ -1,54 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Tue, 1 Feb 2022 15:51:44 -0700
|
||||
Subject: [PATCH] API for creating command sender which forwards feedback
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -0,0 +0,0 @@ public final class Bukkit {
|
||||
return server.getConsoleSender();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Creates a special {@link CommandSender} which redirects command feedback (in the form of chat messages) to the
|
||||
+ * specified listener. The returned sender will have the same effective permissions as {@link #getConsoleSender()}.
|
||||
+ *
|
||||
+ * @param feedback feedback listener
|
||||
+ * @return a command sender
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static CommandSender createCommandSender(final @NotNull java.util.function.Consumer<? super net.kyori.adventure.text.Component> feedback) {
|
||||
+ return server.createCommandSender(feedback);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the folder that contains all of the various {@link World}s.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
public ConsoleCommandSender getConsoleSender();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Creates a special {@link CommandSender} which redirects command feedback (in the form of chat messages) to the
|
||||
+ * specified listener. The returned sender will have the same effective permissions as {@link #getConsoleSender()}.
|
||||
+ *
|
||||
+ * @param feedback feedback listener
|
||||
+ * @return a command sender
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public CommandSender createCommandSender(final @NotNull java.util.function.Consumer<? super net.kyori.adventure.text.Component> feedback);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the folder that contains all of the various {@link World}s.
|
||||
*
|
|
@ -1,169 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 21 Aug 2021 17:25:54 -0700
|
||||
Subject: [PATCH] API for updating recipes on clients
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -0,0 +0,0 @@ public final class Bukkit {
|
||||
server.reloadData();
|
||||
}
|
||||
|
||||
+ // Paper start - update reloadable data
|
||||
+ /**
|
||||
+ * Updates all advancement, tag, and recipe data for all connected clients.
|
||||
+ * Useful for updating clients to new advancements/recipes/tags.
|
||||
+ * @see #updateRecipes()
|
||||
+ */
|
||||
+ public static void updateResources() {
|
||||
+ server.updateResources();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Updates recipe data and the recipe book for all connected clients. Useful for
|
||||
+ * updating clients to new recipes.
|
||||
+ * @see #updateResources()
|
||||
+ */
|
||||
+ public static void updateRecipes() {
|
||||
+ server.updateRecipes();
|
||||
+ }
|
||||
+ // Paper end - update reloadable data
|
||||
+
|
||||
/**
|
||||
* Returns the primary logger associated with this server instance.
|
||||
*
|
||||
@@ -0,0 +0,0 @@ public final class Bukkit {
|
||||
return server.addRecipe(recipe);
|
||||
}
|
||||
|
||||
+ // Paper start - method to send recipes immediately
|
||||
+ /**
|
||||
+ * Adds a recipe to the crafting manager.
|
||||
+ *
|
||||
+ * @param recipe the recipe to add
|
||||
+ * @param resendRecipes true to update the client with the full set of recipes
|
||||
+ * @return true if the recipe was added, false if it wasn't for some reason
|
||||
+ */
|
||||
+ @Contract("null, _ -> false")
|
||||
+ public static boolean addRecipe(@Nullable Recipe recipe, boolean resendRecipes) {
|
||||
+ return server.addRecipe(recipe, resendRecipes);
|
||||
+ }
|
||||
+ // Paper end - method to send recipes immediately
|
||||
+
|
||||
/**
|
||||
* Get a list of all recipes for a given item. The stack size is ignored
|
||||
* in comparisons. If the durability is -1, it will match any data value.
|
||||
@@ -0,0 +0,0 @@ public final class Bukkit {
|
||||
return server.removeRecipe(key);
|
||||
}
|
||||
|
||||
+ // Paper start - method to resend recipes
|
||||
+ /**
|
||||
+ * Remove a recipe from the server.
|
||||
+ * <p>
|
||||
+ * <b>Note that removing a recipe may cause permanent loss of data
|
||||
+ * associated with that recipe (eg whether it has been discovered by
|
||||
+ * players).</b>
|
||||
+ *
|
||||
+ * @param key NamespacedKey of recipe to remove.
|
||||
+ * @param resendRecipes true to update all clients on the new recipe list.
|
||||
+ * Will only update if a recipe was actually removed
|
||||
+ * @return True if recipe was removed
|
||||
+ */
|
||||
+ public static boolean removeRecipe(@NotNull NamespacedKey key, boolean resendRecipes) {
|
||||
+ return server.removeRecipe(key, resendRecipes);
|
||||
+ }
|
||||
+ // Paper end - method to resend recipes
|
||||
+
|
||||
/**
|
||||
* Gets a list of command aliases defined in the server properties.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
public void reloadData();
|
||||
|
||||
+ // Paper start - update reloadable data
|
||||
+ /**
|
||||
+ * Updates all advancement, tag, and recipe data to all connected clients.
|
||||
+ * Useful for updating clients to new advancements/recipes/tags.
|
||||
+ * @see #updateRecipes()
|
||||
+ */
|
||||
+ void updateResources();
|
||||
+
|
||||
+ /**
|
||||
+ * Updates recipe data and the recipe book to each player. Useful for
|
||||
+ * updating clients to new recipes.
|
||||
+ * @see #updateResources()
|
||||
+ */
|
||||
+ void updateRecipes();
|
||||
+ // Paper end - update reloadable data
|
||||
+
|
||||
/**
|
||||
* Returns the primary logger associated with this server instance.
|
||||
*
|
||||
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
public boolean dispatchCommand(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException;
|
||||
|
||||
/**
|
||||
- * Adds a recipe to the crafting manager.
|
||||
+ * Adds a recipe to the crafting manager. Recipes added with
|
||||
+ * this method won't be sent to the client automatically. Use
|
||||
+ * {@link #updateRecipes()} or {@link #updateResources()} to
|
||||
+ * update clients to new recipes added.
|
||||
+ * <p>
|
||||
+ * Player's still have to discover recipes via {@link Player#discoverRecipe(NamespacedKey)}
|
||||
+ * before seeing them in their recipe book.
|
||||
*
|
||||
* @param recipe the recipe to add
|
||||
* @return true if the recipe was added, false if it wasn't for some
|
||||
* reason
|
||||
+ * @see #addRecipe(Recipe, boolean)
|
||||
*/
|
||||
@Contract("null -> false")
|
||||
public boolean addRecipe(@Nullable Recipe recipe);
|
||||
|
||||
+ // Paper start - method to send recipes immediately
|
||||
+ /**
|
||||
+ * Adds a recipe to the crafting manager.
|
||||
+ *
|
||||
+ * @param recipe the recipe to add
|
||||
+ * @param resendRecipes true to update the client with the full set of recipes
|
||||
+ * @return true if the recipe was added, false if it wasn't for some reason
|
||||
+ */
|
||||
+ @Contract("null, _ -> false")
|
||||
+ boolean addRecipe(@Nullable Recipe recipe, boolean resendRecipes);
|
||||
+ // Paper end - method to send recipes immediately
|
||||
+
|
||||
/**
|
||||
* Get a list of all recipes for a given item. The stack size is ignored
|
||||
* in comparisons. If the durability is -1, it will match any data value.
|
||||
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
public boolean removeRecipe(@NotNull NamespacedKey key);
|
||||
|
||||
+ // Paper start - method to resend recipes
|
||||
+ /**
|
||||
+ * Remove a recipe from the server.
|
||||
+ * <p>
|
||||
+ * <b>Note that removing a recipe may cause permanent loss of data
|
||||
+ * associated with that recipe (eg whether it has been discovered by
|
||||
+ * players).</b>
|
||||
+ *
|
||||
+ * @param key NamespacedKey of recipe to remove.
|
||||
+ * @param resendRecipes true to update all clients on the new recipe list.
|
||||
+ * Will only update if a recipe was actually removed
|
||||
+ * @return True if recipe was removed
|
||||
+ */
|
||||
+ boolean removeRecipe(@NotNull NamespacedKey key, boolean resendRecipes);
|
||||
+ // Paper end - method to resend recipes
|
||||
+
|
||||
/**
|
||||
* Gets a list of command aliases defined in the server properties.
|
||||
*
|
|
@ -1,25 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Abel <abelvanhulst@gmail.com>
|
||||
Date: Tue, 12 Nov 2024 22:25:35 +0100
|
||||
Subject: [PATCH] API to allow/disallow tick sleeping
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* Returns whether the server is sleeping/paused.
|
||||
*/
|
||||
boolean isPaused();
|
||||
+
|
||||
+ /**
|
||||
+ * Allows or disallows the server to sleep/pause.
|
||||
+ * If any plugin disallows pausing, the server will never pause.
|
||||
+ *
|
||||
+ * @param plugin The {@link org.bukkit.plugin.Plugin} that's allowing or disallowing pausing.
|
||||
+ * @param value Whether to allow sleeping of the server (defaults to true).
|
||||
+ */
|
||||
+ void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
|
||||
// Paper end - API to check if the server is sleeping
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Abel <abelvanhulst@gmail.com>
|
||||
Date: Sun, 10 Nov 2024 16:32:51 +0100
|
||||
Subject: [PATCH] API to check if the server is sleeping
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
public boolean isGlobalTickThread();
|
||||
// Paper end - Folia region threading API
|
||||
+
|
||||
+ // Paper start - API to check if the server is sleeping
|
||||
+ /**
|
||||
+ * Returns whether the server is sleeping/paused.
|
||||
+ */
|
||||
+ boolean isPaused();
|
||||
+ // Paper end - API to check if the server is sleeping
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 6 Nov 2017 21:10:01 -0500
|
||||
Subject: [PATCH] API to get a BlockState without a snapshot
|
||||
|
||||
This allows you to get a BlockState without creating a snapshot, operating
|
||||
on the real tile entity.
|
||||
|
||||
This is useful for where performance is needed
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable {
|
||||
@NotNull
|
||||
BlockState getState();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * @see #getState() optionally disables use of snapshot, to operate on real block data
|
||||
+ * @param useSnapshot if this block is a TE, should we create a fully copy of the TileEntity
|
||||
+ * @return BlockState with the current state of this block
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ BlockState getState(boolean useSnapshot);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Returns the biome that this block resides in
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/block/TileState.java b/src/main/java/org/bukkit/block/TileState.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/TileState.java
|
||||
+++ b/src/main/java/org/bukkit/block/TileState.java
|
||||
@@ -0,0 +0,0 @@ public interface TileState extends BlockState, PersistentDataHolder {
|
||||
@NotNull
|
||||
@Override
|
||||
PersistentDataContainer getPersistentDataContainer();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Checks if this TileState is a snapshot or a live
|
||||
+ * representation of the underlying tile entity.
|
||||
+ * <p>
|
||||
+ * NOTE: You may still have to call {@link BlockState#update()} on
|
||||
+ * live representations to update any visuals on the block.
|
||||
+ *
|
||||
+ * @return true if this is a snapshot
|
||||
+ * @see Block#getState(boolean)
|
||||
+ */
|
||||
+ boolean isSnapshot();
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 20 Dec 2017 17:38:07 -0500
|
||||
Subject: [PATCH] Ability to apply mending to XP API
|
||||
|
||||
This allows plugins that give players the ability to apply the experience
|
||||
points to the Item Mending formula, which will repair an item instead
|
||||
of giving the player experience points.
|
||||
|
||||
Both an API To standalone mend, and apply mending logic to .giveExp has been added.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public void resetPlayerWeather();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gives the player the amount of experience specified.
|
||||
+ *
|
||||
+ * @param amount Exp amount to give
|
||||
+ */
|
||||
+ public default void giveExp(int amount) {
|
||||
+ giveExp(amount, false);
|
||||
+ }
|
||||
/**
|
||||
* Gets the player's cooldown between picking up experience orbs.
|
||||
*
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* Gives the player the amount of experience specified.
|
||||
*
|
||||
* @param amount Exp amount to give
|
||||
+ * @param applyMending Mend players items with mending, with same behavior as picking up orbs. calls {@link #applyMending(int)}
|
||||
*/
|
||||
- public void giveExp(int amount);
|
||||
+ public void giveExp(int amount, boolean applyMending);
|
||||
+
|
||||
+ /**
|
||||
+ * Applies the mending effect to any items just as picking up an orb would.
|
||||
+ *
|
||||
+ * Can also be called with {@link #giveExp(int, boolean)} by passing true to applyMending
|
||||
+ *
|
||||
+ * @param amount Exp to apply
|
||||
+ * @return the remaining experience
|
||||
+ */
|
||||
+ public int applyMending(int amount);
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Gives the player the amount of experience levels specified. Levels can
|
|
@ -1,42 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 15 Aug 2018 01:04:58 -0400
|
||||
Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Chunk.java
|
||||
+++ b/src/main/java/org/bukkit/Chunk.java
|
||||
@@ -0,0 +0,0 @@ public interface Chunk extends PersistentDataHolder {
|
||||
* @return The tile entities.
|
||||
*/
|
||||
@NotNull
|
||||
- BlockState[] getTileEntities();
|
||||
+ // Paper start
|
||||
+ default BlockState[] getTileEntities() {
|
||||
+ return getTileEntities(true);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get a list of all tile entities in the chunk.
|
||||
+ *
|
||||
+ * @param useSnapshot Take snapshots or direct references
|
||||
+ * @return The tile entities.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ BlockState[] getTileEntities(boolean useSnapshot);
|
||||
+
|
||||
+ /**
|
||||
+ * Get a list of all tile entities that match a given predicate in the chunk.
|
||||
+ *
|
||||
+ * @param blockPredicate The predicate of blocks to return tile entities for
|
||||
+ * @param useSnapshot Take snapshots or direct references
|
||||
+ * @return The tile entities.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Collection<BlockState> getTileEntities(java.util.function.@NotNull Predicate<? super Block> blockPredicate, boolean useSnapshot);
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Checks if the chunk is fully generated.
|
|
@ -1,35 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 28 Aug 2021 09:00:35 -0700
|
||||
Subject: [PATCH] Add API for item entity health
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Item.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Item.java
|
||||
@@ -0,0 +0,0 @@ public interface Item extends Entity {
|
||||
* @param willAge True if the item should age
|
||||
*/
|
||||
public void setWillAge(boolean willAge);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the health of item stack.
|
||||
+ * <p>
|
||||
+ * Currently the default max health is 5.
|
||||
+ *
|
||||
+ * @return the health
|
||||
+ */
|
||||
+ public int getHealth();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the health of the item stack. If the value is non-positive
|
||||
+ * the itemstack's normal "on destroy" functionality will be run.
|
||||
+ * <p>
|
||||
+ * Currently, the default max health is 5.
|
||||
+ *
|
||||
+ * @param health the health, a non-positive value will destroy the entity
|
||||
+ */
|
||||
+ public void setHealth(int health);
|
||||
// Paper end
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Sat, 14 Nov 2020 16:19:58 +0100
|
||||
Subject: [PATCH] Add API for quit reason
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class PlayerQuitEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private net.kyori.adventure.text.Component quitMessage; // Paper
|
||||
+ private final QuitReason reason; // Paper
|
||||
|
||||
@Deprecated // Paper
|
||||
public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage) {
|
||||
+ // Paper start
|
||||
+ this(who, quitMessage, null);
|
||||
+ }
|
||||
+ @Deprecated // Paper
|
||||
+ public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage, @Nullable QuitReason quitReason) {
|
||||
super(who);
|
||||
this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper
|
||||
+ this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason;
|
||||
}
|
||||
// Paper start
|
||||
+ @Deprecated
|
||||
public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage) {
|
||||
+ this(who, quitMessage, null);
|
||||
+ }
|
||||
+ public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage, @Nullable QuitReason quitReason) {
|
||||
super(who);
|
||||
this.quitMessage = quitMessage;
|
||||
+ this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public class PlayerQuitEvent extends PlayerEvent {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @NotNull
|
||||
+ public QuitReason getReason() {
|
||||
+ return this.reason;
|
||||
+ }
|
||||
+
|
||||
+ public enum QuitReason {
|
||||
+ /**
|
||||
+ * The player left on their own behalf.
|
||||
+ * <p>
|
||||
+ * This does not mean they pressed the disconnect button in their client, but rather that the client severed the
|
||||
+ * connection themselves. This may occur if no keep-alive packet is received on their side, among other things.
|
||||
+ */
|
||||
+ DISCONNECTED,
|
||||
+
|
||||
+ /**
|
||||
+ * The player was kicked from the server.
|
||||
+ */
|
||||
+ KICKED,
|
||||
+
|
||||
+ /**
|
||||
+ * The player has timed out.
|
||||
+ */
|
||||
+ TIMED_OUT,
|
||||
+
|
||||
+ /**
|
||||
+ * The player's connection has entered an erroneous state.
|
||||
+ * <p>
|
||||
+ * Reasons for this may include invalid packets, invalid data, and uncaught exceptions in the packet handler,
|
||||
+ * among others.
|
||||
+ */
|
||||
+ ERRONEOUS_STATE,
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: booky10 <boooky10@gmail.com>
|
||||
Date: Fri, 5 Nov 2021 21:01:36 +0100
|
||||
Subject: [PATCH] Add API for resetting a single score
|
||||
|
||||
It was only possible to reset all scores for a specific entry, instead of resetting only specific scores.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Score.java b/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Score.java
|
||||
@@ -0,0 +0,0 @@ public interface Score {
|
||||
*/
|
||||
@Nullable
|
||||
Scoreboard getScoreboard();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Resets this score, if a value has been set.
|
||||
+ *
|
||||
+ * @throws IllegalStateException if the associated objective has been
|
||||
+ * unregistered
|
||||
+ */
|
||||
+ void resetScore() throws IllegalStateException;
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Riley Park <rileysebastianpark@gmail.com>
|
||||
Date: Wed, 21 Dec 2016 11:47:25 -0600
|
||||
Subject: [PATCH] Add API methods to control if armour stands can move
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ArmorStand.java
|
||||
@@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity {
|
||||
*/
|
||||
ADDING;
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Tests if this armor stand can move.
|
||||
+ *
|
||||
+ * <p>The default value is {@code true}.</p>
|
||||
+ *
|
||||
+ * @return {@code true} if this armour stand can move, {@code false} otherwise
|
||||
+ */
|
||||
+ boolean canMove();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this armor stand can move.
|
||||
+ *
|
||||
+ * @param move {@code true} if this armour stand can move, {@code false} otherwise
|
||||
+ */
|
||||
+ void setCanMove(boolean move);
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Madeline Miller <mnmiller1@me.com>
|
||||
Date: Thu, 31 Dec 2020 12:48:38 +1000
|
||||
Subject: [PATCH] Add API to get Material from Boats and Minecarts
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Boat.java b/src/main/java/org/bukkit/entity/Boat.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Boat.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Boat.java
|
||||
@@ -0,0 +0,0 @@ public interface Boat extends Vehicle {
|
||||
ON_LAND,
|
||||
IN_AIR;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the {@link Material} that represents this Boat type.
|
||||
+ *
|
||||
+ * @return the boat material.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Material getBoatMaterial();
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Minecart.java b/src/main/java/org/bukkit/entity/Minecart.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Minecart.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Minecart.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
import org.bukkit.GameRule;
|
||||
+import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.util.Vector;
|
||||
@@ -0,0 +0,0 @@ public interface Minecart extends Vehicle {
|
||||
* @return the current block offset for this minecart.
|
||||
*/
|
||||
public int getDisplayBlockOffset();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the {@link Material} that represents this Minecart type.
|
||||
+ *
|
||||
+ * @return the minecart material.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Material getMinecartMaterial();
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Madeline 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.event.player;
|
||||
|
||||
+import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@@ -0,0 +0,0 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
* <p>
|
||||
* All vector components are between 0.0 and 1.0 inclusive.
|
||||
*
|
||||
+ * @deprecated misleading, use {@link #getInteractionPoint()}
|
||||
* @return the clicked position. May be null.
|
||||
*/
|
||||
@Nullable
|
||||
+ @Deprecated // Paper
|
||||
public Vector getClickedPosition() {
|
||||
return clickedPosistion;
|
||||
}
|
||||
|
||||
+ // 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() {
|
||||
+ if (this.blockClicked == null || this.clickedPosistion == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ return this.blockClicked.getLocation().add(this.clickedPosistion);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
|
@ -1,31 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TrollyLoki <trollyloki@gmail.com>
|
||||
Date: Wed, 11 Oct 2023 00:45:54 -0400
|
||||
Subject: [PATCH] Add API to get the collision shape of a block before it's
|
||||
placed
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/data/BlockData.java
|
||||
+++ b/src/main/java/org/bukkit/block/data/BlockData.java
|
||||
@@ -0,0 +0,0 @@ public interface BlockData extends Cloneable {
|
||||
*/
|
||||
boolean isFaceSturdy(@NotNull BlockFace face, @NotNull BlockSupport support);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Calculates the collision shape this block data would have at a particular location.
|
||||
+ * <p>
|
||||
+ * This does not take into account any block updates that may occur if the block was to be actually placed in the world.
|
||||
+ *
|
||||
+ * @param location the location to calculate the collision shape at
|
||||
+ *
|
||||
+ * @return a {@link org.bukkit.util.VoxelShape} representing the collision shape of this block data.
|
||||
+ */
|
||||
+ @NotNull org.bukkit.util.VoxelShape getCollisionShape(@NotNull Location location);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the color this block should appear as when rendered on a map.
|
||||
*
|
|
@ -1,62 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Wed, 2 Jan 2019 00:31:12 -0600
|
||||
Subject: [PATCH] Add APIs to replace OfflinePlayer#getLastPlayed
|
||||
|
||||
Currently OfflinePlayer#getLastPlayed could more accurately be described
|
||||
as "OfflinePlayer#getLastTimeTheirDataWasSaved".
|
||||
|
||||
The API doc says it should return the last time the server "witnessed"
|
||||
the player, whilst also saying it should return the last time they
|
||||
logged in. The current implementation does neither.
|
||||
|
||||
Given this interesting contradiction in the API documentation and the
|
||||
current defacto implementation, I've elected to deprecate (with no
|
||||
intent to remove) and replace it with two new methods, clearly named and
|
||||
documented as to their purpose.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* UTC.
|
||||
*
|
||||
* @return Date of last log-in for this player, or 0
|
||||
+ * @deprecated The API contract is ambiguous and the implementation may or may not return the correct value given this API ambiguity. It is instead recommended use {@link #getLastLogin()} or {@link #getLastSeen()} depending on your needs.
|
||||
*/
|
||||
+ @Deprecated
|
||||
public long getLastPlayed();
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
@Nullable
|
||||
@Deprecated(since = "1.20.4")
|
||||
public Location getBedSpawnLocation();
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the last date and time that this player logged into the server.
|
||||
+ * <p>
|
||||
+ * If the player has never played before, this will return 0. Otherwise,
|
||||
+ * it will be the amount of milliseconds since midnight, January 1, 1970
|
||||
+ * UTC.
|
||||
+ *
|
||||
+ * @return last login time
|
||||
+ */
|
||||
+ public long getLastLogin();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the last date and time that this player was seen on the server.
|
||||
+ * <p>
|
||||
+ * If the player has never played before, this will return 0. If the
|
||||
+ * player is currently online, this will return the current time.
|
||||
+ * Otherwise it will be the amount of milliseconds since midnight,
|
||||
+ * January 1, 1970 UTC.
|
||||
+ *
|
||||
+ * @return last seen time
|
||||
+ */
|
||||
+ public long getLastSeen();
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Gets the Location where the player will spawn at, null if they
|
|
@ -1,71 +0,0 @@
|
|||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerAdvancementDoneEvent.java
|
||||
@@ -0,0 +0,0 @@ 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.
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ 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() {
|
|
@ -1,42 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Doc <nachito94@msn.com>
|
||||
Date: Sun, 6 Oct 2024 16:45:20 -0300
|
||||
Subject: [PATCH] Add AnvilView#bypassEnchantmentLevelRestriction
|
||||
|
||||
Anvils, by default, limit applied enchantment levels to their respective
|
||||
maximum level. The added API enables plugins to disable this behaviour,
|
||||
allowing enchantments that are overleveled to be applied via the anvil.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/view/AnvilView.java b/src/main/java/org/bukkit/inventory/view/AnvilView.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/view/AnvilView.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/view/AnvilView.java
|
||||
@@ -0,0 +0,0 @@ public interface AnvilView extends InventoryView {
|
||||
* @param levels the levels to set
|
||||
*/
|
||||
void setMaximumRepairCost(int levels);
|
||||
+
|
||||
+ // Paper start - bypass anvil level restrictions
|
||||
+ /**
|
||||
+ * Returns whether this view will bypass the vanilla enchantment level restriction
|
||||
+ * when applying enchantments to an item or not.
|
||||
+ * <p>
|
||||
+ * By default, vanilla will limit enchantments applied to items to the respective
|
||||
+ * {@link org.bukkit.enchantments.Enchantment#getMaxLevel()}, even if the applied enchantment itself is above said
|
||||
+ * limit.
|
||||
+ * Disabling this limit via {@link AnvilView#bypassEnchantmentLevelRestriction(boolean)} allows for, e.g., enchanted
|
||||
+ * books to be applied fully, even if their enchantments are beyond the limit.
|
||||
+ *
|
||||
+ * @return {@code true} if this view bypasses the vanilla restrictions.
|
||||
+ */
|
||||
+ boolean bypassesEnchantmentLevelRestriction();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if enchantments applied via this anvil view may bypass vanilla's level restrictions.
|
||||
+ *
|
||||
+ * @param bypassEnchantmentLevelRestriction if this view bypasses the vanilla level restrictions.
|
||||
+ * @see AnvilView#bypassesEnchantmentLevelRestriction()
|
||||
+ */
|
||||
+ void bypassEnchantmentLevelRestriction(boolean bypassEnchantmentLevelRestriction);
|
||||
+ // Paper end - bypass anvil level restrictions
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Sat, 27 Jan 2018 17:06:24 -0500
|
||||
Subject: [PATCH] Add ArmorStand Item Meta
|
||||
|
||||
This is adds basic item meta for armor stands. It does not add all
|
||||
possible metadata however.
|
||||
|
||||
There are armor, hand, and equipment types, as well as position data
|
||||
that can also be added here. This initial addition should serve a
|
||||
starting point for future additions in this area.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/inventory/meta/ArmorStandMeta.java b/src/main/java/com/destroystokyo/paper/inventory/meta/ArmorStandMeta.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/inventory/meta/ArmorStandMeta.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.inventory.meta;
|
||||
+
|
||||
+import org.bukkit.inventory.meta.ItemMeta;
|
||||
+
|
||||
+public interface ArmorStandMeta extends ItemMeta {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the ArmorStand should be invisible when spawned
|
||||
+ *
|
||||
+ * @return true if this should be invisible
|
||||
+ */
|
||||
+ boolean isInvisible();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether this ArmorStand should have no base plate when spawned
|
||||
+ *
|
||||
+ * @return true if it will not have a base plate
|
||||
+ */
|
||||
+ boolean hasNoBasePlate();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether this ArmorStand should show arms when spawned
|
||||
+ *
|
||||
+ * @return true if it will show arms
|
||||
+ */
|
||||
+ boolean shouldShowArms();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether this ArmorStand will be small when spawned
|
||||
+ *
|
||||
+ * @return true if it will be small
|
||||
+ */
|
||||
+ boolean isSmall();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether this ArmorStand will be a marker when spawned
|
||||
+ * The exact details of this flag are an implementation detail
|
||||
+ *
|
||||
+ * @return true if it will be a marker
|
||||
+ */
|
||||
+ boolean isMarker();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets that this ArmorStand should be invisible when spawned
|
||||
+ *
|
||||
+ * @param invisible true if set invisible
|
||||
+ */
|
||||
+ void setInvisible(boolean invisible);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets that this ArmorStand should have no base plate when spawned
|
||||
+ *
|
||||
+ * @param noBasePlate true if no base plate
|
||||
+ */
|
||||
+ void setNoBasePlate(boolean noBasePlate);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets that this ArmorStand should show arms when spawned
|
||||
+ *
|
||||
+ * @param showArms true if show arms
|
||||
+ */
|
||||
+ void setShowArms(boolean showArms);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets that this ArmorStand should be small when spawned
|
||||
+ *
|
||||
+ * @param small true if small
|
||||
+ */
|
||||
+ void setSmall(boolean small);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets that this ArmorStand should be a marker when spawned
|
||||
+ * The exact details of this flag are an implementation detail
|
||||
+ *
|
||||
+ * @param marker true if a marker
|
||||
+ */
|
||||
+ void setMarker(boolean marker);
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemType.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
|
||||
@@ -0,0 +0,0 @@ public interface ItemType extends Keyed, Translatable {
|
||||
ItemType.Typed<ItemMeta> RABBIT_STEW = getItemType("rabbit_stew");
|
||||
ItemType.Typed<ItemMeta> RABBIT_FOOT = getItemType("rabbit_foot");
|
||||
ItemType.Typed<ItemMeta> RABBIT_HIDE = getItemType("rabbit_hide");
|
||||
- ItemType.Typed<ItemMeta> ARMOR_STAND = getItemType("armor_stand");
|
||||
+ ItemType.Typed<com.destroystokyo.paper.inventory.meta.ArmorStandMeta> ARMOR_STAND = getItemType("armor_stand");
|
||||
ItemType.Typed<ItemMeta> IRON_HORSE_ARMOR = getItemType("iron_horse_armor");
|
||||
ItemType.Typed<ItemMeta> GOLDEN_HORSE_ARMOR = getItemType("golden_horse_armor");
|
||||
ItemType.Typed<ItemMeta> DIAMOND_HORSE_ARMOR = getItemType("diamond_horse_armor");
|
|
@ -1,278 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 28 Apr 2018 10:28:50 -0400
|
||||
Subject: [PATCH] Add Ban Methods to Player Objects
|
||||
|
||||
Allows a more logical API for banning players.
|
||||
|
||||
player.banPlayer("Breaking the rules");
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
* @return true if banned, otherwise false
|
||||
*/
|
||||
public boolean isBanned();
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Permanently Bans this player from the server
|
||||
+ *
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default BanEntry banPlayer(@Nullable String reason) {
|
||||
+ return banPlayer(reason, null, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Permanently Bans this player from the server
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param source Source of the ban, or null for default
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default BanEntry banPlayer(@Nullable String reason, @Nullable String source) {
|
||||
+ return banPlayer(reason, null, source);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Bans this player from the server
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires) {
|
||||
+ return banPlayer(reason, expires, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Bans this player from the server
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @param source Source of the ban or null for default
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) {
|
||||
+ return banPlayer(reason, expires, source, true);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @deprecated use {@link #ban(String, Date, String)}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source, boolean kickIfOnline) {
|
||||
+ BanEntry banEntry = Bukkit.getServer().getBanList(BanList.Type.NAME).addBan(getName(), reason, expires, source);
|
||||
+ if (kickIfOnline && isOnline()) {
|
||||
+ getPlayer().kickPlayer(reason);
|
||||
+ }
|
||||
+ return banEntry;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
public void sendMap(@NotNull MapView map);
|
||||
|
||||
// Paper start
|
||||
+ /**
|
||||
+ * Permanently Bans the Profile and IP address currently used by the player.
|
||||
+ *
|
||||
+ * @param reason Reason for ban
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ // For reference, Bukkit defines this as nullable, while they impl isn't, we'll follow API.
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason) {
|
||||
+ return banPlayerFull(reason, null, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Permanently Bans the Profile and IP address currently used by the player.
|
||||
+ *
|
||||
+ * @param reason Reason for ban
|
||||
+ * @param source Source of ban, or null for default
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason, @Nullable String source) {
|
||||
+ return banPlayerFull(reason, null, source);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Bans the Profile and IP address currently used by the player.
|
||||
+ *
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason, @Nullable java.util.Date expires) {
|
||||
+ return banPlayerFull(reason, expires, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Bans the Profile and IP address currently used by the player.
|
||||
+ *
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @param source Source of the ban, or null for default
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerFull(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) {
|
||||
+ banPlayer(reason, expires, source);
|
||||
+ return banPlayerIP(reason, expires, source, true);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Permanently Bans the IP address currently used by the player.
|
||||
+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)}
|
||||
+ *
|
||||
+ * @param reason Reason for ban
|
||||
+ * @param kickPlayer Whether or not to kick the player afterwards
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, boolean kickPlayer) {
|
||||
+ return banPlayerIP(reason, null, null, kickPlayer);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Permanently Bans the IP address currently used by the player.
|
||||
+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)}
|
||||
+ * @param reason Reason for ban
|
||||
+ * @param source Source of ban, or null for default
|
||||
+ * @param kickPlayer Whether or not to kick the player afterwards
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable String source, boolean kickPlayer) {
|
||||
+ return banPlayerIP(reason, null, source, kickPlayer);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Bans the IP address currently used by the player.
|
||||
+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)}
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @param kickPlayer Whether or not to kick the player afterwards
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires, boolean kickPlayer) {
|
||||
+ return banPlayerIP(reason, expires, null, kickPlayer);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Permanently Bans the IP address currently used by the player.
|
||||
+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)}
|
||||
+ *
|
||||
+ * @param reason Reason for ban
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason) {
|
||||
+ return banPlayerIP(reason, null, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Permanently Bans the IP address currently used by the player.
|
||||
+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)}
|
||||
+ * @param reason Reason for ban
|
||||
+ * @param source Source of ban, or null for default
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable String source) {
|
||||
+ return banPlayerIP(reason, null, source);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Bans the IP address currently used by the player.
|
||||
+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)}
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires) {
|
||||
+ return banPlayerIP(reason, expires, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Bans the IP address currently used by the player.
|
||||
+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)}
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @param source Source of the ban or null for default
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) {
|
||||
+ return banPlayerIP(reason, expires, source, true);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Bans the IP address currently used by the player.
|
||||
+ * Does not ban the Profile, use {@link #banPlayerFull(String, java.util.Date, String)}
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @param source Source of the ban or null for default
|
||||
+ * @param kickPlayer if the targeted player should be kicked
|
||||
+ * @return Ban Entry
|
||||
+ * @deprecated use {@link #ban(String, Date, String)} and {@link #banIp(String, Date, String, boolean)}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated(since = "1.20.4")
|
||||
+ public default org.bukkit.BanEntry banPlayerIP(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source, boolean kickPlayer) {
|
||||
+ org.bukkit.BanEntry banEntry = org.bukkit.Bukkit.getServer().getBanList(org.bukkit.BanList.Type.IP).addBan(getAddress().getAddress().getHostAddress(), reason, expires, source);
|
||||
+ if (kickPlayer && isOnline()) {
|
||||
+ getPlayer().kickPlayer(reason);
|
||||
+ }
|
||||
+
|
||||
+ return banEntry;
|
||||
+ }
|
||||
|
||||
/**
|
||||
* Sends an Action Bar message to the client.
|
|
@ -1,54 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Riley Park <rileysebastianpark@gmail.com>
|
||||
Date: Tue, 8 Mar 2016 13:05:59 -0800
|
||||
Subject: [PATCH] Add BaseComponent sendMessage methods to CommandSender
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/command/CommandSender.java
|
||||
+++ b/src/main/java/org/bukkit/command/CommandSender.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.command;
|
||||
|
||||
import java.util.UUID;
|
||||
+import net.kyori.adventure.audience.MessageType;
|
||||
+import net.kyori.adventure.identity.Identity;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -0,0 +0,0 @@ public interface CommandSender extends net.kyori.adventure.audience.Audience, Pe
|
||||
default void sendPlainMessage(final @NotNull String message) {
|
||||
this.sendMessage(net.kyori.adventure.text.Component.text(message));
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Sends the component to the sender
|
||||
+ *
|
||||
+ * <p>If this sender does not support sending full components then
|
||||
+ * the component will be sent as legacy text.</p>
|
||||
+ *
|
||||
+ * @param component the component to send
|
||||
+ * @deprecated use {@link #sendMessage(Identity, Component, MessageType)} instead
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ this.sendMessage(component.toLegacyText());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to the sender
|
||||
+ *
|
||||
+ * <p>If this sender does not support sending full components then
|
||||
+ * the components will be sent as legacy text.</p>
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @deprecated use {@link #sendMessage(Identity, Component, MessageType)} instead
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ this.sendMessage(new net.md_5.bungee.api.chat.TextComponent(components).toLegacyText());
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Mon, 29 Feb 2016 18:09:40 -0600
|
||||
Subject: [PATCH] Add BeaconEffectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.potion.PotionEffect;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a beacon effect is being applied to a player.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class BeaconEffectEvent extends BlockEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Player player;
|
||||
+ private final boolean primary;
|
||||
+ private PotionEffect effect;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BeaconEffectEvent(final Block block, final PotionEffect effect, final Player player, final boolean primary) {
|
||||
+ super(block);
|
||||
+ this.effect = effect;
|
||||
+ this.player = player;
|
||||
+ this.primary = primary;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the potion effect being applied.
|
||||
+ *
|
||||
+ * @return Potion effect
|
||||
+ */
|
||||
+ public PotionEffect getEffect() {
|
||||
+ return this.effect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the potion effect that will be applied.
|
||||
+ *
|
||||
+ * @param effect Potion effect
|
||||
+ */
|
||||
+ public void setEffect(final PotionEffect effect) {
|
||||
+ this.effect = effect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player who the potion effect is being applied to.
|
||||
+ *
|
||||
+ * @return Affected player
|
||||
+ */
|
||||
+ public Player getPlayer() {
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the effect is a primary beacon effect.
|
||||
+ *
|
||||
+ * @return {@code true} if this event represents a primary effect
|
||||
+ */
|
||||
+ public boolean isPrimary() {
|
||||
+ return this.primary;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,75 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Wed, 26 May 2021 17:08:57 -0400
|
||||
Subject: [PATCH] Add BellRevealRaiderEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java b/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BellRevealRaiderEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Raider;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a {@link Raider} is revealed by a bell.
|
||||
+ *
|
||||
+ * @deprecated use {@link org.bukkit.event.block.BellResonateEvent}
|
||||
+ */
|
||||
+@Deprecated(since = "1.19.4")
|
||||
+public class BellRevealRaiderEvent extends BlockEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Raider raider;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BellRevealRaiderEvent(@NotNull Block theBlock, @NotNull Raider raider) {
|
||||
+ super(theBlock);
|
||||
+ this.raider = raider;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the raider that the bell revealed.
|
||||
+ *
|
||||
+ * @return The raider
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Raider getEntity() {
|
||||
+ return this.raider;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ * <p>
|
||||
+ * This does not cancel the particle effects shown on the bell, only the entity.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,36 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Eearslya Sleiarion <eearslya@gmail.com>
|
||||
Date: Mon, 24 Jun 2019 21:27:39 -0700
|
||||
Subject: [PATCH] Add BellRingEvent
|
||||
|
||||
Add a new event, BellRingEvent, to trigger whenever a player rings a
|
||||
village bell. Passes along the bell block and the player who rang it.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BellRingEvent.java b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a bell is rung.
|
||||
+ *
|
||||
+ * @deprecated use {@link org.bukkit.event.block.BellRingEvent}
|
||||
+ */
|
||||
+@Deprecated(since = "1.19.4")
|
||||
+public class BellRingEvent extends org.bukkit.event.block.BellRingEvent {
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BellRingEvent(@NotNull Block block, @NotNull BlockFace direction, @Nullable Entity entity) {
|
||||
+ super(block, direction, entity);
|
||||
+ }
|
||||
+}
|
|
@ -1,31 +0,0 @@
|
|||
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
|
||||
|
||||
Deprecated for removal
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Paper start - add isValidTool
|
||||
+ /**
|
||||
+ * 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
|
||||
+ * @deprecated partially replaced by {@link Block#isPreferredTool(ItemStack)}
|
||||
+ */
|
||||
+ @Deprecated(since = "1.21", forRemoval = true) // Paper
|
||||
+ boolean isValidTool(@NotNull ItemStack itemStack);
|
||||
+ // Paper end - add isValidTool
|
||||
+
|
||||
/**
|
||||
* Gets the Location of the block
|
||||
*
|
|
@ -1,69 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 3 Jan 2021 17:58:25 -0800
|
||||
Subject: [PATCH] Add BlockBreakBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockBreakBlockEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockExpEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a block forces another block to break and drop items.
|
||||
+ * <p>
|
||||
+ * Currently called for piston's and liquid flows.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class BlockBreakBlockEvent extends BlockExpEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Block source;
|
||||
+ private final List<ItemStack> drops;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockBreakBlockEvent(final Block block, final Block source, final List<ItemStack> drops) {
|
||||
+ super(block, 0);
|
||||
+ this.source = source;
|
||||
+ this.drops = drops;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets a mutable list of drops for this event
|
||||
+ *
|
||||
+ * @return the drops
|
||||
+ */
|
||||
+ public List<ItemStack> getDrops() {
|
||||
+ return this.drops;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block that cause this (e.g. a piston, or adjacent liquid)
|
||||
+ *
|
||||
+ * @return the source
|
||||
+ */
|
||||
+ public Block getSource() {
|
||||
+ return this.source;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,69 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Badbird5907 <50347938+Badbird5907@users.noreply.github.com>
|
||||
Date: Mon, 4 Mar 2024 22:18:33 -0500
|
||||
Subject: [PATCH] Add BlockBreakProgressUpdateEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java b/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockBreakProgressUpdateEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the progress of a block break is updated.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class BlockBreakProgressUpdateEvent extends BlockEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final float progress;
|
||||
+ private final Entity entity;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockBreakProgressUpdateEvent(final Block block, final float progress, final Entity entity) {
|
||||
+ super(block);
|
||||
+ this.progress = progress;
|
||||
+ this.entity = entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The progress of the block break
|
||||
+ * <p>
|
||||
+ * The progress ranges from 0.0 - 1.0, where 0 is no damage and
|
||||
+ * 1.0 is the most damaged
|
||||
+ *
|
||||
+ * @return The progress of the block break
|
||||
+ */
|
||||
+ public float getProgress() {
|
||||
+ return this.progress;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The entity breaking the block.
|
||||
+ *
|
||||
+ * @return The entity breaking the block
|
||||
+ */
|
||||
+ public Entity getEntity() {
|
||||
+ return this.entity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,69 +0,0 @@
|
|||
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..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a block tries to dispense an item, but its inventory is empty.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class BlockFailedDispenseEvent extends BlockEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean shouldPlayEffect = true;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockFailedDispenseEvent(final 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(final boolean playEffect) {
|
||||
+ this.shouldPlayEffect = playEffect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return {@link #shouldPlayEffect()}
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean callEvent() {
|
||||
+ super.callEvent();
|
||||
+ return this.shouldPlayEffect();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,242 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 21 May 2022 20:59:56 -0700
|
||||
Subject: [PATCH] Add BlockLockCheckEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/block/LockableTileState.java b/src/main/java/io/papermc/paper/block/LockableTileState.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/block/LockableTileState.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.block;
|
||||
+
|
||||
+import org.bukkit.Nameable;
|
||||
+import org.bukkit.block.Lockable;
|
||||
+import org.bukkit.block.TileState;
|
||||
+
|
||||
+/**
|
||||
+ * Interface for tile entities that are lockable.
|
||||
+ */
|
||||
+public interface LockableTileState extends TileState, Lockable, Nameable {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import io.papermc.paper.block.LockableTileState;
|
||||
+import java.util.Objects;
|
||||
+import net.kyori.adventure.sound.Sound;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the server tries to check the lock on a lockable block entity.
|
||||
+ * <br>
|
||||
+ * See {@link #setResult(Result)} to change behavior
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class BlockLockCheckEvent extends BlockEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Player player;
|
||||
+ private @Nullable Component lockedMessage;
|
||||
+ private @Nullable Sound lockedSound;
|
||||
+ private @Nullable ItemStack itemStack;
|
||||
+ private Result result = Result.DEFAULT;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockLockCheckEvent(final Block block, final Player player, final Component lockedMessage, final Sound lockedSound) {
|
||||
+ super(block);
|
||||
+ this.player = player;
|
||||
+ this.lockedMessage = lockedMessage;
|
||||
+ this.lockedSound = lockedSound;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the snapshot {@link LockableTileState} of the block entity
|
||||
+ * whose lock is being checked.
|
||||
+ *
|
||||
+ * @return the snapshot block state.
|
||||
+ */
|
||||
+ public LockableTileState getBlockState() {
|
||||
+ final BlockState blockState = this.getBlock().getState();
|
||||
+ Preconditions.checkState(blockState instanceof LockableTileState, "Block state of lock-checked block is no longer a lockable tile state!");
|
||||
+ return (LockableTileState) blockState;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the player involved this lock check.
|
||||
+ *
|
||||
+ * @return the player
|
||||
+ */
|
||||
+ public Player getPlayer() {
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the itemstack that will be used as the key itemstack. Initially
|
||||
+ * this will be the item in the player's main hand but an override can be set
|
||||
+ * with {@link #setKeyItem(ItemStack)}. Use {@link #isUsingCustomKeyItemStack()}
|
||||
+ * to check if a custom key stack has been set.
|
||||
+ *
|
||||
+ * @return the item being used as the key item
|
||||
+ * @see #isUsingCustomKeyItemStack()
|
||||
+ */
|
||||
+ public ItemStack getKeyItem() {
|
||||
+ return Objects.requireNonNullElseGet(this.itemStack, this.player.getInventory()::getItemInMainHand);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the itemstack that will be used as the key item.
|
||||
+ *
|
||||
+ * @param stack the stack to use as a key
|
||||
+ * @see #resetKeyItem() to clear a custom key item
|
||||
+ */
|
||||
+ public void setKeyItem(final ItemStack stack) {
|
||||
+ Preconditions.checkArgument(stack != null, "stack cannot be null");
|
||||
+ this.itemStack = stack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Reset the key stack to the default (the player's main hand).
|
||||
+ */
|
||||
+ public void resetKeyItem() {
|
||||
+ this.itemStack = null;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if a custom key stack has been set.
|
||||
+ *
|
||||
+ * @return {@code true} if a custom key itemstack has been set
|
||||
+ */
|
||||
+ public boolean isUsingCustomKeyItemStack() {
|
||||
+ return this.itemStack != null;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the result of this event.
|
||||
+ *
|
||||
+ * @return the result
|
||||
+ * @see #setResult(Result)
|
||||
+ */
|
||||
+ public Result getResult() {
|
||||
+ return this.result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the result of this event. {@link Result#DEFAULT} is the default
|
||||
+ * allowing the vanilla logic to check the lock of this block. Set to {@link Result#ALLOW}
|
||||
+ * or {@link Result#DENY} to override that behavior.
|
||||
+ * <p>
|
||||
+ * Setting this to {@link Result#ALLOW} bypasses the spectator check.
|
||||
+ *
|
||||
+ * @param result the result of this event
|
||||
+ */
|
||||
+ public void setResult(final Result result) {
|
||||
+ this.result = result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Shorthand method to set the {@link #getResult()} to {@link Result#DENY},
|
||||
+ * the locked message and locked sound.
|
||||
+ *
|
||||
+ * @param lockedMessage the message to show if locked (or {@code null} for none)
|
||||
+ * @param lockedSound the sound to play if locked (or {@code null} for none)
|
||||
+ */
|
||||
+ public void denyWithMessageAndSound(final @Nullable Component lockedMessage, final @Nullable Sound lockedSound) {
|
||||
+ this.result = Result.DENY;
|
||||
+ this.lockedMessage = lockedMessage;
|
||||
+ this.lockedSound = lockedSound;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the locked message that will be sent if the
|
||||
+ * player cannot open the block.
|
||||
+ *
|
||||
+ * @return the locked message (or {@code null} if none)
|
||||
+ */
|
||||
+ public @Nullable Component getLockedMessage() {
|
||||
+ return this.lockedMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the locked message that will be sent if the
|
||||
+ * player cannot open the block.
|
||||
+ *
|
||||
+ * @param lockedMessage the locked message (or {@code null} for none)
|
||||
+ */
|
||||
+ public void setLockedMessage(final @Nullable Component lockedMessage) {
|
||||
+ this.lockedMessage = lockedMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the locked sound that will play if the
|
||||
+ * player cannot open the block.
|
||||
+ *
|
||||
+ * @return the locked sound (or {@code null} if none)
|
||||
+ */
|
||||
+ public @Nullable Sound getLockedSound() {
|
||||
+ return this.lockedSound;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the locked sound that will play if the
|
||||
+ * player cannot open the block.
|
||||
+ *
|
||||
+ * @param lockedSound the locked sound (or {@code null} for none)
|
||||
+ */
|
||||
+ public void setLockedSound(final @Nullable Sound lockedSound) {
|
||||
+ this.lockedSound = lockedSound;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/block/Beacon.java b/src/main/java/org/bukkit/block/Beacon.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/Beacon.java
|
||||
+++ b/src/main/java/org/bukkit/block/Beacon.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a beacon.
|
||||
*/
|
||||
-public interface Beacon extends TileState, Lockable, Nameable {
|
||||
+public interface Beacon extends io.papermc.paper.block.LockableTileState { // Paper
|
||||
|
||||
/**
|
||||
* Returns the list of players within the beacon's range of effect.
|
||||
diff --git a/src/main/java/org/bukkit/block/Container.java b/src/main/java/org/bukkit/block/Container.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/Container.java
|
||||
+++ b/src/main/java/org/bukkit/block/Container.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a captured state of a container block.
|
||||
*/
|
||||
-public interface Container extends TileState, BlockInventoryHolder, Lockable, Nameable {
|
||||
+public interface Container extends io.papermc.paper.block.LockableTileState, BlockInventoryHolder { // Paper
|
||||
|
||||
/**
|
||||
* Gets the inventory of the block represented by this block state.
|
|
@ -1,76 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Madeline 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..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@NullMarked
|
||||
+public class BlockPreDispenseEvent extends BlockEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final ItemStack itemStack;
|
||||
+ private final int slot;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BlockPreDispenseEvent(final Block block, final ItemStack itemStack, final int slot) {
|
||||
+ super(block);
|
||||
+ this.itemStack = itemStack;
|
||||
+ this.slot = slot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link ItemStack} to be dispensed.
|
||||
+ *
|
||||
+ * @return The item to be dispensed
|
||||
+ */
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return this.itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the inventory slot of the dispenser to dispense from.
|
||||
+ *
|
||||
+ * @return The inventory slot
|
||||
+ */
|
||||
+ public int getSlot() {
|
||||
+ return this.slot;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,107 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: simpleauthority <jacob@algorithmjunkie.com>
|
||||
Date: Tue, 28 May 2019 03:41:28 -0700
|
||||
Subject: [PATCH] Add BlockSoundGroup interface
|
||||
|
||||
This PR adds the getSoundGroup() method in Block which returns a BlockSoundGroup
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/block/BlockSoundGroup.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.block;
|
||||
+
|
||||
+import org.bukkit.Sound;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Represents the sounds that a {@link Block} makes in certain situations
|
||||
+ * <p>
|
||||
+ * The sound group includes break, step, place, hit, and fall sounds.
|
||||
+ * @deprecated use {@link org.bukkit.SoundGroup}
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true, since = "1.18.2")
|
||||
+public interface BlockSoundGroup {
|
||||
+ /**
|
||||
+ * Gets the sound that plays when breaking this block
|
||||
+ *
|
||||
+ * @return The break sound
|
||||
+ * @deprecated use {@link org.bukkit.SoundGroup#getBreakSound()}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(forRemoval = true, since = "1.18.2")
|
||||
+ Sound getBreakSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when stepping on this block
|
||||
+ *
|
||||
+ * @return The step sound
|
||||
+ * @deprecated use {@link org.bukkit.SoundGroup#getStepSound()}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(forRemoval = true, since = "1.18.2")
|
||||
+ Sound getStepSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when placing this block
|
||||
+ *
|
||||
+ * @return The place sound
|
||||
+ * @deprecated use {@link org.bukkit.SoundGroup#getPlaceSound()}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(forRemoval = true, since = "1.18.2")
|
||||
+ Sound getPlaceSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when hitting this block
|
||||
+ *
|
||||
+ * @return The hit sound
|
||||
+ * @deprecated use {@link org.bukkit.SoundGroup#getHitSound()}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(forRemoval = true, since = "1.18.2")
|
||||
+ Sound getHitSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when this block falls
|
||||
+ *
|
||||
+ * @return The fall sound
|
||||
+ * @deprecated use {@link org.bukkit.SoundGroup#getFallSound()}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(forRemoval = true, since = "1.18.2")
|
||||
+ Sound getFallSound();
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable {
|
||||
* @return <code>true</code> if the block data can be placed here
|
||||
*/
|
||||
boolean canPlace(@NotNull BlockData data);
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the {@link com.destroystokyo.paper.block.BlockSoundGroup} for this block.
|
||||
+ * <p>
|
||||
+ * This object contains the block, step, place, hit, and fall sounds.
|
||||
+ *
|
||||
+ * @return the sound group for this block
|
||||
+ * @deprecated use {@link #getBlockSoundGroup()}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated(forRemoval = true, since = "1.18.2")
|
||||
+ com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link org.bukkit.SoundGroup} for this block.
|
||||
+ *
|
||||
+ * @return the sound group for this block
|
||||
+ */
|
||||
+ @NotNull org.bukkit.SoundGroup getBlockSoundGroup();
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 11 Jan 2024 12:41:54 -0800
|
||||
Subject: [PATCH] Add BlockStateMeta#clearBlockState
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java b/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/BlockStateMeta.java
|
||||
@@ -0,0 +0,0 @@ public interface BlockStateMeta extends ItemMeta {
|
||||
*/
|
||||
boolean hasBlockState();
|
||||
|
||||
+ // Paper start - add method to clear block state
|
||||
+ /**
|
||||
+ * Clears the block state currently attached to this item.
|
||||
+ */
|
||||
+ void clearBlockState();
|
||||
+ // Paper end - add method to clear block state
|
||||
+
|
||||
/**
|
||||
* Returns the currently attached block state for this
|
||||
* item or creates a new one if one doesn't exist.
|
|
@ -1,45 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Janet Blackquill <uhhadd@gmail.com>
|
||||
Date: Sun, 7 Apr 2024 16:51:04 -0400
|
||||
Subject: [PATCH] Add CartographyItemEvent
|
||||
|
||||
Similar to SmithItemEvent, but for cartography tables.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/CartographyItemEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.event.inventory.ClickType;
|
||||
+import org.bukkit.event.inventory.InventoryAction;
|
||||
+import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
+import org.bukkit.event.inventory.InventoryType;
|
||||
+import org.bukkit.inventory.CartographyInventory;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the recipe of an Item is completed inside a cartography table.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class CartographyItemEvent extends InventoryClickEvent {
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public CartographyItemEvent(final InventoryView view, final InventoryType.SlotType type, final int slot, final ClickType click, final InventoryAction action) {
|
||||
+ super(view, type, slot, click, action);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public CartographyItemEvent(final InventoryView view, final InventoryType.SlotType type, final int slot, final ClickType click, final InventoryAction action, final int key) {
|
||||
+ super(view, type, slot, click, action, key);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public CartographyInventory getInventory() {
|
||||
+ return (CartographyInventory) super.getInventory();
|
||||
+ }
|
||||
+}
|
|
@ -1,129 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Noah van der Aa <ndvdaa@gmail.com>
|
||||
Date: Sat, 7 Aug 2021 15:11:27 +0200
|
||||
Subject: [PATCH] Add CompostItemEvent and EntityCompostItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java b/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/CompostItemEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item is about to be composted by a hopper.
|
||||
+ * To prevent hoppers from moving items into composters, cancel the {@link InventoryMoveItemEvent}.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class CompostItemEvent extends BlockEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final ItemStack item;
|
||||
+ private boolean willRaiseLevel;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public CompostItemEvent(final Block composter, final ItemStack item, final boolean willRaiseLevel) {
|
||||
+ super(composter);
|
||||
+ this.item = item;
|
||||
+ this.willRaiseLevel = willRaiseLevel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the item that was used on the composter.
|
||||
+ *
|
||||
+ * @return the item
|
||||
+ */
|
||||
+ public ItemStack getItem() {
|
||||
+ return this.item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the composter will rise a level.
|
||||
+ *
|
||||
+ * @return {@code true} if successful
|
||||
+ */
|
||||
+ public boolean willRaiseLevel() {
|
||||
+ return this.willRaiseLevel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the composter will rise a level.
|
||||
+ *
|
||||
+ * @param willRaiseLevel {@code true} if the composter should rise a level
|
||||
+ */
|
||||
+ public void setWillRaiseLevel(final boolean willRaiseLevel) {
|
||||
+ this.willRaiseLevel = willRaiseLevel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityCompostItemEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import io.papermc.paper.event.block.CompostItemEvent;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item is about to be composted by an entity.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityCompostItemEvent extends CompostItemEvent implements Cancellable {
|
||||
+
|
||||
+ private final Entity entity;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityCompostItemEvent(final Entity entity, final Block composter, final ItemStack item, final boolean willRaiseLevel) {
|
||||
+ super(composter, item, willRaiseLevel);
|
||||
+ this.entity = entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity that interacted with the composter.
|
||||
+ *
|
||||
+ * @return the entity that composted an item.
|
||||
+ */
|
||||
+ public Entity getEntity() {
|
||||
+ return this.entity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+}
|
|
@ -1,81 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ineusia <ineusia@yahoo.com>
|
||||
Date: Mon, 26 Oct 2020 11:37:48 -0500
|
||||
Subject: [PATCH] Add Destroy Speed API
|
||||
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -0,0 +0,0 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
||||
@Deprecated(forRemoval = true)
|
||||
String getTranslationKey();
|
||||
// Paper end
|
||||
+
|
||||
+ // Paper start - destroy speed API
|
||||
+ /**
|
||||
+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack}
|
||||
+ * <p>
|
||||
+ * Default value is 1.0
|
||||
+ *
|
||||
+ * @param itemStack {@link ItemStack} used to mine this Block
|
||||
+ * @return the speed that this Block will be mined by the given {@link ItemStack}
|
||||
+ */
|
||||
+ default float getDestroySpeed(final @NotNull ItemStack itemStack) {
|
||||
+ return this.getBlockData().getDestroySpeed(itemStack);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack}
|
||||
+ * <p>
|
||||
+ * Default value is 1.0
|
||||
+ *
|
||||
+ * @param itemStack {@link ItemStack} used to mine this Block
|
||||
+ * @param considerEnchants true to look at enchants on the itemstack
|
||||
+ * @return the speed that this Block will be mined by the given {@link ItemStack}
|
||||
+ */
|
||||
+ default float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants) {
|
||||
+ return this.getBlockData().getDestroySpeed(itemStack, considerEnchants);
|
||||
+ }
|
||||
+ // Paper end - destroy speed API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/data/BlockData.java
|
||||
+++ b/src/main/java/org/bukkit/block/data/BlockData.java
|
||||
@@ -0,0 +0,0 @@ public interface BlockData extends Cloneable {
|
||||
@NotNull
|
||||
@ApiStatus.Experimental
|
||||
BlockState createBlockState();
|
||||
+
|
||||
+ // Paper start - destroy speed API
|
||||
+ /**
|
||||
+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack}
|
||||
+ * <p>
|
||||
+ * Default value is 1.0
|
||||
+ *
|
||||
+ * @param itemStack {@link ItemStack} used to mine this Block
|
||||
+ * @return the speed that this Block will be mined by the given {@link ItemStack}
|
||||
+ * @apiNote this method assumes default player state and hence, e.g., does not take into account changed
|
||||
+ * player attributes or potion effects.
|
||||
+ */
|
||||
+ default float getDestroySpeed(final @NotNull ItemStack itemStack) {
|
||||
+ return this.getDestroySpeed(itemStack, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack}
|
||||
+ * <p>
|
||||
+ * Default value is 1.0
|
||||
+ *
|
||||
+ * @param itemStack {@link ItemStack} used to mine this Block
|
||||
+ * @param considerEnchants true to look at enchants on the itemstack
|
||||
+ * @return the speed that this Block will be mined by the given {@link ItemStack}
|
||||
+ * @apiNote this method assumes default player state and hence, e.g., does not take into account changed
|
||||
+ * player attributes or potion effects.
|
||||
+ */
|
||||
+ float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants);
|
||||
+ // Paper end - destroy speed API
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Fri, 19 Mar 2021 23:39:21 -0400
|
||||
Subject: [PATCH] Add ElderGuardianAppearanceEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java b/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/ElderGuardianAppearanceEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.ElderGuardian;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Is called when an {@link ElderGuardian} appears in front of a {@link Player}.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class ElderGuardianAppearanceEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Player affectedPlayer;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ElderGuardianAppearanceEvent(final ElderGuardian guardian, final Player affectedPlayer) {
|
||||
+ super(guardian);
|
||||
+ this.affectedPlayer = affectedPlayer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the player affected by the guardian appearance.
|
||||
+ *
|
||||
+ * @return Player affected by the appearance
|
||||
+ */
|
||||
+ public Player getAffectedPlayer() {
|
||||
+ return this.affectedPlayer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The elder guardian playing the effect.
|
||||
+ *
|
||||
+ * @return The elder guardian
|
||||
+ */
|
||||
+ @Override
|
||||
+ public ElderGuardian getEntity() {
|
||||
+ return (ElderGuardian) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,81 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TheTuso <piotrekpasztor@gmail.com>
|
||||
Date: Thu, 2 Feb 2023 16:40:11 +0100
|
||||
Subject: [PATCH] Add Entity Body Yaw API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
* @return true if in powdered snow.
|
||||
*/
|
||||
boolean isInPowderedSnow();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the x-coordinate of this entity
|
||||
+ *
|
||||
+ * @return x-coordinate
|
||||
+ */
|
||||
+ double getX();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the y-coordinate of this entity
|
||||
+ *
|
||||
+ * @return y-coordinate
|
||||
+ */
|
||||
+ double getY();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the z-coordinate of this entity
|
||||
+ *
|
||||
+ * @return z-coordinate
|
||||
+ */
|
||||
+ double getZ();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets this entity's pitch
|
||||
+ *
|
||||
+ * @see Location#getPitch()
|
||||
+ * @return the entity's pitch
|
||||
+ */
|
||||
+ float getPitch();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets this entity's yaw
|
||||
+ *
|
||||
+ * @see Location#getYaw()
|
||||
+ * @return the entity's yaw
|
||||
+ */
|
||||
+ float getYaw();
|
||||
// Paper end
|
||||
|
||||
// Paper start - Collision API
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount);
|
||||
// Paper end - ItemStack damage API
|
||||
+
|
||||
+ // Paper start - body yaw API
|
||||
+ /**
|
||||
+ * Gets entity body yaw
|
||||
+ *
|
||||
+ * @return entity body yaw
|
||||
+ * @see Location#getYaw()
|
||||
+ */
|
||||
+ float getBodyYaw();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets entity body yaw
|
||||
+ *
|
||||
+ * @param bodyYaw new entity body yaw
|
||||
+ * @see Location#setYaw(float)
|
||||
+ */
|
||||
+ void setBodyYaw(float bodyYaw);
|
||||
+ // Paper end - body yaw API
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/EntityBlockStorage.java
|
||||
+++ b/src/main/java/org/bukkit/block/EntityBlockStorage.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
|
@ -1,270 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 18 Mar 2022 21:16:38 -0700
|
||||
Subject: [PATCH] Add EntityDyeEvent and CollarColorable interface
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/entity/CollarColorable.java b/src/main/java/io/papermc/paper/entity/CollarColorable.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/entity/CollarColorable.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.entity;
|
||||
+
|
||||
+import org.bukkit.DyeColor;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Entities that can have their collars colored.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public interface CollarColorable extends LivingEntity {
|
||||
+
|
||||
+ /**
|
||||
+ * Get the collar color of this entity
|
||||
+ *
|
||||
+ * @return the color of the collar
|
||||
+ */
|
||||
+ DyeColor getCollarColor();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the collar color of this entity
|
||||
+ *
|
||||
+ * @param color the color to apply
|
||||
+ */
|
||||
+ void setCollarColor(DyeColor color);
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityDyeEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.DyeColor;
|
||||
+import org.bukkit.entity.Cat;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.entity.Sheep;
|
||||
+import org.bukkit.entity.Wolf;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity is dyed. Currently, this is called for {@link Sheep}
|
||||
+ * being dyed, and {@link Wolf}/{@link Cat} collars being dyed.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityDyeEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final @Nullable Player player;
|
||||
+ private DyeColor dyeColor;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityDyeEvent(final Entity entity, final DyeColor dyeColor, final @Nullable Player player) {
|
||||
+ super(entity);
|
||||
+ this.dyeColor = dyeColor;
|
||||
+ this.player = player;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the DyeColor the entity is being dyed
|
||||
+ *
|
||||
+ * @return the DyeColor the entity is being dyed
|
||||
+ */
|
||||
+ public DyeColor getColor() {
|
||||
+ return this.dyeColor;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the DyeColor the entity is being dyed
|
||||
+ *
|
||||
+ * @param dyeColor the DyeColor the entity will be dyed
|
||||
+ */
|
||||
+ public void setColor(final DyeColor dyeColor) {
|
||||
+ this.dyeColor = dyeColor;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the player dyeing the entity, if available.
|
||||
+ *
|
||||
+ * @return player or {@code null}
|
||||
+ */
|
||||
+ public @Nullable Player getPlayer() {
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final 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/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Cat.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Cat.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Meow.
|
||||
*/
|
||||
-public interface Cat extends Tameable, Sittable {
|
||||
+public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable
|
||||
|
||||
/**
|
||||
* Gets the current type of this cat.
|
||||
@@ -0,0 +0,0 @@ public interface Cat extends Tameable, Sittable {
|
||||
* @return the color of the collar
|
||||
*/
|
||||
@NotNull
|
||||
+ @Override // Paper
|
||||
public DyeColor getCollarColor();
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public interface Cat extends Tameable, Sittable {
|
||||
*
|
||||
* @param color the color to apply
|
||||
*/
|
||||
+ @Override // Paper
|
||||
public void setCollarColor(@NotNull DyeColor color);
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/entity/Wolf.java b/src/main/java/org/bukkit/entity/Wolf.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Wolf.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Wolf.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a Wolf
|
||||
*/
|
||||
-public interface Wolf extends Tameable, Sittable {
|
||||
+public interface Wolf extends Tameable, Sittable, io.papermc.paper.entity.CollarColorable { // Paper - CollarColorable
|
||||
|
||||
/**
|
||||
* Checks if this wolf is angry
|
||||
@@ -0,0 +0,0 @@ public interface Wolf extends Tameable, Sittable {
|
||||
* @return the color of the collar
|
||||
*/
|
||||
@NotNull
|
||||
+ @Override // Paper
|
||||
public DyeColor getCollarColor();
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public interface Wolf extends Tameable, Sittable {
|
||||
*
|
||||
* @param color the color to apply
|
||||
*/
|
||||
+ @Override // Paper
|
||||
public void setCollarColor(@NotNull DyeColor color);
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java b/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/SheepDyeWoolEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Called when a sheep's wool is dyed
|
||||
*/
|
||||
-public class SheepDyeWoolEvent extends EntityEvent implements Cancellable {
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
- private boolean cancel;
|
||||
- private DyeColor color;
|
||||
- private final Player player;
|
||||
+public class SheepDyeWoolEvent extends io.papermc.paper.event.entity.EntityDyeEvent implements Cancellable {
|
||||
+ // Paper - move everything to superclass
|
||||
|
||||
@Deprecated(since = "1.17.1")
|
||||
public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color) {
|
||||
@@ -0,0 +0,0 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable {
|
||||
}
|
||||
|
||||
public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color, @Nullable Player player) {
|
||||
- super(sheep);
|
||||
- this.cancel = false;
|
||||
- this.color = color;
|
||||
- this.player = player;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public boolean isCancelled() {
|
||||
- return cancel;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void setCancelled(boolean cancel) {
|
||||
- this.cancel = cancel;
|
||||
+ super(sheep, color, player); // Paper
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -0,0 +0,0 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable {
|
||||
public Sheep getEntity() {
|
||||
return (Sheep) entity;
|
||||
}
|
||||
-
|
||||
- /**
|
||||
- * Returns the player dyeing the sheep, if available.
|
||||
- *
|
||||
- * @return player or null
|
||||
- */
|
||||
- @Nullable
|
||||
- public Player getPlayer() {
|
||||
- return player;
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Gets the DyeColor the sheep is being dyed
|
||||
- *
|
||||
- * @return the DyeColor the sheep is being dyed
|
||||
- */
|
||||
- @NotNull
|
||||
- public DyeColor getColor() {
|
||||
- return color;
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Sets the DyeColor the sheep is being dyed
|
||||
- *
|
||||
- * @param color the DyeColor the sheep will be dyed
|
||||
- */
|
||||
- public void setColor(@NotNull DyeColor color) {
|
||||
- this.color = color;
|
||||
- }
|
||||
-
|
||||
- @NotNull
|
||||
- @Override
|
||||
- public HandlerList getHandlers() {
|
||||
- return handlers;
|
||||
- }
|
||||
-
|
||||
- @NotNull
|
||||
- public static HandlerList getHandlerList() {
|
||||
- return handlers;
|
||||
- }
|
||||
-
|
||||
}
|
|
@ -1,145 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
|
||||
Date: Fri, 24 Jun 2022 11:56:32 +0200
|
||||
Subject: [PATCH] Add EntityFertilizeEggEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityBreedEvent;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when two entities mate and the mating process results in a fertilization.
|
||||
+ * Fertilization differs from normal breeding, as represented by the {@link EntityBreedEvent}, as
|
||||
+ * it does not result in the immediate creation of the child entity in the world.
|
||||
+ * <p>
|
||||
+ * An example of this would be:
|
||||
+ * <ul>
|
||||
+ * <li>A frog being marked as "is_pregnant" and laying {@link Material#FROGSPAWN} later.</li>
|
||||
+ * <li>Sniffers producing the {@link Material#SNIFFER_EGG} item, which needs to be placed before it can begin to hatch.</li>
|
||||
+ * <li>A turtle being marked with "HasEgg" and laying a {@link Material#TURTLE_EGG} later.</li>
|
||||
+ * </ul>
|
||||
+ * <p>
|
||||
+ * The event hence only exposes the two parent entities in the fertilization process and cannot provide the child entity, as it will only exist at a later point in time.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityFertilizeEggEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final LivingEntity mother;
|
||||
+ private final LivingEntity father;
|
||||
+ private final @Nullable Player breeder;
|
||||
+ private final @Nullable ItemStack bredWith;
|
||||
+ private int experience;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityFertilizeEggEvent(final LivingEntity mother, final LivingEntity father, final @Nullable Player breeder, final @Nullable ItemStack bredWith, final int experience) {
|
||||
+ super(mother);
|
||||
+ this.mother = mother;
|
||||
+ this.father = father;
|
||||
+ this.breeder = breeder;
|
||||
+ this.bredWith = bredWith;
|
||||
+ this.experience = experience;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the entity in the fertilization process that will eventually be responsible for "creating" offspring,
|
||||
+ * may that be by setting a block that later hatches or dropping an egg that has to be placed.
|
||||
+ *
|
||||
+ * @return The "mother" entity.
|
||||
+ */
|
||||
+ public LivingEntity getMother() {
|
||||
+ return this.mother;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the "father" entity in the fertilization process that is not responsible for initiating the offspring
|
||||
+ * creation.
|
||||
+ *
|
||||
+ * @return the other parent
|
||||
+ */
|
||||
+ public LivingEntity getFather() {
|
||||
+ return this.father;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the Entity responsible for fertilization. Breeder is {@code null} for spontaneous
|
||||
+ * conception.
|
||||
+ *
|
||||
+ * @return The Entity who initiated fertilization.
|
||||
+ */
|
||||
+ public @Nullable Player getBreeder() {
|
||||
+ return this.breeder;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The ItemStack that was used to initiate fertilization, if present.
|
||||
+ *
|
||||
+ * @return ItemStack used to initiate fertilization.
|
||||
+ */
|
||||
+ public @Nullable ItemStack getBredWith() {
|
||||
+ return this.bredWith;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the amount of experience granted by fertilization.
|
||||
+ *
|
||||
+ * @return experience amount
|
||||
+ */
|
||||
+ public int getExperience() {
|
||||
+ return this.experience;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set the amount of experience granted by fertilization.
|
||||
+ * If the amount is negative or zero, no experience will be dropped.
|
||||
+ *
|
||||
+ * @param experience experience amount
|
||||
+ */
|
||||
+ public void setExperience(final int experience) {
|
||||
+ this.experience = experience;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,98 +0,0 @@
|
|||
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..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityInsideBlockEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * 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>Big dripleaf</li>
|
||||
+ * <li>Bubble column</li>
|
||||
+ * <li>Buttons</li>
|
||||
+ * <li>Cactus</li>
|
||||
+ * <li>Campfire</li>
|
||||
+ * <li>Cauldron</li>
|
||||
+ * <li>Crops</li>
|
||||
+ * <li>End Gateway</li>
|
||||
+ * <li>Ender Portal</li>
|
||||
+ * <li>Eye blossom</li>
|
||||
+ * <li>Fires</li>
|
||||
+ * <li>Frogspawn</li>
|
||||
+ * <li>Honey</li>
|
||||
+ * <li>Hopper</li>
|
||||
+ * <li>Detector rails</li>
|
||||
+ * <li>Nether portals</li>
|
||||
+ * <li>Pitcher crop</li>
|
||||
+ * <li>Powdered snow</li>
|
||||
+ * <li>Pressure plates</li>
|
||||
+ * <li>Sweet berry bush</li>
|
||||
+ * <li>Tripwire</li>
|
||||
+ * <li>Waterlily</li>
|
||||
+ * <li>Web</li>
|
||||
+ * <li>Wither rose</li>
|
||||
+ * </ul>
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityInsideBlockEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Block block;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityInsideBlockEvent(final Entity entity, final Block block) {
|
||||
+ super(entity);
|
||||
+ this.block = block;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block.
|
||||
+ *
|
||||
+ * @return the block
|
||||
+ */
|
||||
+ public Block getBlock() {
|
||||
+ return this.block;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,104 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Roy <10731363+JRoy@users.noreply.github.com>
|
||||
Date: Wed, 7 Oct 2020 12:04:17 -0400
|
||||
Subject: [PATCH] Add EntityLoadCrossbowEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityLoadCrossbowEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a LivingEntity loads a crossbow with a projectile.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityLoadCrossbowEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final ItemStack crossbow;
|
||||
+ private final EquipmentSlot hand;
|
||||
+
|
||||
+ private boolean consumeItem = true;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityLoadCrossbowEvent(final LivingEntity entity, final ItemStack crossbow, final EquipmentSlot hand) {
|
||||
+ super(entity);
|
||||
+ this.crossbow = crossbow;
|
||||
+ this.hand = hand;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the crossbow {@link ItemStack} being loaded.
|
||||
+ *
|
||||
+ * @return the crossbow involved in this event
|
||||
+ */
|
||||
+ public ItemStack getCrossbow() {
|
||||
+ return this.crossbow;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the hand from which the crossbow was loaded.
|
||||
+ *
|
||||
+ * @return the hand
|
||||
+ */
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return this.hand;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return should the itemstack be consumed
|
||||
+ */
|
||||
+ public boolean shouldConsumeItem() {
|
||||
+ return this.consumeItem;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param consume should the item be consumed
|
||||
+ */
|
||||
+ public void setConsumeItem(final boolean consume) {
|
||||
+ this.consumeItem = consume;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether to cancel the crossbow being loaded. If canceled, the
|
||||
+ * projectile that would be loaded into the crossbow will not be consumed.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,107 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 12 May 2021 04:30:53 -0700
|
||||
Subject: [PATCH] Add EntityPortalReadyEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/EntityPortalReadyEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.PortalType;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.bukkit.event.entity.EntityPortalEvent;
|
||||
+import org.bukkit.event.player.PlayerPortalEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an entity is ready to be teleported by a plugin.
|
||||
+ * Currently, this is only called after the required
|
||||
+ * ticks have passed for a Nether Portal.
|
||||
+ * <p>
|
||||
+ * Cancelling this event resets the entity's readiness
|
||||
+ * regarding the current portal.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityPortalReadyEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final PortalType portalType;
|
||||
+ private @Nullable World targetWorld;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityPortalReadyEvent(final Entity entity, final @Nullable World targetWorld, final PortalType portalType) {
|
||||
+ super(entity);
|
||||
+ this.targetWorld = targetWorld;
|
||||
+ this.portalType = portalType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the world this portal will teleport to.
|
||||
+ * Can be {@code null} if "allow-nether" is false in server.properties
|
||||
+ * or if there is another situation where there is no world to teleport to.
|
||||
+ * <p>
|
||||
+ * This world may be modified by later events such as {@link PlayerPortalEvent}
|
||||
+ * or {@link EntityPortalEvent}.
|
||||
+ *
|
||||
+ * @return the world the portal will teleport the entity to.
|
||||
+ */
|
||||
+ public @Nullable World getTargetWorld() {
|
||||
+ return this.targetWorld;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the world this portal will teleport to. A {@code null} value
|
||||
+ * will essentially cancel the teleport and prevent further events
|
||||
+ * such as {@link PlayerPortalEvent} from firing.
|
||||
+ * <p>
|
||||
+ * This world may be modified by later events such as {@link PlayerPortalEvent}
|
||||
+ * or {@link EntityPortalEvent}.
|
||||
+ *
|
||||
+ * @param targetWorld the world
|
||||
+ */
|
||||
+ public void setTargetWorld(final @Nullable World targetWorld) {
|
||||
+ this.targetWorld = targetWorld;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the portal type for this event.
|
||||
+ *
|
||||
+ * @return the portal type
|
||||
+ */
|
||||
+ public PortalType getPortalType() {
|
||||
+ return this.portalType;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,45 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sat, 9 Jun 2018 13:08:21 +0100
|
||||
Subject: [PATCH] Add EntityTeleportEndGatewayEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTeleportEndGatewayEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.block.EndGateway;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time an entity attempts to teleport in an end gateway
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityTeleportEndGatewayEvent extends EntityTeleportEvent {
|
||||
+
|
||||
+ private final EndGateway gateway;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityTeleportEndGatewayEvent(final Entity entity, final Location from, final Location to, final EndGateway gateway) {
|
||||
+ super(entity, from, to);
|
||||
+ this.gateway = gateway;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The gateway triggering the teleport
|
||||
+ *
|
||||
+ * @return EndGateway used
|
||||
+ */
|
||||
+ public EndGateway getGateway() {
|
||||
+ return this.gateway;
|
||||
+ }
|
||||
+
|
||||
+}
|
|
@ -1,115 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaBlend <whizkid3000@hotmail.com>
|
||||
Date: Sun, 16 Oct 2016 23:19:34 -0700
|
||||
Subject: [PATCH] Add EntityZapEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import java.util.Collections;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.LightningStrike;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when lightning strikes an entity
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class EntityZapEvent extends EntityTransformEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final LightningStrike bolt;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public EntityZapEvent(final Entity entity, final LightningStrike bolt, final Entity replacementEntity) {
|
||||
+ super(entity, Collections.singletonList(replacementEntity), TransformReason.LIGHTNING);
|
||||
+ this.bolt = bolt;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the lightning bolt that is striking the entity.
|
||||
+ *
|
||||
+ * @return The lightning bolt responsible for this event
|
||||
+ */
|
||||
+ public LightningStrike getBolt() {
|
||||
+ return this.bolt;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity that will replace the struck entity.
|
||||
+ *
|
||||
+ * @return The entity that will replace the struck entity
|
||||
+ */
|
||||
+ public Entity getReplacementEntity() {
|
||||
+ return super.getTransformedEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final 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/org/bukkit/event/entity/PigZapEvent.java b/src/main/java/org/bukkit/event/entity/PigZapEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/PigZapEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/PigZapEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Stores data for pigs being zapped
|
||||
*/
|
||||
-public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
+public class PigZapEvent extends com.destroystokyo.paper.event.entity.EntityZapEvent implements Cancellable { // Paper
|
||||
+ // private static final HandlerList handlers = new HandlerList(); // Paper - moved in the super class
|
||||
private boolean canceled;
|
||||
private final PigZombie pigzombie;
|
||||
private final LightningStrike bolt;
|
||||
|
||||
public PigZapEvent(@NotNull final Pig pig, @NotNull final LightningStrike bolt, @NotNull final PigZombie pigzombie) {
|
||||
- super(pig, Collections.singletonList((Entity) pigzombie), TransformReason.LIGHTNING);
|
||||
+ super(pig, bolt, pigzombie); // Paper
|
||||
this.bolt = bolt;
|
||||
this.pigzombie = pigzombie;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
||||
return pigzombie;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /*
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -0,0 +0,0 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+ */
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SoSeDiK <mrsosedik@gmail.com>
|
||||
Date: Sun, 16 Oct 2022 15:28:49 +0300
|
||||
Subject: [PATCH] Add EquipmentSlot convenience methods
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlot.java b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
|
||||
@@ -0,0 +0,0 @@ public enum EquipmentSlot {
|
||||
public EquipmentSlotGroup getGroup() {
|
||||
return group.get();
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Checks whether this equipment slot is a hand:
|
||||
+ * either {@link #HAND} or {@link #OFF_HAND}
|
||||
+ *
|
||||
+ * @return whether this is a hand slot
|
||||
+ */
|
||||
+ public boolean isHand() {
|
||||
+ return this == HAND || this == OFF_HAND;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the opposite hand
|
||||
+ *
|
||||
+ * @return the opposite hand
|
||||
+ * @throws IllegalArgumentException if this equipment slot is not a hand
|
||||
+ * @see #isHand()
|
||||
+ */
|
||||
+ public @NotNull EquipmentSlot getOppositeHand() {
|
||||
+ return switch (this) {
|
||||
+ case HAND -> OFF_HAND;
|
||||
+ case OFF_HAND -> HAND;
|
||||
+ default -> throw new IllegalArgumentException("Unable to determine an opposite hand for equipment slot: " + name());
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Checks whether this equipment slot
|
||||
+ * is one of the armor slots:
|
||||
+ * {@link #HEAD}, {@link #CHEST},
|
||||
+ * {@link #LEGS}, {@link #FEET}, or {@link #BODY}
|
||||
+ *
|
||||
+ * @return whether this is an armor slot
|
||||
+ */
|
||||
+ public boolean isArmor() {
|
||||
+ return this == HEAD || this == CHEST || this == LEGS || this == FEET || this == BODY;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 1 Apr 2016 00:02:47 -0400
|
||||
Subject: [PATCH] Add FastUtil to Bukkit
|
||||
|
||||
Doesn't expose to plugins, just allows Paper-API to use it for optimization
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -0,0 +0,0 @@ dependencies {
|
||||
api("com.googlecode.json-simple:json-simple:1.1.1") {
|
||||
isTransitive = false // includes junit
|
||||
}
|
||||
+ api("it.unimi.dsi:fastutil:8.5.15")
|
||||
// Paper end
|
||||
|
||||
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
|
@ -1,376 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 9 Mar 2023 11:24:43 -0800
|
||||
Subject: [PATCH] Add FeatureFlag API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/flag/FeatureDependant.java b/src/main/java/io/papermc/paper/world/flag/FeatureDependant.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/world/flag/FeatureDependant.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.world.flag;
|
||||
+
|
||||
+import java.util.Set;
|
||||
+import org.bukkit.FeatureFlag;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Unmodifiable;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Implemented by types in built-in registries that are controlled by {@link FeatureFlag FeatureFlags}.
|
||||
+ * Types in data-driven registries that are controlled by feature flags just will not exist in that registry.
|
||||
+ * @apiNote When a type that currently implements this interface transitions to being data-drive, this
|
||||
+ * interface will be removed from that type in the following major version.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface FeatureDependant {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the set of required feature flags for this
|
||||
+ * to be enabled.
|
||||
+ *
|
||||
+ * @return the immutable set of feature flags
|
||||
+ */
|
||||
+ default @Unmodifiable Set<FeatureFlag> requiredFeatures() {
|
||||
+ return FeatureFlagProvider.provider().requiredFeatures(this);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/world/flag/FeatureFlagProvider.java b/src/main/java/io/papermc/paper/world/flag/FeatureFlagProvider.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/world/flag/FeatureFlagProvider.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.world.flag;
|
||||
+
|
||||
+import java.util.Optional;
|
||||
+import java.util.ServiceLoader;
|
||||
+import java.util.Set;
|
||||
+import org.bukkit.FeatureFlag;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@NullMarked
|
||||
+@ApiStatus.Internal
|
||||
+interface FeatureFlagProvider {
|
||||
+
|
||||
+ Optional<FeatureFlagProvider> PROVIDER = ServiceLoader.load(FeatureFlagProvider.class).findFirst();
|
||||
+
|
||||
+ static FeatureFlagProvider provider() {
|
||||
+ return PROVIDER.orElseThrow();
|
||||
+ }
|
||||
+
|
||||
+ Set<FeatureFlag> requiredFeatures(FeatureDependant dependant);
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/world/flag/FeatureFlagSetHolder.java b/src/main/java/io/papermc/paper/world/flag/FeatureFlagSetHolder.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/world/flag/FeatureFlagSetHolder.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.world.flag;
|
||||
+
|
||||
+import java.util.Set;
|
||||
+import org.bukkit.FeatureFlag;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Unmodifiable;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Implemented by types that hold {@link FeatureFlag FeatureFlags} like
|
||||
+ * {@link org.bukkit.generator.WorldInfo} and {@link org.bukkit.RegionAccessor}.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface FeatureFlagSetHolder {
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this is enabled based on the loaded feature flags.
|
||||
+ *
|
||||
+ * @return true if enabled
|
||||
+ */
|
||||
+ default boolean isEnabled(final FeatureDependant featureDependant) {
|
||||
+ return this.getFeatureFlags().containsAll(featureDependant.requiredFeatures());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get all {@link FeatureFlag FeatureFlags} enabled in this world.
|
||||
+ *
|
||||
+ * @return all enabled {@link FeatureFlag FeatureFlags}
|
||||
+ */
|
||||
+ @Unmodifiable Set<FeatureFlag> getFeatureFlags();
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/FeatureFlag.java b/src/main/java/org/bukkit/FeatureFlag.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/FeatureFlag.java
|
||||
+++ b/src/main/java/org/bukkit/FeatureFlag.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit;
|
||||
|
||||
+// Paper start - overhaul FeatureFlag API
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import java.util.List;
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import net.kyori.adventure.util.Index;
|
||||
+import org.intellij.lang.annotations.Subst;
|
||||
+// Paper end - overhaul FeatureFlag API
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
- * This represents a Feature Flag for a World.
|
||||
- * <br>
|
||||
- * Flags which are unavailable in the current version will be null and/or
|
||||
- * removed.
|
||||
+ * This represents a Feature Flag for a {@link io.papermc.paper.world.flag.FeatureFlagSetHolder}.
|
||||
*/
|
||||
-@ApiStatus.Experimental
|
||||
public interface FeatureFlag extends Keyed {
|
||||
|
||||
- public static final FeatureFlag VANILLA = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("vanilla"));
|
||||
+ // Paper start - overhaul FeatureFlag API
|
||||
+ /**
|
||||
+ * The {@code vanilla} feature flag.
|
||||
+ */
|
||||
+ FeatureFlag VANILLA = create("vanilla");
|
||||
|
||||
/**
|
||||
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.19.3 - 1.21.1
|
||||
@@ -0,0 +0,0 @@ public interface FeatureFlag extends Keyed {
|
||||
* @deprecated not available since 1.21.2
|
||||
*/
|
||||
@Deprecated(since = "1.21.2")
|
||||
- public static final FeatureFlag BUNDLE = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("bundle"));
|
||||
+ FeatureFlag BUNDLE = deprecated("bundle");
|
||||
|
||||
/**
|
||||
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.19 - 1.19.4
|
||||
*
|
||||
* @deprecated not available since 1.20
|
||||
+ * The {@code trade_rebalance} feature flag.
|
||||
*/
|
||||
- @Deprecated(since = "1.20.2")
|
||||
- public static final FeatureFlag UPDATE_1_20 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_20"));
|
||||
+ @Deprecated(since = "1.20")
|
||||
+ FeatureFlag UPDATE_1_20 = deprecated("update_1_20");
|
||||
|
||||
@ApiStatus.Experimental // Paper - add missing annotation
|
||||
- public static final FeatureFlag TRADE_REBALANCE = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("trade_rebalance"));
|
||||
+ FeatureFlag TRADE_REBALANCE = create("trade_rebalance");
|
||||
|
||||
/**
|
||||
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.20.5 - 1.20.6
|
||||
@@ -0,0 +0,0 @@ public interface FeatureFlag extends Keyed {
|
||||
* @deprecated not available since 1.21
|
||||
*/
|
||||
@Deprecated(since = "1.21")
|
||||
- public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21"));
|
||||
+ FeatureFlag UPDATE_121 = deprecated("update_1_21");
|
||||
|
||||
/**
|
||||
* <strong>AVAILABLE BETWEEN VERSIONS:</strong> 1.21.2 - 1.21.3
|
||||
@@ -0,0 +0,0 @@ public interface FeatureFlag extends Keyed {
|
||||
* @deprecated not available since 1.21.4
|
||||
*/
|
||||
@Deprecated(since = "1.21.4")
|
||||
- public static final FeatureFlag WINTER_DROP = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("winter_drop"));
|
||||
+ FeatureFlag WINTER_DROP = deprecated("winter_drop");
|
||||
|
||||
@ApiStatus.Experimental // Paper - add missing annotation
|
||||
- public static final FeatureFlag REDSTONE_EXPERIMENTS = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("redstone_experiments"));
|
||||
+ FeatureFlag REDSTONE_EXPERIMENTS = create("redstone_experiments");
|
||||
|
||||
@ApiStatus.Experimental // Paper - add missing annotation
|
||||
- public static final FeatureFlag MINECART_IMPROVEMENTS = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("minecart_improvements"));
|
||||
+ FeatureFlag MINECART_IMPROVEMENTS = create("minecart_improvements");
|
||||
+
|
||||
+ /**
|
||||
+ * An index of all feature flags.
|
||||
+ */
|
||||
+ Index<Key, FeatureFlag> ALL_FLAGS = Index.create(FeatureFlag::key, List.copyOf(FeatureFlagImpl.ALL_FLAGS));
|
||||
+
|
||||
+ private static FeatureFlag create(@Subst("vanilla") final String name) {
|
||||
+ final FeatureFlag flag = new FeatureFlagImpl(NamespacedKey.minecraft(name));
|
||||
+ Preconditions.checkState(FeatureFlagImpl.ALL_FLAGS.add(flag), "Tried to add duplicate feature flag: " + name);
|
||||
+ return flag;
|
||||
+ }
|
||||
+
|
||||
+ private static FeatureFlag deprecated(@Subst("vanilla") final String name) {
|
||||
+ return new FeatureFlagImpl.Deprecated(NamespacedKey.minecraft(name));
|
||||
+ }
|
||||
+ // Paper end - overhaul FeatureFlag API
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/FeatureFlagImpl.java b/src/main/java/org/bukkit/FeatureFlagImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/FeatureFlagImpl.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package org.bukkit;
|
||||
+
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+@NullMarked
|
||||
+record FeatureFlagImpl(NamespacedKey key) implements FeatureFlag {
|
||||
+
|
||||
+ static final Set<FeatureFlag> ALL_FLAGS = new HashSet<>();
|
||||
+
|
||||
+ @Override
|
||||
+ public NamespacedKey getKey() {
|
||||
+ return this.key;
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ record Deprecated(NamespacedKey key) implements FeatureFlag {
|
||||
+
|
||||
+ @Override
|
||||
+ public NamespacedKey getKey() {
|
||||
+ return this.key;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/RegionAccessor.java
|
||||
+++ b/src/main/java/org/bukkit/RegionAccessor.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
* A RegionAccessor gives access to getting, modifying and spawning {@link Biome}, {@link BlockState} and {@link Entity},
|
||||
* as well as generating some basic structures.
|
||||
*/
|
||||
-public interface RegionAccessor extends Keyed { // Paper
|
||||
+public interface RegionAccessor extends Keyed, io.papermc.paper.world.flag.FeatureFlagSetHolder { // Paper - feature flag API
|
||||
|
||||
/**
|
||||
* Gets the {@link Biome} at the given {@link Location}.
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
||||
@Deprecated(since = "1.21.3", forRemoval = true)
|
||||
String getTranslationKey(Attribute attribute);
|
||||
|
||||
- @Nullable
|
||||
- FeatureFlag getFeatureFlag(@NotNull NamespacedKey key);
|
||||
+ // Paper - replace with better system
|
||||
|
||||
/**
|
||||
* Do not use, method will get removed, and the plugin won't run
|
||||
diff --git a/src/main/java/org/bukkit/block/BlockType.java b/src/main/java/org/bukkit/block/BlockType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/block/BlockType.java
|
||||
+++ b/src/main/java/org/bukkit/block/BlockType.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
* changes may occur. Do not use this API in plugins.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
-public interface BlockType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - add translatable
|
||||
+public interface BlockType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - add translatable & feature flag API
|
||||
|
||||
/**
|
||||
* Typed represents a subtype of {@link BlockType}s that have a known block
|
||||
@@ -0,0 +0,0 @@ public interface BlockType extends Keyed, Translatable, net.kyori.adventure.tran
|
||||
*
|
||||
* @param world the world to check
|
||||
* @return true if this BlockType can be used in this World.
|
||||
+ * @deprecated Use {@link io.papermc.paper.world.flag.FeatureFlagSetHolder#isEnabled(io.papermc.paper.world.flag.FeatureDependant)}
|
||||
*/
|
||||
+ @Deprecated(forRemoval = true, since = "1.21.1") // Paper
|
||||
boolean isEnabledByFeature(@NotNull World world);
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/EntityType.java
|
||||
+++ b/src/main/java/org/bukkit/entity/EntityType.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
-public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - translatable
|
||||
+public enum EntityType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - translatable
|
||||
|
||||
// These strings MUST match the strings in nms.EntityTypes and are case sensitive.
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/generator/WorldInfo.java b/src/main/java/org/bukkit/generator/WorldInfo.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/generator/WorldInfo.java
|
||||
+++ b/src/main/java/org/bukkit/generator/WorldInfo.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Holds various information of a World
|
||||
*/
|
||||
-public interface WorldInfo {
|
||||
+public interface WorldInfo extends io.papermc.paper.world.flag.FeatureFlagSetHolder { // Paper - feature flag API
|
||||
|
||||
/**
|
||||
* Gets the unique name of this world
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemType.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
* changes may occur. Do not use this API in plugins.
|
||||
*/
|
||||
@ApiStatus.Experimental // Paper - already required for registry builders
|
||||
-public interface ItemType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - add Translatable
|
||||
+public interface ItemType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - add Translatable & feature flag API
|
||||
|
||||
/**
|
||||
* Typed represents a subtype of {@link ItemType}s that have a known item meta type
|
||||
@@ -0,0 +0,0 @@ public interface ItemType extends Keyed, Translatable, net.kyori.adventure.trans
|
||||
*
|
||||
* @param world the world to check
|
||||
* @return true if this ItemType can be used in this World.
|
||||
+ * @deprecated use {@link io.papermc.paper.world.flag.FeatureFlagSetHolder#isEnabled(io.papermc.paper.world.flag.FeatureDependant)}
|
||||
*/
|
||||
+ @Deprecated(forRemoval = true, since = "1.21.1") // Paper
|
||||
boolean isEnabledByFeature(@NotNull World world);
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/inventory/MenuType.java b/src/main/java/org/bukkit/inventory/MenuType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/MenuType.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/MenuType.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
* created and viewed by the player.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
-public interface MenuType extends Keyed {
|
||||
+public interface MenuType extends Keyed, io.papermc.paper.world.flag.FeatureDependant { // Paper - make FeatureDependant
|
||||
|
||||
/**
|
||||
* A MenuType which represents a chest with 1 row.
|
||||
diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/potion/PotionEffectType.java
|
||||
+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a type of potion and its effect on an entity.
|
||||
*/
|
||||
-public abstract class PotionEffectType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - implement Translatable
|
||||
+public abstract class PotionEffectType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - implement Translatable & feature flag API
|
||||
private static final BiMap<Integer, PotionEffectType> ID_MAP = HashBiMap.create();
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/potion/PotionType.java b/src/main/java/org/bukkit/potion/PotionType.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/potion/PotionType.java
|
||||
+++ b/src/main/java/org/bukkit/potion/PotionType.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
* This enum reflects and matches each potion state that can be obtained from
|
||||
* the Creative mode inventory
|
||||
*/
|
||||
-public enum PotionType implements Keyed {
|
||||
+public enum PotionType implements Keyed, io.papermc.paper.world.flag.FeatureDependant { // Paper - feature flag API
|
||||
WATER("water"),
|
||||
MUNDANE("mundane"),
|
||||
THICK("thick"),
|
|
@ -1,165 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: vicisacat <victor.branchu@gmail.com>
|
||||
Date: Fri, 17 Nov 2023 20:21:47 +0100
|
||||
Subject: [PATCH] Add FluidState API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/block/fluid/FluidData.java b/src/main/java/io/papermc/paper/block/fluid/FluidData.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/block/fluid/FluidData.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.block.fluid;
|
||||
+
|
||||
+import org.bukkit.Fluid;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.Range;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * A representation of a fluid in a specific state of data.
|
||||
+ * This type is not linked to a specific location and hence mostly resembles a {@link org.bukkit.block.data.BlockData}.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public interface FluidData extends Cloneable {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the fluid type of this fluid data.
|
||||
+ *
|
||||
+ * @return the fluid type
|
||||
+ */
|
||||
+ Fluid getFluidType();
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a copy of this FluidData.
|
||||
+ *
|
||||
+ * @return a copy of the fluid data
|
||||
+ */
|
||||
+ FluidData clone();
|
||||
+
|
||||
+ /**
|
||||
+ * Computes the direction of the flow of the liquid at the given location as a vector.
|
||||
+ * <p>
|
||||
+ * This method requires the passed location's chunk to be loaded.
|
||||
+ * If said chunk is not loaded when this method is called, the chunk will first be loaded prior to the computation
|
||||
+ * which leads to a potentially slow sync chunk load.
|
||||
+ *
|
||||
+ * @param location - the location to check the liquid flow
|
||||
+ * @return the flow direction vector at the given location
|
||||
+ */
|
||||
+ Vector computeFlowDirection(Location location);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the level of liquid this fluid data holds.
|
||||
+ *
|
||||
+ * @return the amount as an integer, between 0 and 8
|
||||
+ */
|
||||
+ @Range(from = 0, to = 8)
|
||||
+ int getLevel();
|
||||
+
|
||||
+ /**
|
||||
+ * Computes the height of the fluid in the world.
|
||||
+ * <p>
|
||||
+ * This method requires the passed location's chunk to be loaded.
|
||||
+ * If said chunk is not loaded when this method is called, the chunk will first be loaded prior to the computation
|
||||
+ * which leads to a potentially slow sync chunk load.
|
||||
+ *
|
||||
+ * @param location the location at which to check the high of this fluid data.
|
||||
+ * @return the height as a float value
|
||||
+ */
|
||||
+ @Range(from = 0, to = 1)
|
||||
+ float computeHeight(Location location);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether this fluid is a source block
|
||||
+ *
|
||||
+ * @return true if the fluid is a source block, false otherwise
|
||||
+ */
|
||||
+ boolean isSource();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java b/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/block/fluid/type/FallingFluidData.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.block.fluid.type;
|
||||
+
|
||||
+import io.papermc.paper.block.fluid.FluidData;
|
||||
+
|
||||
+/**
|
||||
+ * A specific subtype of {@link FluidData} that is returned by the API for fluid data of potentially falling fluids.
|
||||
+ */
|
||||
+public interface FallingFluidData extends FluidData {
|
||||
+
|
||||
+ /**
|
||||
+ * Get if this liquid is falling.
|
||||
+ *
|
||||
+ * @return true if falling
|
||||
+ */
|
||||
+ boolean isFalling();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java b/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/block/fluid/type/FlowingFluidData.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.block.fluid.type;
|
||||
+
|
||||
+import io.papermc.paper.block.fluid.FluidData;
|
||||
+
|
||||
+/**
|
||||
+ * A specific subtype of {@link FluidData} that is returned by the API for fluid data of potentially falling fluids.
|
||||
+ */
|
||||
+public interface FlowingFluidData extends FallingFluidData {
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/RegionAccessor.java
|
||||
+++ b/src/main/java/org/bukkit/RegionAccessor.java
|
||||
@@ -0,0 +0,0 @@ public interface RegionAccessor extends Keyed { // Paper
|
||||
@NotNull
|
||||
BlockState getBlockState(int x, int y, int z);
|
||||
|
||||
+ // Paper start - FluidState API
|
||||
+ /**
|
||||
+ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the specified position.
|
||||
+ *
|
||||
+ * @param x The x-coordinate of the position
|
||||
+ * @param y The y-coordinate of the position
|
||||
+ * @param z The z-coordinate of the position
|
||||
+ * @return The {@link io.papermc.paper.block.fluid.FluidData} at the specified position
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ io.papermc.paper.block.fluid.FluidData getFluidData(int x, int y, int z);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the given position
|
||||
+ *
|
||||
+ * @param position The position of the fluid
|
||||
+ * @return The fluid data at the given position
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ default io.papermc.paper.block.fluid.FluidData getFluidData(@NotNull io.papermc.paper.math.Position position) {
|
||||
+ return getFluidData(position.blockX(), position.blockY(), position.blockZ());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link io.papermc.paper.block.fluid.FluidData} at the given position
|
||||
+ *
|
||||
+ * @param location The location of the fluid
|
||||
+ * @return The fluid data at the given position
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ default io.papermc.paper.block.fluid.FluidData getFluidData(@NotNull Location location) {
|
||||
+ return getFluidData(location.blockX(), location.blockY(), location.blockZ());
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the {@link BlockData} at the given {@link Location}.
|
||||
*
|
|
@ -1,407 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Sun, 17 Mar 2019 21:46:27 +0200
|
||||
Subject: [PATCH] Add GS4 Query event
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java b/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/GS4QueryEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
+import java.net.InetAddress;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Collection;
|
||||
+import java.util.List;
|
||||
+import org.bukkit.Server;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * This event is fired if server is getting queried over GS4 Query protocol.
|
||||
+ * <br>
|
||||
+ * Adapted from Velocity's ProxyQueryEvent
|
||||
+ *
|
||||
+ * @author Mark Vainomaa
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public final class GS4QueryEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final QueryType queryType;
|
||||
+ private final InetAddress querierAddress;
|
||||
+ private QueryResponse response;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public GS4QueryEvent(final QueryType queryType, final InetAddress querierAddress, final QueryResponse response) {
|
||||
+ super(true); // should always be called async
|
||||
+ this.queryType = queryType;
|
||||
+ this.querierAddress = querierAddress;
|
||||
+ this.response = response;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get query type
|
||||
+ *
|
||||
+ * @return query type
|
||||
+ */
|
||||
+ public QueryType getQueryType() {
|
||||
+ return this.queryType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get querier address
|
||||
+ *
|
||||
+ * @return querier address
|
||||
+ */
|
||||
+ public InetAddress getQuerierAddress() {
|
||||
+ return this.querierAddress;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get query response
|
||||
+ *
|
||||
+ * @return query response
|
||||
+ */
|
||||
+ public QueryResponse getResponse() {
|
||||
+ return this.response;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set query response
|
||||
+ *
|
||||
+ * @param response query response
|
||||
+ */
|
||||
+ public void setResponse(final QueryResponse response) {
|
||||
+ this.response = Preconditions.checkNotNull(response, "response");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The type of query
|
||||
+ */
|
||||
+ public enum QueryType {
|
||||
+ /**
|
||||
+ * Basic query asks only a subset of information, such as motd, game type (hardcoded to <pre>MINECRAFT</pre>), map,
|
||||
+ * current players, max players, server port and server motd
|
||||
+ */
|
||||
+ BASIC,
|
||||
+
|
||||
+ /**
|
||||
+ * Full query asks pretty much everything present on this event (only hardcoded values cannot be modified here).
|
||||
+ */
|
||||
+ FULL
|
||||
+ }
|
||||
+
|
||||
+ public static final class QueryResponse {
|
||||
+
|
||||
+ private final String motd;
|
||||
+ private final String gameVersion;
|
||||
+ private final String map;
|
||||
+ private final int currentPlayers;
|
||||
+ private final int maxPlayers;
|
||||
+ private final String hostname;
|
||||
+ private final int port;
|
||||
+ private final Collection<String> players;
|
||||
+ private final String serverVersion;
|
||||
+ private final Collection<PluginInformation> plugins;
|
||||
+
|
||||
+ private QueryResponse(final String motd, final String gameVersion, final String map, final int currentPlayers, final int maxPlayers, final String hostname, final int port, final Collection<String> players, final String serverVersion, final Collection<PluginInformation> plugins) {
|
||||
+ this.motd = motd;
|
||||
+ this.gameVersion = gameVersion;
|
||||
+ this.map = map;
|
||||
+ this.currentPlayers = currentPlayers;
|
||||
+ this.maxPlayers = maxPlayers;
|
||||
+ this.hostname = hostname;
|
||||
+ this.port = port;
|
||||
+ this.players = players;
|
||||
+ this.serverVersion = serverVersion;
|
||||
+ this.plugins = plugins;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get motd which will be used to reply to the query. By default, it is {@link Server#getMotd()}.
|
||||
+ *
|
||||
+ * @return motd
|
||||
+ */
|
||||
+ public String getMotd() {
|
||||
+ return this.motd;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get game version which will be used to reply to the query. By default, supported Minecraft versions range is sent.
|
||||
+ *
|
||||
+ * @return game version
|
||||
+ */
|
||||
+ public String getGameVersion() {
|
||||
+ return this.gameVersion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get map name which will be used to reply to the query. By default {@code world} is sent.
|
||||
+ *
|
||||
+ * @return map name
|
||||
+ */
|
||||
+ public String getMap() {
|
||||
+ return this.map;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get current online player count which will be used to reply to the query.
|
||||
+ *
|
||||
+ * @return online player count
|
||||
+ */
|
||||
+ public int getCurrentPlayers() {
|
||||
+ return this.currentPlayers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get max player count which will be used to reply to the query.
|
||||
+ *
|
||||
+ * @return max player count
|
||||
+ */
|
||||
+ public int getMaxPlayers() {
|
||||
+ return this.maxPlayers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get server (public facing) hostname.
|
||||
+ *
|
||||
+ * @return server hostname
|
||||
+ */
|
||||
+ public String getHostname() {
|
||||
+ return this.hostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get server (public facing) port.
|
||||
+ *
|
||||
+ * @return server port
|
||||
+ */
|
||||
+ public int getPort() {
|
||||
+ return this.port;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get collection of players which will be used to reply to the query.
|
||||
+ *
|
||||
+ * @return collection of players
|
||||
+ */
|
||||
+ public Collection<String> getPlayers() {
|
||||
+ return this.players;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get server software (name and version) which will be used to reply to the query.
|
||||
+ *
|
||||
+ * @return server software
|
||||
+ */
|
||||
+ public String getServerVersion() {
|
||||
+ return this.serverVersion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get list of plugins which will be used to reply to the query.
|
||||
+ *
|
||||
+ * @return collection of plugins
|
||||
+ */
|
||||
+ public Collection<PluginInformation> getPlugins() {
|
||||
+ return this.plugins;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new {@link Builder} instance from data represented by this response.
|
||||
+ *
|
||||
+ * @return {@link QueryResponse} builder
|
||||
+ */
|
||||
+ public Builder toBuilder() {
|
||||
+ return QueryResponse.builder()
|
||||
+ .motd(this.getMotd())
|
||||
+ .gameVersion(this.getGameVersion())
|
||||
+ .map(this.getMap())
|
||||
+ .currentPlayers(this.getCurrentPlayers())
|
||||
+ .maxPlayers(this.getMaxPlayers())
|
||||
+ .hostname(this.getHostname())
|
||||
+ .port(this.getPort())
|
||||
+ .players(this.getPlayers())
|
||||
+ .serverVersion(this.getServerVersion())
|
||||
+ .plugins(this.getPlugins());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new {@link Builder} instance.
|
||||
+ *
|
||||
+ * @return {@link QueryResponse} builder
|
||||
+ */
|
||||
+ public static Builder builder() {
|
||||
+ return new Builder();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * A builder for {@link QueryResponse} objects.
|
||||
+ */
|
||||
+ public static final class Builder {
|
||||
+
|
||||
+ private @MonotonicNonNull String motd;
|
||||
+ private @MonotonicNonNull String gameVersion;
|
||||
+ private @MonotonicNonNull String map;
|
||||
+ private @MonotonicNonNull String hostname;
|
||||
+ private @MonotonicNonNull String serverVersion;
|
||||
+
|
||||
+ private int currentPlayers;
|
||||
+ private int maxPlayers;
|
||||
+ private int port;
|
||||
+
|
||||
+ private final List<String> players = new ArrayList<>();
|
||||
+ private final List<PluginInformation> plugins = new ArrayList<>();
|
||||
+
|
||||
+ private Builder() {
|
||||
+ }
|
||||
+
|
||||
+ public Builder motd(final String motd) {
|
||||
+ this.motd = Preconditions.checkNotNull(motd, "motd");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder gameVersion(final String gameVersion) {
|
||||
+ this.gameVersion = Preconditions.checkNotNull(gameVersion, "gameVersion");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder map(final String map) {
|
||||
+ this.map = Preconditions.checkNotNull(map, "map");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder currentPlayers(final int currentPlayers) {
|
||||
+ Preconditions.checkArgument(currentPlayers >= 0, "currentPlayers cannot be negative");
|
||||
+ this.currentPlayers = currentPlayers;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder maxPlayers(final int maxPlayers) {
|
||||
+ Preconditions.checkArgument(maxPlayers >= 0, "maxPlayers cannot be negative");
|
||||
+ this.maxPlayers = maxPlayers;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder hostname(final String hostname) {
|
||||
+ this.hostname = Preconditions.checkNotNull(hostname, "hostname");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder port(final int port) {
|
||||
+ Preconditions.checkArgument(port >= 1 && port <= 65535, "port must be between 1-65535");
|
||||
+ this.port = port;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder players(final Collection<String> players) {
|
||||
+ this.players.addAll(Preconditions.checkNotNull(players, "players"));
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder players(final String... players) {
|
||||
+ this.players.addAll(Arrays.asList(Preconditions.checkNotNull(players, "players")));
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder clearPlayers() {
|
||||
+ this.players.clear();
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder serverVersion(final String serverVersion) {
|
||||
+ this.serverVersion = Preconditions.checkNotNull(serverVersion, "serverVersion");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder plugins(final Collection<PluginInformation> plugins) {
|
||||
+ this.plugins.addAll(Preconditions.checkNotNull(plugins, "plugins"));
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder plugins(final PluginInformation... plugins) {
|
||||
+ this.plugins.addAll(Arrays.asList(Preconditions.checkNotNull(plugins, "plugins")));
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ public Builder clearPlugins() {
|
||||
+ this.plugins.clear();
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Builds new {@link QueryResponse} with supplied data.
|
||||
+ *
|
||||
+ * @return response
|
||||
+ */
|
||||
+ public QueryResponse build() {
|
||||
+ return new QueryResponse(
|
||||
+ Preconditions.checkNotNull(this.motd, "motd"),
|
||||
+ Preconditions.checkNotNull(this.gameVersion, "gameVersion"),
|
||||
+ Preconditions.checkNotNull(this.map, "map"),
|
||||
+ this.currentPlayers,
|
||||
+ this.maxPlayers,
|
||||
+ Preconditions.checkNotNull(this.hostname, "hostname"),
|
||||
+ this.port,
|
||||
+ ImmutableList.copyOf(this.players),
|
||||
+ Preconditions.checkNotNull(this.serverVersion, "serverVersion"),
|
||||
+ ImmutableList.copyOf(this.plugins)
|
||||
+ );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Plugin information
|
||||
+ */
|
||||
+ public static class PluginInformation {
|
||||
+
|
||||
+ private String name;
|
||||
+ private String version;
|
||||
+
|
||||
+ public PluginInformation(final String name, final String version) {
|
||||
+ this.name = Preconditions.checkNotNull(name, "name");
|
||||
+ this.version = Preconditions.checkNotNull(version, "version");
|
||||
+ }
|
||||
+
|
||||
+ public String getName() {
|
||||
+ return this.name;
|
||||
+ }
|
||||
+
|
||||
+ public void setName(final String name) {
|
||||
+ this.name = name;
|
||||
+ }
|
||||
+
|
||||
+ public void setVersion(final String version) {
|
||||
+ this.version = version;
|
||||
+ }
|
||||
+
|
||||
+ public String getVersion() {
|
||||
+ return this.version;
|
||||
+ }
|
||||
+
|
||||
+ public static PluginInformation of(final String name, final String version) {
|
||||
+ return new PluginInformation(name, version);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
|
@ -1,36 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 18 Dec 2021 10:34:21 -0800
|
||||
Subject: [PATCH] Add GameEvent tags
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Tag.java b/src/main/java/org/bukkit/Tag.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Tag.java
|
||||
+++ b/src/main/java/org/bukkit/Tag.java
|
||||
@@ -0,0 +0,0 @@ public interface Tag<T extends Keyed> extends Keyed {
|
||||
*/
|
||||
Tag<EntityType> ENTITY_TYPES_REDIRECTABLE_PROJECTILE = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("redirectable_projectile"), EntityType.class);
|
||||
|
||||
+ // Paper start
|
||||
+ String REGISTRY_GAME_EVENTS = "game_events";
|
||||
+
|
||||
+ /**
|
||||
+ * Tag for game events that trigger sculk sensors
|
||||
+ */
|
||||
+ Tag<GameEvent> GAME_EVENT_VIBRATIONS = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("vibrations"), GameEvent.class);
|
||||
+
|
||||
+ /**
|
||||
+ * Tag for game events that are ignored if the entity is sneaking
|
||||
+ */
|
||||
+ Tag<GameEvent> GAME_EVENT_IGNORE_VIBRATIONS_SNEAKING = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("ignore_vibrations_sneaking"), GameEvent.class);
|
||||
+
|
||||
+ /**
|
||||
+ * Tag for game events that an allay can listen to
|
||||
+ */
|
||||
+ Tag<GameEvent> GAME_EVENT_ALLAY_CAN_LISTEN = Bukkit.getTag(REGISTRY_GAME_EVENTS, NamespacedKey.minecraft("allay_can_listen"), GameEvent.class);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Returns whether or not this tag has an entry for the specified item.
|
||||
*
|
|
@ -1,27 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SoSeDiK <mrsosedik@gmail.com>
|
||||
Date: Wed, 1 May 2024 06:56:21 +0300
|
||||
Subject: [PATCH] Add GameMode#isInvulnerable
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/GameMode.java b/src/main/java/org/bukkit/GameMode.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/GameMode.java
|
||||
+++ b/src/main/java/org/bukkit/GameMode.java
|
||||
@@ -0,0 +0,0 @@ public enum GameMode implements net.kyori.adventure.translation.Translatable { /
|
||||
BY_ID.put(mode.getValue(), mode);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Paper start - Add GameMode#isInvulnerable
|
||||
+ /**
|
||||
+ * Checks whether this game mode is invulnerable
|
||||
+ * (i.e. is either {@link #CREATIVE} or {@link #SPECTATOR})
|
||||
+ *
|
||||
+ * @return whether this game mode is invulnerable
|
||||
+ */
|
||||
+ public boolean isInvulnerable() {
|
||||
+ return this == CREATIVE || this == SPECTATOR;
|
||||
+ }
|
||||
+ // Paper end - Add GameMode#isInvulnerable
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Sat, 1 Dec 2018 19:00:36 -0800
|
||||
Subject: [PATCH] Add Heightmap API
|
||||
|
||||
Changed to use upstream's heightmap API - Machine_Maker
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Location.java
|
||||
+++ b/src/main/java/org/bukkit/Location.java
|
||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||
}
|
||||
// Paper end - expand Location API
|
||||
|
||||
+ // Paper start - Add heightmap api
|
||||
+ /**
|
||||
+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ())
|
||||
+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ())
|
||||
+ * @throws NullPointerException if {{@link #getWorld()}} is {@code null}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location toHighestLocation() {
|
||||
+ return this.toHighestLocation(HeightMap.WORLD_SURFACE);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightMap)
|
||||
+ * @param heightMap The heightmap to use for finding the highest y location.
|
||||
+ * @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightMap)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location toHighestLocation(@NotNull final HeightMap heightMap) {
|
||||
+ final Location ret = this.clone();
|
||||
+ ret.setY(this.getWorld().getHighestBlockYAt(this, heightMap));
|
||||
+ return ret;
|
||||
+ }
|
||||
+ // Paper end - Add heightmap api
|
||||
+
|
||||
// Paper start - Expand Explosions API
|
||||
/**
|
||||
* Creates explosion at this location with given power
|
|
@ -1,170 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tamion <70228790+notTamion@users.noreply.github.com>
|
||||
Date: Sun, 5 Nov 2023 09:50:48 +0100
|
||||
Subject: [PATCH] Add HiddenPotionEffect API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
|
||||
/**
|
||||
* Adds the given {@link PotionEffect} to the living entity.
|
||||
+ * <p>
|
||||
+ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when
|
||||
+ * adding the effect to the entity.
|
||||
*
|
||||
* @param effect PotionEffect to be added
|
||||
* @return whether the effect could be added
|
||||
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
/**
|
||||
* Attempts to add all of the given {@link PotionEffect} to the living
|
||||
* entity.
|
||||
+ * <p>
|
||||
+ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when
|
||||
+ * adding the effect to the entity.
|
||||
*
|
||||
* @param effects the effects to add
|
||||
* @return whether all of the effects could be added
|
||||
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||
@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
*/
|
||||
public static final int INFINITE_DURATION = -1;
|
||||
|
||||
+ private static final String HIDDEN_EFFECT = "hidden_effect"; // Paper
|
||||
private static final String AMPLIFIER = "amplifier";
|
||||
private static final String DURATION = "duration";
|
||||
private static final String TYPE = "effect";
|
||||
@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
private final boolean ambient;
|
||||
private final boolean particles;
|
||||
private final boolean icon;
|
||||
+ private final PotionEffect hiddenEffect; // Paper
|
||||
|
||||
/**
|
||||
* Creates a potion effect.
|
||||
@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
* @param ambient the ambient status, see {@link PotionEffect#isAmbient()}
|
||||
* @param particles the particle status, see {@link PotionEffect#hasParticles()}
|
||||
* @param icon the icon status, see {@link PotionEffect#hasIcon()}
|
||||
+ * @param hiddenEffect the hidden PotionEffect
|
||||
+ * @hidden Internal-- hidden effects are only shown internally
|
||||
*/
|
||||
- public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) {
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable PotionEffect hiddenEffect) { // Paper
|
||||
Preconditions.checkArgument(type != null, "effect type cannot be null");
|
||||
this.type = type;
|
||||
this.duration = duration;
|
||||
@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
this.ambient = ambient;
|
||||
this.particles = particles;
|
||||
this.icon = icon;
|
||||
+ // Paper start
|
||||
+ this.hiddenEffect = hiddenEffect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a potion effect.
|
||||
+ * @param type effect type
|
||||
+ * @param duration measured in ticks, see {@link
|
||||
+ * PotionEffect#getDuration()}
|
||||
+ * @param amplifier the amplifier, see {@link PotionEffect#getAmplifier()}
|
||||
+ * @param ambient the ambient status, see {@link PotionEffect#isAmbient()}
|
||||
+ * @param particles the particle status, see {@link PotionEffect#hasParticles()}
|
||||
+ * @param icon the icon status, see {@link PotionEffect#hasIcon()}
|
||||
+ */
|
||||
+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) {
|
||||
+ this(type, duration, amplifier, ambient, particles, icon, null);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
* @param map the map to deserialize from
|
||||
*/
|
||||
public PotionEffect(@NotNull Map<String, Object> map) {
|
||||
- this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)));
|
||||
+ this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)), (PotionEffect) map.get(HIDDEN_EFFECT)); // Paper
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
public PotionEffect withIcon(boolean icon) {
|
||||
return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the PotionEffect that will become active
|
||||
+ * after the current PotionEffect has run out.
|
||||
+ * <p>
|
||||
+ * Note: This value is only applicable to type applied to living entities.
|
||||
+ *
|
||||
+ * @return The hidden PotionEffect.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public PotionEffect getHiddenPotionEffect() {
|
||||
+ return hiddenEffect;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@NotNull
|
||||
@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
@Override
|
||||
@NotNull
|
||||
public Map<String, Object> serialize() {
|
||||
- return ImmutableMap.<String, Object>builder()
|
||||
+ ImmutableMap.Builder<String, Object> builder = ImmutableMap.<String, Object>builder() // Paper
|
||||
.put(TYPE, type.getKey().toString())
|
||||
.put(DURATION, duration)
|
||||
.put(AMPLIFIER, amplifier)
|
||||
.put(AMBIENT, ambient)
|
||||
.put(PARTICLES, particles)
|
||||
- .put(ICON, icon)
|
||||
- .build();
|
||||
+ .put(ICON, icon);
|
||||
+ // Paper start
|
||||
+ if (this.hiddenEffect != null) {
|
||||
+ builder.put(HIDDEN_EFFECT, this.hiddenEffect);
|
||||
+ }
|
||||
+ return builder.build();
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to add the effect represented by this object to the given
|
||||
* {@link LivingEntity}.
|
||||
+ * <p>
|
||||
+ * Note: {@link PotionEffect#getHiddenPotionEffect()} is ignored when
|
||||
+ * adding the effect to the entity.
|
||||
*
|
||||
* @param entity The entity to add this effect to
|
||||
* @return Whether the effect could be added
|
||||
@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
return false;
|
||||
}
|
||||
PotionEffect that = (PotionEffect) obj;
|
||||
- return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon;
|
||||
+ return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon && java.util.Objects.equals(this.hiddenEffect, that.hiddenEffect); // Paper
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
hash ^= 0x22222222 >> (ambient ? 1 : -1);
|
||||
hash ^= 0x22222222 >> (particles ? 1 : -1);
|
||||
hash ^= 0x22222222 >> (icon ? 1 : -1);
|
||||
+ if (hiddenEffect != null) hash = hash * 31 + hiddenEffect.hashCode(); // Paper
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
- return type.getName() + (ambient ? ":(" : ":") + duration + "t-x" + amplifier + (ambient ? ")" : "");
|
||||
+ return "PotionEffect{" + "amplifier=" + amplifier + ", duration=" + duration + ", type=" + type + ", ambient=" + ambient + ", particles=" + particles + ", icon=" + icon + ", hiddenEffect=" + hiddenEffect + '}'; // Paper
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 28 Jan 2014 19:13:57 -0500
|
||||
Subject: [PATCH] Add ItemStack Recipe API helper methods
|
||||
|
||||
Allows using ExactChoice Recipes with easier methods
|
||||
|
||||
Redirects some of upstream's APIs to these new methods to avoid
|
||||
usage of magic values and the deprecated RecipeChoice#getItemStack
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/RecipeChoice.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java
|
||||
@@ -0,0 +0,0 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
|
||||
/**
|
||||
* Represents a choice that will be valid only if one of the stacks is
|
||||
* exactly matched (aside from stack size).
|
||||
- * <br>
|
||||
- * <b>Only valid for shaped recipes</b>
|
||||
*/
|
||||
public static class ExactChoice implements RecipeChoice {
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
|
||||
@@ -0,0 +0,0 @@ public class ShapedRecipe extends CraftingRecipe {
|
||||
return this;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @NotNull
|
||||
+ public ShapedRecipe setIngredient(char key, @NotNull ItemStack item) {
|
||||
+ return setIngredient(key, new RecipeChoice.ExactChoice(item));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get a copy of the ingredients map.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
|
||||
@@ -0,0 +0,0 @@ public class ShapelessRecipe extends CraftingRecipe {
|
||||
return this;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @NotNull
|
||||
+ public ShapelessRecipe addIngredient(@NotNull ItemStack item) {
|
||||
+ return addIngredient(item.getAmount(), item);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ShapelessRecipe addIngredient(int count, @NotNull ItemStack item) {
|
||||
+ Preconditions.checkArgument(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients");
|
||||
+ while (count-- > 0) {
|
||||
+ ingredients.add(new RecipeChoice.ExactChoice(item));
|
||||
+ }
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ShapelessRecipe removeIngredient(@NotNull ItemStack item) {
|
||||
+ return removeIngredient(1, item);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ShapelessRecipe removeIngredient(int count, @NotNull ItemStack item) {
|
||||
+ Iterator<RecipeChoice> iterator = ingredients.iterator();
|
||||
+ while (count > 0 && iterator.hasNext()) {
|
||||
+ RecipeChoice choice = iterator.next();
|
||||
+ if (choice.test(item)) {
|
||||
+ iterator.remove();
|
||||
+ count--;
|
||||
+ }
|
||||
+ }
|
||||
+ return this;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Removes an ingredient from the list.
|
||||
*
|
||||
@@ -0,0 +0,0 @@ public class ShapelessRecipe extends CraftingRecipe {
|
||||
*/
|
||||
@NotNull
|
||||
public ShapelessRecipe removeIngredient(@NotNull Material ingredient) {
|
||||
- return removeIngredient(ingredient, 0);
|
||||
+ return removeIngredient(new ItemStack(ingredient)); // Paper - avoid using deprecated methods (magic values; RecipeChoice#getItemStack)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public class ShapelessRecipe extends CraftingRecipe {
|
||||
*/
|
||||
@NotNull
|
||||
public ShapelessRecipe removeIngredient(int count, @NotNull Material ingredient) {
|
||||
- return removeIngredient(count, ingredient, 0);
|
||||
+ return removeIngredient(count, new ItemStack(ingredient)); // Paper - avoid using deprecated methods (magic values; RecipeChoice#getItemStack)
|
||||
}
|
||||
|
||||
/**
|
|
@ -1,646 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 18 Jul 2023 14:47:02 -0700
|
||||
Subject: [PATCH] Add Lifecycle Event system
|
||||
|
||||
This event system is separate from Bukkit's event system and is
|
||||
meant for managing resources across reloads and from points in the
|
||||
PluginBootstrap.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/bootstrap/BootstrapContext.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package io.papermc.paper.plugin.bootstrap;
|
||||
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -0,0 +0,0 @@ import org.jspecify.annotations.NullMarked;
|
||||
@ApiStatus.Experimental
|
||||
@NullMarked
|
||||
@ApiStatus.NonExtendable
|
||||
-public interface BootstrapContext extends PluginProviderContext {
|
||||
+public interface BootstrapContext extends PluginProviderContext, LifecycleEventOwner {
|
||||
+
|
||||
+ /**
|
||||
+ * Get the lifecycle event manager for registering handlers
|
||||
+ * for lifecycle events allowed on the {@link BootstrapContext}.
|
||||
+ *
|
||||
+ * @return the lifecycle event manager
|
||||
+ */
|
||||
+ LifecycleEventManager<BootstrapContext> getLifecycleManager();
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event;
|
||||
+
|
||||
+import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+/**
|
||||
+ * Base type for all Lifecycle Events.
|
||||
+ * <p>
|
||||
+ * Lifecycle events are generally fired when the older
|
||||
+ * event system is not available, like during early
|
||||
+ * server initialization.
|
||||
+ * @see LifecycleEvents
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface LifecycleEvent {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventManager.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event;
|
||||
+
|
||||
+import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.LifecycleEventHandlerConfiguration;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEventType;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Manages a plugin's lifecycle events. Can be obtained
|
||||
+ * from {@link org.bukkit.plugin.Plugin} or {@link io.papermc.paper.plugin.bootstrap.BootstrapContext}.
|
||||
+ *
|
||||
+ * @param <O> the owning type, {@link org.bukkit.plugin.Plugin} or {@link io.papermc.paper.plugin.bootstrap.BootstrapContext}
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface LifecycleEventManager<O extends LifecycleEventOwner> {
|
||||
+
|
||||
+ /**
|
||||
+ * Registers an event handler for a specific event type.
|
||||
+ * <p>
|
||||
+ * This is shorthand for creating a new {@link LifecycleEventHandlerConfiguration} and
|
||||
+ * just passing in the {@link LifecycleEventHandler}.
|
||||
+ * <pre>{@code
|
||||
+ * LifecycleEventHandler<RegistrarEvent<Commands>> handler = new Handler();
|
||||
+ * manager.registerEventHandler(LifecycleEvents.COMMANDS, handler);
|
||||
+ * }</pre>
|
||||
+ * is equivalent to
|
||||
+ * <pre>{@code
|
||||
+ * LifecycleEventHandler<RegistrarEvent<Commands>> handler = new Handler();
|
||||
+ * manager.registerEventHandler(LifecycleEvents.COMMANDS.newHandler(handler));
|
||||
+ * }</pre>
|
||||
+ *
|
||||
+ * @param eventType the event type to listen to
|
||||
+ * @param eventHandler the handler for that event
|
||||
+ * @param <E> the type of the event object
|
||||
+ */
|
||||
+ default <E extends LifecycleEvent> void registerEventHandler(final LifecycleEventType<? super O, ? extends E, ?> eventType, final LifecycleEventHandler<? super E> eventHandler) {
|
||||
+ this.registerEventHandler(eventType.newHandler(eventHandler));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Registers an event handler configuration.
|
||||
+ * <p>
|
||||
+ * Configurations are created via {@link LifecycleEventType#newHandler(LifecycleEventHandler)}.
|
||||
+ * Event types may have different configurations options available on the builder-like object
|
||||
+ * returned by {@link LifecycleEventType#newHandler(LifecycleEventHandler)}.
|
||||
+ *
|
||||
+ * @param handlerConfiguration the handler configuration to register
|
||||
+ */
|
||||
+ void registerEventHandler(LifecycleEventHandlerConfiguration<? super O> handlerConfiguration);
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/LifecycleEventOwner.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event;
|
||||
+
|
||||
+import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Implemented by types that are considered owners
|
||||
+ * of registered handlers for lifecycle events. Generally
|
||||
+ * the types that implement this interface also provide
|
||||
+ * a {@link LifecycleEventManager} where you can register
|
||||
+ * event handlers.
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface LifecycleEventOwner {
|
||||
+
|
||||
+ /**
|
||||
+ * Get the plugin meta for this plugin.
|
||||
+ *
|
||||
+ * @return the plugin meta
|
||||
+ */
|
||||
+ PluginMeta getPluginMeta();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/LifecycleEventHandler.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event.handler;
|
||||
+
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * A handler for a specific event. Can be implemented
|
||||
+ * in a concrete class or as a lambda.
|
||||
+ *
|
||||
+ * @param <E> the event
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@FunctionalInterface
|
||||
+public interface LifecycleEventHandler<E extends LifecycleEvent> {
|
||||
+
|
||||
+ void run(E event);
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/LifecycleEventHandlerConfiguration.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event.handler.configuration;
|
||||
+
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Base type for constructing configured event handlers for
|
||||
+ * lifecycle events. Usually created via {@link io.papermc.paper.plugin.lifecycle.event.types.LifecycleEventType#newHandler(LifecycleEventHandler)}
|
||||
+ * from event types in {@link io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents}
|
||||
+ *
|
||||
+ * @param <O>
|
||||
+ */
|
||||
+@SuppressWarnings("unused")
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface LifecycleEventHandlerConfiguration<O extends LifecycleEventOwner> {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/MonitorLifecycleEventHandlerConfiguration.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event.handler.configuration;
|
||||
+
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Handler configuration for event types that allow "monitor" handlers.
|
||||
+ *
|
||||
+ * @param <O> the required owner type
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface MonitorLifecycleEventHandlerConfiguration<O extends LifecycleEventOwner> extends LifecycleEventHandlerConfiguration<O> {
|
||||
+
|
||||
+ /**
|
||||
+ * Sets this handler configuration to be considered a "monitor".
|
||||
+ * These handlers will run last and should only be used by plugins
|
||||
+ * to observe changes from previously run handlers.
|
||||
+ *
|
||||
+ * @return this configuration for chaining
|
||||
+ */
|
||||
+ @Contract("-> this")
|
||||
+ MonitorLifecycleEventHandlerConfiguration<O> monitor();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/handler/configuration/PrioritizedLifecycleEventHandlerConfiguration.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event.handler.configuration;
|
||||
+
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Handler configuration that allows both "monitor" and prioritized handlers.
|
||||
+ * The default priority is 0.
|
||||
+ *
|
||||
+ * @param <O> the required owner type
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface PrioritizedLifecycleEventHandlerConfiguration<O extends LifecycleEventOwner> extends LifecycleEventHandlerConfiguration<O> {
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the priority for this handler. Resets
|
||||
+ * all previous calls to {@link #monitor()}. A
|
||||
+ * lower numeric value correlates to the handler
|
||||
+ * being run earlier.
|
||||
+ *
|
||||
+ * @param priority the numerical priority
|
||||
+ * @return this configuration for chaining
|
||||
+ */
|
||||
+ @Contract("_ -> this")
|
||||
+ PrioritizedLifecycleEventHandlerConfiguration<O> priority(int priority);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets this handler configuration to be considered a "monitor".
|
||||
+ * These handlers will run last and should only be used by plugins
|
||||
+ * to observe any changes from previously ran handlers.
|
||||
+ *
|
||||
+ * @return this configuration for chaining
|
||||
+ */
|
||||
+ @Contract("-> this")
|
||||
+ PrioritizedLifecycleEventHandlerConfiguration<O> monitor();
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/Registrar.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event.registrar;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+/**
|
||||
+ * To be implemented by types that provide ways to register types
|
||||
+ * either on server start or during a reload
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface Registrar {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/RegistrarEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event.registrar;
|
||||
+
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * A lifecycle event that exposes a {@link Registrar} of some kind
|
||||
+ * to allow management of various things. Look at implementations of
|
||||
+ * {@link Registrar} for an idea of what uses this event.
|
||||
+ *
|
||||
+ * @param <R> registrar type
|
||||
+ * @see ReloadableRegistrarEvent
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface RegistrarEvent<R extends Registrar> extends LifecycleEvent {
|
||||
+
|
||||
+ /**
|
||||
+ * Get the registrar related to this event.
|
||||
+ *
|
||||
+ * @return the registrar
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ R registrar();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/registrar/ReloadableRegistrarEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event.registrar;
|
||||
+
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * A lifecycle event that exposes a {@link Registrar} that is
|
||||
+ * reloadable.
|
||||
+ *
|
||||
+ * @param <R> the registrar type
|
||||
+ * @see RegistrarEvent
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface ReloadableRegistrarEvent<R extends Registrar> extends RegistrarEvent<R> {
|
||||
+
|
||||
+ /**
|
||||
+ * Get the cause of this reload.
|
||||
+ *
|
||||
+ * @return the cause
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ Cause cause();
|
||||
+
|
||||
+ @ApiStatus.Experimental
|
||||
+ enum Cause {
|
||||
+ /**
|
||||
+ * The initial load of the server.
|
||||
+ */
|
||||
+ INITIAL,
|
||||
+ /**
|
||||
+ * A reload, triggered via one of the various mechanisms like
|
||||
+ * the bukkit or minecraft reload commands.
|
||||
+ */
|
||||
+ RELOAD
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventType.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event.types;
|
||||
+
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.handler.LifecycleEventHandler;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.LifecycleEventHandlerConfiguration;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.MonitorLifecycleEventHandlerConfiguration;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.handler.configuration.PrioritizedLifecycleEventHandlerConfiguration;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Base type for all types of lifecycle events. Differs from
|
||||
+ * {@link LifecycleEvent} which is the actual event object, whereas
|
||||
+ * this is an object representing the type of the event. Used
|
||||
+ * to construct subtypes of {@link LifecycleEventHandlerConfiguration} for
|
||||
+ * use in {@link LifecycleEventManager}
|
||||
+ *
|
||||
+ * @param <O> the required owner type
|
||||
+ * @param <E> the event object type
|
||||
+ * @param <C> the configuration type
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface LifecycleEventType<O extends LifecycleEventOwner, E extends LifecycleEvent, C extends LifecycleEventHandlerConfiguration<O>> {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the name of the lifecycle event.
|
||||
+ *
|
||||
+ * @return the name
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ String name();
|
||||
+
|
||||
+ /**
|
||||
+ * Create a configuration for this event with the specified
|
||||
+ * handler.
|
||||
+ *
|
||||
+ * @param handler the event handler
|
||||
+ * @return a new configuration
|
||||
+ * @see LifecycleEventManager#registerEventHandler(LifecycleEventHandlerConfiguration)
|
||||
+ */
|
||||
+ @Contract("_ -> new")
|
||||
+ C newHandler(LifecycleEventHandler<? super E> handler);
|
||||
+
|
||||
+ /**
|
||||
+ * Lifecycle event type that supports separate registration
|
||||
+ * of handlers as "monitors" that are run last. Useful
|
||||
+ * if a plugin wants to only observe the changes other handlers
|
||||
+ * made.
|
||||
+ *
|
||||
+ * @param <O> the required owner type
|
||||
+ * @param <E> the event object type
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ @ApiStatus.NonExtendable
|
||||
+ interface Monitorable<O extends LifecycleEventOwner, E extends LifecycleEvent> extends LifecycleEventType<O, E, MonitorLifecycleEventHandlerConfiguration<O>> {
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Lifecycle event type that supports both {@link Monitorable "monitors"} and
|
||||
+ * specific numeric-based priorities.
|
||||
+ *
|
||||
+ * @param <O> the required owner type
|
||||
+ * @param <E> the event object type
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ @ApiStatus.NonExtendable
|
||||
+ interface Prioritizable<O extends LifecycleEventOwner, E extends LifecycleEvent> extends LifecycleEventType<O, E, PrioritizedLifecycleEventHandlerConfiguration<O>> {
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEventTypeProvider.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event.types;
|
||||
+
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner;
|
||||
+import java.util.Optional;
|
||||
+import java.util.ServiceLoader;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+@NullMarked
|
||||
+interface LifecycleEventTypeProvider {
|
||||
+
|
||||
+ Optional<LifecycleEventTypeProvider> INSTANCE = ServiceLoader.load(LifecycleEventTypeProvider.class)
|
||||
+ .findFirst();
|
||||
+
|
||||
+ static LifecycleEventTypeProvider provider() {
|
||||
+ return INSTANCE.orElseThrow();
|
||||
+ }
|
||||
+
|
||||
+ <O extends LifecycleEventOwner, E extends LifecycleEvent> LifecycleEventType.Monitorable<O, E> monitor(String name, Class<? extends O> ownerType);
|
||||
+
|
||||
+ <O extends LifecycleEventOwner, E extends LifecycleEvent> LifecycleEventType.Prioritizable<O, E> prioritized(String name, Class<? extends O> ownerType);
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/lifecycle/event/types/LifecycleEvents.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.plugin.lifecycle.event.types;
|
||||
+
|
||||
+import io.papermc.paper.plugin.bootstrap.BootstrapContext;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEvent;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Holds various types of lifecycle events for
|
||||
+ * use when creating event handler configurations
|
||||
+ * in {@link LifecycleEventManager}.
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+public final class LifecycleEvents {
|
||||
+
|
||||
+ //<editor-fold desc="helper methods" defaultstate="collapsed">
|
||||
+ @ApiStatus.Internal
|
||||
+ static <E extends LifecycleEvent> LifecycleEventType.Monitorable<Plugin, E> plugin(final String name) {
|
||||
+ return monitor(name, Plugin.class);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ static <E extends LifecycleEvent> LifecycleEventType.Prioritizable<Plugin, E> pluginPrioritized(final String name) {
|
||||
+ return prioritized(name, Plugin.class);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ static <E extends LifecycleEvent> LifecycleEventType.Monitorable<BootstrapContext, E> bootstrap(final String name) {
|
||||
+ return monitor(name, BootstrapContext.class);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ static <E extends LifecycleEvent> LifecycleEventType.Prioritizable<BootstrapContext, E> bootstrapPrioritized(final String name) {
|
||||
+ return prioritized(name, BootstrapContext.class);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ static <O extends LifecycleEventOwner, E extends LifecycleEvent, O2 extends O> LifecycleEventType.Monitorable<O, E> monitor(final String name, final Class<O2> ownerType) {
|
||||
+ return LifecycleEventTypeProvider.provider().monitor(name, ownerType);
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ static <O extends LifecycleEventOwner, E extends LifecycleEvent> LifecycleEventType.Prioritizable<O, E> prioritized(final String name, final Class<? extends O> ownerType) {
|
||||
+ return LifecycleEventTypeProvider.provider().prioritized(name, ownerType);
|
||||
+ }
|
||||
+ //</editor-fold>
|
||||
+
|
||||
+ private LifecycleEvents() {
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
||||
*/
|
||||
@Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer);
|
||||
// Paper end - spawn egg color visibility
|
||||
+
|
||||
+ // Paper start - lifecycle event API
|
||||
+ /**
|
||||
+ * @hidden
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal
|
||||
+ io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager<org.bukkit.plugin.Plugin> createPluginLifecycleEventManager(final org.bukkit.plugin.java.JavaPlugin plugin, final java.util.function.BooleanSupplier registrationCheck);
|
||||
+ // Paper end - lifecycle event API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/Plugin.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/Plugin.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
* <p>
|
||||
* The use of {@link PluginBase} is recommended for actual Implementation
|
||||
*/
|
||||
-public interface Plugin extends TabExecutor {
|
||||
+public interface Plugin extends TabExecutor, io.papermc.paper.plugin.lifecycle.event.LifecycleEventOwner { // Paper
|
||||
/**
|
||||
* Returns the folder that the plugin data files are located in. The
|
||||
* folder may not yet exist.
|
||||
@@ -0,0 +0,0 @@ public interface Plugin extends TabExecutor {
|
||||
*/
|
||||
@NotNull
|
||||
public String getName();
|
||||
+
|
||||
+ // Paper start - lifecycle events
|
||||
+ /**
|
||||
+ * Get the lifecycle event manager for registering handlers
|
||||
+ * for lifecycle events allowed on the {@link Plugin}.
|
||||
+ *
|
||||
+ * @return the lifecycle event manager
|
||||
+ */
|
||||
+ io.papermc.paper.plugin.lifecycle.event.@NotNull LifecycleEventManager<Plugin> getLifecycleManager();
|
||||
+ // Paper end - lifecycle events
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
private FileConfiguration newConfig = null;
|
||||
private File configFile = null;
|
||||
private Logger logger = null; // Paper - PluginLogger -> Logger
|
||||
+ // Paper start - lifecycle events
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ private final io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager<org.bukkit.plugin.Plugin> lifecycleEventManager = org.bukkit.Bukkit.getUnsafe().createPluginLifecycleEventManager(this, () -> this.allowsLifecycleRegistration);
|
||||
+ private boolean allowsLifecycleRegistration = true;
|
||||
+ // Paper end
|
||||
|
||||
public JavaPlugin() {
|
||||
// Paper start
|
||||
@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
isEnabled = enabled;
|
||||
|
||||
if (isEnabled) {
|
||||
+ try { // Paper - lifecycle events
|
||||
onEnable();
|
||||
+ } finally { this.allowsLifecycleRegistration = false; } // Paper - lifecycle events
|
||||
} else {
|
||||
onDisable();
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
}
|
||||
return plugin;
|
||||
}
|
||||
+
|
||||
+ // Paper start - lifecycle events
|
||||
+ @Override
|
||||
+ public final io.papermc.paper.plugin.lifecycle.event.@NotNull LifecycleEventManager<org.bukkit.plugin.Plugin> getLifecycleManager() {
|
||||
+ return this.lifecycleEventManager;
|
||||
+ }
|
||||
+ // Paper end - lifecycle events
|
||||
}
|
||||
diff --git a/src/test/java/org/bukkit/plugin/TestPlugin.java b/src/test/java/org/bukkit/plugin/TestPlugin.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/test/java/org/bukkit/plugin/TestPlugin.java
|
||||
+++ b/src/test/java/org/bukkit/plugin/TestPlugin.java
|
||||
@@ -0,0 +0,0 @@ public class TestPlugin extends PluginBase {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
+
|
||||
+ // Paper start - lifecycle events
|
||||
+ @Override
|
||||
+ public io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager<Plugin> getLifecycleManager() {
|
||||
+ throw new UnsupportedOperationException("Not supported.");
|
||||
+ }
|
||||
+ // Paper end - lifecycle events
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Corey Shupe <coreyshupe101@gmail.com>
|
||||
Date: Wed, 11 Jan 2023 16:40:31 -0500
|
||||
Subject: [PATCH] Add Listing API for Player
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public boolean canSee(@NotNull Entity entity);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Returns whether the {@code other} player is listed for {@code this}.
|
||||
+ *
|
||||
+ * @param other The other {@link Player} to check for listing.
|
||||
+ * @return True if the {@code other} player is listed for {@code this}.
|
||||
+ */
|
||||
+ boolean isListed(@NotNull Player other);
|
||||
+
|
||||
+ /**
|
||||
+ * Unlists the {@code other} player from the tablist.
|
||||
+ *
|
||||
+ * @param other The other {@link Player} to de-list.
|
||||
+ * @return True if the {@code other} player was listed.
|
||||
+ */
|
||||
+ boolean unlistPlayer(@NotNull Player other);
|
||||
+
|
||||
+ /**
|
||||
+ * Lists the {@code other} player.
|
||||
+ *
|
||||
+ * @param other The other {@link Player} to list.
|
||||
+ * @return True if the {@code other} player was not listed.
|
||||
+ */
|
||||
+ boolean listPlayer(@NotNull Player other);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Checks to see if this player is currently flying or not.
|
||||
*
|
|
@ -1,22 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Anrza <andrzejrzeczycki314@gmail.com>
|
||||
Date: Wed, 15 Jul 2020 12:07:58 +0200
|
||||
Subject: [PATCH] Add LivingEntity#clearActiveItem
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
org.bukkit.inventory.@NotNull ItemStack getActiveItem();
|
||||
|
||||
+ /**
|
||||
+ * Interrupts any ongoing active "usage" or consumption or an item.
|
||||
+ */
|
||||
+ void clearActiveItem();
|
||||
+
|
||||
/**
|
||||
* Gets the remaining number of ticks for {@link #getActiveItem()}'s usage.
|
||||
*
|
|
@ -1,134 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 22 Sep 2018 00:32:53 -0500
|
||||
Subject: [PATCH] Add LivingEntity#getTargetEntity
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/TargetEntityInfo.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Represents information about a targeted entity
|
||||
+ * @deprecated use {@link org.bukkit.util.RayTraceResult}
|
||||
+ */
|
||||
+@Deprecated(forRemoval = true, since = "1.19.3")
|
||||
+public class TargetEntityInfo {
|
||||
+ private final Entity entity;
|
||||
+ private final Vector hitVec;
|
||||
+
|
||||
+ public TargetEntityInfo(@NotNull Entity entity, @NotNull Vector hitVec) {
|
||||
+ this.entity = entity;
|
||||
+ this.hitVec = hitVec;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the entity that is targeted
|
||||
+ *
|
||||
+ * @return Targeted entity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getEntity() {
|
||||
+ return entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the position the entity is targeted at
|
||||
+ *
|
||||
+ * @return Targeted position
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Vector getHitVector() {
|
||||
+ return hitVec;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
@Deprecated(forRemoval = true, since = "1.19.3")
|
||||
@Nullable
|
||||
public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets information about the entity being targeted
|
||||
+ *
|
||||
+ * @param maxDistance this is the maximum distance to scan
|
||||
+ * @return entity being targeted, or null if no entity is targeted
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default Entity getTargetEntity(int maxDistance) {
|
||||
+ return getTargetEntity(maxDistance, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets information about the entity being targeted
|
||||
+ *
|
||||
+ * @param maxDistance this is the maximum distance to scan
|
||||
+ * @param ignoreBlocks true to scan through blocks
|
||||
+ * @return entity being targeted, or null if no entity is targeted
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getTargetEntity(int maxDistance, boolean ignoreBlocks);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets information about the entity being targeted
|
||||
+ *
|
||||
+ * @param maxDistance this is the maximum distance to scan
|
||||
+ * @return TargetEntityInfo about the entity being targeted,
|
||||
+ * or null if no entity is targeted
|
||||
+ * @deprecated use {@link #rayTraceEntities(int)}
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true, since = "1.19.3")
|
||||
+ @Nullable
|
||||
+ public default com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance) {
|
||||
+ return getTargetEntityInfo(maxDistance, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets information about the entity being targeted
|
||||
+ *
|
||||
+ * @param maxDistance this is the maximum distance to scan
|
||||
+ * @return RayTraceResult about the entity being targeted,
|
||||
+ * or null if no entity is targeted
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default RayTraceResult rayTraceEntities(int maxDistance) {
|
||||
+ return this.rayTraceEntities(maxDistance, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets information about the entity being targeted
|
||||
+ *
|
||||
+ * @param maxDistance this is the maximum distance to scan
|
||||
+ * @param ignoreBlocks true to scan through blocks
|
||||
+ * @return TargetEntityInfo about the entity being targeted,
|
||||
+ * or null if no entity is targeted
|
||||
+ * @deprecated use {@link #rayTraceEntities(int, boolean)}
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true, since = "1.19.3")
|
||||
+ @Nullable
|
||||
+ public com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets information about the entity being targeted
|
||||
+ *
|
||||
+ * @param maxDistance this is the maximum distance to scan
|
||||
+ * @param ignoreBlocks true to scan through blocks
|
||||
+ * @return RayTraceResult about the entity being targeted,
|
||||
+ * or null if no entity is targeted
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ RayTraceResult rayTraceEntities(int maxDistance, boolean ignoreBlocks);
|
||||
// Paper end
|
||||
|
||||
/**
|
|
@ -1,35 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SoSeDiK <mrsosedik@gmail.com>
|
||||
Date: Tue, 11 Oct 2022 22:35:56 +0300
|
||||
Subject: [PATCH] Add LivingEntity#swingHand(EquipmentSlot) convenience method
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
@Deprecated
|
||||
void setHurtDirection(float hurtDirection);
|
||||
// Paper end - hurt direction API
|
||||
+
|
||||
+ // Paper start - swing hand API
|
||||
+ /**
|
||||
+ * Makes this entity swing their hand.
|
||||
+ *
|
||||
+ * <p>This method does nothing if this entity does not
|
||||
+ * have an animation for swinging their hand.
|
||||
+ *
|
||||
+ * @param hand hand to be swung, either {@link org.bukkit.inventory.EquipmentSlot#HAND} or {@link org.bukkit.inventory.EquipmentSlot#OFF_HAND}
|
||||
+ * @throws IllegalArgumentException if invalid hand is passed
|
||||
+ */
|
||||
+ default void swingHand(@NotNull org.bukkit.inventory.EquipmentSlot hand) {
|
||||
+ com.google.common.base.Preconditions.checkArgument(hand != null && hand.isHand(), String.format("Expected a valid hand, got \"%s\" instead!", hand));
|
||||
+ if (hand == org.bukkit.inventory.EquipmentSlot.HAND) {
|
||||
+ this.swingMainHand();
|
||||
+ } else {
|
||||
+ this.swingOffHand();
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - swing hand API
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,46 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 16 Jul 2013 21:26:50 -0400
|
||||
Subject: [PATCH] Add MetadataStoreBase.removeAll(Plugin)
|
||||
|
||||
So that on reload, metadata will be cleared
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
|
||||
+++ b/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
|
||||
@@ -0,0 +0,0 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
+import java.util.Iterator; // Paper
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
@@ -0,0 +0,0 @@ public abstract class MetadataStoreBase<T> {
|
||||
}
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Removes all metadata in the metadata store that originates from the
|
||||
+ * given plugin.
|
||||
+ *
|
||||
+ * @param owningPlugin the plugin requesting the invalidation.
|
||||
+ * @throws IllegalArgumentException If plugin is null
|
||||
+ */
|
||||
+ public void removeAll(@NotNull Plugin owningPlugin) {
|
||||
+ Preconditions.checkNotNull(owningPlugin, "Plugin cannot be null");
|
||||
+ for (Iterator<Map<Plugin, MetadataValue>> iterator = metadataMap.values().iterator(); iterator.hasNext(); ) {
|
||||
+ Map<Plugin, MetadataValue> values = iterator.next();
|
||||
+ if (values.containsKey(owningPlugin)) {
|
||||
+ values.remove(owningPlugin);
|
||||
+ }
|
||||
+ if (values.isEmpty()) {
|
||||
+ iterator.remove();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Creates a unique name for the object receiving metadata by combining
|
||||
* unique data from the subject with a metadataKey.
|
|
@ -1,24 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: GodOfPro <1387ilia@gmail.com>
|
||||
Date: Tue, 11 Apr 2023 16:30:58 +0430
|
||||
Subject: [PATCH] Add Mob Experience reward API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Mob.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Mob.java
|
||||
@@ -0,0 +0,0 @@ public interface Mob extends LivingEntity, Lootable {
|
||||
*/
|
||||
public void setLeftHanded(boolean leftHanded);
|
||||
// Paper end - left-handed API
|
||||
+
|
||||
+ // Paper start - mob xp reward API
|
||||
+ /**
|
||||
+ * Gets the amount of experience the mob will possibly drop. This value is randomized and it can give different results
|
||||
+ *
|
||||
+ * @return the amount of experience the mob will possibly drop
|
||||
+ */
|
||||
+ public int getPossibleExperienceReward();
|
||||
+ // Paper end - mob xp reward API
|
||||
}
|
|
@ -1,250 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MiniDigger | Martin <admin@minidigger.dev>
|
||||
Date: Fri, 3 Jan 2020 16:24:46 +0100
|
||||
Subject: [PATCH] Add Mob Goal API
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java b/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/Goal.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.entity.ai;
|
||||
+
|
||||
+import java.util.EnumSet;
|
||||
+import org.bukkit.entity.Mob;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Represents an AI goal of an entity
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public interface Goal<T extends Mob> {
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this goal should be activated
|
||||
+ *
|
||||
+ * @return if this goal should be activated
|
||||
+ */
|
||||
+ boolean shouldActivate();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this goal should stay active, defaults to {@link Goal#shouldActivate()}
|
||||
+ *
|
||||
+ * @return if this goal should stay active
|
||||
+ */
|
||||
+ default boolean shouldStayActive() {
|
||||
+ return this.shouldActivate();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called when this goal gets activated
|
||||
+ */
|
||||
+ default void start() {
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called when this goal gets stopped
|
||||
+ */
|
||||
+ default void stop() {
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Called each tick the goal is activated
|
||||
+ */
|
||||
+ default void tick() {
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * A unique key that identifies this type of goal. Plugins should use their own namespace, not the minecraft
|
||||
+ * namespace. Additionally, this key also specifies to what mobs this goal can be applied to
|
||||
+ *
|
||||
+ * @return the goal key
|
||||
+ */
|
||||
+ GoalKey<T> getKey();
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a list of all applicable flags for this goal.<br>
|
||||
+ * <p>
|
||||
+ * This method is only called on construction.
|
||||
+ *
|
||||
+ * @return the subtypes.
|
||||
+ */
|
||||
+ EnumSet<GoalType> getTypes();
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java b/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/GoalKey.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.entity.ai;
|
||||
+
|
||||
+import com.google.common.base.Objects;
|
||||
+import java.util.StringJoiner;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.entity.Mob;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Used to identify a Goal. Consists of a {@link NamespacedKey} and the type of mob the goal can be applied to
|
||||
+ *
|
||||
+ * @param <T> the type of mob the goal can be applied to
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public final class GoalKey<T extends Mob> {
|
||||
+
|
||||
+ private final Class<T> entityClass;
|
||||
+ private final NamespacedKey namespacedKey;
|
||||
+
|
||||
+ private GoalKey(Class<T> entityClass, NamespacedKey namespacedKey) {
|
||||
+ this.entityClass = entityClass;
|
||||
+ this.namespacedKey = namespacedKey;
|
||||
+ }
|
||||
+
|
||||
+ public Class<T> getEntityClass() {
|
||||
+ return this.entityClass;
|
||||
+ }
|
||||
+
|
||||
+ public NamespacedKey getNamespacedKey() {
|
||||
+ return this.namespacedKey;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(@Nullable Object o) {
|
||||
+ if (this == o) return true;
|
||||
+ if (o == null || this.getClass() != o.getClass()) return false;
|
||||
+ GoalKey<?> goalKey = (GoalKey<?>) o;
|
||||
+ return Objects.equal(this.entityClass, goalKey.entityClass) &&
|
||||
+ Objects.equal(this.namespacedKey, goalKey.namespacedKey);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return Objects.hashCode(this.entityClass, this.namespacedKey);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return new StringJoiner(", ", GoalKey.class.getSimpleName() + "[", "]")
|
||||
+ .add("entityClass=" + this.entityClass)
|
||||
+ .add("namespacedKey=" + this.namespacedKey)
|
||||
+ .toString();
|
||||
+ }
|
||||
+
|
||||
+ public static <A extends Mob> GoalKey<A> of(Class<A> entityClass, NamespacedKey namespacedKey) {
|
||||
+ return new GoalKey<>(entityClass, namespacedKey);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java b/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/GoalType.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.entity.ai;
|
||||
+
|
||||
+/**
|
||||
+ * Represents the subtype of a goal. Used by minecraft to disable certain types of goals if needed.
|
||||
+ */
|
||||
+public enum GoalType {
|
||||
+
|
||||
+ MOVE,
|
||||
+ LOOK,
|
||||
+ JUMP,
|
||||
+ TARGET,
|
||||
+ /**
|
||||
+ * Used to map vanilla goals, that are a behavior goal but don't have a type set...
|
||||
+ */
|
||||
+ UNKNOWN_BEHAVIOR,
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoals.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.entity.ai;
|
||||
+
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+import org.bukkit.entity.Mob;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a part of the "brain" of a mob. It tracks all tasks (running or not), allows adding and removing goals
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public interface MobGoals {
|
||||
+
|
||||
+ <T extends Mob> void addGoal(T mob, int priority, Goal<T> goal);
|
||||
+
|
||||
+ <T extends Mob> void removeGoal(T mob, Goal<T> goal);
|
||||
+
|
||||
+ <T extends Mob> void removeAllGoals(T mob);
|
||||
+
|
||||
+ <T extends Mob> void removeAllGoals(T mob, GoalType type);
|
||||
+
|
||||
+ <T extends Mob> void removeGoal(T mob, GoalKey<T> key);
|
||||
+
|
||||
+ <T extends Mob> boolean hasGoal(T mob, GoalKey<T> key);
|
||||
+
|
||||
+ <T extends Mob> @Nullable Goal<T> getGoal(T mob, GoalKey<T> key);
|
||||
+
|
||||
+ <T extends Mob> Collection<Goal<T>> getGoals(T mob, GoalKey<T> key);
|
||||
+
|
||||
+ <T extends Mob> Collection<Goal<T>> getAllGoals(T mob);
|
||||
+
|
||||
+ <T extends Mob> Collection<Goal<T>> getAllGoals(T mob, GoalType type);
|
||||
+
|
||||
+ <T extends Mob> Collection<Goal<T>> getAllGoalsWithout(T mob, GoalType type);
|
||||
+
|
||||
+ <T extends Mob> Collection<Goal<T>> getRunningGoals(T mob);
|
||||
+
|
||||
+ <T extends Mob> Collection<Goal<T>> getRunningGoals(T mob, GoalType type);
|
||||
+
|
||||
+ <T extends Mob> Collection<Goal<T>> getRunningGoalsWithout(T mob, GoalType type);
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -0,0 +0,0 @@ public final class Bukkit {
|
||||
public static boolean isStopping() {
|
||||
return server.isStopping();
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager
|
||||
+ *
|
||||
+ * @return the mob goals manager
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
|
||||
+ return server.getMobGoals();
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@NotNull
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
* @return true if server is in the process of being shutdown
|
||||
*/
|
||||
boolean isStopping();
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager
|
||||
+ *
|
||||
+ * @return the mob goals manager
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
|
||||
// Paper end
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Mob.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Mob.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
/**
|
||||
* Instructs this Mob to set the specified LivingEntity as its target.
|
|
@ -1,97 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 24 Aug 2018 11:50:16 -0500
|
||||
Subject: [PATCH] Add More Creeper API
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Creeper;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a Creeper is ignited either by a
|
||||
+ * flint and steel, {@link Creeper#ignite()} or
|
||||
+ * {@link Creeper#setIgnited(boolean)}.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class CreeperIgniteEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private boolean ignited;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public CreeperIgniteEvent(final Creeper creeper, final boolean ignited) {
|
||||
+ super(creeper);
|
||||
+ this.ignited = ignited;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Creeper getEntity() {
|
||||
+ return (Creeper) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ public boolean isIgnited() {
|
||||
+ return this.ignited;
|
||||
+ }
|
||||
+
|
||||
+ public void setIgnited(final boolean ignited) {
|
||||
+ this.ignited = ignited;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final 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/org/bukkit/entity/Creeper.java b/src/main/java/org/bukkit/entity/Creeper.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Creeper.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Creeper.java
|
||||
@@ -0,0 +0,0 @@ public interface Creeper extends Monster {
|
||||
*/
|
||||
@Nullable
|
||||
public Entity getIgniter();
|
||||
+ // Paper start
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether creeper is ignited or not (armed to explode)
|
||||
+ *
|
||||
+ * @param ignited New ignited state
|
||||
+ */
|
||||
+ public void setIgnited(boolean ignited);
|
||||
+
|
||||
+ /**
|
||||
+ * Check if creeper is ignited or not (armed to explode)
|
||||
+ *
|
||||
+ * @return Ignited state
|
||||
+ */
|
||||
+ public boolean isIgnited();
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Sat, 4 Dec 2021 13:29:45 -0500
|
||||
Subject: [PATCH] Add Moving Piston API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/block/MovingPiston.java b/src/main/java/io/papermc/paper/block/MovingPiston.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/block/MovingPiston.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.block;
|
||||
+
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.bukkit.block.TileState;
|
||||
+import org.bukkit.block.data.BlockData;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@NullMarked
|
||||
+public interface MovingPiston extends TileState {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block that is being pushed
|
||||
+ *
|
||||
+ * @return the pushed block
|
||||
+ */
|
||||
+ BlockData getMovingBlock();
|
||||
+
|
||||
+ /**
|
||||
+ * The direction that the current moving piston
|
||||
+ * is pushing/pulling a block in.
|
||||
+ *
|
||||
+ * @return the direction
|
||||
+ */
|
||||
+ BlockFace getDirection();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if the piston is extending or not.
|
||||
+ * Returns false if the piston is retracting.
|
||||
+ *
|
||||
+ * @return is extending or not
|
||||
+ */
|
||||
+ boolean isExtending();
|
||||
+
|
||||
+ /**
|
||||
+ * Returns if this moving piston represents the main piston head
|
||||
+ * from the original piston.
|
||||
+ *
|
||||
+ * @return is the piston head or not
|
||||
+ */
|
||||
+ boolean isPistonHead();
|
||||
+
|
||||
+}
|
|
@ -1,49 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Roy <10731363+JRoy@users.noreply.github.com>
|
||||
Date: Sun, 14 Aug 2022 12:22:54 -0400
|
||||
Subject: [PATCH] Add NamespacedKey biome methods
|
||||
|
||||
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
||||
*/
|
||||
@org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey);
|
||||
// Paper end
|
||||
+
|
||||
+ // Paper start - namespaced key biome methods
|
||||
+ /**
|
||||
+ * Gets the {@link NamespacedKey} for the biome at the given location.
|
||||
+ *
|
||||
+ * @param accessor The {@link RegionAccessor} of the provided coordinates
|
||||
+ * @param x X-coordinate of the block
|
||||
+ * @param y Y-coordinate of the block
|
||||
+ * @param z Z-coordinate of the block
|
||||
+ * @deprecated custom biomes are properly supported in API now
|
||||
+ * @return the biome's {@link NamespacedKey}
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.NotNull
|
||||
+ @Deprecated(since = "1.21.3", forRemoval = true)
|
||||
+ NamespacedKey getBiomeKey(RegionAccessor accessor, int x, int y, int z);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the biome at the given location to a biome registered
|
||||
+ * to the given {@link NamespacedKey}. If no biome by the given
|
||||
+ * {@link NamespacedKey} exists, an {@link IllegalStateException}
|
||||
+ * will be thrown.
|
||||
+ *
|
||||
+ * @param accessor The {@link RegionAccessor} of the provided coordinates
|
||||
+ * @param x X-coordinate of the block
|
||||
+ * @param y Y-coordinate of the block
|
||||
+ * @param z Z-coordinate of the block
|
||||
+ * @param biomeKey Biome key
|
||||
+ * @deprecated custom biomes are properly supported in API now
|
||||
+ * @throws IllegalStateException if no biome by the given key is registered.
|
||||
+ */
|
||||
+ @Deprecated(since = "1.21.3", forRemoval = true)
|
||||
+ void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey);
|
||||
+ // Paper end - namespaced key biome methods
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 24 Dec 2020 12:43:30 -0800
|
||||
Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java b/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerBedEnterEvent.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
|
||||
* Entering the bed is prevented due to the player being too far away.
|
||||
*/
|
||||
TOO_FAR_AWAY,
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Bed was obstructed.
|
||||
+ */
|
||||
+ OBSTRUCTED,
|
||||
+ // Paper end
|
||||
/**
|
||||
* Entering the bed is prevented due to there being monsters nearby.
|
||||
*/
|
|
@ -1,40 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
|
||||
Date: Sat, 9 Jul 2022 17:17:04 +0200
|
||||
Subject: [PATCH] Add Offline PDC API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
* player that is stored on the disk and can, thus, be retrieved without the
|
||||
* player needing to be online.
|
||||
*/
|
||||
-public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable {
|
||||
+public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable, io.papermc.paper.persistence.PersistentDataViewHolder { // Paper - Add Offline PDC API
|
||||
|
||||
/**
|
||||
* Checks if this player is currently online
|
||||
@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
*/
|
||||
@Nullable
|
||||
public Location getLocation();
|
||||
+ // Paper start - add pdc to offline player
|
||||
+ /**
|
||||
+ * Yields a view of the persistent data container for this offline player.
|
||||
+ * In case this {@link OfflinePlayer} instance was created for an offline player, the returned view will wrap the persistent
|
||||
+ * data on disk.
|
||||
+ * <p>
|
||||
+ * As such, this method as well as queries to the {@link io.papermc.paper.persistence.PersistentDataContainerView}
|
||||
+ * may produce blocking IO requests to read the requested data from disk.
|
||||
+ * Caution in its usage is hence advised.
|
||||
+ *
|
||||
+ * @return the persistent data container view
|
||||
+ * @see io.papermc.paper.persistence.PersistentDataViewHolder#getPersistentDataContainer()
|
||||
+ */
|
||||
+ @Override
|
||||
+ io.papermc.paper.persistence.@NotNull PersistentDataContainerView getPersistentDataContainer();
|
||||
+ // Paper end - add pdc to offline player
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aeltumn <daniel@goossens.ch>
|
||||
Date: Thu, 24 Aug 2023 13:05:07 +0200
|
||||
Subject: [PATCH] Add OfflinePlayer#isConnected
|
||||
|
||||
This adds an alternative to OfflinePlayer#isOnline that returns true only if the same instance of the player is still online. This is generally more useful than isOnline as it allows you to determine if you have an instance of a Player that still exists. If a player relogs an old Player instance becomes unlinked leading to e.g. messages sent to the old player no longer arriving despite isOnline returning true. Checking against isConnected is more useful there to discard invalid instances.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
@@ -0,0 +0,0 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||
/**
|
||||
* Checks if this player is currently online
|
||||
*
|
||||
+ * It should be noted that this will return true if any instance of this player is
|
||||
+ * online! This instance may have disconnected. If you wish to check if this specific
|
||||
+ * instance of the player is still online, see {@link OfflinePlayer#isConnected()}.
|
||||
+ *
|
||||
* @return true if they are online
|
||||
*/
|
||||
public boolean isOnline();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Checks whether the connection to this player is still valid. This will return
|
||||
+ * true as long as this specific instance of the player is still connected. This
|
||||
+ * will return false after this instance has disconnected, even if the same player
|
||||
+ * has reconnected since.
|
||||
+ *
|
||||
+ * @return true if this player instance is connected
|
||||
+ */
|
||||
+ public boolean isConnected();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Returns the name of this player
|
||||
* <p>
|
|
@ -1,72 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 25 Aug 2018 19:56:42 -0500
|
||||
Subject: [PATCH] Add PhantomPreSpawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a phantom is spawned for an exhausted player
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent {
|
||||
+
|
||||
+ private final Entity entity;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PhantomPreSpawnEvent(final Location location, final Entity entity, final CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ super(location, EntityType.PHANTOM, reason);
|
||||
+ this.entity = entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the entity this phantom is spawning for
|
||||
+ *
|
||||
+ * @return the Entity
|
||||
+ */
|
||||
+ public Entity getSpawningEntity() {
|
||||
+ return this.entity;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Phantom.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Phantom.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
/**
|
||||
* Represents a phantom.
|
||||
*/
|
||||
@@ -0,0 +0,0 @@ public interface Phantom extends Flying, Enemy {
|
||||
* @param sz The new size of the phantom.
|
||||
*/
|
||||
public void setSize(int sz);
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get the UUID of the entity that caused this phantom to spawn
|
||||
+ *
|
||||
+ * @return UUID
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public java.util.UUID getSpawningEntity();
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,280 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MiniDigger | Martin <admin@minidigger.dev>
|
||||
Date: Mon, 20 Jan 2020 21:38:34 +0100
|
||||
Subject: [PATCH] Add Player Client Options API
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/ClientOption.java b/src/main/java/com/destroystokyo/paper/ClientOption.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/ClientOption.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+import net.kyori.adventure.translation.Translatable;
|
||||
+import net.kyori.adventure.util.Index;
|
||||
+import org.bukkit.inventory.MainHand;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@NullMarked
|
||||
+public final class ClientOption<T> {
|
||||
+
|
||||
+ public static final ClientOption<SkinParts> SKIN_PARTS = new ClientOption<>(SkinParts.class);
|
||||
+ public static final ClientOption<Boolean> CHAT_COLORS_ENABLED = new ClientOption<>(Boolean.class);
|
||||
+ public static final ClientOption<ChatVisibility> CHAT_VISIBILITY = new ClientOption<>(ChatVisibility.class);
|
||||
+ public static final ClientOption<String> LOCALE = new ClientOption<>(String.class);
|
||||
+ public static final ClientOption<MainHand> MAIN_HAND = new ClientOption<>(MainHand.class);
|
||||
+ public static final ClientOption<Integer> VIEW_DISTANCE = new ClientOption<>(Integer.class);
|
||||
+ public static final ClientOption<Boolean> TEXT_FILTERING_ENABLED = new ClientOption<>(Boolean.class);
|
||||
+ public static final ClientOption<Boolean> ALLOW_SERVER_LISTINGS = new ClientOption<>(Boolean.class);
|
||||
+ public static final ClientOption<ParticleVisibility> PARTICLE_VISIBILITY = new ClientOption<>(ParticleVisibility.class);
|
||||
+
|
||||
+ private final Class<T> type;
|
||||
+
|
||||
+ private ClientOption(final Class<T> type) {
|
||||
+ this.type = type;
|
||||
+ }
|
||||
+
|
||||
+ public Class<T> getType() {
|
||||
+ return this.type;
|
||||
+ }
|
||||
+
|
||||
+ public enum ChatVisibility implements Translatable {
|
||||
+ FULL("full"),
|
||||
+ SYSTEM("system"),
|
||||
+ HIDDEN("hidden"),
|
||||
+ /**
|
||||
+ * @deprecated no longer used anymore since 1.15.2, the value fallback
|
||||
+ * to the default value of the setting when unknown on the server.
|
||||
+ * In this case {@link #FULL} will be returned.
|
||||
+ */
|
||||
+ @Deprecated(since = "1.15.2", forRemoval = true)
|
||||
+ UNKNOWN("unknown");
|
||||
+
|
||||
+ public static final Index<String, ChatVisibility> NAMES = Index.create(ChatVisibility.class, chatVisibility -> chatVisibility.name);
|
||||
+ private final String name;
|
||||
+
|
||||
+ ChatVisibility(final String name) {
|
||||
+ this.name = name;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String translationKey() {
|
||||
+ if (this == UNKNOWN) {
|
||||
+ throw new UnsupportedOperationException(this.name + " doesn't have a translation key");
|
||||
+ }
|
||||
+ return "options.chat.visibility." + this.name;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public enum ParticleVisibility implements Translatable {
|
||||
+ ALL("all"),
|
||||
+ DECREASED("decreased"),
|
||||
+ MINIMAL("minimal");
|
||||
+
|
||||
+ public static final Index<String, ParticleVisibility> NAMES = Index.create(ParticleVisibility.class, particleVisibility -> particleVisibility.name);
|
||||
+ private final String name;
|
||||
+
|
||||
+ ParticleVisibility(final String name) {
|
||||
+ this.name = name;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String translationKey() {
|
||||
+ return "options.particles." + this.name;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/SkinParts.java b/src/main/java/com/destroystokyo/paper/SkinParts.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/SkinParts.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+public interface SkinParts {
|
||||
+
|
||||
+ boolean hasCapeEnabled();
|
||||
+
|
||||
+ boolean hasJacketEnabled();
|
||||
+
|
||||
+ boolean hasLeftSleeveEnabled();
|
||||
+
|
||||
+ boolean hasRightSleeveEnabled();
|
||||
+
|
||||
+ boolean hasLeftPantsEnabled();
|
||||
+
|
||||
+ boolean hasRightPantsEnabled();
|
||||
+
|
||||
+ boolean hasHatsEnabled();
|
||||
+
|
||||
+ int getRaw();
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerClientOptionsChangeEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.destroystokyo.paper.ClientOption;
|
||||
+import com.destroystokyo.paper.ClientOption.ChatVisibility;
|
||||
+import com.destroystokyo.paper.ClientOption.ParticleVisibility;
|
||||
+import com.destroystokyo.paper.SkinParts;
|
||||
+import java.util.Map;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.MainHand;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the player changes their client settings
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerClientOptionsChangeEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final String locale;
|
||||
+ private final int viewDistance;
|
||||
+ private final ChatVisibility chatVisibility;
|
||||
+ private final boolean chatColors;
|
||||
+ private final SkinParts skinparts;
|
||||
+ private final MainHand mainHand;
|
||||
+ private final boolean allowsServerListings;
|
||||
+ private final boolean textFilteringEnabled;
|
||||
+ private final ParticleVisibility particleVisibility;
|
||||
+
|
||||
+ @Deprecated
|
||||
+ public PlayerClientOptionsChangeEvent(final Player player, final String locale, final int viewDistance, final ChatVisibility chatVisibility, final boolean chatColors, final SkinParts skinParts, final MainHand mainHand) {
|
||||
+ super(player);
|
||||
+ this.locale = locale;
|
||||
+ this.viewDistance = viewDistance;
|
||||
+ this.chatVisibility = chatVisibility;
|
||||
+ this.chatColors = chatColors;
|
||||
+ this.skinparts = skinParts;
|
||||
+ this.mainHand = mainHand;
|
||||
+ this.allowsServerListings = false;
|
||||
+ this.textFilteringEnabled = false;
|
||||
+ this.particleVisibility = ParticleVisibility.ALL;
|
||||
+ }
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerClientOptionsChangeEvent(final Player player, final Map<ClientOption<?>, ?> options) {
|
||||
+ super(player);
|
||||
+
|
||||
+ this.locale = (String) options.get(ClientOption.LOCALE);
|
||||
+ this.viewDistance = (int) options.get(ClientOption.VIEW_DISTANCE);
|
||||
+ this.chatVisibility = (ChatVisibility) options.get(ClientOption.CHAT_VISIBILITY);
|
||||
+ this.chatColors = (boolean) options.get(ClientOption.CHAT_COLORS_ENABLED);
|
||||
+ this.skinparts = (SkinParts) options.get(ClientOption.SKIN_PARTS);
|
||||
+ this.mainHand = (MainHand) options.get(ClientOption.MAIN_HAND);
|
||||
+ this.allowsServerListings = (boolean) options.get(ClientOption.ALLOW_SERVER_LISTINGS);
|
||||
+ this.textFilteringEnabled = (boolean) options.get(ClientOption.TEXT_FILTERING_ENABLED);
|
||||
+ this.particleVisibility = (ParticleVisibility) options.get(ClientOption.PARTICLE_VISIBILITY);
|
||||
+ }
|
||||
+
|
||||
+ public String getLocale() {
|
||||
+ return this.locale;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasLocaleChanged() {
|
||||
+ return !this.locale.equals(this.player.getClientOption(ClientOption.LOCALE));
|
||||
+ }
|
||||
+
|
||||
+ public int getViewDistance() {
|
||||
+ return this.viewDistance;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasViewDistanceChanged() {
|
||||
+ return this.viewDistance != this.player.getClientOption(ClientOption.VIEW_DISTANCE);
|
||||
+ }
|
||||
+
|
||||
+ public ChatVisibility getChatVisibility() {
|
||||
+ return this.chatVisibility;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatVisibilityChanged() {
|
||||
+ return this.chatVisibility != this.player.getClientOption(ClientOption.CHAT_VISIBILITY);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatColorsEnabled() {
|
||||
+ return this.chatColors;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatColorsEnabledChanged() {
|
||||
+ return this.chatColors != this.player.getClientOption(ClientOption.CHAT_COLORS_ENABLED);
|
||||
+ }
|
||||
+
|
||||
+ public SkinParts getSkinParts() {
|
||||
+ return this.skinparts;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasSkinPartsChanged() {
|
||||
+ return this.skinparts.getRaw() != this.player.getClientOption(ClientOption.SKIN_PARTS).getRaw();
|
||||
+ }
|
||||
+
|
||||
+ public MainHand getMainHand() {
|
||||
+ return this.mainHand;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasMainHandChanged() {
|
||||
+ return this.mainHand != this.player.getClientOption(ClientOption.MAIN_HAND);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasTextFilteringEnabled() {
|
||||
+ return this.textFilteringEnabled;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasTextFilteringChanged() {
|
||||
+ return this.textFilteringEnabled != this.player.getClientOption(ClientOption.TEXT_FILTERING_ENABLED);
|
||||
+ }
|
||||
+
|
||||
+ public boolean allowsServerListings() {
|
||||
+ return this.allowsServerListings;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasAllowServerListingsChanged() {
|
||||
+ return this.allowsServerListings != this.player.getClientOption(ClientOption.ALLOW_SERVER_LISTINGS);
|
||||
+ }
|
||||
+
|
||||
+ public ParticleVisibility getParticleVisibility() {
|
||||
+ return this.particleVisibility;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasParticleVisibilityChanged() {
|
||||
+ return this.particleVisibility != this.player.getClientOption(ClientOption.PARTICLE_VISIBILITY);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
void resetCooldown();
|
||||
// Paper end - attack cooldown API
|
||||
|
||||
+ // Paper start - client option API
|
||||
+ /**
|
||||
+ * @return the client option value of the player
|
||||
+ */
|
||||
+ <T> @NotNull T getClientOption(com.destroystokyo.paper.@NotNull ClientOption<T> option);
|
||||
+ // Paper end - client option API
|
||||
+
|
||||
// Spigot start
|
||||
public class Spigot extends Entity.Spigot {
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: dawon <dawon@dawon.eu>
|
||||
Date: Sat, 15 Oct 2022 00:46:32 +0200
|
||||
Subject: [PATCH] Add Player Warden Warning API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param silent whether sound should be silenced
|
||||
*/
|
||||
void showElderGuardian(boolean silent);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the player's cooldown in ticks until the next Warden warning can occur.
|
||||
+ *
|
||||
+ * @return ticks until next Warden warning can occur. 0 means there is no cooldown left.
|
||||
+ */
|
||||
+ int getWardenWarningCooldown();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the player's cooldown in ticks until next Warden warning can occur.
|
||||
+ *
|
||||
+ * @param cooldown ticks until next Warden warning can occur. 0 means there is no cooldown left. Values less than 0 are set to 0.
|
||||
+ */
|
||||
+ void setWardenWarningCooldown(int cooldown);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns time since last Warden warning in ticks.
|
||||
+ *
|
||||
+ * @return ticks since last Warden warning
|
||||
+ */
|
||||
+ int getWardenTimeSinceLastWarning();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets time since last Warden warning in ticks.
|
||||
+ *
|
||||
+ * @param time ticks since last Warden warning
|
||||
+ */
|
||||
+ void setWardenTimeSinceLastWarning(int time);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the player's current Warden warning level.
|
||||
+ *
|
||||
+ * @return current Warden warning level
|
||||
+ */
|
||||
+ int getWardenWarningLevel();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the player's Warden warning level.
|
||||
+ * <p>
|
||||
+ * <b>Note:</b> This will not actually spawn the Warden.
|
||||
+ * Even if the warning level is over threshold, the player still needs to activate a Shrieker in order to summon the Warden.
|
||||
+ *
|
||||
+ * @param warningLevel player's Warden warning level. The warning level is internally limited to valid values.
|
||||
+ */
|
||||
+ void setWardenWarningLevel(int warningLevel);
|
||||
+
|
||||
+ /**
|
||||
+ * Increases the player's Warden warning level if possible and not on cooldown.
|
||||
+ * <p>
|
||||
+ * <b>Note:</b> This will not actually spawn the Warden.
|
||||
+ * Even if the warning level is over threshold, the player still needs to activate a Shrieker in order to summon the Warden.
|
||||
+ */
|
||||
+ void increaseWardenWarningLevel();
|
||||
// Paper end
|
||||
|
||||
@NotNull
|
|
@ -1,24 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: u9g <git@u9g.dev>
|
||||
Date: Tue, 14 Jun 2022 19:35:21 -0400
|
||||
Subject: [PATCH] Add Player#getFishHook
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
@@ -0,0 +0,0 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
|
||||
@Nullable
|
||||
public Location getPotentialBedLocation();
|
||||
// Paper end
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * @return the player's fishing hook if they are fishing
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ FishHook getFishHook();
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Attempts to make the entity sleep at the given location.
|
|
@ -1,93 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 19 Jan 2018 08:15:14 -0600
|
||||
Subject: [PATCH] Add PlayerAdvancementCriterionGrantEvent
|
||||
|
||||
Co-authored-by: The456gamer <the456gamer@the456gamer.dev>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAdvancementCriterionGrantEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.advancement.Advancement;
|
||||
+import org.bukkit.advancement.AdvancementProgress;
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called after a player is granted a criteria in an advancement.
|
||||
+ * If cancelled the criteria will be revoked.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerAdvancementCriterionGrantEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Advancement advancement;
|
||||
+ private final String criterion;
|
||||
+ private final AdvancementProgress advancementProgress;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerAdvancementCriterionGrantEvent(final Player player, final Advancement advancement, final String criterion) {
|
||||
+ super(player);
|
||||
+ this.advancement = advancement;
|
||||
+ this.criterion = criterion;
|
||||
+ this.advancementProgress = player.getAdvancementProgress(advancement);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the advancement which has been affected.
|
||||
+ *
|
||||
+ * @return affected advancement
|
||||
+ */
|
||||
+ public Advancement getAdvancement() {
|
||||
+ return this.advancement;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the criterion which has been granted.
|
||||
+ *
|
||||
+ * @return granted criterion
|
||||
+ */
|
||||
+ public String getCriterion() {
|
||||
+ return this.criterion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the current AdvancementProgress.
|
||||
+ *
|
||||
+ * @return advancement progress
|
||||
+ */
|
||||
+ public AdvancementProgress getAdvancementProgress() {
|
||||
+ return this.advancementProgress;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,132 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: pkt77 <parkerkt77@gmail.com>
|
||||
Date: Fri, 10 Nov 2017 23:45:59 -0500
|
||||
Subject: [PATCH] Add PlayerArmorChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerArmorChangeEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import java.util.Set;
|
||||
+import org.bukkit.Material;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+import static org.bukkit.Material.*;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the player themselves change their armor items
|
||||
+ * <p>
|
||||
+ * Not currently called for environmental factors though it <strong>MAY BE IN THE FUTURE</strong>
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerArmorChangeEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final SlotType slotType;
|
||||
+ private final ItemStack oldItem;
|
||||
+ private final ItemStack newItem;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerArmorChangeEvent(final Player player, final SlotType slotType, final ItemStack oldItem, final ItemStack newItem) {
|
||||
+ super(player);
|
||||
+ this.slotType = slotType;
|
||||
+ this.oldItem = oldItem;
|
||||
+ this.newItem = newItem;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the type of slot being altered.
|
||||
+ *
|
||||
+ * @return type of slot being altered
|
||||
+ */
|
||||
+ public SlotType getSlotType() {
|
||||
+ return this.slotType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the existing item that's being replaced
|
||||
+ *
|
||||
+ * @return old item
|
||||
+ */
|
||||
+ public ItemStack getOldItem() {
|
||||
+ return this.oldItem;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the new item that's replacing the old
|
||||
+ *
|
||||
+ * @return new item
|
||||
+ */
|
||||
+ public ItemStack getNewItem() {
|
||||
+ return this.newItem;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum SlotType {
|
||||
+ HEAD(NETHERITE_HELMET, DIAMOND_HELMET, GOLDEN_HELMET, IRON_HELMET, CHAINMAIL_HELMET, LEATHER_HELMET, CARVED_PUMPKIN, PLAYER_HEAD, SKELETON_SKULL, ZOMBIE_HEAD, CREEPER_HEAD, WITHER_SKELETON_SKULL, TURTLE_HELMET, DRAGON_HEAD, PIGLIN_HEAD),
|
||||
+ CHEST(NETHERITE_CHESTPLATE, DIAMOND_CHESTPLATE, GOLDEN_CHESTPLATE, IRON_CHESTPLATE, CHAINMAIL_CHESTPLATE, LEATHER_CHESTPLATE, ELYTRA),
|
||||
+ LEGS(NETHERITE_LEGGINGS, DIAMOND_LEGGINGS, GOLDEN_LEGGINGS, IRON_LEGGINGS, CHAINMAIL_LEGGINGS, LEATHER_LEGGINGS),
|
||||
+ FEET(NETHERITE_BOOTS, DIAMOND_BOOTS, GOLDEN_BOOTS, IRON_BOOTS, CHAINMAIL_BOOTS, LEATHER_BOOTS);
|
||||
+
|
||||
+ private final Set<Material> types;
|
||||
+
|
||||
+ SlotType(final Material... types) {
|
||||
+ this.types = Set.of(types);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets an immutable set of all allowed material types that can be placed in an
|
||||
+ * armor slot.
|
||||
+ *
|
||||
+ * @return immutable set of material types
|
||||
+ */
|
||||
+ public Set<Material> getTypes() {
|
||||
+ return this.types;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the type of slot via the specified material
|
||||
+ *
|
||||
+ * @param material material to get slot by
|
||||
+ * @return slot type the material will go in, or {@code null} if it won't
|
||||
+ */
|
||||
+ public static @Nullable SlotType getByMaterial(final Material material) {
|
||||
+ for (final SlotType slotType : values()) {
|
||||
+ if (slotType.getTypes().contains(material)) {
|
||||
+ return slotType;
|
||||
+ }
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether this material can be equipped to a slot
|
||||
+ *
|
||||
+ * @param material material to check
|
||||
+ * @return whether this material can be equipped
|
||||
+ */
|
||||
+ public static boolean isEquipable(final Material material) {
|
||||
+ return getByMaterial(material) != null;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
|
@ -1,89 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: nossr50 <nossr50@gmail.com>
|
||||
Date: Thu, 26 Mar 2020 19:30:58 -0700
|
||||
Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerAttackEntityCooldownResetEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when processing a player's attack on an entity when the player's attack strength cooldown is reset
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerAttackEntityCooldownResetEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Entity attackedEntity;
|
||||
+ private final float cooledAttackStrength;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerAttackEntityCooldownResetEvent(final Player player, final Entity attackedEntity, final float cooledAttackStrength) {
|
||||
+ super(player);
|
||||
+ this.attackedEntity = attackedEntity;
|
||||
+ this.cooledAttackStrength = cooledAttackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the value of the players cooldown attack strength when they initiated the attack
|
||||
+ *
|
||||
+ * @return returns the original player cooldown value
|
||||
+ */
|
||||
+ public float getCooledAttackStrength() {
|
||||
+ return this.cooledAttackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the entity attacked by the player
|
||||
+ *
|
||||
+ * @return the entity attacked by the player
|
||||
+ */
|
||||
+ public Entity getAttackedEntity() {
|
||||
+ return this.attackedEntity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ * <p>
|
||||
+ * If an attack cooldown event is cancelled, the players attack strength will remain at the same value instead of being reset.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ * <p>
|
||||
+ * Cancelling this event will prevent the target player from having their cooldown reset from attacking this entity
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,124 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Sun, 7 Oct 2018 12:05:06 -0700
|
||||
Subject: [PATCH] Add PlayerConnectionCloseEvent
|
||||
|
||||
This event is invoked when a player has disconnected. It is guaranteed that,
|
||||
if the server is in online-mode, that the provided uuid and username have been
|
||||
validated.
|
||||
|
||||
The event is invoked for players who have not yet logged into the world, whereas
|
||||
PlayerQuitEvent is only invoked on players who have logged into the world.
|
||||
|
||||
The event is invoked for players who have already logged into the world,
|
||||
although whether or not the player exists in the world at the time of
|
||||
firing is undefined. (That is, whether the plugin can retrieve a Player object
|
||||
using the event parameters is undefined). However, it is guaranteed that this
|
||||
event is invoked AFTER PlayerQuitEvent, if the player has already logged into
|
||||
the world.
|
||||
|
||||
This event is guaranteed to never fire unless AsyncPlayerPreLoginEvent has
|
||||
been called beforehand, and this event may not be called in parallel with
|
||||
AsyncPlayerPreLoginEvent for the same connection.
|
||||
|
||||
Cancelling the AsyncPlayerPreLoginEvent guarantees the corresponding
|
||||
PlayerConnectionCloseEvent is never called.
|
||||
|
||||
The event may be invoked asynchronously or synchronously. As it stands,
|
||||
it is never invoked asynchronously. However, plugins should check
|
||||
Event#isAsynchronous to be future-proof.
|
||||
|
||||
On purpose, the deprecated PlayerPreLoginEvent event is left out of the
|
||||
API spec for this event. Plugins should not be using that event, and
|
||||
how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent
|
||||
is undefined.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import java.net.InetAddress;
|
||||
+import java.util.UUID;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
+import org.bukkit.event.player.PlayerQuitEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * <p>
|
||||
+ * This event is invoked when a player has disconnected. It is guaranteed that,
|
||||
+ * if the server is in online-mode, that the provided uuid and username have been
|
||||
+ * validated.
|
||||
+ * <p>
|
||||
+ * The event is invoked for players who have not yet logged into the world, whereas
|
||||
+ * {@link PlayerQuitEvent} is only invoked on players who have logged into the world.
|
||||
+ * <p>
|
||||
+ * The event is invoked for players who have already logged into the world,
|
||||
+ * although whether or not the player exists in the world at the time of
|
||||
+ * firing is undefined. (That is, whether the plugin can retrieve a Player object
|
||||
+ * using the event parameters is undefined). However, it is guaranteed that this
|
||||
+ * event is invoked AFTER {@link PlayerQuitEvent}, if the player has already logged into the world.
|
||||
+ * <p>
|
||||
+ * This event is guaranteed to never fire unless {@link AsyncPlayerPreLoginEvent} has
|
||||
+ * been fired beforehand, and this event may not be called in parallel with
|
||||
+ * {@link AsyncPlayerPreLoginEvent} for the same connection.
|
||||
+ * <p>
|
||||
+ * Cancelling the {@link AsyncPlayerPreLoginEvent} guarantees the corresponding
|
||||
+ * {@code PlayerConnectionCloseEvent} is never called.
|
||||
+ * <p>
|
||||
+ * The event may be invoked asynchronously or synchronously. Plugins should check
|
||||
+ * {@link Event#isAsynchronous()} and handle accordingly.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerConnectionCloseEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final UUID playerUniqueId;
|
||||
+ private final String playerName;
|
||||
+ private final InetAddress ipAddress;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerConnectionCloseEvent(final UUID playerUniqueId, final String playerName, final InetAddress ipAddress, final boolean async) {
|
||||
+ super(async);
|
||||
+ this.playerUniqueId = playerUniqueId;
|
||||
+ this.playerName = playerName;
|
||||
+ this.ipAddress = ipAddress;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the {@code UUID} of the player disconnecting.
|
||||
+ */
|
||||
+ public UUID getPlayerUniqueId() {
|
||||
+ return this.playerUniqueId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the name of the player disconnecting.
|
||||
+ */
|
||||
+ public String getPlayerName() {
|
||||
+ return this.playerName;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the player's IP address.
|
||||
+ */
|
||||
+ public InetAddress getIpAddress() {
|
||||
+ return this.ipAddress;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,125 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Moulberry <james.jenour@protonmail.com>
|
||||
Date: Wed, 26 Jul 2023 20:57:11 +0800
|
||||
Subject: [PATCH] Add PlayerFailMoveEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerFailMoveEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Runs when a player attempts to move, but is prevented from doing so by the server
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerFailMoveEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final FailReason failReason;
|
||||
+ private final Location from;
|
||||
+ private final Location to;
|
||||
+ private boolean allowed;
|
||||
+ private boolean logWarning;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerFailMoveEvent(final Player player, final FailReason failReason, final boolean allowed, final boolean logWarning, final Location from, final Location to) {
|
||||
+ super(player);
|
||||
+ this.failReason = failReason;
|
||||
+ this.allowed = allowed;
|
||||
+ this.logWarning = logWarning;
|
||||
+ this.from = from;
|
||||
+ this.to = to;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the reason this movement was prevented by the server
|
||||
+ *
|
||||
+ * @return The reason the movement was prevented
|
||||
+ */
|
||||
+ public FailReason getFailReason() {
|
||||
+ return this.failReason;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location this player moved from
|
||||
+ *
|
||||
+ * @return Location the player moved from
|
||||
+ */
|
||||
+ public Location getFrom() {
|
||||
+ return this.from.clone();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location this player tried to move to
|
||||
+ *
|
||||
+ * @return Location the player tried to move to
|
||||
+ */
|
||||
+ public Location getTo() {
|
||||
+ return this.to.clone();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if the check should be bypassed, allowing the movement
|
||||
+ *
|
||||
+ * @return whether to bypass the check
|
||||
+ */
|
||||
+ public boolean isAllowed() {
|
||||
+ return this.allowed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set if the check should be bypassed and the movement should be allowed
|
||||
+ *
|
||||
+ * @param allowed whether to bypass the check
|
||||
+ */
|
||||
+ public void setAllowed(final boolean allowed) {
|
||||
+ this.allowed = allowed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if warnings will be printed to console. e.g. "Player123 moved too quickly!"
|
||||
+ *
|
||||
+ * @return whether to log warnings
|
||||
+ */
|
||||
+ public boolean getLogWarning() {
|
||||
+ return this.logWarning;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set if a warning is printed to console. e.g. "Player123 moved too quickly!"
|
||||
+ *
|
||||
+ * @param logWarning whether to log warnings
|
||||
+ */
|
||||
+ public void setLogWarning(final boolean logWarning) {
|
||||
+ this.logWarning = logWarning;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum FailReason {
|
||||
+ MOVED_INTO_UNLOADED_CHUNK, // Only fired if the world setting prevent-moving-into-unloaded-chunks is true
|
||||
+ MOVED_TOO_QUICKLY,
|
||||
+ MOVED_WRONGLY,
|
||||
+ CLIPPED_INTO_BLOCK
|
||||
+ }
|
||||
+
|
||||
+}
|
|
@ -1,92 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MisterVector <whizkid3000@hotmail.com>
|
||||
Date: Tue, 13 Aug 2019 19:44:19 -0700
|
||||
Subject: [PATCH] Add PlayerFlowerPotManipulateEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerFlowerPotManipulateEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+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.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player places an item in or takes an item out of a flowerpot.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerFlowerPotManipulateEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Block flowerpot;
|
||||
+ private final ItemStack item;
|
||||
+ private final boolean placing;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerFlowerPotManipulateEvent(final Player player, final Block flowerpot, final ItemStack item, final boolean placing) {
|
||||
+ super(player);
|
||||
+ this.flowerpot = flowerpot;
|
||||
+ this.item = item;
|
||||
+ this.placing = placing;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the flowerpot that is involved in this event.
|
||||
+ *
|
||||
+ * @return the flowerpot that is involved with this event
|
||||
+ */
|
||||
+ public Block getFlowerpot() {
|
||||
+ return this.flowerpot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the item being placed, or taken from, the flower pot.
|
||||
+ * Check if placing with {@link #isPlacing()}.
|
||||
+ *
|
||||
+ * @return the item placed, or taken from, the flowerpot
|
||||
+ */
|
||||
+ public ItemStack getItem() {
|
||||
+ return this.item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if the item is being placed into the flowerpot.
|
||||
+ *
|
||||
+ * @return if the item is being placed into the flowerpot
|
||||
+ */
|
||||
+ public boolean isPlacing() {
|
||||
+ return this.placing;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,108 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Sat, 29 Aug 2020 21:55:41 +0200
|
||||
Subject: [PATCH] Add PlayerInsertLecternBookEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerInsertLecternBookEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerInsertLecternBookEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerInsertLecternBookEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.block.BlockState;
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * This event is called when a player clicks on a lectern to insert a book.
|
||||
+ * If this event is cancelled the player will keep the book and the lectern will remain empty.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerInsertLecternBookEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+ private boolean cancelled = false;
|
||||
+ private final Block block;
|
||||
+ private ItemStack book;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerInsertLecternBookEvent(final Player player, final Block block, final ItemStack book) {
|
||||
+ super(player);
|
||||
+ this.block = block;
|
||||
+ this.book = book;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block of the lectern involved in this event.
|
||||
+ *
|
||||
+ * @return the block of the lectern
|
||||
+ */
|
||||
+ public Block getBlock() {
|
||||
+ return this.block;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Fetches the lectern block state that was part of this event.
|
||||
+ * This method constructs a new snapshot {@link org.bukkit.block.BlockState}.
|
||||
+ *
|
||||
+ * @return a new lectern state snapshot of the involved lectern
|
||||
+ * @throws IllegalStateException if the block at {@link #getBlock()} is no longer a lectern
|
||||
+ */
|
||||
+ public Lectern getLectern() {
|
||||
+ final BlockState state = this.getBlock().getState();
|
||||
+ Preconditions.checkState(state instanceof Lectern, "Block state of lectern block is no longer a lectern tile state!");
|
||||
+ return (Lectern) state;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the itemstack the player tried to insert. This is a copy of the item,
|
||||
+ * changes made to this itemstack will not affect the book that is being placed in the lectern.
|
||||
+ * If you want to mutate the item stack that ends up in the lectern, use {@link #setBook(ItemStack)}.
|
||||
+ *
|
||||
+ * @return the book that is being placed
|
||||
+ */
|
||||
+ public ItemStack getBook() {
|
||||
+ return this.book.clone();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the itemstack to insert into the lectern.
|
||||
+ *
|
||||
+ * @param book the book to insert (non book items will leave the lectern in a locked
|
||||
+ * state as the menu cannot be opened, preventing item extraction)
|
||||
+ */
|
||||
+ public void setBook(final ItemStack book) {
|
||||
+ Preconditions.checkArgument(book != null, "Cannot set book to null");
|
||||
+ this.book = book.clone();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,110 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Zacek <dawon@dawon.eu>
|
||||
Date: Sun, 24 Apr 2022 22:56:31 +0200
|
||||
Subject: [PATCH] Add PlayerInventorySlotChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerInventorySlotChangeEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.Inventory;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a slot contents change in a player's inventory.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerInventorySlotChangeEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final int rawSlot;
|
||||
+ private final int slot;
|
||||
+ private final ItemStack oldItemStack;
|
||||
+ private final ItemStack newItemStack;
|
||||
+ private boolean triggerAdvancements = true;
|
||||
+
|
||||
+ public PlayerInventorySlotChangeEvent(final Player player, final int rawSlot, final ItemStack oldItemStack, final ItemStack newItemStack) {
|
||||
+ super(player);
|
||||
+ this.rawSlot = rawSlot;
|
||||
+ this.slot = player.getOpenInventory().convertSlot(rawSlot);
|
||||
+ this.oldItemStack = oldItemStack;
|
||||
+ this.newItemStack = newItemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The raw slot number that was changed.
|
||||
+ *
|
||||
+ * @return The raw slot number.
|
||||
+ */
|
||||
+ public int getRawSlot() {
|
||||
+ return this.rawSlot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The slot number that was changed, ready for passing to
|
||||
+ * {@link Inventory#getItem(int)}. Note that there may be two slots with
|
||||
+ * the same slot number, since a view links two different inventories.
|
||||
+ * <p>
|
||||
+ * If no inventory is opened, internal crafting view is used for conversion.
|
||||
+ *
|
||||
+ * @return The slot number.
|
||||
+ */
|
||||
+ public int getSlot() {
|
||||
+ return this.slot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Clone of ItemStack that was in the slot before the change.
|
||||
+ *
|
||||
+ * @return The old ItemStack in the slot.
|
||||
+ */
|
||||
+ public ItemStack getOldItemStack() {
|
||||
+ return this.oldItemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Clone of ItemStack that is in the slot after the change.
|
||||
+ *
|
||||
+ * @return The new ItemStack in the slot.
|
||||
+ */
|
||||
+ public ItemStack getNewItemStack() {
|
||||
+ return this.newItemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the slot change advancements will be triggered.
|
||||
+ *
|
||||
+ * @return Whether the slot change advancements will be triggered.
|
||||
+ */
|
||||
+ public boolean shouldTriggerAdvancements() {
|
||||
+ return this.triggerAdvancements;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the slot change advancements will be triggered.
|
||||
+ *
|
||||
+ * @param triggerAdvancements Whether the slot change advancements will be triggered.
|
||||
+ */
|
||||
+ public void setShouldTriggerAdvancements(final boolean triggerAdvancements) {
|
||||
+ this.triggerAdvancements = triggerAdvancements;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,133 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Date: Tue, 25 Aug 2020 13:45:15 +0200
|
||||
Subject: [PATCH] Add PlayerItemCooldownEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemCooldownEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a player receives an item cooldown when using an item.
|
||||
+ *
|
||||
+ * @see PlayerItemGroupCooldownEvent for a more general event when applied to a group of items
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerItemCooldownEvent extends PlayerItemGroupCooldownEvent {
|
||||
+
|
||||
+ private final Material type;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerItemCooldownEvent(final Player player, final Material type, final NamespacedKey cooldownGroup, final int cooldown) {
|
||||
+ super(player, cooldownGroup, cooldown);
|
||||
+ this.type = type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the material of the item affected by the cooldown.
|
||||
+ *
|
||||
+ * @return material affected by the cooldown
|
||||
+ */
|
||||
+ public Material getType() {
|
||||
+ return this.type;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemGroupCooldownEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemGroupCooldownEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemGroupCooldownEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a player receives an item cooldown.
|
||||
+ *
|
||||
+ * @see PlayerItemCooldownEvent for a more specific event when applied to a specific item.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerItemGroupCooldownEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final NamespacedKey cooldownGroup;
|
||||
+ private int cooldown;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerItemGroupCooldownEvent(final Player player, final NamespacedKey cooldownGroup, final int cooldown) {
|
||||
+ super(player);
|
||||
+ this.cooldownGroup = cooldownGroup;
|
||||
+ this.cooldown = cooldown;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the cooldown group as defined by an item's {@link org.bukkit.inventory.meta.components.UseCooldownComponent}.
|
||||
+ *
|
||||
+ * @return cooldown group
|
||||
+ */
|
||||
+ public NamespacedKey getCooldownGroup() {
|
||||
+ return this.cooldownGroup;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cooldown in ticks.
|
||||
+ *
|
||||
+ * @return cooldown in ticks
|
||||
+ */
|
||||
+ public int getCooldown() {
|
||||
+ return this.cooldown;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the cooldown of the material in ticks.
|
||||
+ * Setting the cooldown to 0 results in removing an already existing cooldown for the material.
|
||||
+ *
|
||||
+ * @param cooldown cooldown in ticks, has to be a positive number
|
||||
+ */
|
||||
+ public void setCooldown(final int cooldown) {
|
||||
+ Preconditions.checkArgument(cooldown >= 0, "The cooldown has to be equal to or greater than 0!");
|
||||
+ this.cooldown = cooldown;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,111 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SamB440 <sam@islandearth.net>
|
||||
Date: Mon, 15 Nov 2021 18:09:46 +0000
|
||||
Subject: [PATCH] Add PlayerItemFrameChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerItemFrameChangeEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.ItemFrame;
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an {@link ItemFrame} is having an item rotated, added, or removed from it.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerItemFrameChangeEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final ItemFrame itemFrame;
|
||||
+ private final ItemFrameChangeAction action;
|
||||
+ private ItemStack itemStack;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerItemFrameChangeEvent(final Player player, final ItemFrame itemFrame, final ItemStack itemStack, final ItemFrameChangeAction action) {
|
||||
+ super(player);
|
||||
+ this.itemFrame = itemFrame;
|
||||
+ this.itemStack = itemStack;
|
||||
+ this.action = action;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link ItemFrame} involved in this event.
|
||||
+ *
|
||||
+ * @return the {@link ItemFrame}
|
||||
+ */
|
||||
+ public ItemFrame getItemFrame() {
|
||||
+ return this.itemFrame;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link ItemStack} involved in this event.
|
||||
+ * This is the item being added, rotated, or removed from the {@link ItemFrame}.
|
||||
+ * <p>
|
||||
+ * If this method returns air, then the resulting item in the ItemFrame will be empty.
|
||||
+ *
|
||||
+ * @return the {@link ItemStack} being added, rotated, or removed
|
||||
+ */
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return this.itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the {@link ItemStack} that this {@link ItemFrame} holds.
|
||||
+ * If {@code null} is provided, the ItemStack will become air and the result in the ItemFrame will be empty.
|
||||
+ *
|
||||
+ * @param itemStack {@link ItemFrame} item
|
||||
+ */
|
||||
+ public void setItemStack(final @Nullable ItemStack itemStack) {
|
||||
+ this.itemStack = itemStack == null ? ItemStack.empty() : itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the action that was performed on this {@link ItemFrame}.
|
||||
+ *
|
||||
+ * @return action performed on the item frame in this event
|
||||
+ */
|
||||
+ public ItemFrameChangeAction getAction() {
|
||||
+ return this.action;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum ItemFrameChangeAction {
|
||||
+ PLACE,
|
||||
+ REMOVE,
|
||||
+ ROTATE
|
||||
+ }
|
||||
+}
|
|
@ -1,117 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Thu, 28 Sep 2017 17:21:32 -0400
|
||||
Subject: [PATCH] Add PlayerJumpEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.event.player.PlayerMoveEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the server detects the player is jumping.
|
||||
+ * <p>
|
||||
+ * Added to avoid the overhead and special case logic that many plugins use
|
||||
+ * when checking for jumps via {@link PlayerMoveEvent}, this event is fired whenever
|
||||
+ * the server detects that the player is jumping.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerJumpEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Location to;
|
||||
+ private Location from;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerJumpEvent(final Player player, final Location from, final Location to) {
|
||||
+ super(player);
|
||||
+ this.from = from;
|
||||
+ this.to = to;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ * <p>
|
||||
+ * If a jump event is cancelled, the player will be moved or
|
||||
+ * teleported back to the Location as defined by {@link #getFrom()}. This will not
|
||||
+ * fire an event
|
||||
+ *
|
||||
+ * @return {@code true} if this event is cancelled
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ * <p>
|
||||
+ * If a jump event is cancelled, the player will be moved or
|
||||
+ * teleported back to the Location as defined by {@link #getFrom()}. This will not
|
||||
+ * fire an event
|
||||
+ *
|
||||
+ * @param cancel {@code true} if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location this player jumped from
|
||||
+ *
|
||||
+ * @return Location the player jumped from
|
||||
+ */
|
||||
+ public Location getFrom() {
|
||||
+ return this.from;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the location to mark as where the player jumped from
|
||||
+ *
|
||||
+ * @param from New location to mark as the players previous location
|
||||
+ */
|
||||
+ public void setFrom(final Location from) {
|
||||
+ Preconditions.checkArgument(from != null, "Cannot use null from location!");
|
||||
+ Preconditions.checkArgument(from.getWorld() != null, "Cannot use from location with null world!");
|
||||
+ this.from = from;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location this player jumped to
|
||||
+ * <p>
|
||||
+ * This information is based on what the client sends, it typically
|
||||
+ * has little relation to the arc of the jump at any given point.
|
||||
+ *
|
||||
+ * @return Location the player jumped to
|
||||
+ */
|
||||
+ public Location getTo() {
|
||||
+ return this.to.clone();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,144 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sat, 15 May 2021 20:30:34 -0700
|
||||
Subject: [PATCH] Add PlayerKickEvent causes
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param message kick message
|
||||
*/
|
||||
void kick(final net.kyori.adventure.text.@Nullable Component message);
|
||||
+
|
||||
+ /**
|
||||
+ * Kicks player with custom kick message and cause.
|
||||
+ *
|
||||
+ * @param message kick message
|
||||
+ * @param cause kick cause
|
||||
+ */
|
||||
+ void kick(final net.kyori.adventure.text.@Nullable Component message, org.bukkit.event.player.PlayerKickEvent.@NotNull Cause cause);
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private net.kyori.adventure.text.Component leaveMessage; // Paper
|
||||
private net.kyori.adventure.text.Component kickReason; // Paper
|
||||
+ private final Cause cause; // Paper
|
||||
private boolean cancel;
|
||||
|
||||
@Deprecated // Paper
|
||||
@@ -0,0 +0,0 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
|
||||
super(playerKicked);
|
||||
this.kickReason = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(kickReason); // Paper
|
||||
this.leaveMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(leaveMessage); // Paper
|
||||
+ this.cause = Cause.UNKNOWN; // Paper
|
||||
this.cancel = false;
|
||||
}
|
||||
// Paper start
|
||||
+ @Deprecated
|
||||
public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final net.kyori.adventure.text.Component kickReason, @NotNull final net.kyori.adventure.text.Component leaveMessage) {
|
||||
super(playerKicked);
|
||||
this.kickReason = kickReason;
|
||||
this.leaveMessage = leaveMessage;
|
||||
this.cancel = false;
|
||||
+ this.cause = Cause.UNKNOWN;
|
||||
+ }
|
||||
+
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal
|
||||
+ public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final net.kyori.adventure.text.Component kickReason, @NotNull final net.kyori.adventure.text.Component leaveMessage, @NotNull final Cause cause) {
|
||||
+ super(playerKicked);
|
||||
+ this.kickReason = kickReason;
|
||||
+ this.leaveMessage = leaveMessage;
|
||||
+ this.cancel = false;
|
||||
+ this.cause = cause;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the cause of this kick
|
||||
+ *
|
||||
+ * @return
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public org.bukkit.event.player.PlayerKickEvent.Cause getCause() {
|
||||
+ return cause;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+
|
||||
+ PLUGIN,
|
||||
+
|
||||
+ WHITELIST,
|
||||
+
|
||||
+ BANNED,
|
||||
+
|
||||
+ IP_BANNED,
|
||||
+
|
||||
+ KICK_COMMAND,
|
||||
+
|
||||
+ FLYING_PLAYER,
|
||||
+
|
||||
+ FLYING_VEHICLE,
|
||||
+
|
||||
+ TIMEOUT,
|
||||
+
|
||||
+ IDLING,
|
||||
+
|
||||
+ INVALID_VEHICLE_MOVEMENT,
|
||||
+
|
||||
+ INVALID_PLAYER_MOVEMENT,
|
||||
+
|
||||
+ INVALID_ENTITY_ATTACKED,
|
||||
+
|
||||
+ INVALID_PAYLOAD,
|
||||
+
|
||||
+ INVALID_COOKIE,
|
||||
+
|
||||
+ SPAM,
|
||||
+
|
||||
+ ILLEGAL_ACTION,
|
||||
+
|
||||
+ ILLEGAL_CHARACTERS,
|
||||
+
|
||||
+ OUT_OF_ORDER_CHAT,
|
||||
+
|
||||
+ UNSIGNED_CHAT,
|
||||
+
|
||||
+ CHAT_VALIDATION_FAILED,
|
||||
+
|
||||
+ EXPIRED_PROFILE_PUBLIC_KEY,
|
||||
+
|
||||
+ INVALID_PUBLIC_KEY_SIGNATURE,
|
||||
+
|
||||
+ TOO_MANY_PENDING_CHATS,
|
||||
+
|
||||
+ SELF_INTERACTION,
|
||||
+
|
||||
+ DUPLICATE_LOGIN,
|
||||
+
|
||||
+ RESOURCE_PACK_REJECTION,
|
||||
+
|
||||
+ /**
|
||||
+ * Spigot's restart command
|
||||
+ */
|
||||
+ RESTART_COMMAND,
|
||||
+ /**
|
||||
+ * Fallback cause
|
||||
+ */
|
||||
+ UNKNOWN,
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: RodneyMKay <36546810+RodneyMKay@users.noreply.github.com>
|
||||
Date: Wed, 8 Sep 2021 22:15:43 +0200
|
||||
Subject: [PATCH] Add PlayerPickItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerPickItemEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+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.ApiStatus;
|
||||
+import org.jetbrains.annotations.Range;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Event that is fired when a player uses the pick item functionality (middle-clicking a block or entity to get the
|
||||
+ * appropriate item). After the handling of this event, the contents of the source and the target slot will be swapped
|
||||
+ * and the currently selected hotbar slot of the player will be set to the target slot.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerPickItemEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private int targetSlot;
|
||||
+ private int sourceSlot;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerPickItemEvent(final Player player, final int targetSlot, final int sourceSlot) {
|
||||
+ super(player);
|
||||
+ this.targetSlot = targetSlot;
|
||||
+ this.sourceSlot = sourceSlot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the slot the item that is being picked goes into.
|
||||
+ *
|
||||
+ * @return hotbar slot (0-8 inclusive)
|
||||
+ */
|
||||
+ public @Range(from = 0, to = 8) int getTargetSlot() {
|
||||
+ return this.targetSlot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Changes the slot the item that is being picked goes into.
|
||||
+ *
|
||||
+ * @param targetSlot hotbar slot (0-8 inclusive)
|
||||
+ */
|
||||
+ public void setTargetSlot(final @Range(from = 0, to = 8) int targetSlot) {
|
||||
+ Preconditions.checkArgument(targetSlot >= 0 && targetSlot <= 8, "Target slot must be in range 0 - 8 (inclusive)");
|
||||
+ this.targetSlot = targetSlot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the slot in which the item that will be put into the players hotbar is located.
|
||||
+ * <p>
|
||||
+ * Returns {@code -1} if the item is not in the player's inventory.
|
||||
+ * If this is the case and the player is in creative mode, the item will be spawned in.
|
||||
+ *
|
||||
+ * @return player inventory slot (0-35 inclusive, or {@code -1} if not in the player inventory)
|
||||
+ */
|
||||
+ public @Range(from = -1, to = 35) int getSourceSlot() {
|
||||
+ return this.sourceSlot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Change the source slot from which the item that will be put in the players hotbar will be taken.
|
||||
+ * <p>
|
||||
+ * If set to {@code -1} and the player is in creative mode, the item will be spawned in.
|
||||
+ *
|
||||
+ * @param sourceSlot player inventory slot (0-35 inclusive, or {@code -1} if not in the player inventory)
|
||||
+ */
|
||||
+ public void setSourceSlot(final @Range(from = -1, to = 35) int sourceSlot) {
|
||||
+ Preconditions.checkArgument(sourceSlot >= -1 && sourceSlot <= 35, "Source slot must be in range of the player's inventory slot, or -1");
|
||||
+ this.sourceSlot = sourceSlot;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,80 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MisterVector <whizkid3000@hotmail.com>
|
||||
Date: Fri, 26 Oct 2018 21:33:13 -0700
|
||||
Subject: [PATCH] Add PlayerPostRespawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostRespawnEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired after a player has respawned
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerPostRespawnEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Location respawnedLocation;
|
||||
+ private final boolean isBedSpawn;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerPostRespawnEvent(final Player respawnPlayer, final Location respawnedLocation, final boolean isBedSpawn) {
|
||||
+ super(respawnPlayer);
|
||||
+ this.respawnedLocation = respawnedLocation;
|
||||
+ this.isBedSpawn = isBedSpawn;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the location of the respawned player
|
||||
+ *
|
||||
+ * @return location of the respawned player
|
||||
+ */
|
||||
+ public Location getRespawnedLocation() {
|
||||
+ return this.respawnedLocation.clone();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the player respawned to their bed
|
||||
+ *
|
||||
+ * @return whether the player respawned to their bed
|
||||
+ */
|
||||
+ public boolean isBedSpawn() {
|
||||
+ return this.isBedSpawn;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when a player respawns.
|
||||
+ * <p>
|
||||
+ * If changing player state, see {@link com.destroystokyo.paper.event.player.PlayerPostRespawnEvent}
|
||||
+ * because the player is "reset" between this event and that event and some changes won't persist.
|
||||
*/
|
||||
public class PlayerRespawnEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
|
@ -1,201 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 19 May 2021 18:58:24 -0700
|
||||
Subject: [PATCH] Add PlayerSetSpawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import org.bukkit.Location;
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player's spawn is set, either by themselves or otherwise.
|
||||
+ * <br>
|
||||
+ * Cancelling this event will prevent the spawn from being set.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Cause cause;
|
||||
+ private @Nullable Location location;
|
||||
+ private boolean forced;
|
||||
+ private boolean notifyPlayer;
|
||||
+ private @Nullable Component notification;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerSetSpawnEvent(final Player player, final Cause cause, final @Nullable Location location, final boolean forced, final boolean notifyPlayer, final @Nullable Component notification) {
|
||||
+ super(player);
|
||||
+ this.cause = cause;
|
||||
+ this.location = location;
|
||||
+ this.forced = forced;
|
||||
+ this.notifyPlayer = notifyPlayer;
|
||||
+ this.notification = notification;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cause of this event.
|
||||
+ *
|
||||
+ * @return the cause
|
||||
+ */
|
||||
+ public Cause getCause() {
|
||||
+ return this.cause;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location that the spawn is set to. The yaw
|
||||
+ * of this location is the spawn angle. Mutating this location
|
||||
+ * will change the resulting spawn point of the player. Use
|
||||
+ * {@link Location#clone()} to get a copy of this location.
|
||||
+ *
|
||||
+ * @return the spawn location, or {@code null} if removing the location
|
||||
+ */
|
||||
+ public @Nullable Location getLocation() {
|
||||
+ return this.location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the location to be set as the spawn location. The yaw
|
||||
+ * of this location is the spawn angle.
|
||||
+ *
|
||||
+ * @param location the spawn location, or {@code null} to remove the spawn location
|
||||
+ */
|
||||
+ public void setLocation(final @Nullable Location location) {
|
||||
+ this.location = location;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if this is a force spawn location
|
||||
+ *
|
||||
+ * @return {@code true} if forced
|
||||
+ */
|
||||
+ public boolean isForced() {
|
||||
+ return this.forced;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this is a forced spawn location
|
||||
+ *
|
||||
+ * @param forced {@code true} to force
|
||||
+ */
|
||||
+ public void setForced(final boolean forced) {
|
||||
+ this.forced = forced;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if this action will notify the player their spawn
|
||||
+ * has been set.
|
||||
+ *
|
||||
+ * @return {@code true} to notify
|
||||
+ */
|
||||
+ public boolean willNotifyPlayer() {
|
||||
+ return this.notifyPlayer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this action will notify the player that their spawn
|
||||
+ * has been set.
|
||||
+ *
|
||||
+ * @param notifyPlayer {@code true} to notify
|
||||
+ */
|
||||
+ public void setNotifyPlayer(final boolean notifyPlayer) {
|
||||
+ this.notifyPlayer = notifyPlayer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the notification message that will be sent to the player
|
||||
+ * if {@link #willNotifyPlayer()} returns true.
|
||||
+ *
|
||||
+ * @return {@code null} if no notification
|
||||
+ */
|
||||
+ public @Nullable Component getNotification() {
|
||||
+ return this.notification;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the notification message that will be sent to the player.
|
||||
+ *
|
||||
+ * @param notification {@code null} to send no message
|
||||
+ */
|
||||
+ public void setNotification(final @Nullable Component notification) {
|
||||
+ this.notification = notification;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ /**
|
||||
+ * When a player interacts successfully with a bed.
|
||||
+ */
|
||||
+ BED,
|
||||
+ /**
|
||||
+ * When a player interacts successfully with a respawn anchor.
|
||||
+ */
|
||||
+ RESPAWN_ANCHOR,
|
||||
+ /**
|
||||
+ * When a player respawns.
|
||||
+ */
|
||||
+ PLAYER_RESPAWN,
|
||||
+ /**
|
||||
+ * When the {@code /spawnpoint} command is used on a player.
|
||||
+ */
|
||||
+ COMMAND,
|
||||
+ /**
|
||||
+ * When a plugin uses {@link Player#setRespawnLocation(Location)} or
|
||||
+ * {@link Player#setRespawnLocation(Location, boolean)}.
|
||||
+ */
|
||||
+ PLUGIN,
|
||||
+ /**
|
||||
+ * Fallback cause.
|
||||
+ */
|
||||
+ UNKNOWN,
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerSpawnChangeEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* This event is fired when the spawn point of the player is changed.
|
||||
+ * @deprecated use {@link com.destroystokyo.paper.event.player.PlayerSetSpawnEvent}
|
||||
*/
|
||||
+@Deprecated(forRemoval = true) // Paper
|
||||
public class PlayerSpawnChangeEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
|
@ -1,119 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Roy <10731363+JRoy@users.noreply.github.com>
|
||||
Date: Thu, 27 Aug 2020 12:32:35 -0400
|
||||
Subject: [PATCH] Add PlayerShearBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/PlayerShearBlockEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import java.util.List;
|
||||
+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.inventory.EquipmentSlot;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player uses sheers on a block.
|
||||
+ * <p>
|
||||
+ * This event is <b>not</b> called when breaking blocks with shears but instead only when a
|
||||
+ * player uses the sheer item on a block to garner drops from said block and/or change its state.
|
||||
+ * <p>
|
||||
+ * Examples include shearing a pumpkin to turn it into a carved pumpkin or shearing a beehive to get honeycomb.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerShearBlockEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Block block;
|
||||
+ private final ItemStack item;
|
||||
+ private final EquipmentSlot hand;
|
||||
+ private final List<ItemStack> drops;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerShearBlockEvent(final Player player, final Block block, final ItemStack item, final EquipmentSlot hand, final List<ItemStack> drops) {
|
||||
+ super(player);
|
||||
+ this.block = block;
|
||||
+ this.item = item;
|
||||
+ this.hand = hand;
|
||||
+ this.drops = drops;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block being sheared in this event.
|
||||
+ *
|
||||
+ * @return The {@link Block} which block is being sheared in this event.
|
||||
+ */
|
||||
+ public Block getBlock() {
|
||||
+ return this.block;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the item used to shear the block.
|
||||
+ *
|
||||
+ * @return The {@link ItemStack} of the shears.
|
||||
+ */
|
||||
+ public ItemStack getItem() {
|
||||
+ return this.item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the hand used to shear the block.
|
||||
+ *
|
||||
+ * @return Either {@link EquipmentSlot#HAND} OR {@link EquipmentSlot#OFF_HAND}.
|
||||
+ */
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return this.hand;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the resulting drops of this event.
|
||||
+ *
|
||||
+ * @return A mutable {@link List list} of {@link ItemStack items} that will be dropped as result of this event.
|
||||
+ */
|
||||
+ public List<ItemStack> getDrops() {
|
||||
+ return this.drops;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the shearing of the block should be cancelled or not.
|
||||
+ *
|
||||
+ * @return Whether the shearing of the block should be cancelled or not.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the shearing of the block should be cancelled or not.
|
||||
+ *
|
||||
+ * @param cancel whether the shearing of the block should be cancelled or not.
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,113 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 1 May 2023 16:22:43 -0500
|
||||
Subject: [PATCH] Add PlayerShieldDisableEvent
|
||||
|
||||
Called whenever a players shield is disabled. This is mainly caused by
|
||||
attacking players or monsters that carry axes.
|
||||
|
||||
The event, while similar to the PlayerItemCooldownEvent, offers other
|
||||
behaviour and can hence not be implemented as a childtype of said event.
|
||||
Specifically, cancelling the event prevents the game events from being
|
||||
sent to the player.
|
||||
|
||||
Plugins listening to just the PlayerItemCooldownEvent may not want said
|
||||
sideeffects, meaning the disable event cannot share a handlerlist with
|
||||
the cooldown event.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called whenever a players shield is disabled due to an attack from another entity that was capable of disabling the
|
||||
+ * shield. This, most commonly, may be another player attacking with an axe.
|
||||
+ * <p>
|
||||
+ * Notably, this even is distinct from a {@link PlayerItemCooldownEvent} and will fire prior to the item going on
|
||||
+ * cooldown.
|
||||
+ * It follows that, if this event is cancelled, no {@link PlayerItemCooldownEvent} is called as the shield is never
|
||||
+ * disabled in the first place.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerShieldDisableEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Entity damager;
|
||||
+ private int cooldown;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerShieldDisableEvent(final Player player, final Entity damager, final int cooldown) {
|
||||
+ super(player);
|
||||
+ this.damager = damager;
|
||||
+ this.cooldown = cooldown;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Provides the damager that disabled the shield.
|
||||
+ *
|
||||
+ * @return the entity instance that damaged the player in a way that caused the shield to be disabled.
|
||||
+ */
|
||||
+ public Entity getDamager() {
|
||||
+ return this.damager;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cooldown the disabled shield will be disabled for in ticks.
|
||||
+ * <p>
|
||||
+ * Notably, this value is not final as it might be changed by a {@link PlayerItemCooldownEvent} down the line,
|
||||
+ * as said event is called if this event is not cancelled.
|
||||
+ *
|
||||
+ * @return cooldown in ticks
|
||||
+ */
|
||||
+ public int getCooldown() {
|
||||
+ return this.cooldown;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the cooldown of the shield in ticks.
|
||||
+ * <p>
|
||||
+ * Notably, this value is not final as it might be changed by a {@link PlayerItemCooldownEvent} down the line,
|
||||
+ * as said event is called if this event is not cancelled.
|
||||
+ *
|
||||
+ * @param cooldown cooldown in ticks, has to be a positive number
|
||||
+ */
|
||||
+ public void setCooldown(final int cooldown) {
|
||||
+ Preconditions.checkArgument(cooldown >= 0, "The cooldown has to be equal to or greater than 0!");
|
||||
+ this.cooldown = cooldown;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,59 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 9 Jul 2021 17:44:33 -0700
|
||||
Subject: [PATCH] Add PlayerSignCommandPreprocessEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerSignCommandPreprocessEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import java.util.Set;
|
||||
+import org.bukkit.block.Sign;
|
||||
+import org.bukkit.block.sign.Side;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a {@link Player} clicks a side on a sign that causes a command to run.
|
||||
+ * <p>
|
||||
+ * This command is run with elevated permissions which allows players to access commands on signs they wouldn't
|
||||
+ * normally be able to run.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerSignCommandPreprocessEvent extends PlayerCommandPreprocessEvent {
|
||||
+
|
||||
+ private final Sign sign;
|
||||
+ private final Side side;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerSignCommandPreprocessEvent(final Player player, final String message, final Set<Player> recipients, final Sign sign, final Side side) {
|
||||
+ super(player, message, recipients);
|
||||
+ this.sign = sign;
|
||||
+ this.side = side;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sign that the command originated from.
|
||||
+ *
|
||||
+ * @return the sign
|
||||
+ */
|
||||
+ public Sign getSign() {
|
||||
+ return this.sign;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the side of the sign that the command originated from.
|
||||
+ *
|
||||
+ * @return the sign side
|
||||
+ */
|
||||
+ public Side getSide() {
|
||||
+ return this.side;
|
||||
+ }
|
||||
+}
|
|
@ -1,65 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: u9g <git@u9g.dev>
|
||||
Date: Tue, 3 May 2022 20:41:30 -0400
|
||||
Subject: [PATCH] Add PlayerStopUsingItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerStopUsingItemEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the server detects a player stopping using an item.
|
||||
+ * Examples of this are letting go of the interact button when holding a bow, an edible item, or a spyglass.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerStopUsingItemEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final ItemStack item;
|
||||
+ private final int ticksHeldFor;
|
||||
+
|
||||
+ public PlayerStopUsingItemEvent(final Player player, final ItemStack item, final int ticksHeldFor) {
|
||||
+ super(player);
|
||||
+ this.item = item;
|
||||
+ this.ticksHeldFor = ticksHeldFor;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the exact item the player is releasing
|
||||
+ *
|
||||
+ * @return ItemStack the exact item the player released
|
||||
+ */
|
||||
+ public ItemStack getItem() {
|
||||
+ return this.item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the number of ticks the item was held for
|
||||
+ *
|
||||
+ * @return int the number of ticks the item was held for
|
||||
+ */
|
||||
+ public int getTicksHeldFor() {
|
||||
+ return this.ticksHeldFor;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,101 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Sat, 2 Apr 2016 05:08:36 -0400
|
||||
Subject: [PATCH] Add PlayerUseUnknownEntityEvent
|
||||
|
||||
Adds the PlayerUseUnknownEntityEvent to be used by plugins dealing with
|
||||
virtual entities/entities that are not actually known to the server.
|
||||
|
||||
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerUseUnknownEntityEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Represents an event that is called when a player right-clicks an unknown entity.
|
||||
+ * Useful for plugins dealing with virtual entities (entities that aren't actually spawned on the server).
|
||||
+ * <br>
|
||||
+ * This event may be called multiple times per interaction with different interaction hands
|
||||
+ * and with or without the clicked position.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerUseUnknownEntityEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final int entityId;
|
||||
+ private final boolean attack;
|
||||
+ private final EquipmentSlot hand;
|
||||
+ private final @Nullable Vector clickedPosition;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerUseUnknownEntityEvent(final Player player, final int entityId, final boolean attack, final EquipmentSlot hand, final @Nullable Vector clickedPosition) {
|
||||
+ super(player);
|
||||
+ this.entityId = entityId;
|
||||
+ this.attack = attack;
|
||||
+ this.hand = hand;
|
||||
+ this.clickedPosition = clickedPosition;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the entity id of the unknown entity that was interacted with.
|
||||
+ *
|
||||
+ * @return the entity id of the entity that was interacted with
|
||||
+ */
|
||||
+ public int getEntityId() {
|
||||
+ return this.entityId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether the interaction was an attack.
|
||||
+ *
|
||||
+ * @return {@code true} if the player is attacking the entity, {@code false} if the player is interacting with the entity
|
||||
+ */
|
||||
+ public boolean isAttack() {
|
||||
+ return this.attack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the hand used to perform this interaction.
|
||||
+ *
|
||||
+ * @return the hand used to interact
|
||||
+ */
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return this.hand;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the position relative to the entity that was clicked, or {@code null} if not available.
|
||||
+ * See {@link PlayerInteractAtEntityEvent} for more details.
|
||||
+ *
|
||||
+ * @return the position relative to the entity that was clicked, or {@code null} if not available
|
||||
+ * @see PlayerInteractAtEntityEvent
|
||||
+ */
|
||||
+ public @Nullable Vector getClickedRelativePosition() {
|
||||
+ return this.clickedPosition != null ? this.clickedPosition.clone() : null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,438 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 20 Mar 2022 10:42:28 -0700
|
||||
Subject: [PATCH] Add Position
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/math/BlockPosition.java b/src/main/java/io/papermc/paper/math/BlockPosition.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/BlockPosition.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.Axis;
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * A position represented with integers.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ *
|
||||
+ * @see FinePosition
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+public interface BlockPosition extends Position {
|
||||
+
|
||||
+ @Override
|
||||
+ default double x() {
|
||||
+ return this.blockX();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default double y() {
|
||||
+ return this.blockY();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default double z() {
|
||||
+ return this.blockZ();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isBlock() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isFine() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default BlockPosition toBlock() {
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default BlockPosition offset(final int x, final int y, final int z) {
|
||||
+ return x == 0 && y == 0 && z == 0 ? this : new BlockPositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default FinePosition offset(final double x, final double y, final double z) {
|
||||
+ return new FinePositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a block position offset by 1 in the direction specified.
|
||||
+ *
|
||||
+ * @param blockFace the block face to offset towards
|
||||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ default BlockPosition offset(final BlockFace blockFace) {
|
||||
+ return this.offset(blockFace, 1);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a block position offset in the direction specified
|
||||
+ * multiplied by the amount.
|
||||
+ *
|
||||
+ * @param blockFace the block face to offset towards
|
||||
+ * @param amount the number of times to move in that direction
|
||||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ default BlockPosition offset(final BlockFace blockFace, final int amount) {
|
||||
+ return amount == 0 ? this : new BlockPositionImpl(this.blockX() + (blockFace.getModX() * amount), this.blockY() + (blockFace.getModY() * amount), this.blockZ() + (blockFace.getModZ() * amount));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a block position offset by the amount along
|
||||
+ * the specified axis.
|
||||
+ *
|
||||
+ * @param axis the axis to offset along
|
||||
+ * @param amount the amount to offset along that axis
|
||||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ default BlockPosition offset(final Axis axis, final int amount) {
|
||||
+ return amount == 0 ? this : switch (axis) {
|
||||
+ case X -> new BlockPositionImpl(this.blockX() + amount, this.blockY(), this.blockZ());
|
||||
+ case Y -> new BlockPositionImpl(this.blockX(), this.blockY() + amount, this.blockZ());
|
||||
+ case Z -> new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ() + amount);
|
||||
+ };
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/BlockPositionImpl.java b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+record BlockPositionImpl(int blockX, int blockY, int blockZ) implements BlockPosition {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/FinePosition.java b/src/main/java/io/papermc/paper/math/FinePosition.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/FinePosition.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.util.NumberConversions;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * A position represented with doubles.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ *
|
||||
+ * @see BlockPosition
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+public interface FinePosition extends Position {
|
||||
+
|
||||
+ @Override
|
||||
+ default int blockX() {
|
||||
+ return NumberConversions.floor(this.x());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default int blockY() {
|
||||
+ return NumberConversions.floor(this.y());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default int blockZ() {
|
||||
+ return NumberConversions.floor(this.z());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isBlock() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isFine() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default BlockPosition toBlock() {
|
||||
+ return new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default FinePosition offset(final int x, final int y, final int z) {
|
||||
+ return this.offset((double) x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default FinePosition offset(final double x, final double y, final double z) {
|
||||
+ return x == 0.0 && y == 0.0 && z == 0.0 ? this : new FinePositionImpl(this.x() + x, this.y() + y, this.z() + z);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/FinePositionImpl.java b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+record FinePositionImpl(double x, double y, double z) implements FinePosition {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/Position.java b/src/main/java/io/papermc/paper/math/Position.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/Position.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Common interface for {@link FinePosition} and {@link BlockPosition}.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+@NullMarked
|
||||
+public interface Position {
|
||||
+
|
||||
+ FinePosition FINE_ZERO = new FinePositionImpl(0, 0, 0);
|
||||
+ BlockPosition BLOCK_ZERO = new BlockPositionImpl(0, 0, 0);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block x value for this position
|
||||
+ *
|
||||
+ * @return the block x value
|
||||
+ */
|
||||
+ int blockX();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block x value for this position
|
||||
+ *
|
||||
+ * @return the block x value
|
||||
+ */
|
||||
+ int blockY();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block x value for this position
|
||||
+ *
|
||||
+ * @return the block x value
|
||||
+ */
|
||||
+ int blockZ();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the x value for this position
|
||||
+ *
|
||||
+ * @return the x value
|
||||
+ */
|
||||
+ double x();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the y value for this position
|
||||
+ *
|
||||
+ * @return the y value
|
||||
+ */
|
||||
+ double y();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the z value for this position
|
||||
+ *
|
||||
+ * @return the z value
|
||||
+ */
|
||||
+ double z();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks of this position represents a {@link BlockPosition}
|
||||
+ *
|
||||
+ * @return true if block
|
||||
+ */
|
||||
+ boolean isBlock();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this position represents a {@link FinePosition}
|
||||
+ *
|
||||
+ * @return true if fine
|
||||
+ */
|
||||
+ boolean isFine();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if each component of this position is finite.
|
||||
+ */
|
||||
+ default boolean isFinite() {
|
||||
+ return Double.isFinite(this.x()) && Double.isFinite(this.y()) && Double.isFinite(this.z());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a position offset by the specified amounts.
|
||||
+ *
|
||||
+ * @param x x value to offset
|
||||
+ * @param y y value to offset
|
||||
+ * @param z z value to offset
|
||||
+ * @return the offset position
|
||||
+ */
|
||||
+ Position offset(int x, int y, int z);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a position offset by the specified amounts.
|
||||
+ *
|
||||
+ * @param x x value to offset
|
||||
+ * @param y y value to offset
|
||||
+ * @param z z value to offset
|
||||
+ * @return the offset position
|
||||
+ */
|
||||
+ FinePosition offset(double x, double y, double z);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a new position at the center of the block position this represents
|
||||
+ *
|
||||
+ * @return a new center position
|
||||
+ */
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ default FinePosition toCenter() {
|
||||
+ return new FinePositionImpl(this.blockX() + 0.5, this.blockY() + 0.5, this.blockZ() + 0.5);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the block position of this position
|
||||
+ * or itself if it already is a block position
|
||||
+ *
|
||||
+ * @return the block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ BlockPosition toBlock();
|
||||
+
|
||||
+ /**
|
||||
+ * Converts this position to a vector
|
||||
+ *
|
||||
+ * @return a new vector
|
||||
+ */
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ default Vector toVector() {
|
||||
+ return new Vector(this.x(), this.y(), this.z());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new location object at this position with the specified world
|
||||
+ *
|
||||
+ * @param world the world for the location object
|
||||
+ * @return a new location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ default Location toLocation(final World world) {
|
||||
+ return new Location(world, this.x(), this.y(), this.z());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position at the coordinates
|
||||
+ *
|
||||
+ * @param x x coord
|
||||
+ * @param y y coord
|
||||
+ * @param z z coord
|
||||
+ * @return a position with those coords
|
||||
+ */
|
||||
+ @Contract(value = "_, _, _ -> new", pure = true)
|
||||
+ static BlockPosition block(final int x, final int y, final int z) {
|
||||
+ return new BlockPositionImpl(x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position from the location.
|
||||
+ *
|
||||
+ * @param location the location to copy the position of
|
||||
+ * @return a new position at that location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static BlockPosition block(final Location location) {
|
||||
+ return new BlockPositionImpl(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position at the coordinates
|
||||
+ *
|
||||
+ * @param x x coord
|
||||
+ * @param y y coord
|
||||
+ * @param z z coord
|
||||
+ * @return a position with those coords
|
||||
+ */
|
||||
+ @Contract(value = "_, _, _ -> new", pure = true)
|
||||
+ static FinePosition fine(final double x, final double y, final double z) {
|
||||
+ return new FinePositionImpl(x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position from the location.
|
||||
+ *
|
||||
+ * @param location the location to copy the position of
|
||||
+ * @return a new position at that location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static FinePosition fine(final Location location) {
|
||||
+ return new FinePositionImpl(location.getX(), location.getY(), location.getZ());
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Location.java
|
||||
+++ b/src/main/java/org/bukkit/Location.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
* magnitude than 360 are valid, but may be normalized to any other equivalent
|
||||
* representation by the implementation.
|
||||
*/
|
||||
-public class Location implements Cloneable, ConfigurationSerializable {
|
||||
+public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition { // Paper
|
||||
private Reference<World> world;
|
||||
private double x;
|
||||
private double y;
|
||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
}
|
||||
return pitch;
|
||||
}
|
||||
+
|
||||
+ // Paper - add Position
|
||||
+ @Override
|
||||
+ public double x() {
|
||||
+ return this.getX();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double y() {
|
||||
+ return this.getY();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double z() {
|
||||
+ return this.getZ();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isFinite() {
|
||||
+ return io.papermc.paper.math.FinePosition.super.isFinite() && Float.isFinite(this.getYaw()) && Float.isFinite(this.getPitch());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Location toLocation(@NotNull World world) {
|
||||
+ return new Location(world, this.x(), this.y(), this.z(), this.getYaw(), this.getPitch());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
||||
Date: Sun, 18 Sep 2022 13:10:28 -0400
|
||||
Subject: [PATCH] Add PrePlayerAttackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the player tries to attack an entity.
|
||||
+ * <p>
|
||||
+ * This occurs before any of the damage logic, so cancelling this event
|
||||
+ * will prevent any sort of sounds from being played when attacking.
|
||||
+ * <p>
|
||||
+ * This event will fire as cancelled for certain entities, with {@link PrePlayerAttackEntityEvent#willAttack()} being false
|
||||
+ * to indicate that this entity will not actually be attacked.
|
||||
+ * <p>
|
||||
+ * Note: there may be other factors (invulnerability, etc.) that will prevent this entity from being attacked that this event will not cover
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Entity attacked;
|
||||
+ private final boolean willAttack;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PrePlayerAttackEntityEvent(final Player player, final Entity attacked, final boolean willAttack) {
|
||||
+ super(player);
|
||||
+ this.attacked = attacked;
|
||||
+ this.willAttack = willAttack;
|
||||
+ this.cancelled = !willAttack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity that was attacked in this event.
|
||||
+ *
|
||||
+ * @return entity that was attacked
|
||||
+ */
|
||||
+ public Entity getAttacked() {
|
||||
+ return this.attacked;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets if this entity will be attacked normally.
|
||||
+ * Entities like falling sand will return {@code false} because
|
||||
+ * their entity type does not allow them to be attacked.
|
||||
+ * <p>
|
||||
+ * Note: there may be other factors (invulnerability, etc.) that will prevent this entity from being attacked that this event will not cover
|
||||
+ *
|
||||
+ * @return if the entity will actually be attacked
|
||||
+ */
|
||||
+ public boolean willAttack() {
|
||||
+ return this.willAttack;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this attack should be cancelled, note if {@link PrePlayerAttackEntityEvent#willAttack()} returns false
|
||||
+ * this event will always be cancelled.
|
||||
+ *
|
||||
+ * @param cancel {@code true} if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ if (!this.willAttack) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
|
@ -1,206 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 3 Jul 2020 11:58:56 -0500
|
||||
Subject: [PATCH] Add PrepareResultEvent / PrepareGrindstoneEvent
|
||||
|
||||
Adds a new event for all crafting stations that generate a result slot item
|
||||
|
||||
Anvil, Grindstone and Smithing now extend this event
|
||||
|
||||
Grindstone is a backwards compat from a previous PrepareGrindstoneEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareGrindstoneEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.inventory;
|
||||
+
|
||||
+import org.bukkit.Warning;
|
||||
+import org.bukkit.inventory.GrindstoneInventory;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item is put in a slot for grinding in a Grindstone
|
||||
+ *
|
||||
+ * @deprecated use {@link org.bukkit.event.inventory.PrepareGrindstoneEvent}
|
||||
+ */
|
||||
+@Deprecated(since = "1.16.1")
|
||||
+@Warning
|
||||
+public class PrepareGrindstoneEvent extends PrepareResultEvent {
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
||||
+ super(inventory, result);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public GrindstoneInventory getInventory() {
|
||||
+ return (GrindstoneInventory) super.getInventory();
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/inventory/PrepareResultEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.inventory;
|
||||
+
|
||||
+import org.bukkit.event.inventory.PrepareInventoryResultEvent;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item is put in an inventory containing a result slot
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PrepareResultEvent extends PrepareInventoryResultEvent {
|
||||
+
|
||||
+ // HandlerList on PrepareInventoryResultEvent to ensure api compat
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PrepareResultEvent(final InventoryView inventory, final @Nullable ItemStack result) {
|
||||
+ super(inventory, result);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get result item, may be {@code null}.
|
||||
+ *
|
||||
+ * @return result item
|
||||
+ */
|
||||
+ @Override
|
||||
+ public @Nullable ItemStack getResult() {
|
||||
+ return super.getResult();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set result item, may be {@code null}.
|
||||
+ *
|
||||
+ * @param result result item
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setResult(final @Nullable ItemStack result) {
|
||||
+ super.setResult(result);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/PrepareAnvilEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Called when an item is put in a slot for repair by an anvil.
|
||||
*/
|
||||
-public class PrepareAnvilEvent extends PrepareInventoryResultEvent {
|
||||
+public class PrepareAnvilEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent {
|
||||
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
+ // Paper - move HandlerList to PrepareInventoryResultEvent
|
||||
|
||||
public PrepareAnvilEvent(@NotNull AnvilView inventory, @Nullable ItemStack result) {
|
||||
super(inventory, result);
|
||||
@@ -0,0 +0,0 @@ public class PrepareAnvilEvent extends PrepareInventoryResultEvent {
|
||||
return (AnvilView) super.getView();
|
||||
}
|
||||
|
||||
- @NotNull
|
||||
- @Override
|
||||
- public HandlerList getHandlers() {
|
||||
- return handlers;
|
||||
- }
|
||||
-
|
||||
- @NotNull
|
||||
- public static HandlerList getHandlerList() {
|
||||
- return handlers;
|
||||
- }
|
||||
+ // Paper - move HandlerList to PrepareInventoryResultEvent
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/PrepareGrindstoneEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Called when an item is put in a slot for repair or unenchanting in a grindstone.
|
||||
*/
|
||||
-public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent {
|
||||
+public class PrepareGrindstoneEvent extends com.destroystokyo.paper.event.inventory.PrepareGrindstoneEvent { // Paper
|
||||
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
+ // Paper - move HandlerList to PrepareInventoryResultEvent
|
||||
|
||||
public PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
||||
super(inventory, result);
|
||||
@@ -0,0 +0,0 @@ public class PrepareGrindstoneEvent extends PrepareInventoryResultEvent {
|
||||
return (GrindstoneInventory) super.getInventory();
|
||||
}
|
||||
|
||||
- @NotNull
|
||||
- @Override
|
||||
- public HandlerList getHandlers() {
|
||||
- return handlers;
|
||||
- }
|
||||
-
|
||||
- @NotNull
|
||||
- public static HandlerList getHandlerList() {
|
||||
- return handlers;
|
||||
- }
|
||||
+ // Paper - move HandlerList to PrepareInventoryResultEvent
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/PrepareInventoryResultEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when an item is put in a slot and the result is calculated.
|
||||
+ * @deprecated use {@link com.destroystokyo.paper.event.inventory.PrepareResultEvent}
|
||||
*/
|
||||
+@Deprecated @org.bukkit.Warning(false) // Paper
|
||||
public class PrepareInventoryResultEvent extends InventoryEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/PrepareSmithingEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Called when an item is put in a slot for upgrade by a Smithing Table.
|
||||
*/
|
||||
-public class PrepareSmithingEvent extends PrepareInventoryResultEvent {
|
||||
+public class PrepareSmithingEvent extends com.destroystokyo.paper.event.inventory.PrepareResultEvent {
|
||||
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
+ // Paper - move HandlerList ot PrepareInventoryResultEvent
|
||||
|
||||
public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
||||
super(inventory, result);
|
||||
@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends PrepareInventoryResultEvent {
|
||||
return (SmithingInventory) super.getInventory();
|
||||
}
|
||||
|
||||
- @NotNull
|
||||
- @Override
|
||||
- public HandlerList getHandlers() {
|
||||
- return handlers;
|
||||
- }
|
||||
-
|
||||
- @NotNull
|
||||
- public static HandlerList getHandlerList() {
|
||||
- return handlers;
|
||||
- }
|
||||
+ // Paper - move HandlerList to PrepareInventoryResultEvent
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue