mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Move patches around
This commit is contained in:
parent
9f5325207d
commit
95d25d98e8
1079 changed files with 126318 additions and 0 deletions
|
@ -74,6 +74,9 @@ paperweight {
|
|||
serverProject.set(project(":Paper-Server"))
|
||||
|
||||
paper {
|
||||
spigotApiPatchDir.set(file("patches/api"))
|
||||
spigotServerPatchDir.set(file("patches/server"))
|
||||
|
||||
mappingsPatch.set(file("build-data/mappings-patch.tiny"))
|
||||
|
||||
additionalSpigotMemberMappings.set(file("build-data/additional-spigot-member-mappings.csrg"))
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
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 {
|
||||
@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
|
||||
*
|
|
@ -0,0 +1,50 @@
|
|||
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);
|
||||
+ }
|
||||
/**
|
||||
* 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
|
|
@ -0,0 +1,91 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 18 Mar 2018 11:43:30 -0400
|
||||
Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent
|
||||
|
||||
This will allow you to change the players name or skin on login.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.event.player;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.UUID;
|
||||
+
|
||||
+import com.destroystokyo.paper.profile.PlayerProfile;
|
||||
+import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Result result;
|
||||
private net.kyori.adventure.text.Component message; // Paper
|
||||
- private final String name;
|
||||
+ //private String name; // Paper - Not used anymore
|
||||
private final InetAddress ipAddress;
|
||||
- private final UUID uniqueId;
|
||||
+ //private UUID uniqueId; // Paper - Not used anymore
|
||||
|
||||
@Deprecated
|
||||
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress) {
|
||||
@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
}
|
||||
|
||||
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId) {
|
||||
+ // Paper start
|
||||
+ this(name, ipAddress, uniqueId, Bukkit.createProfile(uniqueId, name));
|
||||
+ }
|
||||
+ private PlayerProfile profile;
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the PlayerProfile of the player logging in
|
||||
+ * @return The Profile
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PlayerProfile getPlayerProfile() {
|
||||
+ return profile;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Changes the PlayerProfile the player will login as
|
||||
+ * @param profile The profile to use
|
||||
+ */
|
||||
+ public void setPlayerProfile(@NotNull PlayerProfile profile) {
|
||||
+ this.profile = profile;
|
||||
+ }
|
||||
+
|
||||
+ public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, @NotNull PlayerProfile profile) {
|
||||
super(true);
|
||||
+ this.profile = profile;
|
||||
+ // Paper end
|
||||
this.result = Result.ALLOWED;
|
||||
this.message = net.kyori.adventure.text.Component.empty(); // Paper
|
||||
- this.name = name;
|
||||
+ //this.name = name; // Paper - Not used anymore
|
||||
this.ipAddress = ipAddress;
|
||||
- this.uniqueId = uniqueId;
|
||||
+ //this.uniqueId = uniqueId; // Paper - Not used anymore
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
*/
|
||||
@NotNull
|
||||
public String getName() {
|
||||
- return name;
|
||||
+ return profile.getName(); // Paper
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event {
|
||||
*/
|
||||
@NotNull
|
||||
public UUID getUniqueId() {
|
||||
- return uniqueId;
|
||||
+ return profile.getId(); // Paper
|
||||
}
|
||||
|
||||
@NotNull
|
|
@ -0,0 +1,57 @@
|
|||
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 @@
|
||||
package org.bukkit;
|
||||
|
||||
import java.util.Collection;
|
||||
+import java.util.function.Predicate;
|
||||
+
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@@ -0,0 +0,0 @@ public interface Chunk extends PersistentDataHolder {
|
||||
@NotNull
|
||||
Entity[] getEntities();
|
||||
|
||||
+ // Paper start
|
||||
/**
|
||||
* Get a list of all tile entities in the chunk.
|
||||
*
|
||||
* @return The tile entities.
|
||||
*/
|
||||
@NotNull
|
||||
- BlockState[] getTileEntities();
|
||||
+ 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(@NotNull Predicate<Block> blockPredicate, boolean useSnapshot);
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Checks if the chunk is loaded.
|
79
patches/api-unmapped/Add-API-for-quit-reason.patch
Normal file
79
patches/api-unmapped/Add-API-for-quit-reason.patch
Normal file
|
@ -0,0 +1,79 @@
|
|||
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 ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().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
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
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
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew 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 @@
|
||||
package org.bukkit.entity;
|
||||
|
||||
+import org.bukkit.Material;
|
||||
import org.bukkit.TreeSpecies;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -0,0 +0,0 @@ public interface Boat extends Vehicle {
|
||||
*/
|
||||
@Deprecated
|
||||
public void setWorkOnLand(boolean workOnLand);
|
||||
+
|
||||
+ // 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.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
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Miller <mnmiller1@me.com>
|
||||
Date: Mon, 4 Jan 2021 16:40:55 +1000
|
||||
Subject: [PATCH] Add API to get exact interaction point in PlayerInteractEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java b/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java
|
||||
index 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 {
|
||||
private Result useClickedBlock;
|
||||
private Result useItemInHand;
|
||||
private EquipmentSlot hand;
|
||||
+ private Location interactionPoint; // Paper
|
||||
|
||||
public PlayerInteractEvent(@NotNull final Player who, @NotNull final Action action, @Nullable final ItemStack item, @Nullable final Block clickedBlock, @NotNull final BlockFace clickedFace) {
|
||||
this(who, action, item, clickedBlock, clickedFace, EquipmentSlot.HAND);
|
||||
}
|
||||
|
||||
public PlayerInteractEvent(@NotNull final Player who, @NotNull final Action action, @Nullable final ItemStack item, @Nullable final Block clickedBlock, @NotNull final BlockFace clickedFace, @Nullable final EquipmentSlot hand) {
|
||||
+ // Paper start - Add interactionPoint
|
||||
+ this(who, action, item, clickedBlock, clickedFace, hand, null);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerInteractEvent(@NotNull final Player who, @NotNull final Action action, @Nullable final ItemStack item, @Nullable final Block clickedBlock, @NotNull final BlockFace clickedFace, @Nullable final EquipmentSlot hand, @Nullable final Location interactionPoint) {
|
||||
super(who);
|
||||
this.action = action;
|
||||
this.item = item;
|
||||
this.blockClicked = clickedBlock;
|
||||
this.blockFace = clickedFace;
|
||||
this.hand = hand;
|
||||
+ this.interactionPoint = interactionPoint;
|
||||
|
||||
useItemInHand = Result.DEFAULT;
|
||||
useClickedBlock = clickedBlock == null ? Result.DENY : Result.ALLOW;
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Returns the action type
|
||||
@@ -0,0 +0,0 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
|
||||
return hand;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * The exact point at which the interaction occurred. May be null.
|
||||
+ *
|
||||
+ * @return the exact interaction point. May be null.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getInteractionPoint() {
|
||||
+ return interactionPoint;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
|
@ -0,0 +1,62 @@
|
|||
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
|
||||
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
|
||||
|
||||
/**
|
||||
* Increments the given statistic for this player.
|
|
@ -0,0 +1,71 @@
|
|||
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() {
|
96
patches/api-unmapped/Add-ArmorStand-Item-Meta.patch
Normal file
96
patches/api-unmapped/Add-ArmorStand-Item-Meta.patch
Normal file
|
@ -0,0 +1,96 @@
|
|||
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);
|
||||
+}
|
253
patches/api-unmapped/Add-Ban-Methods-to-Player-Objects.patch
Normal file
253
patches/api-unmapped/Add-Ban-Methods-to-Player-Objects.patch
Normal file
|
@ -0,0 +1,253 @@
|
|||
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
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ 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
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ 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
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ 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
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public default BanEntry banPlayer(@Nullable String reason, @Nullable java.util.Date expires, @Nullable String source) {
|
||||
+ return banPlayer(reason, expires, source, true);
|
||||
+ }
|
||||
+ @NotNull
|
||||
+ 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
|
||||
|
||||
/**
|
||||
* Checks if this player is whitelisted or not
|
||||
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 @@ import java.util.UUID;
|
||||
import com.destroystokyo.paper.Title; // Paper
|
||||
import net.kyori.adventure.text.Component;
|
||||
import com.destroystokyo.paper.profile.PlayerProfile; // Paper
|
||||
+import java.util.Date; // Paper
|
||||
+import org.bukkit.BanEntry; // Paper
|
||||
+import org.bukkit.BanList; // Paper
|
||||
+import org.bukkit.Bukkit; // Paper
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
@@ -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
|
||||
+ */
|
||||
+ // For reference, Bukkit defines this as nullable, while they impl isn't, we'll follow API.
|
||||
+ @Nullable
|
||||
+ public default 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
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default 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
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default BanEntry banPlayerFull(@Nullable String reason, @Nullable 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
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default BanEntry banPlayerFull(@Nullable String reason, @Nullable 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, Date, String)}
|
||||
+ *
|
||||
+ * @param reason Reason for ban
|
||||
+ * @param kickPlayer Whether or not to kick the player afterwards
|
||||
+ * @return Ban Entry
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default 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, 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
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default 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, 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
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default BanEntry banPlayerIP(@Nullable String reason, @Nullable 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, Date, String)}
|
||||
+ *
|
||||
+ * @param reason Reason for ban
|
||||
+ * @return Ban Entry
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default 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, Date, String)}
|
||||
+ * @param reason Reason for ban
|
||||
+ * @param source Source of ban, or null for default
|
||||
+ * @return Ban Entry
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default 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, Date, String)}
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @return Ban Entry
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default BanEntry banPlayerIP(@Nullable String reason, @Nullable 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, Date, String)}
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @param source Source of the banm or null for default
|
||||
+ * @return Ban Entry
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default BanEntry banPlayerIP(@Nullable String reason, @Nullable 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, Date, String)}
|
||||
+ * @param reason Reason for Ban
|
||||
+ * @param expires When to expire the ban
|
||||
+ * @param source Source of the banm or null for default
|
||||
+ * @param kickPlayer if the targeted player should be kicked
|
||||
+ * @return Ban Entry
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public default BanEntry banPlayerIP(@Nullable String reason, @Nullable Date expires, @Nullable String source, boolean kickPlayer) {
|
||||
+ BanEntry banEntry = Bukkit.getServer().getBanList(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.
|
|
@ -0,0 +1,54 @@
|
|||
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 sendMessage(final @NotNull net.kyori.adventure.identity.Identity identity, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) {
|
||||
this.sendMessage(org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(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
|
||||
}
|
98
patches/api-unmapped/Add-BeaconEffectEvent.patch
Normal file
98
patches/api-unmapped/Add-BeaconEffectEvent.patch
Normal file
|
@ -0,0 +1,98 @@
|
|||
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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a beacon effect is being applied to a player.
|
||||
+ */
|
||||
+public class BeaconEffectEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private PotionEffect effect;
|
||||
+ private Player player;
|
||||
+ private boolean primary;
|
||||
+
|
||||
+ public BeaconEffectEvent(@NotNull Block block, @NotNull PotionEffect effect, @NotNull Player player, boolean primary) {
|
||||
+ super(block);
|
||||
+ this.effect = effect;
|
||||
+ this.player = player;
|
||||
+ this.primary = primary;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the potion effect being applied.
|
||||
+ *
|
||||
+ * @return Potion effect
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PotionEffect getEffect() {
|
||||
+ return effect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the potion effect that will be applied.
|
||||
+ *
|
||||
+ * @param effect Potion effect
|
||||
+ */
|
||||
+ public void setEffect(@NotNull PotionEffect effect) {
|
||||
+ this.effect = effect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player who the potion effect is being applied to.
|
||||
+ *
|
||||
+ * @return Affected player
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the effect is a primary beacon effect.
|
||||
+ *
|
||||
+ * @return true if this event represents a primary effect
|
||||
+ */
|
||||
+ public boolean isPrimary() {
|
||||
+ return primary;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
70
patches/api-unmapped/Add-BellRevealRaiderEvent.patch
Normal file
70
patches/api-unmapped/Add-BellRevealRaiderEvent.patch
Normal file
|
@ -0,0 +1,70 @@
|
|||
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.Entity;
|
||||
+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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a {@link org.bukkit.entity.Raider} is revealed by a bell.
|
||||
+ */
|
||||
+public class BellRevealRaiderEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled = false;
|
||||
+ private final Raider raider;
|
||||
+
|
||||
+ public BellRevealRaiderEvent(@NotNull Block theBlock, @NotNull Entity raider) {
|
||||
+ super(theBlock);
|
||||
+ this.raider = (Raider) raider;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the raider that the bell revealed.
|
||||
+ *
|
||||
+ * @return The raider
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Raider getEntity() {
|
||||
+ return raider;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return 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 handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
69
patches/api-unmapped/Add-BellRingEvent.patch
Normal file
69
patches/api-unmapped/Add-BellRingEvent.patch
Normal file
|
@ -0,0 +1,69 @@
|
|||
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.entity.Entity;
|
||||
+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.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a bell is rung.
|
||||
+ */
|
||||
+public class BellRingEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private final Entity entity;
|
||||
+
|
||||
+ public BellRingEvent(@NotNull Block block, @Nullable Entity entity) {
|
||||
+ super(block);
|
||||
+ this.entity = entity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity that rang the bell.
|
||||
+ *
|
||||
+ * @return the ringer or null if none
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getEntity() {
|
||||
+ return entity;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
26
patches/api-unmapped/Add-Block-isValidTool.patch
Normal file
26
patches/api-unmapped/Add-Block-isValidTool.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
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
|
||||
|
||||
|
||||
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 {
|
||||
public static int getBlockKeyZ(long packed) {
|
||||
return (int) ((packed << 10) >> 37);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * 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
|
||||
+ */
|
||||
+ boolean isValidTool(@NotNull ItemStack itemStack);
|
||||
// Paper End
|
||||
|
||||
/**
|
69
patches/api-unmapped/Add-BlockFailedDispenseEvent.patch
Normal file
69
patches/api-unmapped/Add-BlockFailedDispenseEvent.patch
Normal file
|
@ -0,0 +1,69 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TheViperShow <29604693+TheViperShow@users.noreply.github.com>
|
||||
Date: Wed, 22 Apr 2020 09:40:23 +0200
|
||||
Subject: [PATCH] Add BlockFailedDispenseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockFailedDispenseEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a block tries to dispense an item, but its inventory is empty.
|
||||
+ */
|
||||
+public class BlockFailedDispenseEvent extends BlockEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private boolean shouldPlayEffect = true;
|
||||
+
|
||||
+ public BlockFailedDispenseEvent(@NotNull Block theBlock) {
|
||||
+ super(theBlock);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return if the effect should be played
|
||||
+ */
|
||||
+ public boolean shouldPlayEffect() {
|
||||
+ return this.shouldPlayEffect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if the effect for empty dispensers should be played
|
||||
+ *
|
||||
+ * @param playEffect if the effect should be played
|
||||
+ */
|
||||
+ public void shouldPlayEffect(boolean playEffect) {
|
||||
+ this.shouldPlayEffect = playEffect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * @return {@link #shouldPlayEffect()}
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean callEvent() {
|
||||
+ super.callEvent();
|
||||
+ return this.shouldPlayEffect();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull
|
||||
+ HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull
|
||||
+ HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
72
patches/api-unmapped/Add-BlockPreDispenseEvent.patch
Normal file
72
patches/api-unmapped/Add-BlockPreDispenseEvent.patch
Normal file
|
@ -0,0 +1,72 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Miller <mnmiller1@me.com>
|
||||
Date: Sun, 17 Jan 2021 13:15:54 +1000
|
||||
Subject: [PATCH] Add BlockPreDispenseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java b/src/main/java/io/papermc/paper/event/block/BlockPreDispenseEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..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.NotNull;
|
||||
+
|
||||
+public class BlockPreDispenseEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled = false;
|
||||
+ private final ItemStack itemStack;
|
||||
+ private final int slot;
|
||||
+
|
||||
+ public BlockPreDispenseEvent(@NotNull Block block, @NotNull ItemStack itemStack, int slot) {
|
||||
+ super(block);
|
||||
+ this.itemStack = itemStack;
|
||||
+ this.slot = slot;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link ItemStack} to be dispensed.
|
||||
+ *
|
||||
+ * @return The item to be dispensed
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the inventory slot of the dispenser to dispense from.
|
||||
+ *
|
||||
+ * @return The inventory slot
|
||||
+ */
|
||||
+ public int getSlot() {
|
||||
+ return slot;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+}
|
94
patches/api-unmapped/Add-BlockSoundGroup-interface.patch
Normal file
94
patches/api-unmapped/Add-BlockSoundGroup-interface.patch
Normal file
|
@ -0,0 +1,94 @@
|
|||
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.
|
||||
+ */
|
||||
+public interface BlockSoundGroup {
|
||||
+ /**
|
||||
+ * Gets the sound that plays when breaking this block
|
||||
+ *
|
||||
+ * @return The break sound
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Sound getBreakSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when stepping on this block
|
||||
+ *
|
||||
+ * @return The step sound
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Sound getStepSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when placing this block
|
||||
+ *
|
||||
+ * @return The place sound
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Sound getPlaceSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when hitting this block
|
||||
+ *
|
||||
+ * @return The hit sound
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Sound getHitSound();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sound that plays when this block falls
|
||||
+ *
|
||||
+ * @return The fall sound
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ 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 @@
|
||||
package org.bukkit.block;
|
||||
|
||||
import java.util.Collection;
|
||||
+
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.Location;
|
||||
@@ -0,0 +0,0 @@ public interface Block extends Metadatable {
|
||||
*/
|
||||
@NotNull
|
||||
BoundingBox getBoundingBox();
|
||||
+
|
||||
+ // 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
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup();
|
||||
+ // Paper end
|
||||
}
|
41
patches/api-unmapped/Add-Destroy-Speed-API.patch
Normal file
41
patches/api-unmapped/Add-Destroy-Speed-API.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
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 {
|
||||
*/
|
||||
@NotNull
|
||||
String getTranslationKey();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the speed at which this block will be destroyed by a given {@link ItemStack}
|
||||
+ *
|
||||
+ * <p>Default value is 1.0</p>
|
||||
+ *
|
||||
+ * @param itemStack {@link ItemStack} used to mine this Block
|
||||
+ * @return the speed that this Block will be mined by the given {@link ItemStack}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public default float getDestroySpeed(@NotNull ItemStack itemStack) {
|
||||
+ return getDestroySpeed(itemStack, false);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the speed at which this blook will be destroyed by a given {@link org.bukkit.inventory.ItemStack}
|
||||
+ * <p>
|
||||
+ * Default value is 1.0
|
||||
+ * @param itemStack {@link org.bukkit.inventory.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 org.bukkit.inventory.ItemStack}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ float getDestroySpeed(@NotNull ItemStack itemStack, boolean considerEnchants);
|
||||
// Paper end
|
||||
}
|
81
patches/api-unmapped/Add-ElderGuardianAppearanceEvent.patch
Normal file
81
patches/api-unmapped/Add-ElderGuardianAppearanceEvent.patch
Normal file
|
@ -0,0 +1,81 @@
|
|||
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.Entity;
|
||||
+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.NotNull;
|
||||
+
|
||||
+import java.util.Collections;
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * Is called when an {@link org.bukkit.entity.ElderGuardian} appears in front of a {@link org.bukkit.entity.Player}.
|
||||
+ */
|
||||
+public class ElderGuardianAppearanceEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+ private final Player affectedPlayer;
|
||||
+
|
||||
+ public ElderGuardianAppearanceEvent(@NotNull Entity what, @NotNull Player affectedPlayer) {
|
||||
+ super(what);
|
||||
+ this.affectedPlayer = affectedPlayer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the player affected by the guardian appearance.
|
||||
+ *
|
||||
+ * @return Player affected by the appearance
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Player getAffectedPlayer() {
|
||||
+ return affectedPlayer;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The elder guardian playing the effect.
|
||||
+ *
|
||||
+ * @return The elder guardian
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ElderGuardian getEntity() {
|
||||
+ return (ElderGuardian) entity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,22 @@
|
|||
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
|
||||
}
|
92
patches/api-unmapped/Add-EntityInsideBlockEvent.patch
Normal file
92
patches/api-unmapped/Add-EntityInsideBlockEvent.patch
Normal file
|
@ -0,0 +1,92 @@
|
|||
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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * 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>Bubble column</li>
|
||||
+ * <li>Buttons</li>
|
||||
+ * <li>Cactus</li>
|
||||
+ * <li>Campfire</li>
|
||||
+ * <li>Cauldron</li>
|
||||
+ * <li>Crops</li>
|
||||
+ * <li>Ender Portal</li>
|
||||
+ * <li>Fires</li>
|
||||
+ * <li>Honey</li>
|
||||
+ * <li>Hopper</li>
|
||||
+ * <li>Detector rails</li>
|
||||
+ * <li>Nether portals</li>
|
||||
+ * <li>Pressure plates</li>
|
||||
+ * <li>Sweet berry bush</li>
|
||||
+ * <li>Tripwire</li>
|
||||
+ * <li>Waterlily</li>
|
||||
+ * <li>Web</li>
|
||||
+ * <li>Wither rose</li>
|
||||
+ * </ul>
|
||||
+ */
|
||||
+public class EntityInsideBlockEvent extends EntityEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Block block;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public EntityInsideBlockEvent(@NotNull Entity entity, @NotNull Block block) {
|
||||
+ super(entity);
|
||||
+ this.block = block;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block.
|
||||
+ *
|
||||
+ * @return the block
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Block getBlock() {
|
||||
+ return block;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
94
patches/api-unmapped/Add-EntityKnockbackByEntityEvent.patch
Normal file
94
patches/api-unmapped/Add-EntityKnockbackByEntityEvent.patch
Normal file
|
@ -0,0 +1,94 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brokkonaut <hannos17@gmx.de>
|
||||
Date: Mon, 18 Jun 2018 15:40:39 +0200
|
||||
Subject: [PATCH] Add EntityKnockbackByEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.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.util.Vector;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when an Entity is knocked back by the hit of another Entity. The acceleration
|
||||
+ * vector can be modified. If this event is cancelled, the entity is not knocked back.
|
||||
+ *
|
||||
+ */
|
||||
+public class EntityKnockbackByEntityEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final Entity hitBy;
|
||||
+ private final float knockbackStrength;
|
||||
+ @NotNull private final Vector acceleration;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public EntityKnockbackByEntityEvent(@NotNull LivingEntity entity, @NotNull Entity hitBy, float knockbackStrength, @NotNull Vector acceleration) {
|
||||
+ super(entity);
|
||||
+ this.hitBy = hitBy;
|
||||
+ this.knockbackStrength = knockbackStrength;
|
||||
+ this.acceleration = acceleration;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the entity which was knocked back
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the original knockback strength.
|
||||
+ */
|
||||
+ public float getKnockbackStrength() {
|
||||
+ return knockbackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the Entity which hit
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getHitBy() {
|
||||
+ return hitBy;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the acceleration that will be applied
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Vector getAcceleration() {
|
||||
+ return acceleration;
|
||||
+ }
|
||||
+}
|
113
patches/api-unmapped/Add-EntityLoadCrossbowEvent.patch
Normal file
113
patches/api-unmapped/Add-EntityLoadCrossbowEvent.patch
Normal file
|
@ -0,0 +1,113 @@
|
|||
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.entity.Player;
|
||||
+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.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a LivingEntity loads a crossbow with a projectile.
|
||||
+ */
|
||||
+public class EntityLoadCrossbowEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final ItemStack crossbow;
|
||||
+ private final EquipmentSlot hand;
|
||||
+ private boolean cancelled;
|
||||
+ private boolean consumeItem = true;
|
||||
+
|
||||
+ public EntityLoadCrossbowEvent(@NotNull LivingEntity entity, @Nullable ItemStack crossbow, @NotNull EquipmentSlot hand) {
|
||||
+ super(entity);
|
||||
+ this.crossbow = crossbow;
|
||||
+ this.hand = hand;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public LivingEntity getEntity() {
|
||||
+ return (LivingEntity) entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the crossbow {@link ItemStack} being loaded.
|
||||
+ *
|
||||
+ * @return the crossbow involved in this event
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public ItemStack getCrossbow() {
|
||||
+ return crossbow;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the hand from which the crossbow was loaded.
|
||||
+ *
|
||||
+ * @return the hand
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return hand;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ *
|
||||
+ * @return should the itemstack be consumed
|
||||
+ */
|
||||
+ public boolean shouldConsumeItem() {
|
||||
+ return consumeItem;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ *
|
||||
+ * @param consume should the item be consumed
|
||||
+ */
|
||||
+ public void setConsumeItem(boolean consume) {
|
||||
+ this.consumeItem = consume;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether or not to cancel the crossbow being loaded. If canceled, the
|
||||
+ * projectile that would be loaded into the crossbow will not be consumed.
|
||||
+ *
|
||||
+ * If set to false, and this event is pertaining to a player entity,
|
||||
+ * it's recommended that a call to {@link Player#updateInventory()} is made
|
||||
+ * as the client may think the server still loaded an item into the crossbow.
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
43
patches/api-unmapped/Add-EntityTeleportEndGatewayEvent.patch
Normal file
43
patches/api-unmapped/Add-EntityTeleportEndGatewayEvent.patch
Normal file
|
@ -0,0 +1,43 @@
|
|||
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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired any time an entity attempts to teleport in an end gateway
|
||||
+ */
|
||||
+public class EntityTeleportEndGatewayEvent extends EntityTeleportEvent {
|
||||
+
|
||||
+ @NotNull private final EndGateway gateway;
|
||||
+
|
||||
+ public EntityTeleportEndGatewayEvent(@NotNull Entity what, @NotNull Location from, @NotNull Location to, @NotNull EndGateway gateway) {
|
||||
+ super(what, from, to);
|
||||
+ this.gateway = gateway;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The gateway triggering the teleport
|
||||
+ *
|
||||
+ * @return EndGateway used
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EndGateway getGateway() {
|
||||
+ return gateway;
|
||||
+ }
|
||||
+
|
||||
+}
|
123
patches/api-unmapped/Add-EntityZapEvent.patch
Normal file
123
patches/api-unmapped/Add-EntityZapEvent.patch
Normal file
|
@ -0,0 +1,123 @@
|
|||
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 org.apache.commons.lang.Validate;
|
||||
+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.EntityEvent;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+
|
||||
+import java.util.Collections;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when lightning strikes an entity
|
||||
+ */
|
||||
+public class EntityZapEvent extends EntityTransformEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ @NotNull private final LightningStrike bolt;
|
||||
+
|
||||
+ public EntityZapEvent(@NotNull final Entity entity, @NotNull final LightningStrike bolt, @NotNull final Entity replacementEntity) {
|
||||
+ super(entity, Collections.singletonList(replacementEntity), TransformReason.LIGHTNING);
|
||||
+ Validate.notNull(bolt);
|
||||
+ Validate.notNull(replacementEntity);
|
||||
+ this.bolt = bolt;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the lightning bolt that is striking the entity.
|
||||
+ * @return The lightning bolt responsible for this event
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public LightningStrike getBolt() {
|
||||
+ return bolt;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity that will replace the struck entity.
|
||||
+ * @return The entity that will replace the struck entity
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getReplacementEntity() {
|
||||
+ return getTransformedEntity();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
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 @@ package org.bukkit.event.entity;
|
||||
|
||||
import java.util.Collections;
|
||||
import org.bukkit.entity.Entity;
|
||||
+import com.destroystokyo.paper.event.entity.EntityZapEvent;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
@@ -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 EntityZapEvent implements Cancellable {
|
||||
+ //private static final HandlerList handlers = new HandlerList();
|
||||
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);
|
||||
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
|
||||
}
|
24
patches/api-unmapped/Add-FastUtil-to-Bukkit.patch
Normal file
24
patches/api-unmapped/Add-FastUtil-to-Bukkit.patch
Normal file
|
@ -0,0 +1,24 @@
|
|||
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/pom.xml b/pom.xml
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -0,0 +0,0 @@
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
+ <dependency>
|
||||
+ <groupId>it.unimi.dsi</groupId>
|
||||
+ <artifactId>fastutil</artifactId>
|
||||
+ <version>8.2.2</version>
|
||||
+ <scope>provided</scope>
|
||||
+ </dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
424
patches/api-unmapped/Add-GS4-Query-event.patch
Normal file
424
patches/api-unmapped/Add-GS4-Query-event.patch
Normal file
|
@ -0,0 +1,424 @@
|
|||
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 org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.net.InetAddress;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Collection;
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * This event is fired if server is getting queried over GS4 Query protocol
|
||||
+ *
|
||||
+ * Adapted from Velocity's ProxyQueryEvent
|
||||
+ *
|
||||
+ * @author Mark Vainomaa
|
||||
+ */
|
||||
+public final class GS4QueryEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private final QueryType queryType;
|
||||
+ private final InetAddress querierAddress;
|
||||
+ private QueryResponse response;
|
||||
+
|
||||
+ public GS4QueryEvent(@NotNull QueryType queryType, @NotNull InetAddress querierAddress, @NotNull QueryResponse response) {
|
||||
+ super(true); // should always be called async
|
||||
+ this.queryType = Preconditions.checkNotNull(queryType, "queryType");
|
||||
+ this.querierAddress = Preconditions.checkNotNull(querierAddress, "querierAddress");
|
||||
+ this.response = Preconditions.checkNotNull(response, "response");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get query type
|
||||
+ * @return query type
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public QueryType getQueryType() {
|
||||
+ return queryType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get querier address
|
||||
+ * @return querier address
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public InetAddress getQuerierAddress() {
|
||||
+ return querierAddress;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get query response
|
||||
+ * @return query response
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public QueryResponse getResponse() {
|
||||
+ return response;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set query response
|
||||
+ * @param response query response
|
||||
+ */
|
||||
+ public void setResponse(@NotNull QueryResponse response) {
|
||||
+ this.response = Preconditions.checkNotNull(response, "response");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return "GS4QueryEvent{" +
|
||||
+ "queryType=" + queryType +
|
||||
+ ", querierAddress=" + querierAddress +
|
||||
+ ", response=" + response +
|
||||
+ '}';
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * 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 final static 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(String motd, String gameVersion, String map, int currentPlayers, int maxPlayers, String hostname, int port, Collection<String> players, String serverVersion, 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 org.bukkit.Server#getMotd()}.
|
||||
+ * @return motd
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getMotd() {
|
||||
+ return motd;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get game version which will be used to reply to the query. By default supported Minecraft versions range is sent.
|
||||
+ * @return game version
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getGameVersion() {
|
||||
+ return gameVersion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get map name which will be used to reply to the query. By default {@code world} is sent.
|
||||
+ * @return map name
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getMap() {
|
||||
+ return map;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get current online player count which will be used to reply to the query.
|
||||
+ * @return online player count
|
||||
+ */
|
||||
+ public int getCurrentPlayers() {
|
||||
+ return currentPlayers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get max player count which will be used to reply to the query.
|
||||
+ * @return max player count
|
||||
+ */
|
||||
+ public int getMaxPlayers() {
|
||||
+ return maxPlayers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get server (public facing) hostname
|
||||
+ * @return server hostname
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getHostname() {
|
||||
+ return hostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get server (public facing) port
|
||||
+ * @return server port
|
||||
+ */
|
||||
+ public int getPort() {
|
||||
+ return port;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get collection of players which will be used to reply to the query.
|
||||
+ * @return collection of players
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<String> getPlayers() {
|
||||
+ return players;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get server software (name and version) which will be used to reply to the query.
|
||||
+ * @return server software
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getServerVersion() {
|
||||
+ return serverVersion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get list of plugins which will be used to reply to the query.
|
||||
+ * @return collection of plugins
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<PluginInformation> getPlugins() {
|
||||
+ return plugins;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new {@link Builder} instance from data represented by this response
|
||||
+ * @return {@link QueryResponse} builder
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Builder toBuilder() {
|
||||
+ return QueryResponse.builder()
|
||||
+ .motd(getMotd())
|
||||
+ .gameVersion(getGameVersion())
|
||||
+ .map(getMap())
|
||||
+ .currentPlayers(getCurrentPlayers())
|
||||
+ .maxPlayers(getMaxPlayers())
|
||||
+ .hostname(getHostname())
|
||||
+ .port(getPort())
|
||||
+ .players(getPlayers())
|
||||
+ .serverVersion(getServerVersion())
|
||||
+ .plugins(getPlugins());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new {@link Builder} instance
|
||||
+ * @return {@link QueryResponse} builder
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static Builder builder() {
|
||||
+ return new Builder();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * A builder for {@link QueryResponse} objects.
|
||||
+ */
|
||||
+ public static final class Builder {
|
||||
+ private String motd;
|
||||
+ private String gameVersion;
|
||||
+ private String map;
|
||||
+ private String hostname;
|
||||
+ private String serverVersion;
|
||||
+
|
||||
+ private int currentPlayers;
|
||||
+ private int maxPlayers;
|
||||
+ private int port;
|
||||
+
|
||||
+ private List<String> players = new ArrayList<>();
|
||||
+ private List<PluginInformation> plugins = new ArrayList<>();
|
||||
+
|
||||
+ private Builder() {}
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder motd(@NotNull String motd) {
|
||||
+ this.motd = Preconditions.checkNotNull(motd, "motd");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder gameVersion(@NotNull String gameVersion) {
|
||||
+ this.gameVersion = Preconditions.checkNotNull(gameVersion, "gameVersion");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder map(@NotNull String map) {
|
||||
+ this.map = Preconditions.checkNotNull(map, "map");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder currentPlayers(int currentPlayers) {
|
||||
+ Preconditions.checkArgument(currentPlayers >= 0, "currentPlayers cannot be negative");
|
||||
+ this.currentPlayers = currentPlayers;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder maxPlayers(int maxPlayers) {
|
||||
+ Preconditions.checkArgument(maxPlayers >= 0, "maxPlayers cannot be negative");
|
||||
+ this.maxPlayers = maxPlayers;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder hostname(@NotNull String hostname) {
|
||||
+ this.hostname = Preconditions.checkNotNull(hostname, "hostname");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder port(int port) {
|
||||
+ Preconditions.checkArgument(port >= 1 && port <= 65535, "port must be between 1-65535");
|
||||
+ this.port = port;
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder players(@NotNull Collection<String> players) {
|
||||
+ this.players.addAll(Preconditions.checkNotNull(players, "players"));
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder players(@NotNull String... players) {
|
||||
+ this.players.addAll(Arrays.asList(Preconditions.checkNotNull(players, "players")));
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder clearPlayers() {
|
||||
+ this.players.clear();
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder serverVersion(@NotNull String serverVersion) {
|
||||
+ this.serverVersion = Preconditions.checkNotNull(serverVersion, "serverVersion");
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder plugins(@NotNull Collection<PluginInformation> plugins) {
|
||||
+ this.plugins.addAll(Preconditions.checkNotNull(plugins, "plugins"));
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder plugins(@NotNull PluginInformation... plugins) {
|
||||
+ this.plugins.addAll(Arrays.asList(Preconditions.checkNotNull(plugins, "plugins")));
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Builder clearPlugins() {
|
||||
+ this.plugins.clear();
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Builds new {@link QueryResponse} with supplied data
|
||||
+ * @return response
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public QueryResponse build() {
|
||||
+ return new QueryResponse(
|
||||
+ Preconditions.checkNotNull(motd, "motd"),
|
||||
+ Preconditions.checkNotNull(gameVersion, "gameVersion"),
|
||||
+ Preconditions.checkNotNull(map, "map"),
|
||||
+ currentPlayers,
|
||||
+ maxPlayers,
|
||||
+ Preconditions.checkNotNull(hostname, "hostname"),
|
||||
+ port,
|
||||
+ ImmutableList.copyOf(players),
|
||||
+ Preconditions.checkNotNull(serverVersion, "serverVersion"),
|
||||
+ ImmutableList.copyOf(plugins)
|
||||
+ );
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Plugin information
|
||||
+ */
|
||||
+ public static class PluginInformation {
|
||||
+ private String name;
|
||||
+ private String version;
|
||||
+
|
||||
+ public PluginInformation(@NotNull String name, @NotNull String version) {
|
||||
+ this.name = Preconditions.checkNotNull(name, "name");
|
||||
+ this.version = Preconditions.checkNotNull(version, "version");
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getName() {
|
||||
+ return name;
|
||||
+ }
|
||||
+
|
||||
+ public void setName(@NotNull String name) {
|
||||
+ this.name = name;
|
||||
+ }
|
||||
+
|
||||
+ public void setVersion(@NotNull String version) {
|
||||
+ this.version = version;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getVersion() {
|
||||
+ return version;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static PluginInformation of(@NotNull String name, @NotNull String version) {
|
||||
+ return new PluginInformation(name, version);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
196
patches/api-unmapped/Add-Heightmap-API.patch
Normal file
196
patches/api-unmapped/Add-Heightmap-API.patch
Normal file
|
@ -0,0 +1,196 @@
|
|||
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/com/destroystokyo/paper/HeightmapType.java b/src/main/java/com/destroystokyo/paper/HeightmapType.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/HeightmapType.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+import org.bukkit.*;
|
||||
+
|
||||
+/**
|
||||
+ * Enumeration of different heightmap types maintained by the server. Generally using these maps is much faster
|
||||
+ * than using an iterative search for a block in a given x, z coordinate.
|
||||
+ *
|
||||
+ * @deprecated Upstream has added their own API for using the game heightmaps. See {@link org.bukkit.HeightMap} and the
|
||||
+ * non-deprecated getHighestBlock methods on World such as {@link org.bukkit.World#getHighestBlockAt(Location, HeightMap)}.
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public enum HeightmapType {
|
||||
+
|
||||
+ /**
|
||||
+ * The highest block used for lighting in the world. Also the block returned by {@link World#getHighestBlockYAt(int, int)}}
|
||||
+ */
|
||||
+ LIGHT_BLOCKING,
|
||||
+
|
||||
+ /**
|
||||
+ * References the highest block in the world.
|
||||
+ */
|
||||
+ ANY,
|
||||
+
|
||||
+ /**
|
||||
+ * References the highest solid block in a world.
|
||||
+ */
|
||||
+ SOLID,
|
||||
+
|
||||
+ /**
|
||||
+ * References the highest solid or liquid block in a world.
|
||||
+ */
|
||||
+ SOLID_OR_LIQUID,
|
||||
+
|
||||
+ /**
|
||||
+ * References the highest solid or liquid block in a world, excluding leaves.
|
||||
+ */
|
||||
+ SOLID_OR_LIQUID_NO_LEAVES;
|
||||
+}
|
||||
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 {
|
||||
return centerLoc;
|
||||
}
|
||||
|
||||
+ // 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)
|
||||
+ * @throws NullPointerException if {{@link #getWorld()}} is {@code null}
|
||||
+ * @throws UnsupportedOperationException if {@link World#getHighestBlockYAt(int, int, com.destroystokyo.paper.HeightmapType)} does not support the specified heightmap
|
||||
+ * @deprecated Use {@link org.bukkit.Location#toHighestLocation(HeightMap)}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated
|
||||
+ public Location toHighestLocation(@NotNull final com.destroystokyo.paper.HeightmapType heightmap) {
|
||||
+ final Location ret = this.clone();
|
||||
+ ret.setY(this.getWorld().getHighestBlockYAt(this, heightmap));
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * 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
|
||||
+
|
||||
/**
|
||||
* Creates explosion at this location with given power
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
|
||||
@NotNull
|
||||
public Block getHighestBlockAt(@NotNull Location location);
|
||||
|
||||
+ // Paper start - Add heightmap API
|
||||
+ /**
|
||||
+ * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions.
|
||||
+ * <p>
|
||||
+ * <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||
+ * throwing an {@code UnsupportedOperationException}.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @param x The block's x-coordinate.
|
||||
+ * @param z The block's z-coordinate.
|
||||
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||
+ * @return The highest block's y-coordinate at (x, z) that matches the specified heightmap's conditions.
|
||||
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockYAt(int, int, HeightMap)}
|
||||
+ *
|
||||
+ * @see com.destroystokyo.paper.HeightmapType
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public int getHighestBlockYAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException;
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions.
|
||||
+ * Note that the y-coordinate of the specified location is ignored.
|
||||
+ * <p>
|
||||
+ * <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||
+ * throwing an {@code UnsupportedOperationException}.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @param location The specified block coordinates.
|
||||
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||
+ * @return The highest block's y-coordinate at {@code location} that matches the specified heightmap's conditions.
|
||||
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockYAt(Location, HeightMap)}
|
||||
+ * @see com.destroystokyo.paper.HeightmapType
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default int getHighestBlockYAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
|
||||
+ return this.getHighestBlockYAt(location.getBlockX(), location.getBlockZ(), heightmap);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions.
|
||||
+ * <p>
|
||||
+ * <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||
+ * throwing an {@code UnsupportedOperationException}.
|
||||
+ * </p>
|
||||
+ * @param x The block's x-coordinate.
|
||||
+ * @param z The block's z-coordinate.
|
||||
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||
+ * @return The highest {@link Block} at (x, z) that matches the specified heightmap's conditions.
|
||||
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockAt(int, int, HeightMap)}
|
||||
+ * @see com.destroystokyo.paper.HeightmapType
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ @NotNull
|
||||
+ default Block getHighestBlockAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
|
||||
+ return this.getBlockAt(x, this.getHighestBlockYAt(x, z, heightmap), z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions.
|
||||
+ * Note that the y-coordinate of the specified location is ignored.
|
||||
+ * <p>
|
||||
+ * <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||
+ * throwing an {@code UnsupportedOperationException}.
|
||||
+ * </p>
|
||||
+ * @param location The specified block coordinates.
|
||||
+ * @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||
+ * @return The highest {@link Block} at {@code location} that matches the specified heightmap's conditions.
|
||||
+ * @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||
+ * @deprecated Upstream has added support for this, use {@link World#getHighestBlockAt(Location, HeightMap)}
|
||||
+ * @see com.destroystokyo.paper.HeightmapType
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ @NotNull
|
||||
+ default Block getHighestBlockAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
|
||||
+ return this.getHighestBlockAt(location.getBlockX(), location.getBlockZ(), heightmap);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the highest coordinate corresponding to the {@link HeightMap} at the
|
||||
* given coordinates.
|
|
@ -0,0 +1,70 @@
|
|||
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 methodss
|
||||
|
||||
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 implements Recipe, Keyed {
|
||||
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 implements Recipe, Keyed {
|
||||
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) {
|
||||
+ Validate.isTrue(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()) {
|
||||
+ ItemStack stack = iterator.next().getItemStack();
|
||||
+ if (stack.equals(item)) {
|
||||
+ iterator.remove();
|
||||
+ count--;
|
||||
+ }
|
||||
+ }
|
||||
+ return this;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Removes an ingredient from the list.
|
||||
*
|
|
@ -0,0 +1,66 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 13 Sep 2018 21:39:26 -0400
|
||||
Subject: [PATCH] Add ItemStackRecipeChoice Draft API
|
||||
|
||||
This is based on Spigots Draft API. This is subject to change
|
||||
|
||||
Allows creating recipes that must match isSimilar to full item stack.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java b/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/inventory/ItemStackRecipeChoice.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.inventory;
|
||||
+
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.bukkit.inventory.RecipeChoice;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * Allows crafting Items that require full matching itemstacks to complete the recipe for custom items
|
||||
+ * @deprecated Draft API
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class ItemStackRecipeChoice implements RecipeChoice {
|
||||
+
|
||||
+ protected final List<ItemStack> choices = new ArrayList<>();
|
||||
+
|
||||
+ public ItemStackRecipeChoice(ItemStack choices) {
|
||||
+ this.choices.add(choices);
|
||||
+ }
|
||||
+
|
||||
+ public ItemStackRecipeChoice(List<ItemStack> choices) {
|
||||
+ this.choices.addAll(choices);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return choices.isEmpty() ? null : choices.get(0);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public RecipeChoice clone() {
|
||||
+ try {
|
||||
+ ItemStackRecipeChoice clone = (ItemStackRecipeChoice) super.clone();
|
||||
+ clone.choices.addAll(this.choices);
|
||||
+ return clone;
|
||||
+ } catch (CloneNotSupportedException ex) {
|
||||
+ throw new AssertionError(ex);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean test(ItemStack itemStack) {
|
||||
+ for (ItemStack stack : choices) {
|
||||
+ if (stack.isSimilar(itemStack)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
24
patches/api-unmapped/Add-LivingEntity-clearActiveItem.patch
Normal file
24
patches/api-unmapped/Add-LivingEntity-clearActiveItem.patch
Normal file
|
@ -0,0 +1,24 @@
|
|||
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
|
||||
@Nullable
|
||||
ItemStack getActiveItem();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Interrupts any ongoing active "usage" or consumption or an item.
|
||||
+ */
|
||||
+ void clearActiveItem();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get's remaining time a player needs to keep hands raised with an item to finish using it.
|
||||
* @return Remaining ticks to use the item
|
105
patches/api-unmapped/Add-LivingEntity-getTargetEntity.patch
Normal file
105
patches/api-unmapped/Add-LivingEntity-getTargetEntity.patch
Normal file
|
@ -0,0 +1,105 @@
|
|||
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
|
||||
+ */
|
||||
+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
|
||||
*/
|
||||
@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
|
||||
+ */
|
||||
+ @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
|
||||
+ * @param ignoreBlocks true to scan through blocks
|
||||
+ * @return TargetEntityInfo about the entity being targeted,
|
||||
+ * or null if no entity is targeted
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public com.destroystokyo.paper.entity.TargetEntityInfo getTargetEntityInfo(int maxDistance, boolean ignoreBlocks);
|
||||
// Paper end
|
||||
|
||||
/**
|
1044
patches/api-unmapped/Add-Material-Tags.patch
Normal file
1044
patches/api-unmapped/Add-Material-Tags.patch
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,46 @@
|
|||
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) {
|
||||
+ Validate.notNull(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.
|
481
patches/api-unmapped/Add-Mob-Goal-API.patch
Normal file
481
patches/api-unmapped/Add-Mob-Goal-API.patch
Normal file
|
@ -0,0 +1,481 @@
|
|||
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 org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.EnumSet;
|
||||
+
|
||||
+import org.bukkit.entity.Mob;
|
||||
+
|
||||
+/**
|
||||
+ * Represents an AI goal of an entity
|
||||
+ */
|
||||
+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 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
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ GoalKey<T> getKey();
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a list of all applicable flags for this goal.<br>
|
||||
+ *
|
||||
+ * This method is only called on construction.
|
||||
+ *
|
||||
+ * @return the subtypes.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ 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 org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.StringJoiner;
|
||||
+
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.entity.Mob;
|
||||
+
|
||||
+/**
|
||||
+ *
|
||||
+ * 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
|
||||
+ */
|
||||
+public class GoalKey<T extends Mob> {
|
||||
+
|
||||
+ private final Class<T> entityClass;
|
||||
+ private final NamespacedKey namespacedKey;
|
||||
+
|
||||
+ private GoalKey(@NotNull Class<T> entityClass, @NotNull NamespacedKey namespacedKey) {
|
||||
+ this.entityClass = entityClass;
|
||||
+ this.namespacedKey = namespacedKey;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Class<T> getEntityClass() {
|
||||
+ return entityClass;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public NamespacedKey getNamespacedKey() {
|
||||
+ return namespacedKey;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(Object o) {
|
||||
+ if (this == o) return true;
|
||||
+ if (o == null || getClass() != o.getClass()) return false;
|
||||
+ GoalKey<?> goalKey = (GoalKey<?>) o;
|
||||
+ return Objects.equal(entityClass, goalKey.entityClass) &&
|
||||
+ Objects.equal(namespacedKey, goalKey.namespacedKey);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return Objects.hashCode(entityClass, namespacedKey);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return new StringJoiner(", ", GoalKey.class.getSimpleName() + "[", "]")
|
||||
+ .add("entityClass=" + entityClass)
|
||||
+ .add("namespacedKey=" + namespacedKey)
|
||||
+ .toString();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static <A extends Mob> GoalKey<A> of(@NotNull Class<A> entityClass, @NotNull 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 org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+
|
||||
+import org.bukkit.entity.Mob;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a part of the "brain" of a mob. It tracks all tasks (running or not), allows adding and removing goals
|
||||
+ */
|
||||
+public interface MobGoals {
|
||||
+
|
||||
+ <T extends Mob> void addGoal(@NotNull T mob, int priority, @NotNull Goal<T> goal);
|
||||
+
|
||||
+ <T extends Mob> void removeGoal(@NotNull T mob, @NotNull Goal<T> goal);
|
||||
+
|
||||
+ <T extends Mob> void removeAllGoals(@NotNull T mob);
|
||||
+
|
||||
+ <T extends Mob> void removeAllGoals(@NotNull T mob, @NotNull GoalType type);
|
||||
+
|
||||
+ <T extends Mob> void removeGoal(@NotNull T mob, @NotNull GoalKey<T> key);
|
||||
+
|
||||
+ <T extends Mob> boolean hasGoal(@NotNull T mob, @NotNull GoalKey<T> key);
|
||||
+
|
||||
+ @Nullable
|
||||
+ <T extends Mob> Goal<T> getGoal(@NotNull T mob, @NotNull GoalKey<T> key);
|
||||
+
|
||||
+ @NotNull
|
||||
+ <T extends Mob> Collection<Goal<T>> getGoals(@NotNull T mob, @NotNull GoalKey<T> key);
|
||||
+
|
||||
+ @NotNull
|
||||
+ <T extends Mob> Collection<Goal<T>> getAllGoals(@NotNull T mob);
|
||||
+
|
||||
+ @NotNull
|
||||
+ <T extends Mob> Collection<Goal<T>> getAllGoals(@NotNull T mob, @NotNull GoalType type);
|
||||
+
|
||||
+ @NotNull
|
||||
+ <T extends Mob> Collection<Goal<T>> getAllGoalsWithout(@NotNull T mob, @NotNull GoalType type);
|
||||
+
|
||||
+ @NotNull
|
||||
+ <T extends Mob> Collection<Goal<T>> getRunningGoals(@NotNull T mob);
|
||||
+
|
||||
+ @NotNull
|
||||
+ <T extends Mob> Collection<Goal<T>> getRunningGoals(@NotNull T mob, @NotNull GoalType type);
|
||||
+
|
||||
+ @NotNull
|
||||
+ <T extends Mob> Collection<Goal<T>> getRunningGoalsWithout(@NotNull T mob, @NotNull GoalType type);
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.entity.ai;
|
||||
+
|
||||
+import com.destroystokyo.paper.entity.RangedEntity;
|
||||
+
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.entity.*;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a vanilla goal. Plugins should never implement this.<br>
|
||||
+ * Generated by VanillaPathfinderTest in paper-server
|
||||
+ */
|
||||
+public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
||||
+
|
||||
+ GoalKey<Bee> BEE_ATTACK = GoalKey.of(Bee.class, NamespacedKey.minecraft("bee_attack"));
|
||||
+ GoalKey<Bee> BEE_BECOME_ANGRY = GoalKey.of(Bee.class, NamespacedKey.minecraft("bee_become_angry"));
|
||||
+ GoalKey<Bee> BEE_ENTER_HIVE = GoalKey.of(Bee.class, NamespacedKey.minecraft("bee_enter_hive"));
|
||||
+ GoalKey<Bee> BEE_GO_TO_HIVE = GoalKey.of(Bee.class, NamespacedKey.minecraft("bee_go_to_hive"));
|
||||
+ GoalKey<Bee> BEE_GO_TO_KNOWN_FLOWER = GoalKey.of(Bee.class, NamespacedKey.minecraft("bee_go_to_known_flower"));
|
||||
+ GoalKey<Bee> BEE_GROW_CROP = GoalKey.of(Bee.class, NamespacedKey.minecraft("bee_grow_crop"));
|
||||
+ GoalKey<Bee> BEE_HURT_BY_OTHER = GoalKey.of(Bee.class, NamespacedKey.minecraft("bee_hurt_by_other"));
|
||||
+ GoalKey<Bee> BEE_LOCATE_HIVE = GoalKey.of(Bee.class, NamespacedKey.minecraft("bee_locate_hive"));
|
||||
+ GoalKey<Bee> BEE_POLLINATE = GoalKey.of(Bee.class, NamespacedKey.minecraft("bee_pollinate"));
|
||||
+ GoalKey<Bee> BEE_WANDER = GoalKey.of(Bee.class, NamespacedKey.minecraft("bee_wander"));
|
||||
+ GoalKey<Blaze> BLAZE_FIREBALL = GoalKey.of(Blaze.class, NamespacedKey.minecraft("blaze_fireball"));
|
||||
+ GoalKey<Cat> TEMPT_CHANCE = GoalKey.of(Cat.class, NamespacedKey.minecraft("tempt_chance"));
|
||||
+ GoalKey<Cat> CAT_AVOID_ENTITY = GoalKey.of(Cat.class, NamespacedKey.minecraft("cat_avoid_entity"));
|
||||
+ GoalKey<Cat> CAT_RELAX_ON_OWNER = GoalKey.of(Cat.class, NamespacedKey.minecraft("cat_relax_on_owner"));
|
||||
+ GoalKey<Dolphin> DOLPHIN_SWIM_TO_TREASURE = GoalKey.of(Dolphin.class, NamespacedKey.minecraft("dolphin_swim_to_treasure"));
|
||||
+ GoalKey<Dolphin> DOLPHIN_SWIM_WITH_PLAYER = GoalKey.of(Dolphin.class, NamespacedKey.minecraft("dolphin_swim_with_player"));
|
||||
+ GoalKey<Dolphin> DOLPHIN_PLAY_WITH_ITEMS = GoalKey.of(Dolphin.class, NamespacedKey.minecraft("dolphin_play_with_items"));
|
||||
+ GoalKey<Drowned> DROWNED_ATTACK = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_attack"));
|
||||
+ GoalKey<Drowned> DROWNED_GOTO_BEACH = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_goto_beach"));
|
||||
+ GoalKey<Creature> DROWNED_GOTO_WATER = GoalKey.of(Creature.class, NamespacedKey.minecraft("drowned_goto_water"));
|
||||
+ GoalKey<Drowned> DROWNED_SWIM_UP = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_swim_up"));
|
||||
+ GoalKey<RangedEntity> DROWNED_TRIDENT_ATTACK = GoalKey.of(RangedEntity.class, NamespacedKey.minecraft("drowned_trident_attack"));
|
||||
+ GoalKey<Enderman> ENDERMAN_PICKUP_BLOCK = GoalKey.of(Enderman.class, NamespacedKey.minecraft("enderman_pickup_block"));
|
||||
+ GoalKey<Enderman> ENDERMAN_PLACE_BLOCK = GoalKey.of(Enderman.class, NamespacedKey.minecraft("enderman_place_block"));
|
||||
+ GoalKey<Enderman> PLAYER_WHO_LOOKED_AT_TARGET = GoalKey.of(Enderman.class, NamespacedKey.minecraft("player_who_looked_at_target"));
|
||||
+ GoalKey<Enderman> ENDERMAN_FREEZE_WHEN_LOOKED_AT = GoalKey.of(Enderman.class, NamespacedKey.minecraft("enderman_freeze_when_looked_at"));
|
||||
+ GoalKey<Evoker> EVOKER_ATTACK_SPELL = GoalKey.of(Evoker.class, NamespacedKey.minecraft("evoker_attack_spell"));
|
||||
+ GoalKey<Evoker> EVOKER_CAST_SPELL = GoalKey.of(Evoker.class, NamespacedKey.minecraft("evoker_cast_spell"));
|
||||
+ GoalKey<Evoker> EVOKER_SUMMON_SPELL = GoalKey.of(Evoker.class, NamespacedKey.minecraft("evoker_summon_spell"));
|
||||
+ GoalKey<Evoker> EVOKER_WOLOLO_SPELL = GoalKey.of(Evoker.class, NamespacedKey.minecraft("evoker_wololo_spell"));
|
||||
+ GoalKey<Fish> FISH_SWIM = GoalKey.of(Fish.class, NamespacedKey.minecraft("fish_swim"));
|
||||
+ GoalKey<Fox> FOX_DEFEND_TRUSTED = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_defend_trusted"));
|
||||
+ GoalKey<Fox> FOX_FACEPLANT = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_faceplant"));
|
||||
+ GoalKey<Fox> FOX_BREED = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_breed"));
|
||||
+ GoalKey<Fox> FOX_EAT_BERRIES = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_eat_berries"));
|
||||
+ GoalKey<Fox> FOX_FLOAT = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_float"));
|
||||
+ GoalKey<Fox> FOX_FOLLOW_PARENT = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_follow_parent"));
|
||||
+ GoalKey<Fox> FOX_LOOK_AT_PLAYER = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_look_at_player"));
|
||||
+ GoalKey<Fox> FOX_MELEE_ATTACK = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_melee_attack"));
|
||||
+ GoalKey<Fox> FOX_PANIC = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_panic"));
|
||||
+ GoalKey<Fox> FOX_PERCH_AND_SEARCH = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_perch_and_search"));
|
||||
+ GoalKey<Fox> FOX_POUNCE = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_pounce"));
|
||||
+ GoalKey<Fox> FOX_SEARCH_FOR_ITEMS = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_search_for_items"));
|
||||
+ GoalKey<Fox> FOX_SLEEP = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_sleep"));
|
||||
+ GoalKey<Fox> FOX_STROLL_THROUGH_VILLAGE = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_stroll_through_village"));
|
||||
+ GoalKey<Fox> FOX_SEEK_SHELTER = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_seek_shelter"));
|
||||
+ GoalKey<Fox> FOX_STALK_PREY = GoalKey.of(Fox.class, NamespacedKey.minecraft("fox_stalk_prey"));
|
||||
+ GoalKey<Ghast> GHAST_ATTACK_TARGET = GoalKey.of(Ghast.class, NamespacedKey.minecraft("ghast_attack_target"));
|
||||
+ GoalKey<Ghast> GHAST_IDLE_MOVE = GoalKey.of(Ghast.class, NamespacedKey.minecraft("ghast_idle_move"));
|
||||
+ GoalKey<Ghast> GHAST_MOVE_TOWARDS_TARGET = GoalKey.of(Ghast.class, NamespacedKey.minecraft("ghast_move_towards_target"));
|
||||
+ GoalKey<Guardian> GUARDIAN_ATTACK = GoalKey.of(Guardian.class, NamespacedKey.minecraft("guardian_attack"));
|
||||
+ GoalKey<Illager> RAIDER_OPEN_DOOR = GoalKey.of(Illager.class, NamespacedKey.minecraft("raider_open_door"));
|
||||
+ GoalKey<Illusioner> ILLUSIONER_BLINDNESS_SPELL = GoalKey.of(Illusioner.class, NamespacedKey.minecraft("illusioner_blindness_spell"));
|
||||
+ GoalKey<Illusioner> ILLUSIONER_MIRROR_SPELL = GoalKey.of(Illusioner.class, NamespacedKey.minecraft("illusioner_mirror_spell"));
|
||||
+ GoalKey<Spellcaster> SPELLCASTER_CAST_SPELL = GoalKey.of(Spellcaster.class, NamespacedKey.minecraft("spellcaster_cast_spell"));
|
||||
+ GoalKey<Llama> LLAMA_ATTACK_WOLF = GoalKey.of(Llama.class, NamespacedKey.minecraft("llama_attack_wolf"));
|
||||
+ GoalKey<Llama> LLAMA_HURT_BY = GoalKey.of(Llama.class, NamespacedKey.minecraft("llama_hurt_by"));
|
||||
+ GoalKey<TraderLlama> LLAMATRADER_DEFENDED_WANDERING_TRADER = GoalKey.of(TraderLlama.class, NamespacedKey.minecraft("llamatrader_defended_wandering_trader"));
|
||||
+ GoalKey<Monster> LONG_DISTANCE_PATROL = GoalKey.of(Monster.class, NamespacedKey.minecraft("long_distance_patrol"));
|
||||
+ GoalKey<Ocelot> OCELOT_AVOID_ENTITY = GoalKey.of(Ocelot.class, NamespacedKey.minecraft("ocelot_avoid_entity"));
|
||||
+ GoalKey<Ocelot> OCELOT_TEMPT = GoalKey.of(Ocelot.class, NamespacedKey.minecraft("ocelot_tempt"));
|
||||
+ GoalKey<Panda> PANDA_ATTACK = GoalKey.of(Panda.class, NamespacedKey.minecraft("panda_attack"));
|
||||
+ GoalKey<Panda> PANDA_AVOID = GoalKey.of(Panda.class, NamespacedKey.minecraft("panda_avoid"));
|
||||
+ GoalKey<Panda> PANDA_BREED = GoalKey.of(Panda.class, NamespacedKey.minecraft("panda_breed"));
|
||||
+ GoalKey<Panda> PANDA_HURT_BY_TARGET = GoalKey.of(Panda.class, NamespacedKey.minecraft("panda_hurt_by_target"));
|
||||
+ GoalKey<Panda> PANDA_LIE_ON_BACK = GoalKey.of(Panda.class, NamespacedKey.minecraft("panda_lie_on_back"));
|
||||
+ GoalKey<Panda> PANDA_LOOK_AT_PLAYER = GoalKey.of(Panda.class, NamespacedKey.minecraft("panda_look_at_player"));
|
||||
+ GoalKey<Panda> PANDA_PANIC = GoalKey.of(Panda.class, NamespacedKey.minecraft("panda_panic"));
|
||||
+ GoalKey<Panda> PANDA_ROLL = GoalKey.of(Panda.class, NamespacedKey.minecraft("panda_roll"));
|
||||
+ GoalKey<Panda> PANDA_SIT = GoalKey.of(Panda.class, NamespacedKey.minecraft("panda_sit"));
|
||||
+ GoalKey<Panda> PANDA_SNEEZE = GoalKey.of(Panda.class, NamespacedKey.minecraft("panda_sneeze"));
|
||||
+ GoalKey<Phantom> PHANTOM_ATTACK_PLAYER = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_attack_player"));
|
||||
+ GoalKey<Phantom> PHANTOM_ATTACK_STRATEGY = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_attack_strategy"));
|
||||
+ GoalKey<Phantom> PHANTOM_CIRCLE_AROUND_ANCHOR = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_circle_around_anchor"));
|
||||
+ GoalKey<Phantom> PHANTOM_SWEEP_ATTACK = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_sweep_attack"));
|
||||
+ /**
|
||||
+ * @deprecated removed in 1.16
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ GoalKey<PigZombie> ANGER = GoalKey.of(PigZombie.class, NamespacedKey.minecraft("anger"));
|
||||
+ /**
|
||||
+ * @deprecated removed in 1.16
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ GoalKey<PigZombie> ANGER_OTHER = GoalKey.of(PigZombie.class, NamespacedKey.minecraft("anger_other"));
|
||||
+ GoalKey<PolarBear> POLARBEAR_ATTACK_PLAYERS = GoalKey.of(PolarBear.class, NamespacedKey.minecraft("polarbear_attack_players"));
|
||||
+ GoalKey<PolarBear> POLARBEAR_HURT_BY = GoalKey.of(PolarBear.class, NamespacedKey.minecraft("polarbear_hurt_by"));
|
||||
+ GoalKey<PolarBear> POLARBEAR_MELEE = GoalKey.of(PolarBear.class, NamespacedKey.minecraft("polarbear_melee"));
|
||||
+ GoalKey<PolarBear> POLARBEAR_PANIC = GoalKey.of(PolarBear.class, NamespacedKey.minecraft("polarbear_panic"));
|
||||
+ GoalKey<PufferFish> PUFFERFISH_PUFF = GoalKey.of(PufferFish.class, NamespacedKey.minecraft("pufferfish_puff"));
|
||||
+ GoalKey<Rabbit> EAT_CARROTS = GoalKey.of(Rabbit.class, NamespacedKey.minecraft("eat_carrots"));
|
||||
+ GoalKey<Rabbit> KILLER_RABBIT_MELEE_ATTACK = GoalKey.of(Rabbit.class, NamespacedKey.minecraft("killer_rabbit_melee_attack"));
|
||||
+ GoalKey<Rabbit> RABBIT_AVOID_TARGET = GoalKey.of(Rabbit.class, NamespacedKey.minecraft("rabbit_avoid_target"));
|
||||
+ GoalKey<Rabbit> RABBIT_PANIC = GoalKey.of(Rabbit.class, NamespacedKey.minecraft("rabbit_panic"));
|
||||
+ GoalKey<Raider> RAIDER_HOLD_GROUND = GoalKey.of(Raider.class, NamespacedKey.minecraft("raider_hold_ground"));
|
||||
+ GoalKey<Raider> RAIDER_OBTAIN_BANNER = GoalKey.of(Raider.class, NamespacedKey.minecraft("raider_obtain_banner"));
|
||||
+ GoalKey<Raider> RAIDER_CELEBRATION = GoalKey.of(Raider.class, NamespacedKey.minecraft("raider_celebration"));
|
||||
+ GoalKey<Raider> RAIDER_MOVE_THROUGH_VILLAGE = GoalKey.of(Raider.class, NamespacedKey.minecraft("raider_move_through_village"));
|
||||
+ GoalKey<Ravager> RAVAGER_MELEE_ATTACK = GoalKey.of(Ravager.class, NamespacedKey.minecraft("ravager_melee_attack"));
|
||||
+ GoalKey<Shulker> SHULKER_ATTACK = GoalKey.of(Shulker.class, NamespacedKey.minecraft("shulker_attack"));
|
||||
+ GoalKey<Shulker> SHULKER_DEFENSE = GoalKey.of(Shulker.class, NamespacedKey.minecraft("shulker_defense"));
|
||||
+ GoalKey<Shulker> SHULKER_NEAREST = GoalKey.of(Shulker.class, NamespacedKey.minecraft("shulker_nearest"));
|
||||
+ GoalKey<Shulker> SHULKER_PEEK = GoalKey.of(Shulker.class, NamespacedKey.minecraft("shulker_peek"));
|
||||
+ GoalKey<Silverfish> SILVERFISH_HIDE_IN_BLOCK = GoalKey.of(Silverfish.class, NamespacedKey.minecraft("silverfish_hide_in_block"));
|
||||
+ GoalKey<Silverfish> SILVERFISH_WAKE_OTHERS = GoalKey.of(Silverfish.class, NamespacedKey.minecraft("silverfish_wake_others"));
|
||||
+ GoalKey<Skeleton> SKELETON_MELEE = GoalKey.of(Skeleton.class, NamespacedKey.minecraft("skeleton_melee"));
|
||||
+ GoalKey<Slime> SLIME_IDLE = GoalKey.of(Slime.class, NamespacedKey.minecraft("slime_idle"));
|
||||
+ GoalKey<Slime> SLIME_NEAREST_PLAYER = GoalKey.of(Slime.class, NamespacedKey.minecraft("slime_nearest_player"));
|
||||
+ GoalKey<Slime> SLIME_RANDOM_DIRECTION = GoalKey.of(Slime.class, NamespacedKey.minecraft("slime_random_direction"));
|
||||
+ GoalKey<Slime> SLIME_RANDOM_JUMP = GoalKey.of(Slime.class, NamespacedKey.minecraft("slime_random_jump"));
|
||||
+ GoalKey<Spider> SPIDER_MELEE_ATTACK = GoalKey.of(Spider.class, NamespacedKey.minecraft("spider_melee_attack"));
|
||||
+ GoalKey<Spider> SPIDER_NEAREST_ATTACKABLE_TARGET = GoalKey.of(Spider.class, NamespacedKey.minecraft("spider_nearest_attackable_target"));
|
||||
+ GoalKey<Strider> STRIDER_GO_TO_LAVA = GoalKey.of(Strider.class, NamespacedKey.minecraft("strider_go_to_lava"));
|
||||
+ GoalKey<Squid> SQUID = GoalKey.of(Squid.class, NamespacedKey.minecraft("squid"));
|
||||
+ GoalKey<Squid> SQUID_FLEE = GoalKey.of(Squid.class, NamespacedKey.minecraft("squid_flee"));
|
||||
+ GoalKey<Turtle> TURTLE_BREED = GoalKey.of(Turtle.class, NamespacedKey.minecraft("turtle_breed"));
|
||||
+ GoalKey<Turtle> TURTLE_GO_HOME = GoalKey.of(Turtle.class, NamespacedKey.minecraft("turtle_go_home"));
|
||||
+ GoalKey<Turtle> TURTLE_GOTO_WATER = GoalKey.of(Turtle.class, NamespacedKey.minecraft("turtle_goto_water"));
|
||||
+ GoalKey<Turtle> TURTLE_LAY_EGG = GoalKey.of(Turtle.class, NamespacedKey.minecraft("turtle_lay_egg"));
|
||||
+ GoalKey<Turtle> TURTLE_PANIC = GoalKey.of(Turtle.class, NamespacedKey.minecraft("turtle_panic"));
|
||||
+ GoalKey<Turtle> TURTLE_RANDOM_STROLL = GoalKey.of(Turtle.class, NamespacedKey.minecraft("turtle_random_stroll"));
|
||||
+ GoalKey<Turtle> TURTLE_TEMPT = GoalKey.of(Turtle.class, NamespacedKey.minecraft("turtle_tempt"));
|
||||
+ GoalKey<Turtle> TURTLE_TRAVEL = GoalKey.of(Turtle.class, NamespacedKey.minecraft("turtle_travel"));
|
||||
+ GoalKey<Vex> VEX_CHARGE_ATTACK = GoalKey.of(Vex.class, NamespacedKey.minecraft("vex_charge_attack"));
|
||||
+ GoalKey<Vex> VEX_COPY_TARGET_OF_OWNER = GoalKey.of(Vex.class, NamespacedKey.minecraft("vex_copy_target_of_owner"));
|
||||
+ GoalKey<Vex> VEX_RANDOM_MOVE = GoalKey.of(Vex.class, NamespacedKey.minecraft("vex_random_move"));
|
||||
+ GoalKey<WanderingTrader> VILLAGERTRADER_WANDER_TO_POSITION = GoalKey.of(WanderingTrader.class, NamespacedKey.minecraft("villagertrader_wander_to_position"));
|
||||
+ GoalKey<Mob> VINDICATOR_BREAK_DOOR = GoalKey.of(Mob.class, NamespacedKey.minecraft("vindicator_break_door"));
|
||||
+ GoalKey<Vindicator> VINDICATOR_JOHNNY_ATTACK = GoalKey.of(Vindicator.class, NamespacedKey.minecraft("vindicator_johnny_attack"));
|
||||
+ GoalKey<Vindicator> VINDICATOR_MELEE_ATTACK = GoalKey.of(Vindicator.class, NamespacedKey.minecraft("vindicator_melee_attack"));
|
||||
+ GoalKey<Wither> WITHER_DO_NOTHING = GoalKey.of(Wither.class, NamespacedKey.minecraft("wither_do_nothing"));
|
||||
+ GoalKey<Wolf> WOLF_AVOID_ENTITY = GoalKey.of(Wolf.class, NamespacedKey.minecraft("wolf_avoid_entity"));
|
||||
+ GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack_turtle_egg"));
|
||||
+ GoalKey<RangedEntity> ARROW_ATTACK = GoalKey.of(RangedEntity.class, NamespacedKey.minecraft("arrow_attack"));
|
||||
+ GoalKey<Creature> AVOID_TARGET = GoalKey.of(Creature.class, NamespacedKey.minecraft("avoid_target"));
|
||||
+ GoalKey<Wolf> BEG = GoalKey.of(Wolf.class, NamespacedKey.minecraft("beg"));
|
||||
+ GoalKey<Monster> BOW_SHOOT = GoalKey.of(Monster.class, NamespacedKey.minecraft("bow_shoot"));
|
||||
+ GoalKey<Mob> BREAK_DOOR = GoalKey.of(Mob.class, NamespacedKey.minecraft("break_door"));
|
||||
+ GoalKey<Creature> BREATH = GoalKey.of(Creature.class, NamespacedKey.minecraft("breath"));
|
||||
+ GoalKey<Animals> BREED = GoalKey.of(Animals.class, NamespacedKey.minecraft("breed"));
|
||||
+ GoalKey<Cat> CAT_SIT_ON_BED = GoalKey.of(Cat.class, NamespacedKey.minecraft("cat_sit_on_bed"));
|
||||
+ GoalKey<Monster> CROSSBOW_ATTACK = GoalKey.of(Monster.class, NamespacedKey.minecraft("crossbow_attack"));
|
||||
+ GoalKey<IronGolem> DEFEND_VILLAGE = GoalKey.of(IronGolem.class, NamespacedKey.minecraft("defend_village"));
|
||||
+ GoalKey<Mob> DOOR_OPEN = GoalKey.of(Mob.class, NamespacedKey.minecraft("door_open"));
|
||||
+ GoalKey<Mob> EAT_TILE = GoalKey.of(Mob.class, NamespacedKey.minecraft("eat_tile"));
|
||||
+ GoalKey<Fish> FISH_SCHOOL = GoalKey.of(Fish.class, NamespacedKey.minecraft("fish_school"));
|
||||
+ GoalKey<Creature> FLEE_SUN = GoalKey.of(Creature.class, NamespacedKey.minecraft("flee_sun"));
|
||||
+ GoalKey<Mob> FLOAT = GoalKey.of(Mob.class, NamespacedKey.minecraft("float"));
|
||||
+ GoalKey<Creature> FOLLOW_BOAT = GoalKey.of(Creature.class, NamespacedKey.minecraft("follow_boat"));
|
||||
+ GoalKey<Mob> FOLLOW_ENTITY = GoalKey.of(Mob.class, NamespacedKey.minecraft("follow_entity"));
|
||||
+ GoalKey<Tameable> FOLLOW_OWNER = GoalKey.of(Tameable.class, NamespacedKey.minecraft("follow_owner"));
|
||||
+ GoalKey<Animals> FOLLOW_PARENT = GoalKey.of(Animals.class, NamespacedKey.minecraft("follow_parent"));
|
||||
+ GoalKey<SkeletonHorse> HORSE_TRAP = GoalKey.of(SkeletonHorse.class, NamespacedKey.minecraft("horse_trap"));
|
||||
+ GoalKey<Creature> HURT_BY_TARGET = GoalKey.of(Creature.class, NamespacedKey.minecraft("hurt_by_target"));
|
||||
+ GoalKey<Mob> INTERACT = GoalKey.of(Mob.class, NamespacedKey.minecraft("interact"));
|
||||
+ GoalKey<Cat> JUMP_ON_BLOCK = GoalKey.of(Cat.class, NamespacedKey.minecraft("jump_on_block"));
|
||||
+ GoalKey<Mob> LEAP_AT_TARGET = GoalKey.of(Mob.class, NamespacedKey.minecraft("leap_at_target"));
|
||||
+ GoalKey<Llama> LLAMA_FOLLOW = GoalKey.of(Llama.class, NamespacedKey.minecraft("llama_follow"));
|
||||
+ GoalKey<Mob> LOOK_AT_PLAYER = GoalKey.of(Mob.class, NamespacedKey.minecraft("look_at_player"));
|
||||
+ GoalKey<AbstractVillager> LOOK_AT_TRADING_PLAYER = GoalKey.of(AbstractVillager.class, NamespacedKey.minecraft("look_at_trading_player"));
|
||||
+ GoalKey<Creature> MELEE_ATTACK = GoalKey.of(Creature.class, NamespacedKey.minecraft("melee_attack"));
|
||||
+ GoalKey<Creature> MOVE_THROUGH_VILLAGE = GoalKey.of(Creature.class, NamespacedKey.minecraft("move_through_village"));
|
||||
+ GoalKey<Creature> MOVE_TOWARDS_RESTRICTION = GoalKey.of(Creature.class, NamespacedKey.minecraft("move_towards_restriction"));
|
||||
+ GoalKey<Creature> MOVE_TOWARDS_TARGET = GoalKey.of(Creature.class, NamespacedKey.minecraft("move_towards_target"));
|
||||
+ GoalKey<Mob> NEAREST_ATTACKABLE_TARGET = GoalKey.of(Mob.class, NamespacedKey.minecraft("nearest_attackable_target"));
|
||||
+ GoalKey<Raider> NEAREST_ATTACKABLE_TARGET_WITCH = GoalKey.of(Raider.class, NamespacedKey.minecraft("nearest_attackable_target_witch"));
|
||||
+ GoalKey<Raider> NEAREST_HEALABLE_RAIDER = GoalKey.of(Raider.class, NamespacedKey.minecraft("nearest_healable_raider"));
|
||||
+ GoalKey<Creature> NEAREST_VILLAGE = GoalKey.of(Creature.class, NamespacedKey.minecraft("nearest_village"));
|
||||
+ GoalKey<Mob> OCELOT_ATTACK = GoalKey.of(Mob.class, NamespacedKey.minecraft("ocelot_attack"));
|
||||
+ GoalKey<IronGolem> OFFER_FLOWER = GoalKey.of(IronGolem.class, NamespacedKey.minecraft("offer_flower"));
|
||||
+ GoalKey<Tameable> OWNER_HURT_BY_TARGET = GoalKey.of(Tameable.class, NamespacedKey.minecraft("owner_hurt_by_target"));
|
||||
+ GoalKey<Tameable> OWNER_HURT_TARGET = GoalKey.of(Tameable.class, NamespacedKey.minecraft("owner_hurt_target"));
|
||||
+ GoalKey<Creature> PANIC = GoalKey.of(Creature.class, NamespacedKey.minecraft("panic"));
|
||||
+ GoalKey<Parrot> PERCH = GoalKey.of(Parrot.class, NamespacedKey.minecraft("perch"));
|
||||
+ GoalKey<Raider> RAID = GoalKey.of(Raider.class, NamespacedKey.minecraft("raid"));
|
||||
+ GoalKey<Creature> RANDOM_FLY = GoalKey.of(Creature.class, NamespacedKey.minecraft("random_fly"));
|
||||
+ GoalKey<Mob> RANDOM_LOOKAROUND = GoalKey.of(Mob.class, NamespacedKey.minecraft("random_lookaround"));
|
||||
+ GoalKey<Creature> RANDOM_STROLL = GoalKey.of(Creature.class, NamespacedKey.minecraft("random_stroll"));
|
||||
+ GoalKey<Creature> RANDOM_STROLL_LAND = GoalKey.of(Creature.class, NamespacedKey.minecraft("random_stroll_land"));
|
||||
+ GoalKey<Creature> RANDOM_SWIM = GoalKey.of(Creature.class, NamespacedKey.minecraft("random_swim"));
|
||||
+ GoalKey<Tameable> RANDOM_TARGET_NON_TAMED = GoalKey.of(Tameable.class, NamespacedKey.minecraft("random_target_non_tamed"));
|
||||
+ GoalKey<Creature> REMOVE_BLOCK = GoalKey.of(Creature.class, NamespacedKey.minecraft("remove_block"));
|
||||
+ GoalKey<Creature> RESTRICT_SUN = GoalKey.of(Creature.class, NamespacedKey.minecraft("restrict_sun"));
|
||||
+ GoalKey<Tameable> SIT = GoalKey.of(Tameable.class, NamespacedKey.minecraft("sit"));
|
||||
+ GoalKey<Creature> STROLL_VILLAGE = GoalKey.of(Creature.class, NamespacedKey.minecraft("stroll_village"));
|
||||
+ GoalKey<Creeper> SWELL = GoalKey.of(Creeper.class, NamespacedKey.minecraft("swell"));
|
||||
+ GoalKey<AbstractHorse> TAME = GoalKey.of(AbstractHorse.class, NamespacedKey.minecraft("tame"));
|
||||
+ GoalKey<Creature> TEMPT = GoalKey.of(Creature.class, NamespacedKey.minecraft("tempt"));
|
||||
+ GoalKey<AbstractVillager> TRADE_WITH_PLAYER = GoalKey.of(AbstractVillager.class, NamespacedKey.minecraft("trade_with_player"));
|
||||
+ GoalKey<Mob> USE_ITEM = GoalKey.of(Mob.class, NamespacedKey.minecraft("use_item"));
|
||||
+ GoalKey<Creature> WATER = GoalKey.of(Creature.class, NamespacedKey.minecraft("water"));
|
||||
+ GoalKey<Dolphin> WATER_JUMP = GoalKey.of(Dolphin.class, NamespacedKey.minecraft("water_jump"));
|
||||
+ GoalKey<Zombie> ZOMBIE_ATTACK = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack"));
|
||||
+ GoalKey<Creature> STROLL_VILLAGE_GOLEM = GoalKey.of(Creature.class, NamespacedKey.minecraft("stroll_village_golem"));
|
||||
+ GoalKey<Mob> UNIVERSAL_ANGER_RESET = GoalKey.of(Mob.class, NamespacedKey.minecraft("universal_anger_reset"));
|
||||
+}
|
||||
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
|
||||
}
|
99
patches/api-unmapped/Add-Mob-lookAt-API.patch
Normal file
99
patches/api-unmapped/Add-Mob-lookAt-API.patch
Normal file
|
@ -0,0 +1,99 @@
|
|||
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
|
||||
|
||||
/**
|
91
patches/api-unmapped/Add-More-Creeper-API.patch
Normal file
91
patches/api-unmapped/Add-More-Creeper-API.patch
Normal file
|
@ -0,0 +1,91 @@
|
|||
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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a Creeper is ignite flag is changed (armed/disarmed to explode).
|
||||
+ */
|
||||
+public class CreeperIgniteEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean canceled;
|
||||
+ private boolean ignited;
|
||||
+
|
||||
+ public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) {
|
||||
+ super(creeper);
|
||||
+ this.ignited = ignited;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Creeper getEntity() {
|
||||
+ return (Creeper) entity;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isIgnited() {
|
||||
+ return ignited;
|
||||
+ }
|
||||
+
|
||||
+ public void setIgnited(boolean ignited) {
|
||||
+ this.ignited = ignited;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isCancelled() {
|
||||
+ return canceled;
|
||||
+ }
|
||||
+
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ canceled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
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 {
|
||||
* griefing gamerule.
|
||||
*/
|
||||
public void ignite();
|
||||
+ // 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
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
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.
|
||||
*/
|
71
patches/api-unmapped/Add-PhantomPreSpawnEvent.patch
Normal file
71
patches/api-unmapped/Add-PhantomPreSpawnEvent.patch
Normal file
|
@ -0,0 +1,71 @@
|
|||
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.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * Called when a phantom is spawned for an exhausted player
|
||||
+ */
|
||||
+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent {
|
||||
+ @NotNull private final Entity entity;
|
||||
+
|
||||
+ public PhantomPreSpawnEvent(@NotNull Location location, @NotNull Entity entity, @NotNull CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ super(location, EntityType.PHANTOM, reason);
|
||||
+ this.entity = entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the entity this phantom is spawning for
|
||||
+ *
|
||||
+ * @return Entity
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getSpawningEntity() {
|
||||
+ return 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 {
|
||||
* @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
|
||||
}
|
202
patches/api-unmapped/Add-Player-Client-Options-API.patch
Normal file
202
patches/api-unmapped/Add-Player-Client-Options-API.patch
Normal file
|
@ -0,0 +1,202 @@
|
|||
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 org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import org.bukkit.inventory.MainHand;
|
||||
+
|
||||
+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);
|
||||
+
|
||||
+ private final Class<T> type;
|
||||
+
|
||||
+ private ClientOption(@NotNull Class<T> type) {
|
||||
+ this.type = type;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Class<T> getType() {
|
||||
+ return type;
|
||||
+ }
|
||||
+
|
||||
+ public enum ChatVisibility {
|
||||
+ FULL,
|
||||
+ SYSTEM,
|
||||
+ HIDDEN,
|
||||
+ UNKNOWN
|
||||
+ }
|
||||
+}
|
||||
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.SkinParts;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.MainHand;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the player changes his client settings
|
||||
+ */
|
||||
+public class PlayerClientOptionsChangeEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList handlers = 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;
|
||||
+
|
||||
+ public PlayerClientOptionsChangeEvent(@NotNull Player player, @NotNull String locale, int viewDistance, @NotNull ChatVisibility chatVisibility, boolean chatColors, @NotNull SkinParts skinParts, @NotNull MainHand mainHand) {
|
||||
+ super(player);
|
||||
+ this.locale = locale;
|
||||
+ this.viewDistance = viewDistance;
|
||||
+ this.chatVisibility = chatVisibility;
|
||||
+ this.chatColors = chatColors;
|
||||
+ this.skinparts = skinParts;
|
||||
+ this.mainHand = mainHand;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getLocale() {
|
||||
+ return locale;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasLocaleChanged() {
|
||||
+ return !locale.equals(player.getClientOption(ClientOption.LOCALE));
|
||||
+ }
|
||||
+
|
||||
+ public int getViewDistance() {
|
||||
+ return viewDistance;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasViewDistanceChanged() {
|
||||
+ return viewDistance != player.getClientOption(ClientOption.VIEW_DISTANCE);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ChatVisibility getChatVisibility() {
|
||||
+ return chatVisibility;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatVisibilityChanged() {
|
||||
+ return chatVisibility != player.getClientOption(ClientOption.CHAT_VISIBILITY);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatColorsEnabled() {
|
||||
+ return chatColors;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasChatColorsEnabledChanged() {
|
||||
+ return chatColors != player.getClientOption(ClientOption.CHAT_COLORS_ENABLED);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public SkinParts getSkinParts() {
|
||||
+ return skinparts;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasSkinPartsChanged() {
|
||||
+ return skinparts.getRaw() != player.getClientOption(ClientOption.SKIN_PARTS).getRaw();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public MainHand getMainHand() {
|
||||
+ return mainHand;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasMainHandChanged() {
|
||||
+ return mainHand != player.getClientOption(ClientOption.MAIN_HAND);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
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 @@ package org.bukkit.entity;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.UUID;
|
||||
+import com.destroystokyo.paper.ClientOption; // Paper
|
||||
import com.destroystokyo.paper.Title; // Paper
|
||||
import net.kyori.adventure.text.Component;
|
||||
import com.destroystokyo.paper.profile.PlayerProfile; // Paper
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* Reset the cooldown counter to 0, effectively starting the cooldown period.
|
||||
*/
|
||||
void resetCooldown();
|
||||
+
|
||||
+ /**
|
||||
+ * @return the client option value of the player
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ <T> T getClientOption(@NotNull ClientOption<T> option);
|
||||
// Paper end
|
||||
|
||||
// Spigot start
|
149
patches/api-unmapped/Add-PlayerArmorChangeEvent.patch
Normal file
149
patches/api-unmapped/Add-PlayerArmorChangeEvent.patch
Normal file
|
@ -0,0 +1,149 @@
|
|||
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 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 java.util.Arrays;
|
||||
+import java.util.Collections;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.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>
|
||||
+ */
|
||||
+public class PlayerArmorChangeEvent extends PlayerEvent {
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final SlotType slotType;
|
||||
+ @Nullable private final ItemStack oldItem;
|
||||
+ @Nullable private final ItemStack newItem;
|
||||
+
|
||||
+ public PlayerArmorChangeEvent(@NotNull Player player, @NotNull SlotType slotType, @Nullable ItemStack oldItem, @Nullable 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
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public SlotType getSlotType() {
|
||||
+ return this.slotType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the existing item that's being replaced
|
||||
+ *
|
||||
+ * @return old item
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public ItemStack getOldItem() {
|
||||
+ return this.oldItem;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the new item that's replacing the old
|
||||
+ *
|
||||
+ * @return new item
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public ItemStack getNewItem() {
|
||||
+ return this.newItem;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return "ArmorChangeEvent{" + "player=" + player + ", slotType=" + slotType + ", oldItem=" + oldItem + ", newItem=" + newItem + '}';
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLERS;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLERS;
|
||||
+ }
|
||||
+
|
||||
+ 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),
|
||||
+ 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> mutableTypes = new HashSet<>();
|
||||
+ private Set<Material> immutableTypes;
|
||||
+
|
||||
+ SlotType(Material... types) {
|
||||
+ this.mutableTypes.addAll(Arrays.asList(types));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets an immutable set of all allowed material types that can be placed in an
|
||||
+ * armor slot.
|
||||
+ *
|
||||
+ * @return immutable set of material types
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Set<Material> getTypes() {
|
||||
+ if (immutableTypes == null) {
|
||||
+ immutableTypes = Collections.unmodifiableSet(mutableTypes);
|
||||
+ }
|
||||
+
|
||||
+ return immutableTypes;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * 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 null if it won't
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public static SlotType getByMaterial(@NotNull Material material) {
|
||||
+ for (SlotType slotType : values()) {
|
||||
+ if (slotType.getTypes().contains(material)) {
|
||||
+ return slotType;
|
||||
+ }
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether or not this material can be equipped to a slot
|
||||
+ *
|
||||
+ * @param material material to check
|
||||
+ * @return whether or not this material can be equipped
|
||||
+ */
|
||||
+ public static boolean isEquipable(@NotNull Material material) {
|
||||
+ return getByMaterial(material) != null;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,88 @@
|
|||
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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when processing a player's attack on an entity when the player's attack strength cooldown is reset
|
||||
+ */
|
||||
+public class PlayerAttackEntityCooldownResetEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private final float cooledAttackStrength;
|
||||
+ private boolean cancel = false;
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ @NotNull private final Entity attackedEntity;
|
||||
+
|
||||
+ public PlayerAttackEntityCooldownResetEvent(@NotNull Player who, @NotNull Entity attackedEntity, float cooledAttackStrength) {
|
||||
+ super(who);
|
||||
+ this.attackedEntity = attackedEntity;
|
||||
+ this.cooledAttackStrength = cooledAttackStrength;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ * <p>
|
||||
+ * If an attack cooldown event is cancelled, the players attack strength will remain at the same value instead of being reset.
|
||||
+ *
|
||||
+ * @return true if this event is cancelled
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Cancelling this event will prevent the target player from having their cooldown reset from attacking this entity
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * 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 cooledAttackStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the entity attacked by the player
|
||||
+ *
|
||||
+ * @return the entity attacked by the player
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getAttackedEntity() {
|
||||
+ return attackedEntity;
|
||||
+ }
|
||||
+}
|
136
patches/api-unmapped/Add-PlayerConnectionCloseEvent.patch
Normal file
136
patches/api-unmapped/Add-PlayerConnectionCloseEvent.patch
Normal file
|
@ -0,0 +1,136 @@
|
|||
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 org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+
|
||||
+import java.net.InetAddress;
|
||||
+import java.util.UUID;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * <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>
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * The event is invoked for players who have not yet logged into the world, whereas
|
||||
+ * {@link org.bukkit.event.player.PlayerQuitEvent} is only invoked on players who have logged into the world.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * <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 org.bukkit.event.player.PlayerQuitEvent}, if the player has already logged into the world.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * This event is guaranteed to never fire unless {@link org.bukkit.event.player.AsyncPlayerPreLoginEvent} has
|
||||
+ * been fired beforehand, and this event may not be called in parallel with
|
||||
+ * {@link org.bukkit.event.player.AsyncPlayerPreLoginEvent} for the same connection.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * Cancelling the {@link org.bukkit.event.player.AsyncPlayerPreLoginEvent} guarantees the corresponding
|
||||
+ * {@code PlayerConnectionCloseEvent} is never called.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * <p>
|
||||
+ * The event may be invoked asynchronously or synchronously. Plugins should check
|
||||
+ * {@link Event#isAsynchronous()} and handle accordingly.
|
||||
+ * </p>
|
||||
+ */
|
||||
+public class PlayerConnectionCloseEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final UUID playerUniqueId;
|
||||
+ @NotNull private final String playerName;
|
||||
+ @NotNull private final InetAddress ipAddress;
|
||||
+
|
||||
+ public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull 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.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public UUID getPlayerUniqueId() {
|
||||
+ return this.playerUniqueId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the name of the player disconnecting.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getPlayerName() {
|
||||
+ return this.playerName;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the player's IP address.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public InetAddress getIpAddress() {
|
||||
+ return this.ipAddress;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLERS;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLERS;
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,94 @@
|
|||
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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player places an item in or takes an item out of a flowerpot.
|
||||
+ */
|
||||
+public class PlayerFlowerPotManipulateEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ private final Block flowerpot;
|
||||
+ @NotNull
|
||||
+ private final ItemStack item;
|
||||
+ private final boolean placing;
|
||||
+
|
||||
+ private boolean cancel = false;
|
||||
+
|
||||
+ public PlayerFlowerPotManipulateEvent(@NotNull final Player player, @NotNull final Block flowerpot, @NotNull final ItemStack item, final boolean placing) {
|
||||
+ super(player);
|
||||
+ this.flowerpot = flowerpot;
|
||||
+ this.item = item;
|
||||
+ this.placing = placing;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the flowerpot that is involved in this event.
|
||||
+ *
|
||||
+ * @return the flowerpot that is involved with this event
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Block getFlowerpot() {
|
||||
+ return 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
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItem() {
|
||||
+ return 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 placing;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
29
patches/api-unmapped/Add-PlayerInitialSpawnEvent.patch
Normal file
29
patches/api-unmapped/Add-PlayerInitialSpawnEvent.patch
Normal file
|
@ -0,0 +1,29 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Anton <anxuiz.nx@gmail.com>
|
||||
Date: Mon, 29 Feb 2016 18:13:58 -0600
|
||||
Subject: [PATCH] Add PlayerInitialSpawnEvent
|
||||
|
||||
For modifying a player's initial spawn location as they join the server
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.spigotmc.event.player.PlayerSpawnLocationEvent;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Use {@link PlayerSpawnLocationEvent}, Duplicate API
|
||||
+ */
|
||||
+public class PlayerInitialSpawnEvent extends PlayerSpawnLocationEvent {
|
||||
+
|
||||
+ public PlayerInitialSpawnEvent(@NotNull Player who, @NotNull Location spawnLocation) {
|
||||
+ super(who, spawnLocation);
|
||||
+ }
|
||||
+}
|
89
patches/api-unmapped/Add-PlayerItemCooldownEvent.patch
Normal file
89
patches/api-unmapped/Add-PlayerItemCooldownEvent.patch
Normal file
|
@ -0,0 +1,89 @@
|
|||
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 com.google.common.base.Preconditions;
|
||||
+import org.bukkit.Material;
|
||||
+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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a player receives an item cooldown.
|
||||
+ */
|
||||
+public class PlayerItemCooldownEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ @NotNull
|
||||
+ private final Material type;
|
||||
+ private boolean cancelled;
|
||||
+ private int cooldown;
|
||||
+
|
||||
+ public PlayerItemCooldownEvent(@NotNull Player player, @NotNull Material type, int cooldown) {
|
||||
+ super(player);
|
||||
+ this.type = type;
|
||||
+ this.cooldown = cooldown;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the material affected by the cooldown.
|
||||
+ *
|
||||
+ * @return material affected by the cooldown
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Material getType() {
|
||||
+ return type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cooldown in ticks.
|
||||
+ *
|
||||
+ * @return cooldown in ticks
|
||||
+ */
|
||||
+ public int getCooldown() {
|
||||
+ return 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(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 cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
118
patches/api-unmapped/Add-PlayerJumpEvent.patch
Normal file
118
patches/api-unmapped/Add-PlayerJumpEvent.patch
Normal file
|
@ -0,0 +1,118 @@
|
|||
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.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * 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 PlayerMoveEvent, this event is fired whenever
|
||||
+ * the server detects that the player is jumping.
|
||||
+ */
|
||||
+public class PlayerJumpEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancel = false;
|
||||
+ @NotNull private Location from;
|
||||
+ @NotNull private Location to;
|
||||
+
|
||||
+ public PlayerJumpEvent(@NotNull final Player player, @NotNull final Location from, @NotNull final Location to) {
|
||||
+ super(player);
|
||||
+ this.from = from;
|
||||
+ this.to = to;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ * <p>
|
||||
+ * If a jump event is cancelled, the player will be moved or
|
||||
+ * teleported back to the Location as defined by getFrom(). This will not
|
||||
+ * fire an event
|
||||
+ *
|
||||
+ * @return true if this event is cancelled
|
||||
+ */
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the cancellation state of this event. A cancelled event will not
|
||||
+ * be executed in the server, but will still pass to other plugins
|
||||
+ * <p>
|
||||
+ * If a jump event is cancelled, the player will be moved or
|
||||
+ * teleported back to the Location as defined by getFrom(). This will not
|
||||
+ * fire an event
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel this event
|
||||
+ */
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location this player jumped from
|
||||
+ *
|
||||
+ * @return Location the player jumped from
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getFrom() {
|
||||
+ return 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(@NotNull Location from) {
|
||||
+ validateLocation(from);
|
||||
+ this.from = from;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location this player jumped to
|
||||
+ *
|
||||
+ * 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
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getTo() {
|
||||
+ return to;
|
||||
+ }
|
||||
+
|
||||
+ private void validateLocation(Location loc) {
|
||||
+ Preconditions.checkArgument(loc != null, "Cannot use null location!");
|
||||
+ Preconditions.checkArgument(loc.getWorld() != null, "Cannot use location with null world!");
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
127
patches/api-unmapped/Add-PlayerKickEvent-causes.patch
Normal file
127
patches/api-unmapped/Add-PlayerKickEvent-causes.patch
Normal file
|
@ -0,0 +1,127 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: 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 @Nullable net.kyori.adventure.text.Component message);
|
||||
+
|
||||
+ /**
|
||||
+ * Kicks player with custom kick message and cause.
|
||||
+ *
|
||||
+ * @param message kick message
|
||||
+ * @param cause kick cause
|
||||
+ */
|
||||
+ void kick(final @Nullable Component message, @NotNull org.bukkit.event.player.PlayerKickEvent.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 = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickReason); // Paper
|
||||
this.leaveMessage = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().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;
|
||||
+ }
|
||||
+
|
||||
+ 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,
|
||||
+
|
||||
+ SPAM,
|
||||
+
|
||||
+ ILLEGAL_ACTION,
|
||||
+
|
||||
+ ILLEGAL_CHARACTERS,
|
||||
+
|
||||
+ SELF_INTERACTION,
|
||||
+
|
||||
+ DUPLICATE_LOGIN,
|
||||
+
|
||||
+ /**
|
||||
+ * Spigot's restart command
|
||||
+ */
|
||||
+ RESTART_COMMAND,
|
||||
+ /**
|
||||
+ * Fallback cause
|
||||
+ */
|
||||
+ UNKNOWN,
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
62
patches/api-unmapped/Add-PlayerLocaleChangeEvent.patch
Normal file
62
patches/api-unmapped/Add-PlayerLocaleChangeEvent.patch
Normal file
|
@ -0,0 +1,62 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Isaac Moore <rmsy@me.com>
|
||||
Date: Mon, 29 Feb 2016 18:02:25 -0600
|
||||
Subject: [PATCH] Add PlayerLocaleChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.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;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the locale of the player is changed.
|
||||
+ *
|
||||
+ * @deprecated Replaced by {@link org.bukkit.event.player.PlayerLocaleChangeEvent} upstream
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class PlayerLocaleChangeEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final String oldLocale;
|
||||
+ private final String newLocale;
|
||||
+
|
||||
+ public PlayerLocaleChangeEvent(final Player player, final String oldLocale, final String newLocale) {
|
||||
+ super(player);
|
||||
+ this.oldLocale = oldLocale;
|
||||
+ this.newLocale = newLocale;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the locale the player switched from.
|
||||
+ *
|
||||
+ * @return player's old locale
|
||||
+ */
|
||||
+ public String getOldLocale() {
|
||||
+ return oldLocale;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the locale the player is changed to.
|
||||
+ *
|
||||
+ * @return player's new locale
|
||||
+ */
|
||||
+ public String getNewLocale() {
|
||||
+ return newLocale;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
64
patches/api-unmapped/Add-PlayerPostRespawnEvent.patch
Normal file
64
patches/api-unmapped/Add-PlayerPostRespawnEvent.patch
Normal file
|
@ -0,0 +1,64 @@
|
|||
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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Fired after a player has respawned
|
||||
+ */
|
||||
+public class PlayerPostRespawnEvent extends PlayerEvent {
|
||||
+ private final static HandlerList handlers = new HandlerList();
|
||||
+ private final Location respawnedLocation;
|
||||
+ private final boolean isBedSpawn;
|
||||
+
|
||||
+ public PlayerPostRespawnEvent(@NotNull final Player respawnPlayer, @NotNull 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
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getRespawnedLocation() {
|
||||
+ return respawnedLocation.clone();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the player respawned to their bed
|
||||
+ *
|
||||
+ * @return whether the player respawned to their bed
|
||||
+ */
|
||||
+ public boolean isBedSpawn() {
|
||||
+ return isBedSpawn;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
120
patches/api-unmapped/Add-PlayerShearBlockEvent.patch
Normal file
120
patches/api-unmapped/Add-PlayerShearBlockEvent.patch
Normal file
|
@ -0,0 +1,120 @@
|
|||
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 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.NotNull;
|
||||
+
|
||||
+import java.util.List;
|
||||
+
|
||||
+/**
|
||||
+ * 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.
|
||||
+ */
|
||||
+public class PlayerShearBlockEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled = false;
|
||||
+ private final Block block;
|
||||
+ private final ItemStack item;
|
||||
+ private final EquipmentSlot hand;
|
||||
+ private final List<ItemStack> drops;
|
||||
+
|
||||
+ public PlayerShearBlockEvent(@NotNull Player who, @NotNull Block block, @NotNull ItemStack item, @NotNull EquipmentSlot hand, @NotNull List<ItemStack> drops) {
|
||||
+ super(who);
|
||||
+ 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.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Block getBlock() {
|
||||
+ return block;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the item used to shear the block.
|
||||
+ *
|
||||
+ * @return The {@link ItemStack} of the shears.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItem() {
|
||||
+ return item;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the hand used to shear the block.
|
||||
+ *
|
||||
+ * @return Either {@link EquipmentSlot#HAND} OR {@link EquipmentSlot#OFF_HAND}.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return hand;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the resulting drops of this event.
|
||||
+ *
|
||||
+ * @return A {@link List list} of {@link ItemStack items} that will be dropped as result of this event.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public List<ItemStack> getDrops() {
|
||||
+ return 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 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(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
58
patches/api-unmapped/Add-PlayerUseUnknownEntityEvent.patch
Normal file
58
patches/api-unmapped/Add-PlayerUseUnknownEntityEvent.patch
Normal file
|
@ -0,0 +1,58 @@
|
|||
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
|
||||
|
||||
|
||||
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.inventory.EquipmentSlot;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class PlayerUseUnknownEntityEvent extends PlayerEvent {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final int entityId;
|
||||
+ private final boolean attack;
|
||||
+ @NotNull private final EquipmentSlot hand;
|
||||
+
|
||||
+ public PlayerUseUnknownEntityEvent(@NotNull Player who, int entityId, boolean attack, @NotNull EquipmentSlot hand) {
|
||||
+ super(who);
|
||||
+ this.entityId = entityId;
|
||||
+ this.attack = attack;
|
||||
+ this.hand = hand;
|
||||
+ }
|
||||
+
|
||||
+ public int getEntityId() {
|
||||
+ return this.entityId;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isAttack() {
|
||||
+ return this.attack;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return this.hand;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,211 @@
|
|||
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.event.HandlerList;
|
||||
+import org.bukkit.event.inventory.InventoryEvent;
|
||||
+import org.bukkit.inventory.GrindstoneInventory;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item is put in a slot for grinding in a Grindstone
|
||||
+ * @see com.destroystokyo.paper.event.inventory.PrepareResultEvent
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class PrepareGrindstoneEvent extends PrepareResultEvent {
|
||||
+
|
||||
+ 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.HandlerList;
|
||||
+import org.bukkit.event.inventory.InventoryEvent;
|
||||
+import org.bukkit.event.inventory.InventoryType;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item is put in an inventory containing a result slot
|
||||
+ */
|
||||
+public class PrepareResultEvent extends InventoryEvent {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private ItemStack result;
|
||||
+
|
||||
+ public PrepareResultEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
||||
+ super(inventory);
|
||||
+ this.result = result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get result item, may be null.
|
||||
+ *
|
||||
+ * @return result item
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public ItemStack getResult() {
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ public void setResult(@Nullable ItemStack result) {
|
||||
+ this.result = result;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
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 @@
|
||||
package org.bukkit.event.inventory;
|
||||
|
||||
+import com.destroystokyo.paper.event.inventory.PrepareResultEvent;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.AnvilInventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
@@ -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 InventoryEvent {
|
||||
+// Paper start - extend PrepareResultEvent
|
||||
+public class PrepareAnvilEvent extends PrepareResultEvent {
|
||||
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
- private ItemStack result;
|
||||
+ //private static final HandlerList handlers = new HandlerList();
|
||||
+ //private ItemStack result;
|
||||
|
||||
public PrepareAnvilEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
||||
- super(inventory);
|
||||
- this.result = result;
|
||||
+ super(inventory, result);
|
||||
+ //this.result = result;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -0,0 +0,0 @@ public class PrepareAnvilEvent extends InventoryEvent {
|
||||
*/
|
||||
@Nullable
|
||||
public ItemStack getResult() {
|
||||
- return result;
|
||||
+ return super.getResult(); // Paper
|
||||
}
|
||||
|
||||
public void setResult(@Nullable ItemStack result) {
|
||||
- this.result = result;
|
||||
+ super.setResult(result); // Paper
|
||||
}
|
||||
|
||||
+ /* // Paper - comment out
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -0,0 +0,0 @@ public class PrepareAnvilEvent extends InventoryEvent {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+ */ // Paper
|
||||
}
|
||||
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 @@
|
||||
package org.bukkit.event.inventory;
|
||||
|
||||
+import com.destroystokyo.paper.event.inventory.PrepareResultEvent;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -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 InventoryEvent {
|
||||
+// Paper start - extend PrepareResultEvent
|
||||
+public class PrepareSmithingEvent extends PrepareResultEvent {
|
||||
|
||||
- private static final HandlerList handlers = new HandlerList();
|
||||
- private ItemStack result;
|
||||
+ //private static final HandlerList handlers = new HandlerList();
|
||||
+ //private ItemStack result;
|
||||
|
||||
public PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result) {
|
||||
- super(inventory);
|
||||
- this.result = result;
|
||||
+ super(inventory, result);
|
||||
+ //this.result = result;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends InventoryEvent {
|
||||
*/
|
||||
@Nullable
|
||||
public ItemStack getResult() {
|
||||
- return result;
|
||||
+ return super.getResult(); // Paper
|
||||
}
|
||||
|
||||
public void setResult(@Nullable ItemStack result) {
|
||||
- this.result = result;
|
||||
+ super.setResult(result); // Paper
|
||||
}
|
||||
|
||||
+ /* // Paper - comment out
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -0,0 +0,0 @@ public class PrepareSmithingEvent extends InventoryEvent {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+ */ // Paper
|
||||
}
|
79
patches/api-unmapped/Add-ProjectileCollideEvent.patch
Normal file
79
patches/api-unmapped/Add-ProjectileCollideEvent.patch
Normal file
|
@ -0,0 +1,79 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Fri, 16 Dec 2016 21:25:39 -0600
|
||||
Subject: [PATCH] Add ProjectileCollideEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/ProjectileCollideEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Projectile;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an projectile collides with an entity
|
||||
+ * <p>
|
||||
+ * This event is called <b>before</b> {@link org.bukkit.event.entity.EntityDamageByEntityEvent}, and cancelling it will allow the projectile to continue flying
|
||||
+ */
|
||||
+public class ProjectileCollideEvent extends EntityEvent implements Cancellable {
|
||||
+ @NotNull private final Entity collidedWith;
|
||||
+
|
||||
+ /**
|
||||
+ * Get the entity the projectile collided with
|
||||
+ *
|
||||
+ * @return the entity collided with
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getCollidedWith() {
|
||||
+ return collidedWith;
|
||||
+ }
|
||||
+
|
||||
+ public ProjectileCollideEvent(@NotNull Projectile what, @NotNull Entity collidedWith) {
|
||||
+ super(what);
|
||||
+ this.collidedWith = collidedWith;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the projectile that collided
|
||||
+ *
|
||||
+ * @return the projectile that collided
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Projectile getEntity() {
|
||||
+ return (Projectile) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlerList = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlerList;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlerList;
|
||||
+ }
|
||||
+
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+}
|
92
patches/api-unmapped/Add-PufferFishStateChangeEvent.patch
Normal file
92
patches/api-unmapped/Add-PufferFishStateChangeEvent.patch
Normal file
|
@ -0,0 +1,92 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: HexedHero <6012891+HexedHero@users.noreply.github.com>
|
||||
Date: Mon, 10 May 2021 16:58:38 +0100
|
||||
Subject: [PATCH] Add PufferFishStateChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/entity/PufferFishStateChangeEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.PufferFish;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.EntityEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called just before a {@link PufferFish} inflates or deflates.
|
||||
+ */
|
||||
+public class PufferFishStateChangeEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private int newPuffState;
|
||||
+
|
||||
+ public PufferFishStateChangeEvent(@NotNull PufferFish entity, int newPuffState) {
|
||||
+ super(entity);
|
||||
+ this.newPuffState = newPuffState;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public PufferFish getEntity() {
|
||||
+ return (PufferFish) entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the <strong>new</strong> puff state of the {@link PufferFish}.
|
||||
+ * <p>
|
||||
+ * This is what the {@link PufferFish}'s new puff state will be after this event if it isn't cancelled.<br>
|
||||
+ * Refer to {@link PufferFish#getPuffState()} to get the current puff state.
|
||||
+ * @return The <strong>new</strong> puff state, 0 being not inflated, 1 being slightly inflated and 2 being fully inflated
|
||||
+ */
|
||||
+ public int getNewPuffState() {
|
||||
+ return this.newPuffState;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get if the {@link PufferFish} is going to inflate.
|
||||
+ * @return If its going to inflate
|
||||
+ */
|
||||
+ public boolean isInflating() {
|
||||
+ return getNewPuffState() > getEntity().getPuffState();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get if the {@link PufferFish} is going to deflate.
|
||||
+ * @return If its going to deflate
|
||||
+ */
|
||||
+ public boolean isDeflating() {
|
||||
+ return getNewPuffState() < getEntity().getPuffState();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether or not to cancel the {@link PufferFish} (in/de)flating.
|
||||
+ *
|
||||
+ * @param cancel true if you wish to cancel the (in/de)flation
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,56 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Thu, 30 Apr 2020 16:56:31 +0200
|
||||
Subject: [PATCH] Add Raw Byte ItemStack Serialization
|
||||
|
||||
Serializes using NBT which is safer for server data migrations than bukkits format.
|
||||
|
||||
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 {
|
||||
static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
|
||||
return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
|
||||
}
|
||||
+
|
||||
+ byte[] serializeItem(ItemStack item);
|
||||
+
|
||||
+ ItemStack deserializeItem(byte[] data);
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||
return Bukkit.getServer().getItemFactory().ensureServerConversions(this);
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Deserializes this itemstack from raw NBT bytes. NBT is safer for data migrations as it will
|
||||
+ * use the built in data converter instead of bukkits dangerous serialization system.
|
||||
+ *
|
||||
+ * This expects that the DataVersion was stored on the root of the Compound, as saved from
|
||||
+ * the {@link #serializeAsBytes()} API returned.
|
||||
+ * @param bytes bytes representing an item in NBT
|
||||
+ * @return ItemStack migrated to this version of Minecraft if needed.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static ItemStack deserializeBytes(@NotNull byte[] bytes) {
|
||||
+ return org.bukkit.Bukkit.getUnsafe().deserializeItem(bytes);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Serializes this itemstack to raw bytes in NBT. NBT is safer for data migrations as it will
|
||||
+ * use the built in data converter instead of bukkits dangerous serialization system.
|
||||
+ * @return bytes representing this item in NBT.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public byte[] serializeAsBytes() {
|
||||
+ return org.bukkit.Bukkit.getUnsafe().serializeItem(this);
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Gets the Display name as seen in the Client.
|
||||
* Currently the server only supports the English language. To override this,
|
86
patches/api-unmapped/Add-String-based-Action-Bar-API.patch
Normal file
86
patches/api-unmapped/Add-String-based-Action-Bar-API.patch
Normal file
|
@ -0,0 +1,86 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 20 Dec 2016 15:55:55 -0500
|
||||
Subject: [PATCH] Add String based Action Bar 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 @@ package org.bukkit.entity;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.UUID;
|
||||
import com.destroystokyo.paper.Title; // Paper
|
||||
+import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
public void sendMap(@NotNull MapView map);
|
||||
|
||||
// Paper start
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an Action Bar message to the client.
|
||||
+ *
|
||||
+ * Use Section symbols for legacy color codes to send formatting.
|
||||
+ *
|
||||
+ * @param message The message to send
|
||||
+ * @deprecated use {@link #sendActionBar(Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void sendActionBar(@NotNull String message);
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an Action Bar message to the client.
|
||||
+ *
|
||||
+ * Use supplied alternative character to the section symbol to represent legacy color codes.
|
||||
+ *
|
||||
+ * @param alternateChar Alternate symbol such as '&'
|
||||
+ * @param message The message to send
|
||||
+ * @deprecated use {@link #sendActionBar(Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void sendActionBar(char alternateChar, @NotNull String message);
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an Action Bar message to the client.
|
||||
+ *
|
||||
+ * @param message The components to send
|
||||
+ * @deprecated use {@link #sendActionBar(Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void sendActionBar(@NotNull net.md_5.bungee.api.chat.BaseComponent... message);
|
||||
+
|
||||
/**
|
||||
* Sends the component to the player
|
||||
*
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
/**
|
||||
* Sends an array of components as a single message to the specified screen position of this player
|
||||
*
|
||||
+ * @deprecated This is unlikely the API you want to use. See {@link #sendActionBar(String)} for a more proper Action Bar API. This deprecated API may send unsafe items to the client.
|
||||
* @param position the screen position
|
||||
* @param components the components to send
|
||||
*/
|
||||
+ @Deprecated
|
||||
public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
spigot().sendMessage(position, components);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
/**
|
||||
* Sends the component to the specified screen position of this player
|
||||
*
|
||||
+ * @deprecated This is unlikely the API you want to use. See {@link #sendActionBar(String)} for a more proper Action Bar API. This deprecated API may send unsafe items to the client.
|
||||
* @param position the screen position
|
||||
* @param component the components to send
|
||||
* @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
/**
|
||||
* Sends an array of components as a single message to the specified screen position of this player
|
||||
*
|
||||
+ * @deprecated This is unlikely the API you want to use. See {@link #sendActionBar(String)} for a more proper Action Bar API. This deprecated API may send unsafe items to the client.
|
||||
* @param position the screen position
|
||||
* @param components the components to send
|
||||
* @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
167
patches/api-unmapped/Add-StructureLocateEvent.patch
Normal file
167
patches/api-unmapped/Add-StructureLocateEvent.patch
Normal file
|
@ -0,0 +1,167 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: dfsek <dfsek@protonmail.com>
|
||||
Date: Tue, 15 Sep 2020 21:59:16 -0700
|
||||
Subject: [PATCH] Add StructureLocateEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.event.world;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.StructureType;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.world.WorldEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called <b>before</b> a structure/feature is located.
|
||||
+ * This happens when:
|
||||
+ * <ul>
|
||||
+ * <li>The /locate command is used.<br></li>
|
||||
+ * <li>An Eye of Ender is used.</li>
|
||||
+ * <li>An Explorer/Treasure Map is activated.</li>
|
||||
+ * <li>{@link World#locateNearestStructure(Location, StructureType, int, boolean)} is invoked.</li>
|
||||
+ * </ul>
|
||||
+ */
|
||||
+public class StructureLocateEvent extends WorldEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Location origin;
|
||||
+ private Location result = null;
|
||||
+ private StructureType type;
|
||||
+ private int radius;
|
||||
+ private boolean findUnexplored;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public StructureLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored) {
|
||||
+ super(world);
|
||||
+ this.origin = origin;
|
||||
+ this.type = structureType;
|
||||
+ this.radius = radius;
|
||||
+ this.findUnexplored = findUnexplored;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location set as the structure location, if it was defined.
|
||||
+ * <p>
|
||||
+ * Returns {@code null} if it has not been set by {@link StructureLocateEvent#setResult(Location)}.
|
||||
+ * Since this event fires <i>before</i> the search is done, the actual location is unknown at this point.
|
||||
+ *
|
||||
+ * @return The result location, if it has been set. null if it has not.
|
||||
+ * @see World#locateNearestStructure(Location, StructureType, int, boolean)
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getResult() {
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the result {@link Location}. This causes the search to be skipped, and the location passed here to be used as the result.
|
||||
+ *
|
||||
+ * @param result the {@link Location} of the structure.
|
||||
+ */
|
||||
+ public void setResult(@Nullable Location result) {
|
||||
+ this.result = result;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link StructureType} that is to be located.
|
||||
+ *
|
||||
+ * @return the structure type.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public StructureType getType() {
|
||||
+ return type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the {@link StructureType} that is to be located.
|
||||
+ *
|
||||
+ * @param type the structure type.
|
||||
+ */
|
||||
+ public void setType(@NotNull StructureType type) {
|
||||
+ this.type = type;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@link Location} from which the search is to be conducted.
|
||||
+ *
|
||||
+ * @return {@link Location} where search begins
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Location getOrigin() {
|
||||
+ return origin;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the search radius in which to attempt locating the structure.
|
||||
+ * <p>
|
||||
+ * This radius may not always be obeyed during the structure search!
|
||||
+ *
|
||||
+ * @return the search radius.
|
||||
+ */
|
||||
+ public int getRadius() {
|
||||
+ return radius;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the search radius in which to attempt locating the structure.
|
||||
+ * <p>
|
||||
+ * This radius may not always be obeyed during the structure search!
|
||||
+ *
|
||||
+ * @param radius the search radius.
|
||||
+ */
|
||||
+ public void setRadius(int radius) {
|
||||
+ this.radius = radius;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether to search exclusively for unexplored structures.
|
||||
+ * <p>
|
||||
+ * As with the search radius, this value is not always obeyed.
|
||||
+ *
|
||||
+ * @return Whether to search for only unexplored structures.
|
||||
+ */
|
||||
+ public boolean shouldFindUnexplored() {
|
||||
+ return findUnexplored;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether to search exclusively for unexplored structures.
|
||||
+ * <p>
|
||||
+ * As with the search radius, this value is not always obeyed.
|
||||
+ *
|
||||
+ * @param findUnexplored Whether to search for only unexplored structures.
|
||||
+ */
|
||||
+ public void setFindUnexplored(boolean findUnexplored) {
|
||||
+ this.findUnexplored = findUnexplored;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+}
|
126
patches/api-unmapped/Add-TNTPrimeEvent.patch
Normal file
126
patches/api-unmapped/Add-TNTPrimeEvent.patch
Normal file
|
@ -0,0 +1,126 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Sun, 15 Jul 2018 22:17:55 +0300
|
||||
Subject: [PATCH] Add TNTPrimeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/TNTPrimeEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when TNT block is about to turn into {@link org.bukkit.entity.TNTPrimed}
|
||||
+ * <p>
|
||||
+ * Cancelling it won't turn TNT into {@link org.bukkit.entity.TNTPrimed} and leaves
|
||||
+ * the TNT block as-is
|
||||
+ *
|
||||
+ * @author Mark Vainomaa
|
||||
+ */
|
||||
+public class TNTPrimeEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ @NotNull private PrimeReason reason;
|
||||
+ @Nullable private Entity primerEntity;
|
||||
+
|
||||
+ public TNTPrimeEvent(@NotNull Block theBlock, @NotNull PrimeReason reason, @Nullable Entity primerEntity) {
|
||||
+ super(theBlock);
|
||||
+ this.reason = reason;
|
||||
+ this.primerEntity = primerEntity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the TNT prime reason
|
||||
+ *
|
||||
+ * @return Prime reason
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PrimeReason getReason() {
|
||||
+ return this.reason;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the TNT primer {@link Entity}.
|
||||
+ *
|
||||
+ * It's null if {@link #getReason()} is {@link PrimeReason#REDSTONE} or {@link PrimeReason#FIRE}.
|
||||
+ * It's not null if {@link #getReason()} is {@link PrimeReason#ITEM} or {@link PrimeReason#PROJECTILE}
|
||||
+ * It might be null if {@link #getReason()} is {@link PrimeReason#EXPLOSION}
|
||||
+ *
|
||||
+ * @return The {@link Entity} who primed the TNT
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getPrimerEntity() {
|
||||
+ return this.primerEntity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
|
||||
+ *
|
||||
+ * @return Whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether to cancel spawning {@link org.bukkit.entity.TNTPrimed} or not
|
||||
+ *
|
||||
+ * @param cancel whether spawning {@link org.bukkit.entity.TNTPrimed} should be cancelled or not
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public enum PrimeReason {
|
||||
+ /**
|
||||
+ * When TNT prime was caused by other explosion (chain reaction)
|
||||
+ */
|
||||
+ EXPLOSION,
|
||||
+
|
||||
+ /**
|
||||
+ * When TNT prime was caused by fire
|
||||
+ */
|
||||
+ FIRE,
|
||||
+
|
||||
+ /**
|
||||
+ * When {@link org.bukkit.entity.Player} used {@link org.bukkit.Material#FLINT_AND_STEEL} or
|
||||
+ * {@link org.bukkit.Material#FIRE_CHARGE} on given TNT block
|
||||
+ */
|
||||
+ ITEM,
|
||||
+
|
||||
+ /**
|
||||
+ * When TNT prime was caused by an {@link Entity} shooting TNT
|
||||
+ * using a bow with {@link org.bukkit.enchantments.Enchantment#ARROW_FIRE} enchantment
|
||||
+ */
|
||||
+ PROJECTILE,
|
||||
+
|
||||
+ /**
|
||||
+ * When redstone power triggered the TNT prime
|
||||
+ */
|
||||
+ REDSTONE
|
||||
+ }
|
||||
+}
|
81
patches/api-unmapped/Add-TargetHitEvent-API.patch
Normal file
81
patches/api-unmapped/Add-TargetHitEvent-API.patch
Normal file
|
@ -0,0 +1,81 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Wed, 25 Nov 2020 23:21:32 -0800
|
||||
Subject: [PATCH] Add TargetHitEvent API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java b/src/main/java/io/papermc/paper/event/block/TargetHitEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/TargetHitEvent.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.Projectile;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a Target Block is hit by a projectile.
|
||||
+ * <p>
|
||||
+ * Cancelling this event will stop the Target from emitting a redstone signal,
|
||||
+ * and in the case that the shooter is a player, will stop them from receiving
|
||||
+ * advancement criteria.
|
||||
+ */
|
||||
+public class TargetHitEvent extends ProjectileHitEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private int signalStrength;
|
||||
+
|
||||
+ public TargetHitEvent(@NotNull Projectile projectile, @NotNull Block block, @NotNull BlockFace blockFace, int signalStrength) {
|
||||
+ super(projectile, null, block, blockFace);
|
||||
+ this.signalStrength = signalStrength;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the strength of the redstone signal to be emitted by the Target block
|
||||
+ *
|
||||
+ * @return the strength of the redstone signal to be emitted
|
||||
+ */
|
||||
+ public int getSignalStrength() {
|
||||
+ return signalStrength;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the strength of the redstone signal to be emitted by the Target block
|
||||
+ *
|
||||
+ * @param signalStrength the strength of the redstone signal to be emitted
|
||||
+ */
|
||||
+ public void setSignalStrength(int signalStrength) {
|
||||
+ if (signalStrength < 0 || signalStrength > 15) {
|
||||
+ throw new IllegalArgumentException("Signal strength out of range (" + signalStrength + "), must be in range [0,15]");
|
||||
+ }
|
||||
+ this.signalStrength = signalStrength;
|
||||
+ }
|
||||
+}
|
129
patches/api-unmapped/Add-ThrownEggHatchEvent.patch
Normal file
129
patches/api-unmapped/Add-ThrownEggHatchEvent.patch
Normal file
|
@ -0,0 +1,129 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 9 Feb 2020 00:19:08 -0600
|
||||
Subject: [PATCH] Add ThrownEggHatchEvent
|
||||
|
||||
Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement
|
||||
(dispensers can throw eggs to hatch them, too).
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/ThrownEggHatchEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Egg;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a thrown egg might hatch.
|
||||
+ * <p>
|
||||
+ * This event fires for all thrown eggs that may hatch, players, dispensers, etc.
|
||||
+ */
|
||||
+public class ThrownEggHatchEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Egg egg;
|
||||
+ private boolean hatching;
|
||||
+ private EntityType hatchType;
|
||||
+ private byte numHatches;
|
||||
+
|
||||
+ public ThrownEggHatchEvent(@NotNull final Egg egg, final boolean hatching, final byte numHatches, @NotNull final EntityType hatchingType) {
|
||||
+ this.egg = egg;
|
||||
+ this.hatching = hatching;
|
||||
+ this.numHatches = numHatches;
|
||||
+ this.hatchType = hatchingType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the egg involved in this event.
|
||||
+ *
|
||||
+ * @return the egg involved in this event
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Egg getEgg() {
|
||||
+ return egg;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the egg is hatching or not. Will be what the server
|
||||
+ * would've done without interaction.
|
||||
+ *
|
||||
+ * @return boolean Whether the egg is going to hatch or not
|
||||
+ */
|
||||
+ public boolean isHatching() {
|
||||
+ return hatching;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the egg will hatch or not.
|
||||
+ *
|
||||
+ * @param hatching true if you want the egg to hatch, false if you want it
|
||||
+ * not to
|
||||
+ */
|
||||
+ public void setHatching(boolean hatching) {
|
||||
+ this.hatching = hatching;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the type of the mob being hatched (EntityType.CHICKEN by default)
|
||||
+ *
|
||||
+ * @return The type of the mob being hatched by the egg
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EntityType getHatchingType() {
|
||||
+ return hatchType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Change the type of mob being hatched by the egg
|
||||
+ *
|
||||
+ * @param hatchType The type of the mob being hatched by the egg
|
||||
+ */
|
||||
+ public void setHatchingType(@NotNull EntityType hatchType) {
|
||||
+ if (!hatchType.isSpawnable()) throw new IllegalArgumentException("Can't spawn that entity type from an egg!");
|
||||
+ this.hatchType = hatchType;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the number of mob hatches from the egg. By default the number will
|
||||
+ * be the number the server would've done
|
||||
+ * <ul>
|
||||
+ * <li>7/8 chance of being 0
|
||||
+ * <li>31/256 ~= 1/8 chance to be 1
|
||||
+ * <li>1/256 chance to be 4
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @return The number of mobs going to be hatched by the egg
|
||||
+ */
|
||||
+ public byte getNumHatches() {
|
||||
+ return numHatches;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Change the number of mobs coming out of the hatched egg
|
||||
+ * <p>
|
||||
+ * The boolean hatching will override this number. Ie. If hatching =
|
||||
+ * false, this number will not matter
|
||||
+ *
|
||||
+ * @param numHatches The number of mobs coming out of the egg
|
||||
+ */
|
||||
+ public void setNumHatches(byte numHatches) {
|
||||
+ this.numHatches = numHatches;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
126
patches/api-unmapped/Add-UnknownCommandEvent.patch
Normal file
126
patches/api-unmapped/Add-UnknownCommandEvent.patch
Normal file
|
@ -0,0 +1,126 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sweepyoface <github@sweepy.pw>
|
||||
Date: Sat, 17 Jun 2017 18:48:06 -0400
|
||||
Subject: [PATCH] Add UnknownCommandEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package org.bukkit.event.command;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.Event;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a player executes a command that is not defined
|
||||
+ */
|
||||
+public class UnknownCommandEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ @NotNull private CommandSender sender;
|
||||
+ @NotNull private String commandLine;
|
||||
+ @Nullable private Component message;
|
||||
+
|
||||
+ @Deprecated
|
||||
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final String message) {
|
||||
+ this(sender, commandLine, message == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message));
|
||||
+ }
|
||||
+
|
||||
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final Component message) {
|
||||
+ super(false);
|
||||
+ this.sender = sender;
|
||||
+ this.commandLine = commandLine;
|
||||
+ this.message = message;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the CommandSender or ConsoleCommandSender
|
||||
+ * <p>
|
||||
+ *
|
||||
+ * @return Sender of the command
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public CommandSender getSender() {
|
||||
+ return sender;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command that was send
|
||||
+ * <p>
|
||||
+ *
|
||||
+ * @return Command sent
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getCommandLine() {
|
||||
+ return commandLine;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets message that will be returned
|
||||
+ * <p>
|
||||
+ *
|
||||
+ * @return Unknown command message
|
||||
+ * @deprecated use {@link #message()}
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ @Deprecated
|
||||
+ public String getMessage() {
|
||||
+ return this.message == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets message that will be returned
|
||||
+ * <p>
|
||||
+ * Set to null to avoid any message being sent
|
||||
+ *
|
||||
+ * @param message the message to be returned, or null
|
||||
+ * @deprecated use {@link #message(Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setMessage(@Nullable String message) {
|
||||
+ this.message(message == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets message that will be returned
|
||||
+ * <p>
|
||||
+ *
|
||||
+ * @return Unknown command message
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Component message() {
|
||||
+ return this.message;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets message that will be returned
|
||||
+ * <p>
|
||||
+ * Set to null to avoid any message being sent
|
||||
+ *
|
||||
+ * @param message the message to be returned, or null
|
||||
+ */
|
||||
+ public void message(@Nullable Component message) {
|
||||
+ this.message = message;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
+
|
52
patches/api-unmapped/Add-WhitelistToggleEvent.patch
Normal file
52
patches/api-unmapped/Add-WhitelistToggleEvent.patch
Normal file
|
@ -0,0 +1,52 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Wed, 13 Mar 2019 20:04:43 +0200
|
||||
Subject: [PATCH] Add WhitelistToggleEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/WhitelistToggleEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * This event is fired when whitelist is toggled
|
||||
+ *
|
||||
+ * @author Mark Vainomaa
|
||||
+ */
|
||||
+public class WhitelistToggleEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ private boolean enabled;
|
||||
+
|
||||
+ public WhitelistToggleEvent(boolean enabled) {
|
||||
+ this.enabled = enabled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether whitelist is going to be enabled or not
|
||||
+ *
|
||||
+ * @return Whether whitelist is going to be enabled or not
|
||||
+ */
|
||||
+ public boolean isEnabled() {
|
||||
+ return enabled;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
28
patches/api-unmapped/Add-World.getEntity-UUID-API.patch
Normal file
28
patches/api-unmapped/Add-World.getEntity-UUID-API.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brokkonaut <hannos17@gmx.de>
|
||||
Date: Tue, 3 Jul 2018 16:07:16 +0200
|
||||
Subject: [PATCH] Add World.getEntity(UUID) API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
|
||||
@NotNull
|
||||
public Collection<Entity> getNearbyEntities(@NotNull Location location, double x, double y, double z);
|
||||
|
||||
+ // Paper start - getEntity by UUID API
|
||||
+ /**
|
||||
+ * Gets an entity in this world by its UUID
|
||||
+ *
|
||||
+ * @param uuid the UUID of the entity
|
||||
+ * @return the entity with the given UUID, or null if it isn't found
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getEntity(@NotNull UUID uuid);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Returns a list of entities within a bounding box centered around a
|
||||
* Location.
|
34
patches/api-unmapped/Add-a-call-helper-to-Event.patch
Normal file
34
patches/api-unmapped/Add-a-call-helper-to-Event.patch
Normal file
|
@ -0,0 +1,34 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 19 May 2013 20:36:58 -0400
|
||||
Subject: [PATCH] Add a call helper to Event
|
||||
|
||||
Reduces diff in Server patches
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/Event.java
|
||||
+++ b/src/main/java/org/bukkit/event/Event.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Event {
|
||||
this.async = isAsync;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Calls the event and tests if cancelled.
|
||||
+ *
|
||||
+ * @return false if event was cancelled, if cancellable. otherwise true.
|
||||
+ */
|
||||
+ public boolean callEvent() {
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(this);
|
||||
+ if (this instanceof Cancellable) {
|
||||
+ return !((Cancellable) this).isCancelled();
|
||||
+ } else {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Convenience method for providing a user-friendly identifier. By
|
||||
* default, it is the event's class's {@linkplain Class#getSimpleName()
|
|
@ -0,0 +1,55 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MeFisto94 <MeFisto94@users.noreply.github.com>
|
||||
Date: Tue, 11 May 2021 00:48:51 +0200
|
||||
Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and
|
||||
Skeletons
|
||||
|
||||
|
||||
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 @@ public interface Phantom extends Flying {
|
||||
*/
|
||||
@Nullable
|
||||
public java.util.UUID getSpawningEntity();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if this phantom will burn in the sunlight
|
||||
+ *
|
||||
+ * @return True if phantom will burn in sunlight
|
||||
+ */
|
||||
+ public boolean shouldBurnInDay();
|
||||
+
|
||||
+ /**
|
||||
+ * Set if this phantom should burn in the sunlight
|
||||
+ *
|
||||
+ * @param shouldBurnInDay True to burn in sunlight
|
||||
+ */
|
||||
+ public void setShouldBurnInDay(boolean shouldBurnInDay);
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
@@ -0,0 +0,0 @@ public interface Skeleton extends Monster, RangedEntity { // Paper
|
||||
*/
|
||||
STRAY;
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Check if this skeleton will burn in the sunlight
|
||||
+ *
|
||||
+ * @return True if skeleton will burn in sunlight
|
||||
+ */
|
||||
+ boolean shouldBurnInDay();
|
||||
+
|
||||
+ /**
|
||||
+ * Set if this skeleton should burn in the sunlight
|
||||
+ *
|
||||
+ * @param shouldBurnInDay True to burn in sunlight
|
||||
+ */
|
||||
+ void setShouldBurnInDay(boolean shouldBurnInDay);
|
||||
+ // Paper end
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MeFisto94 <MeFisto94@users.noreply.github.com>
|
||||
Date: Tue, 11 Aug 2020 19:17:46 +0200
|
||||
Subject: [PATCH] Add a way to get translation keys for blocks, entities and
|
||||
materials
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Material.java
|
||||
+++ b/src/main/java/org/bukkit/Material.java
|
||||
@@ -0,0 +0,0 @@ public enum Material implements Keyed {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Return the translation key for the Material, so the client can translate it into the active
|
||||
+ * locale when using a TranslatableComponent.
|
||||
+ * @return the translation key
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getTranslationKey() {
|
||||
+ return Bukkit.getUnsafe().getTranslationKey(this);
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
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 {
|
||||
byte[] serializeItem(ItemStack item);
|
||||
|
||||
ItemStack deserializeItem(byte[] data);
|
||||
+
|
||||
+ /**
|
||||
+ * Return the translation key for the Material, so the client can translate it into the active
|
||||
+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.
|
||||
+ * @return the translation key
|
||||
+ */
|
||||
+ String getTranslationKey(Material mat);
|
||||
+
|
||||
+ /**
|
||||
+ * Return the translation key for the Block, so the client can translate it into the active
|
||||
+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.
|
||||
+ * @return the translation key
|
||||
+ */
|
||||
+ String getTranslationKey(org.bukkit.block.Block block);
|
||||
+
|
||||
+ /**
|
||||
+ * Return the translation key for the EntityType, so the client can translate it into the active
|
||||
+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.<br>
|
||||
+ * This is <code>null</code>, when the EntityType isn't known to NMS (custom entities)
|
||||
+ * @return the translation key
|
||||
+ */
|
||||
+ String getTranslationKey(org.bukkit.entity.EntityType type);
|
||||
+
|
||||
+ /**
|
||||
+ * Return the translation key for the ItemStack, so the client can translate it into the active
|
||||
+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.<br>
|
||||
+ * @return the translation key
|
||||
+ */
|
||||
+ String getTranslationKey(ItemStack itemStack);
|
||||
// Paper end
|
||||
}
|
||||
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 {
|
||||
*/
|
||||
@NotNull
|
||||
com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup();
|
||||
+
|
||||
+ /**
|
||||
+ * Return the translation key for the Block, so the client can translate it into the active
|
||||
+ * locale when using a TranslatableComponent.
|
||||
+ * @return the translation key
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ String getTranslationKey();
|
||||
// Paper end
|
||||
}
|
||||
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 @@ public enum EntityType implements Keyed {
|
||||
public boolean isAlive() {
|
||||
return living;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Return the translation key for the EntityType, so the client can translate it into the active
|
||||
+ * locale when using a TranslatableComponent.<br>
|
||||
+ * This is <code>null</code>, when the EntityType isn't known to NMS (custom entities)
|
||||
+ * @return the translation key
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ String getTranslationKey() {
|
||||
+ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||
ItemMeta itemMeta = getItemMeta();
|
||||
return itemMeta != null && itemMeta.hasItemFlag(flag);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the translation key for this itemstack.
|
||||
+ * This is not the same as getting the translation key
|
||||
+ * for the material of this itemstack.
|
||||
+ *
|
||||
+ * @return the translation key
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getTranslationKey() {
|
||||
+ return Bukkit.getUnsafe().getTranslationKey(this);
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Roy <10731363+JRoy@users.noreply.github.com>
|
||||
Date: Wed, 26 Aug 2020 02:11:58 -0400
|
||||
Subject: [PATCH] Add additional open container api to HumanEntity
|
||||
|
||||
|
||||
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 InventoryView openMerchant(@NotNull Merchant merchant, boolean force);
|
||||
|
||||
+ // Paper start - Add additional containers
|
||||
+ /**
|
||||
+ * Opens an empty anvil inventory window with the player's inventory
|
||||
+ * on the bottom.
|
||||
+ *
|
||||
+ * @param location The location to attach it to. If null, the player's
|
||||
+ * location is used.
|
||||
+ * @param force If false, and there is no anvil block at the location,
|
||||
+ * no inventory will be opened and null will be returned.
|
||||
+ * @return The newly opened inventory view, or null if it could not be
|
||||
+ * opened.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public InventoryView openAnvil(@Nullable Location location, boolean force);
|
||||
+
|
||||
+ /**
|
||||
+ * Opens an empty cartography table inventory window with the player's inventory
|
||||
+ * on the bottom.
|
||||
+ *
|
||||
+ * @param location The location to attach it to. If null, the player's
|
||||
+ * location is used.
|
||||
+ * @param force If false, and there is no cartography table block at the location,
|
||||
+ * no inventory will be opened and null will be returned.
|
||||
+ * @return The newly opened inventory view, or null if it could not be
|
||||
+ * opened.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public InventoryView openCartographyTable(@Nullable Location location, boolean force);
|
||||
+
|
||||
+ /**
|
||||
+ * Opens an empty grindstone inventory window with the player's inventory
|
||||
+ * on the bottom.
|
||||
+ *
|
||||
+ * @param location The location to attach it to. If null, the player's
|
||||
+ * location is used.
|
||||
+ * @param force If false, and there is no grindstone block at the location,
|
||||
+ * no inventory will be opened and null will be returned.
|
||||
+ * @return The newly opened inventory view, or null if it could not be
|
||||
+ * opened.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public InventoryView openGrindstone(@Nullable Location location, boolean force);
|
||||
+
|
||||
+ /**
|
||||
+ * Opens an empty loom inventory window with the player's inventory
|
||||
+ * on the bottom.
|
||||
+ *
|
||||
+ * @param location The location to attach it to. If null, the player's
|
||||
+ * location is used.
|
||||
+ * @param force If false, and there is no loom block at the location,
|
||||
+ * no inventory will be opened and null will be returned.
|
||||
+ * @return The newly opened inventory view, or null if it could not be
|
||||
+ * opened.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public InventoryView openLoom(@Nullable Location location, boolean force);
|
||||
+
|
||||
+ /**
|
||||
+ * Opens an empty smithing table inventory window with the player's inventory
|
||||
+ * on the bottom.
|
||||
+ *
|
||||
+ * @param location The location to attach it to. If null, the player's
|
||||
+ * location is used.
|
||||
+ * @param force If false, and there is no smithing table block at the location,
|
||||
+ * no inventory will be opened and null will be returned.
|
||||
+ * @return The newly opened inventory view, or null if it could not be
|
||||
+ * opened.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public InventoryView openSmithingTable(@Nullable Location location, boolean force);
|
||||
+
|
||||
+ /**
|
||||
+ * Opens an empty stonecutter inventory window with the player's inventory
|
||||
+ * on the bottom.
|
||||
+ *
|
||||
+ * @param location The location to attach it to. If null, the player's
|
||||
+ * location is used.
|
||||
+ * @param force If false, and there is no stonecutter block at the location,
|
||||
+ * no inventory will be opened and null will be returned.
|
||||
+ * @return The newly opened inventory view, or null if it could not be
|
||||
+ * opened.
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public InventoryView openStonecutter(@Nullable Location location, boolean force);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Force-closes the currently open inventory view for this player, if any.
|
||||
*/
|
|
@ -0,0 +1,319 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Wed, 12 Sep 2018 18:53:35 +0300
|
||||
Subject: [PATCH] Add an API for CanPlaceOn and CanDestroy NBT values
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Namespaced.java b/src/main/java/com/destroystokyo/paper/Namespaced.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Namespaced.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a namespaced resource, see {@link org.bukkit.NamespacedKey} for single elements
|
||||
+ * or {@link com.destroystokyo.paper.NamespacedTag} for a collection of elements
|
||||
+ *
|
||||
+ * Namespaces may only contain lowercase alphanumeric characters, periods,
|
||||
+ * underscores, and hyphens.
|
||||
+ * <p>
|
||||
+ * Keys may only contain lowercase alphanumeric characters, periods,
|
||||
+ * underscores, hyphens, and forward slashes.
|
||||
+ * <p>
|
||||
+ * You should not be implementing this interface yourself, use {@link org.bukkit.NamespacedKey}
|
||||
+ * or {@link com.destroystokyo.paper.NamespacedTag} as needed instead.
|
||||
+ */
|
||||
+public interface Namespaced {
|
||||
+ /**
|
||||
+ * Gets the namespace this resource is a part of
|
||||
+ * <p>
|
||||
+ * This is contractually obligated to only contain lowercase alphanumeric characters,
|
||||
+ * periods, underscores, and hyphens.
|
||||
+ *
|
||||
+ * @return resource namespace
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ String getNamespace();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the key corresponding to this resource
|
||||
+ * <p>
|
||||
+ * This is contractually obligated to only contain lowercase alphanumeric characters,
|
||||
+ * periods, underscores, hyphens, and forward slashes.
|
||||
+ *
|
||||
+ * @return resource key
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ String getKey();
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/NamespacedTag.java b/src/main/java/com/destroystokyo/paper/NamespacedTag.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/NamespacedTag.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import java.util.Locale;
|
||||
+import java.util.UUID;
|
||||
+import java.util.regex.Pattern;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a String based key pertaining to a tagged entry. Consists of two components - a namespace
|
||||
+ * and a key.
|
||||
+ * <p>
|
||||
+ * Namespaces may only contain lowercase alphanumeric characters, periods,
|
||||
+ * underscores, and hyphens.
|
||||
+ * <p>
|
||||
+ * Keys may only contain lowercase alphanumeric characters, periods,
|
||||
+ * underscores, hyphens, and forward slashes.
|
||||
+ *
|
||||
+ */
|
||||
+// Paper - entire class, based on org.bukkit.NamespacedKey
|
||||
+public final class NamespacedTag implements com.destroystokyo.paper.Namespaced {
|
||||
+
|
||||
+ /**
|
||||
+ * The namespace representing all inbuilt keys.
|
||||
+ */
|
||||
+ public static final String MINECRAFT = "minecraft";
|
||||
+ /**
|
||||
+ * The namespace representing all keys generated by Bukkit for backwards
|
||||
+ * compatibility measures.
|
||||
+ */
|
||||
+ public static final String BUKKIT = "bukkit";
|
||||
+ //
|
||||
+ private static final Pattern VALID_NAMESPACE = Pattern.compile("[a-z0-9._-]+");
|
||||
+ private static final Pattern VALID_KEY = Pattern.compile("[a-z0-9/._-]+");
|
||||
+ //
|
||||
+ private final String namespace;
|
||||
+ private final String key;
|
||||
+
|
||||
+ /**
|
||||
+ * Create a key in a specific namespace.
|
||||
+ *
|
||||
+ * @param namespace String representing a grouping of keys
|
||||
+ * @param key Name for this specific key
|
||||
+ * @deprecated should never be used by plugins, for internal use only!!
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public NamespacedTag(@NotNull String namespace, @NotNull String key) {
|
||||
+ Preconditions.checkArgument(namespace != null && VALID_NAMESPACE.matcher(namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", namespace);
|
||||
+ Preconditions.checkArgument(key != null && VALID_KEY.matcher(key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", key);
|
||||
+
|
||||
+ this.namespace = namespace;
|
||||
+ this.key = key;
|
||||
+
|
||||
+ String string = toString();
|
||||
+ Preconditions.checkArgument(string.length() < 256, "NamespacedTag must be less than 256 characters", string);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Create a key in the plugin's namespace.
|
||||
+ * <p>
|
||||
+ * Namespaces may only contain lowercase alphanumeric characters, periods,
|
||||
+ * underscores, and hyphens.
|
||||
+ * <p>
|
||||
+ * Keys may only contain lowercase alphanumeric characters, periods,
|
||||
+ * underscores, hyphens, and forward slashes.
|
||||
+ *
|
||||
+ * @param plugin the plugin to use for the namespace
|
||||
+ * @param key the key to create
|
||||
+ */
|
||||
+ public NamespacedTag(@NotNull Plugin plugin, @NotNull String key) {
|
||||
+ Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
|
||||
+ Preconditions.checkArgument(key != null, "Key cannot be null");
|
||||
+
|
||||
+ this.namespace = plugin.getName().toLowerCase(Locale.ROOT);
|
||||
+ this.key = key.toLowerCase().toLowerCase(Locale.ROOT);
|
||||
+
|
||||
+ // Check validity after normalization
|
||||
+ Preconditions.checkArgument(VALID_NAMESPACE.matcher(this.namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", this.namespace);
|
||||
+ Preconditions.checkArgument(VALID_KEY.matcher(this.key).matches(), "Invalid key. Must be [a-z0-9/._-]: %s", this.key);
|
||||
+
|
||||
+ String string = toString();
|
||||
+ Preconditions.checkArgument(string.length() < 256, "NamespacedTag must be less than 256 characters (%s)", string);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getNamespace() {
|
||||
+ return namespace;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getKey() {
|
||||
+ return key;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ int hash = 7;
|
||||
+ hash = 47 * hash + this.namespace.hashCode();
|
||||
+ hash = 47 * hash + this.key.hashCode();
|
||||
+ return hash;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(Object obj) {
|
||||
+ if (obj == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (getClass() != obj.getClass()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ final NamespacedTag other = (NamespacedTag) obj;
|
||||
+ return this.namespace.equals(other.namespace) && this.key.equals(other.key);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String toString() {
|
||||
+ return "#" + this.namespace + ":" + this.key;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Return a new random key in the {@link #BUKKIT} namespace.
|
||||
+ *
|
||||
+ * @return new key
|
||||
+ * @deprecated should never be used by plugins, for internal use only!!
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static NamespacedTag randomKey() {
|
||||
+ return new NamespacedTag(BUKKIT, UUID.randomUUID().toString());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get a key in the Minecraft namespace.
|
||||
+ *
|
||||
+ * @param key the key to use
|
||||
+ * @return new key in the Minecraft namespace
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static NamespacedTag minecraft(@NotNull String key) {
|
||||
+ return new NamespacedTag(MINECRAFT, key);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/NamespacedKey.java
|
||||
+++ b/src/main/java/org/bukkit/NamespacedKey.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||
* underscores, hyphens, and forward slashes.
|
||||
*
|
||||
*/
|
||||
-public final class NamespacedKey implements net.kyori.adventure.key.Key { // Paper - implement Key
|
||||
+public final class NamespacedKey implements net.kyori.adventure.key.Key, com.destroystokyo.paper.Namespaced { // Paper - implement Key and Namespaced
|
||||
|
||||
/**
|
||||
* The namespace representing all inbuilt keys.
|
||||
@@ -0,0 +0,0 @@ public final class NamespacedKey implements net.kyori.adventure.key.Key { // Pap
|
||||
}
|
||||
|
||||
@NotNull
|
||||
+ @Override // Paper
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
+ @Override // Paper
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@SuppressWarnings("javadoc")
|
||||
@NotNull
|
||||
ItemMeta clone();
|
||||
+
|
||||
+ // Paper start - Add an API for CanPlaceOn and CanDestroy NBT values
|
||||
+ /**
|
||||
+ * Gets set of materials what given item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
|
||||
+ *
|
||||
+ * @return Set of materials
|
||||
+ * @deprecated Minecraft does not limit this to the material enum, Use {@link #getDestroyableKeys()} as a replacement
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ Set<org.bukkit.Material> getCanDestroy();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets set of materials what given item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
|
||||
+ *
|
||||
+ * @param canDestroy Set of materials
|
||||
+ * @deprecated Minecraft does not limit this to the material enum, Use {@link #setDestroyableKeys(Collection)} as a replacement
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void setCanDestroy(Set<org.bukkit.Material> canDestroy);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets set of materials where given item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
|
||||
+ *
|
||||
+ * @return Set of materials
|
||||
+ * @deprecated Minecraft does not limit this to the material enum, Use {@link #getPlaceableKeys()} as a replacement
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ Set<org.bukkit.Material> getCanPlaceOn();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets set of materials where given item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
|
||||
+ *
|
||||
+ * @param canPlaceOn Set of materials
|
||||
+ * @deprecated Minecraft does not limit this to the material enum, Use {@link #setPlaceableKeys(Collection)} as a replacement
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void setCanPlaceOn(Set<org.bukkit.Material> canPlaceOn);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the collection of namespaced keys that the item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
|
||||
+ *
|
||||
+ * @return Set of {@link com.destroystokyo.paper.Namespaced}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Set<com.destroystokyo.paper.Namespaced> getDestroyableKeys();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the collection of namespaced keys that the item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
|
||||
+ *
|
||||
+ * @param canDestroy Collection of {@link com.destroystokyo.paper.Namespaced}
|
||||
+ */
|
||||
+ void setDestroyableKeys(@NotNull Collection<com.destroystokyo.paper.Namespaced> canDestroy);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the collection of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
|
||||
+ *
|
||||
+ * @return Set of {@link com.destroystokyo.paper.Namespaced}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Set<com.destroystokyo.paper.Namespaced> getPlaceableKeys();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the set of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
|
||||
+ *
|
||||
+ * @param canPlaceOn Collection of {@link com.destroystokyo.paper.Namespaced}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ void setPlaceableKeys(@NotNull Collection<com.destroystokyo.paper.Namespaced> canPlaceOn);
|
||||
+
|
||||
+ /**
|
||||
+ * Checks for the existence of any keys that the item can be placed on
|
||||
+ *
|
||||
+ * @return true if this item has placeable keys
|
||||
+ */
|
||||
+ boolean hasPlaceableKeys();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks for the existence of any keys that the item can destroy
|
||||
+ *
|
||||
+ * @return true if this item has destroyable keys
|
||||
+ */
|
||||
+ boolean hasDestroyableKeys();
|
||||
+ // Paper end
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Phoenix616 <max@themoep.de>
|
||||
Date: Tue, 1 Dec 2020 14:57:02 +0100
|
||||
Subject: [PATCH] Add an asterisk to legacy API plugins
|
||||
|
||||
Not here to name and shame, only so server admins can be aware of which
|
||||
plugins have and haven't been updated.
|
||||
|
||||
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 {
|
||||
default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
||||
return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
|
||||
}
|
||||
+
|
||||
+ boolean isSupportedApiVersion(String apiVersion);
|
||||
+
|
||||
+ static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
|
||||
+ return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java
|
||||
@@ -0,0 +0,0 @@ public class PluginsCommand extends BukkitCommand {
|
||||
}
|
||||
|
||||
Plugin plugin = entry.getValue();
|
||||
-
|
||||
+
|
||||
pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED);
|
||||
- pluginList.append(plugin.getDescription().getName());
|
||||
+ // Paper start - Add an asterisk to legacy plugins (so admins are aware)
|
||||
+ String pluginName = plugin.getDescription().getName();
|
||||
+ if (org.bukkit.UnsafeValues.isLegacyPlugin(plugin)) {
|
||||
+ pluginName += "*";
|
||||
+ }
|
||||
+ pluginList.append(pluginName);
|
||||
+ // Paper end
|
||||
|
||||
if (plugin.getDescription().getProvides().size() > 0) {
|
||||
pluginList.append(" (").append(String.join(", ", plugin.getDescription().getProvides())).append(")");
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
Validate.isTrue(plugin instanceof JavaPlugin, "Plugin is not associated with this PluginLoader");
|
||||
|
||||
if (!plugin.isEnabled()) {
|
||||
- plugin.getLogger().info("Enabling " + plugin.getDescription().getFullName());
|
||||
+ // Paper start - Add an asterisk to legacy plugins (so admins are aware)
|
||||
+ String enableMsg = "Enabling " + plugin.getDescription().getFullName();
|
||||
+ if (org.bukkit.UnsafeValues.isLegacyPlugin(plugin)) {
|
||||
+ enableMsg += "*";
|
||||
+ }
|
||||
+
|
||||
+ plugin.getLogger().info(enableMsg);
|
||||
+ // Paper end
|
||||
|
||||
JavaPlugin jPlugin = (JavaPlugin) plugin;
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: LordKorea <lk97798@posteo.net>
|
||||
Date: Mon, 11 May 2020 22:38:10 -0400
|
||||
Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerRecipeBookClickEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+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.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player clicks a recipe in the recipe book
|
||||
+ */
|
||||
+public class PlayerRecipeBookClickEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancel = false;
|
||||
+ @NotNull private NamespacedKey recipe;
|
||||
+ private boolean makeAll;
|
||||
+
|
||||
+ public PlayerRecipeBookClickEvent(@NotNull Player player, @NotNull NamespacedKey recipe, boolean makeAll) {
|
||||
+ super(player);
|
||||
+ this.recipe = recipe;
|
||||
+ this.makeAll = makeAll;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the namespaced key of the recipe that was clicked by the player
|
||||
+ *
|
||||
+ * @return The namespaced key of the recipe
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public NamespacedKey getRecipe() {
|
||||
+ return recipe;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Changes what recipe is requested. This sets the requested recipe to the recipe with the given key
|
||||
+ *
|
||||
+ * @param recipe The key of the recipe that should be requested
|
||||
+ */
|
||||
+ public void setRecipe(@NotNull NamespacedKey recipe) {
|
||||
+ this.recipe = recipe;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets a boolean which indicates whether or not the player requested to make the maximum amount of results. This is
|
||||
+ * true if shift is pressed while the recipe is clicked in the recipe book
|
||||
+ *
|
||||
+ * @return {@code true} if shift is pressed while the recipe is clicked
|
||||
+ */
|
||||
+ public boolean isMakeAll() {
|
||||
+ return makeAll;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether or not the maximum amount of results should be made. If this is true, the request is handled as if
|
||||
+ * the player had pressed shift while clicking on the recipe
|
||||
+ *
|
||||
+ * @param makeAll {@code true} if the request should attempt to make the maximum amount of results
|
||||
+ */
|
||||
+ public void setMakeAll(boolean makeAll) {
|
||||
+ this.makeAll = makeAll;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
106
patches/api-unmapped/Add-basic-Datapack-API.patch
Normal file
106
patches/api-unmapped/Add-basic-Datapack-API.patch
Normal file
|
@ -0,0 +1,106 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Connor Linfoot <connorlinfoot@me.com>
|
||||
Date: Sun, 16 May 2021 15:07:34 +0100
|
||||
Subject: [PATCH] Add basic Datapack API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/datapack/Datapack.java b/src/main/java/io/papermc/paper/datapack/Datapack.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datapack/Datapack.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.datapack;
|
||||
+
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+
|
||||
+public interface Datapack {
|
||||
+
|
||||
+ /**
|
||||
+ * @return the name of the pack
|
||||
+ */
|
||||
+ @NonNull
|
||||
+ String getName();
|
||||
+
|
||||
+ /**
|
||||
+ * @return the compatibility of the pack
|
||||
+ */
|
||||
+ @NonNull
|
||||
+ Compatibility getCompatibility();
|
||||
+
|
||||
+ /**
|
||||
+ * @return whether or not the pack is currently enabled
|
||||
+ */
|
||||
+ boolean isEnabled();
|
||||
+
|
||||
+ void setEnabled(boolean enabled);
|
||||
+
|
||||
+ enum Compatibility {
|
||||
+ TOO_OLD,
|
||||
+ TOO_NEW,
|
||||
+ COMPATIBLE,
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/datapack/DatapackManager.java b/src/main/java/io/papermc/paper/datapack/DatapackManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/datapack/DatapackManager.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.datapack;
|
||||
+
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+
|
||||
+import java.util.Collection;
|
||||
+
|
||||
+public interface DatapackManager {
|
||||
+
|
||||
+ /**
|
||||
+ * @return all the packs known to the server
|
||||
+ */
|
||||
+ @NonNull
|
||||
+ Collection<Datapack> getPacks();
|
||||
+
|
||||
+ /**
|
||||
+ * @return all the packs which are currently enabled
|
||||
+ */
|
||||
+ @NonNull
|
||||
+ Collection<Datapack> getEnabledPacks();
|
||||
+
|
||||
+}
|
||||
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 com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
|
||||
return server.getMobGoals();
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * @return the datapack manager
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static io.papermc.paper.datapack.DatapackManager getDatapackManager() {
|
||||
+ return server.getDatapackManager();
|
||||
+ }
|
||||
// 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
|
||||
*/
|
||||
@NotNull
|
||||
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
|
||||
+
|
||||
+ /**
|
||||
+ * @return the datapack manager
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ io.papermc.paper.datapack.DatapackManager getDatapackManager();
|
||||
// Paper end
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 2 Dec 2020 18:25:31 -0800
|
||||
Subject: [PATCH] Add cause to Weather/ThunderChangeEvents
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/weather/ThunderChangeEvent.java
|
||||
@@ -0,0 +0,0 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean canceled;
|
||||
private final boolean to;
|
||||
+ // Paper start
|
||||
+ private final Cause cause;
|
||||
|
||||
+ public ThunderChangeEvent(@NotNull final World world, final boolean to, @NotNull final Cause cause) {
|
||||
+ super(world);
|
||||
+ this.to = to;
|
||||
+ this.cause = cause;
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated // Paper end
|
||||
public ThunderChangeEvent(@NotNull final World world, final boolean to) {
|
||||
super(world);
|
||||
this.to = to;
|
||||
+ this.cause = Cause.UNKNOWN; // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the cause of the weather change.
|
||||
+ *
|
||||
+ * @return the weather change cause
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return this.cause;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ COMMAND,
|
||||
+ NATURAL,
|
||||
+ SLEEP,
|
||||
+ PLUGIN,
|
||||
+ UNKNOWN
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/weather/WeatherChangeEvent.java
|
||||
@@ -0,0 +0,0 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean canceled;
|
||||
private final boolean to;
|
||||
+ // Paper start
|
||||
+ private final Cause cause;
|
||||
|
||||
+ public WeatherChangeEvent(@NotNull final World world, final boolean to, @NotNull Cause cause) {
|
||||
+ super(world);
|
||||
+ this.to = to;
|
||||
+ this.cause = cause;
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated // Paper end
|
||||
public WeatherChangeEvent(@NotNull final World world, final boolean to) {
|
||||
super(world);
|
||||
this.to = to;
|
||||
+ this.cause = Cause.UNKNOWN; // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +0,0 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the cause of the weather change.
|
||||
+ *
|
||||
+ * @return the weather change cause
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Cause getCause() {
|
||||
+ return cause;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ COMMAND,
|
||||
+ NATURAL,
|
||||
+ SLEEP,
|
||||
+ PLUGIN,
|
||||
+ UNKNOWN
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Tue, 18 May 2021 14:42:26 -0700
|
||||
Subject: [PATCH] Add command line option to load extra plugin jars not in the
|
||||
plugins folder
|
||||
|
||||
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
private final Map<String, Map<Permissible, Boolean>> permSubs = new HashMap<String, Map<Permissible, Boolean>>();
|
||||
private final Map<Boolean, Map<Permissible, Boolean>> defSubs = new HashMap<Boolean, Map<Permissible, Boolean>>();
|
||||
private boolean useTimings = false;
|
||||
+ private File pluginsDirectory; public @Nullable File pluginsDirectory() { return this.pluginsDirectory; } // Paper
|
||||
|
||||
public SimplePluginManager(@NotNull Server instance, @NotNull SimpleCommandMap commandMap) {
|
||||
server = instance;
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
@NotNull
|
||||
public Plugin[] loadPlugins(@NotNull File directory) {
|
||||
+ // Paper start - extra jars
|
||||
+ return this.loadPlugins(directory, java.util.Collections.emptyList());
|
||||
+ }
|
||||
+ @NotNull
|
||||
+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List<File> extraPluginJars) {
|
||||
+ this.pluginsDirectory = directory;
|
||||
+ // Paper end
|
||||
Validate.notNull(directory, "Directory cannot be null");
|
||||
Validate.isTrue(directory.isDirectory(), "Directory must be a directory");
|
||||
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
Map<String, Collection<String>> softDependencies = new HashMap<String, Collection<String>>();
|
||||
|
||||
// This is where it figures out all possible plugins
|
||||
- for (File file : directory.listFiles()) {
|
||||
+ // Paper start - extra jars
|
||||
+ final List<File> pluginJars = new ArrayList<>(java.util.Arrays.asList(directory.listFiles()));
|
||||
+ pluginJars.addAll(extraPluginJars);
|
||||
+ for (File file : pluginJars) {
|
||||
+ // Paper end
|
||||
PluginLoader loader = null;
|
||||
for (Pattern filter : filters) {
|
||||
Matcher match = filter.matcher(file.getName());
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
description = loader.getPluginDescription(file);
|
||||
String name = description.getName();
|
||||
if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': Restricted Name"); // Paper
|
||||
continue;
|
||||
} else if (description.rawName.indexOf(' ') != -1) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': uses the space-character (0x20) in its name");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': uses the space-character (0x20) in its name"); // Paper
|
||||
continue;
|
||||
}
|
||||
} catch (InvalidDescriptionException ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
description.getName(),
|
||||
file.getPath(),
|
||||
replacedFile.getPath(),
|
||||
- directory.getPath()
|
||||
+ file.getParentFile().getPath() // Paper
|
||||
));
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
file.getPath(),
|
||||
provided,
|
||||
pluginFile.getPath(),
|
||||
- directory.getPath()
|
||||
+ file.getParentFile().getPath() // Paper
|
||||
));
|
||||
} else {
|
||||
String replacedPlugin = pluginsProvided.put(provided, description.getName());
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
server.getLogger().log(
|
||||
Level.SEVERE,
|
||||
- "Could not load '" + entry.getValue().getPath() + "' in folder '" + directory.getPath() + "'",
|
||||
+ "Could not load '" + entry.getValue().getPath() + "' in folder '" + entry.getValue().getParentFile().getPath() + "'", // Paper
|
||||
new UnknownDependencyException("Unknown dependency " + dependency + ". Please download and install " + dependency + " to run this plugin."));
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
loadedPlugins.add(loadedPlugin.getName());
|
||||
loadedPlugins.addAll(loadedPlugin.getDescription().getProvides());
|
||||
} else {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'"); // Paper
|
||||
}
|
||||
continue;
|
||||
} catch (InvalidPluginException ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
loadedPlugins.add(loadedPlugin.getName());
|
||||
loadedPlugins.addAll(loadedPlugin.getDescription().getProvides());
|
||||
} else {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'"); // Paper
|
||||
}
|
||||
break;
|
||||
} catch (InvalidPluginException ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
while (failedPluginIterator.hasNext()) {
|
||||
File file = failedPluginIterator.next();
|
||||
failedPluginIterator.remove();
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': circular dependency detected");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': circular dependency detected"); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -0,0 +0,0 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
throw new InvalidPluginException(ex);
|
||||
}
|
||||
|
||||
- final File parentFile = file.getParentFile();
|
||||
+ final File parentFile = ((SimplePluginManager) this.server.getPluginManager()).pluginsDirectory(); // Paper
|
||||
final File dataFolder = new File(parentFile, description.getName());
|
||||
@SuppressWarnings("deprecation")
|
||||
final File oldDataFolder = new File(parentFile, description.getRawName());
|
|
@ -0,0 +1,104 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William <admin@domnian.com>
|
||||
Date: Fri, 18 Mar 2016 03:28:07 -0400
|
||||
Subject: [PATCH] Add command to reload permissions.yml and require confirm to
|
||||
reload
|
||||
|
||||
|
||||
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 org.bukkit.command.CommandMap getCommandMap() {
|
||||
return server.getCommandMap();
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Reload the Permissions in permissions.yml
|
||||
+ */
|
||||
+ public static void reloadPermissions() {
|
||||
+ server.reloadPermissions();
|
||||
+ }
|
||||
// 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
|
||||
@NotNull
|
||||
Spigot spigot();
|
||||
// Spigot end
|
||||
+
|
||||
+ void reloadPermissions(); // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/ReloadCommand.java
|
||||
@@ -0,0 +0,0 @@ public class ReloadCommand extends BukkitCommand {
|
||||
public ReloadCommand(@NotNull String name) {
|
||||
super(name);
|
||||
this.description = "Reloads the server configuration and plugins";
|
||||
- this.usageMessage = "/reload";
|
||||
+ this.usageMessage = "/reload [permissions]"; // Paper
|
||||
this.setPermission("bukkit.command.reload");
|
||||
this.setAliases(Arrays.asList("rl"));
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) {
|
||||
+ public boolean execute(@NotNull CommandSender sender, @NotNull String currentAlias, @NotNull String[] args) { // Paper
|
||||
if (!testPermission(sender)) return true;
|
||||
|
||||
+ // Paper start - Reload permissions.yml & require confirm
|
||||
+ boolean confirmed = System.getProperty("LetMeReload") != null;
|
||||
+ if (args.length == 1) {
|
||||
+ if (args[0].equalsIgnoreCase("permissions")) {
|
||||
+ Bukkit.getServer().reloadPermissions();
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Permissions successfully reloaded.");
|
||||
+ return true;
|
||||
+ } else if ("confirm".equalsIgnoreCase(args[0])) {
|
||||
+ confirmed = true;
|
||||
+ } else {
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "Usage: " + usageMessage);
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!confirmed) {
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "Are you sure you wish to reload your server? Doing so may cause bugs and memory leaks. It is recommended to restart instead of using /reload. To confirm, please type " + ChatColor.YELLOW + "/reload confirm");
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues when using some plugins.");
|
||||
Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
||||
Bukkit.reload();
|
||||
@@ -0,0 +0,0 @@ public class ReloadCommand extends BukkitCommand {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException {
|
||||
- return Collections.emptyList();
|
||||
+ return java.util.Collections.singletonList("permissions"); // Paper
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
public void useTimings(boolean use) {
|
||||
co.aikar.timings.Timings.setTimingsEnabled(use); // Paper
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public void clearPermissions() {
|
||||
+ permissions.clear();
|
||||
+ defaultPerms.get(true).clear();
|
||||
+ defaultPerms.get(false).clear();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Riley Park <rileysebastianpark@gmail.com>
|
||||
Date: Fri, 9 Jun 2017 07:24:24 -0700
|
||||
Subject: [PATCH] Add configuration option to prevent player names from being
|
||||
suggested
|
||||
|
||||
|
||||
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 reloadCommandAliases() {
|
||||
return server.reloadCommandAliases();
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if player names should be suggested when a command returns {@code null} as
|
||||
+ * their tab completion result.
|
||||
+ *
|
||||
+ * @return true if player names should be suggested
|
||||
+ */
|
||||
+ public static boolean suggestPlayerNamesWhenNullTabCompletions() {
|
||||
+ return server.suggestPlayerNamesWhenNullTabCompletions();
|
||||
+ }
|
||||
// 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
|
||||
void reloadPermissions(); // Paper
|
||||
|
||||
boolean reloadCommandAliases(); // Paper
|
||||
+
|
||||
+ // Paper start - allow preventing player name suggestions by default
|
||||
+ /**
|
||||
+ * Checks if player names should be suggested when a command returns {@code null} as
|
||||
+ * their tab completion result.
|
||||
+ *
|
||||
+ * @return true if player names should be suggested
|
||||
+ */
|
||||
+ boolean suggestPlayerNamesWhenNullTabCompletions();
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/command/Command.java
|
||||
+++ b/src/main/java/org/bukkit/command/Command.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Command {
|
||||
Validate.notNull(args, "Arguments cannot be null");
|
||||
Validate.notNull(alias, "Alias cannot be null");
|
||||
|
||||
- if (args.length == 0) {
|
||||
+ if (args.length == 0 || !sender.getServer().suggestPlayerNamesWhenNullTabCompletions()) { // Paper - allow preventing player name suggestions by default) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Date: Fri, 29 Jan 2021 15:13:04 +0100
|
||||
Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityUnleashEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class EntityUnleashEvent extends EntityEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final UnleashReason reason;
|
||||
+ private boolean dropLeash; // Paper
|
||||
|
||||
+ // Paper start - drop leash variable
|
||||
+ @Deprecated
|
||||
public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason) {
|
||||
+ this(entity, reason, false);
|
||||
+ }
|
||||
+
|
||||
+ public EntityUnleashEvent(@NotNull Entity entity, @NotNull UnleashReason reason, boolean dropLeash) {
|
||||
super(entity);
|
||||
+ // Paper end
|
||||
this.reason = reason;
|
||||
+ this.dropLeash = dropLeash; // Paper
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public class EntityUnleashEvent extends EntityEvent {
|
||||
return reason;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Returns whether a leash item will be dropped.
|
||||
+ *
|
||||
+ * @return Whether the leash item will be dropped
|
||||
+ */
|
||||
+ public boolean isDropLeash() {
|
||||
+ return dropLeash;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether a leash item should be dropped.
|
||||
+ *
|
||||
+ * @param dropLeash Whether the leash item should be dropped
|
||||
+ */
|
||||
+ public void setDropLeash(boolean dropLeash) {
|
||||
+ this.dropLeash = dropLeash;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerUnleashEntityEvent.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerUnleashEntityEvent extends EntityUnleashEvent implements Canc
|
||||
private final Player player;
|
||||
private boolean cancelled = false;
|
||||
|
||||
+ // Paper start - drop leash variable
|
||||
+ @Deprecated
|
||||
public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player) {
|
||||
- super(entity, UnleashReason.PLAYER_UNLEASH);
|
||||
+ this(entity, player, false);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerUnleashEntityEvent(@NotNull Entity entity, @NotNull Player player, boolean dropLeash) {
|
||||
+ super(entity, UnleashReason.PLAYER_UNLEASH, dropLeash);
|
||||
+ // Paper end
|
||||
this.player = player;
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 2 Jan 2020 12:25:16 -0600
|
||||
Subject: [PATCH] Add effect to block break naturally
|
||||
|
||||
|
||||
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 {
|
||||
*/
|
||||
boolean breakNaturally(@Nullable ItemStack tool);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Breaks the block and spawns items as if a player had digged it with a
|
||||
+ * specific tool
|
||||
+ *
|
||||
+ * @param tool The tool or item in hand used for digging
|
||||
+ * @param triggerEffect Play the block break particle effect and sound
|
||||
+ * @return true if the block was destroyed
|
||||
+ */
|
||||
+ boolean breakNaturally(@NotNull ItemStack tool, boolean triggerEffect);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Simulate bone meal application to this block (if possible).
|
||||
*
|
46
patches/api-unmapped/Add-entity-liquid-API.patch
Normal file
46
patches/api-unmapped/Add-entity-liquid-API.patch
Normal file
|
@ -0,0 +1,46 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 2 Jul 2020 18:11:33 -0500
|
||||
Subject: [PATCH] Add entity liquid 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
|
||||
*/
|
||||
@NotNull
|
||||
org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in rain
|
||||
+ */
|
||||
+ public boolean isInRain();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in bubble column
|
||||
+ */
|
||||
+ public boolean isInBubbleColumn();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in water or rain
|
||||
+ */
|
||||
+ public boolean isInWaterOrRain();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in water or bubble column
|
||||
+ */
|
||||
+ public boolean isInWaterOrBubbleColumn();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in water or rain or bubble column
|
||||
+ */
|
||||
+ public boolean isInWaterOrRainOrBubbleColumn();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in lava
|
||||
+ */
|
||||
+ public boolean isInLava();
|
||||
// Paper end
|
||||
}
|
604
patches/api-unmapped/Add-exception-reporting-event.patch
Normal file
604
patches/api-unmapped/Add-exception-reporting-event.patch
Normal file
|
@ -0,0 +1,604 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Mon, 29 Feb 2016 20:24:35 -0600
|
||||
Subject: [PATCH] Add exception reporting event
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.apache.commons.lang.Validate;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import com.destroystokyo.paper.exception.ServerException;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called whenever an exception is thrown in a recoverable section of the server.
|
||||
+ */
|
||||
+public class ServerExceptionEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ @NotNull private ServerException exception;
|
||||
+
|
||||
+ public ServerExceptionEvent(@NotNull ServerException exception) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.exception = Preconditions.checkNotNull(exception, "exception");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the wrapped exception that was thrown.
|
||||
+ *
|
||||
+ * @return Exception thrown
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ServerException getException() {
|
||||
+ return exception;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a command throws an exception
|
||||
+ */
|
||||
+public class ServerCommandException extends ServerException {
|
||||
+
|
||||
+ private final Command command;
|
||||
+ private final CommandSender commandSender;
|
||||
+ private final String[] arguments;
|
||||
+
|
||||
+ public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(cause);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command which threw the exception
|
||||
+ *
|
||||
+ * @return exception throwing command
|
||||
+ */
|
||||
+ public Command getCommand() {
|
||||
+ return command;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command sender which executed the command request
|
||||
+ *
|
||||
+ * @return command sender of exception thrown command request
|
||||
+ */
|
||||
+ public CommandSender getCommandSender() {
|
||||
+ return commandSender;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the arguments which threw the exception for the command
|
||||
+ *
|
||||
+ * @return arguments of exception thrown command request
|
||||
+ */
|
||||
+ public String[] getArguments() {
|
||||
+ return arguments;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.Listener;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.*;
|
||||
+
|
||||
+/**
|
||||
+ * Exception thrown when a server event listener throws an exception
|
||||
+ */
|
||||
+public class ServerEventException extends ServerPluginException {
|
||||
+
|
||||
+ private final Listener listener;
|
||||
+ private final Event event;
|
||||
+
|
||||
+ public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the listener which threw the exception
|
||||
+ *
|
||||
+ * @return event listener
|
||||
+ */
|
||||
+ public Listener getListener() {
|
||||
+ return listener;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the event which caused the exception
|
||||
+ *
|
||||
+ * @return event
|
||||
+ */
|
||||
+ public Event getEvent() {
|
||||
+ return event;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+/**
|
||||
+ * Wrapper exception for all exceptions that are thrown by the server.
|
||||
+ */
|
||||
+public class ServerException extends Exception {
|
||||
+
|
||||
+ public ServerException(String message) {
|
||||
+ super(message);
|
||||
+ }
|
||||
+
|
||||
+ public ServerException(String message, Throwable cause) {
|
||||
+ super(message, cause);
|
||||
+ }
|
||||
+
|
||||
+ public ServerException(Throwable cause) {
|
||||
+ super(cause);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when the internal server throws a recoverable exception.
|
||||
+ */
|
||||
+public class ServerInternalException extends ServerException {
|
||||
+
|
||||
+ public ServerInternalException(String message) {
|
||||
+ super(message);
|
||||
+ }
|
||||
+
|
||||
+ public ServerInternalException(String message, Throwable cause) {
|
||||
+ super(message, cause);
|
||||
+ }
|
||||
+
|
||||
+ public ServerInternalException(Throwable cause) {
|
||||
+ super(cause);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ }
|
||||
+
|
||||
+ public static void reportInternalException(Throwable cause) {
|
||||
+ try {
|
||||
+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));
|
||||
+ ;
|
||||
+ } catch (Throwable t) {
|
||||
+ t.printStackTrace(); // Don't want to rethrow!
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown whenever there is an exception with any enabling or disabling of plugins.
|
||||
+ */
|
||||
+public class ServerPluginEnableDisableException extends ServerPluginException {
|
||||
+ public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import org.apache.commons.lang.Validate;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.*;
|
||||
+
|
||||
+/**
|
||||
+ * Wrapper exception for all cases to which a plugin can be immediately blamed for
|
||||
+ */
|
||||
+public class ServerPluginException extends ServerException {
|
||||
+ public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(message, cause);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginException(Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(cause);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ private final Plugin responsiblePlugin;
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the plugin which is directly responsible for the exception being thrown
|
||||
+ *
|
||||
+ * @return plugin which is responsible for the exception throw
|
||||
+ */
|
||||
+ public Plugin getResponsiblePlugin() {
|
||||
+ return responsiblePlugin;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.*;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when an incoming plugin message channel throws an exception
|
||||
+ */
|
||||
+public class ServerPluginMessageException extends ServerPluginException {
|
||||
+
|
||||
+ private final Player player;
|
||||
+ private final String channel;
|
||||
+ private final byte[] data;
|
||||
+
|
||||
+ public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the channel to which the error occurred from recieving data from
|
||||
+ *
|
||||
+ * @return exception channel
|
||||
+ */
|
||||
+ public String getChannel() {
|
||||
+ return channel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the data to which the error occurred from
|
||||
+ *
|
||||
+ * @return exception data
|
||||
+ */
|
||||
+ public byte[] getData() {
|
||||
+ return data;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player which the plugin message causing the exception originated from
|
||||
+ *
|
||||
+ * @return exception player
|
||||
+ */
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.scheduler.BukkitTask;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a plugin's scheduler fails with an exception
|
||||
+ */
|
||||
+public class ServerSchedulerException extends ServerPluginException {
|
||||
+
|
||||
+ private final BukkitTask task;
|
||||
+
|
||||
+ public ServerSchedulerException(String message, Throwable cause, BukkitTask task) {
|
||||
+ super(message, cause, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ public ServerSchedulerException(Throwable cause, BukkitTask task) {
|
||||
+ super(cause, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the task which threw the exception
|
||||
+ *
|
||||
+ * @return exception throwing task
|
||||
+ */
|
||||
+ public BukkitTask getTask() {
|
||||
+ return task;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a tab-complete request throws an exception
|
||||
+ */
|
||||
+public class ServerTabCompleteException extends ServerCommandException {
|
||||
+
|
||||
+ public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, command, commandSender, arguments);
|
||||
+ }
|
||||
+
|
||||
+ public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(cause, command, commandSender, arguments);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -0,0 +0,0 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
+
|
||||
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
||||
+import com.destroystokyo.paper.exception.ServerCommandException;
|
||||
+import com.destroystokyo.paper.exception.ServerTabCompleteException;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
@@ -0,0 +0,0 @@ public class SimpleCommandMap implements CommandMap {
|
||||
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
|
||||
} // target.timings.stopTiming(); // Spigot // Paper
|
||||
} catch (CommandException ex) {
|
||||
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper
|
||||
//target.timings.stopTiming(); // Spigot // Paper
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
//target.timings.stopTiming(); // Spigot // Paper
|
||||
- throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
|
||||
+ String msg = "Unhandled exception executing '" + commandLine + "' in " + target;
|
||||
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper
|
||||
+ throw new CommandException(msg, ex);
|
||||
}
|
||||
|
||||
// return true as command was handled
|
||||
@@ -0,0 +0,0 @@ public class SimpleCommandMap implements CommandMap {
|
||||
} catch (CommandException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
- throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
|
||||
+ String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target;
|
||||
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerTabCompleteException(msg, ex, target, sender, args))); // Paper
|
||||
+ throw new CommandException(msg, ex);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -0,0 +0,0 @@ import java.util.WeakHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
+
|
||||
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
||||
+import com.destroystokyo.paper.exception.ServerEventException;
|
||||
+import com.destroystokyo.paper.exception.ServerPluginEnableDisableException;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
try {
|
||||
plugin.getPluginLoader().enablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while enabling "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin);
|
||||
}
|
||||
|
||||
HandlerList.bakeAll();
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
try {
|
||||
plugin.getPluginLoader().disablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while disabling "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getScheduler().cancelTasks(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while cancelling tasks for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while cancelling tasks for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getServicesManager().unregisterAll(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering services for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering services for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
HandlerList.unregisterAll(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering events for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering events for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getMessenger().unregisterIncomingPluginChannel(plugin);
|
||||
server.getMessenger().unregisterOutgoingPluginChannel(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering plugin channels for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
|
||||
+ server.getLogger().log(Level.SEVERE, msg, ex);
|
||||
+ callEvent(new ServerExceptionEvent(new ServerPluginEnableDisableException(msg, ex, plugin)));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void clearPlugins() {
|
||||
synchronized (this) {
|
||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
||||
));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(), ex);
|
||||
+ // Paper start - error reporting
|
||||
+ String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
|
||||
+ server.getLogger().log(Level.SEVERE, msg, ex);
|
||||
+ if (!(event instanceof ServerExceptionEvent)) { // We don't want to cause an endless event loop
|
||||
+ callEvent(new ServerExceptionEvent(new ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
}
|
381
patches/api-unmapped/Add-extended-PaperServerListPingEvent.patch
Normal file
381
patches/api-unmapped/Add-extended-PaperServerListPingEvent.patch
Normal file
|
@ -0,0 +1,381 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Minecrell <minecrell@minecrell.net>
|
||||
Date: Wed, 11 Oct 2017 15:55:38 +0200
|
||||
Subject: [PATCH] Add extended PaperServerListPingEvent
|
||||
|
||||
Add a new event that extends the original ServerListPingEvent
|
||||
and allows full control of the response sent to the client.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import static java.util.Objects.requireNonNull;
|
||||
+
|
||||
+import com.destroystokyo.paper.network.StatusClient;
|
||||
+import com.destroystokyo.paper.profile.PlayerProfile;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.server.ServerListPingEvent;
|
||||
+import org.bukkit.util.CachedServerIcon;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.List;
|
||||
+import java.util.NoSuchElementException;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Extended version of {@link ServerListPingEvent} that allows full control
|
||||
+ * of the response sent to the client.
|
||||
+ */
|
||||
+public class PaperServerListPingEvent extends ServerListPingEvent implements Cancellable {
|
||||
+
|
||||
+ @NotNull private final StatusClient client;
|
||||
+
|
||||
+ private int numPlayers;
|
||||
+ private boolean hidePlayers;
|
||||
+ @NotNull private final List<PlayerProfile> playerSample = new ArrayList<>();
|
||||
+
|
||||
+ @NotNull private String version;
|
||||
+ private int protocolVersion;
|
||||
+
|
||||
+ @Nullable private CachedServerIcon favicon;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ private boolean originalPlayerCount = true;
|
||||
+ private Object[] players;
|
||||
+
|
||||
+ @Deprecated
|
||||
+ public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull String motd, int numPlayers, int maxPlayers,
|
||||
+ @NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
|
||||
+ super(client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
|
||||
+ this.client = client;
|
||||
+ this.numPlayers = numPlayers;
|
||||
+ this.version = version;
|
||||
+ this.protocolVersion = protocolVersion;
|
||||
+ setServerIcon(favicon);
|
||||
+ }
|
||||
+
|
||||
+ public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull net.kyori.adventure.text.Component motd, int numPlayers, int maxPlayers,
|
||||
+ @NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
|
||||
+ super(client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
|
||||
+ this.client = client;
|
||||
+ this.numPlayers = numPlayers;
|
||||
+ this.version = version;
|
||||
+ this.protocolVersion = protocolVersion;
|
||||
+ setServerIcon(favicon);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the {@link StatusClient} pinging the server.
|
||||
+ *
|
||||
+ * @return The client
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public StatusClient getClient() {
|
||||
+ return this.client;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * <p>Returns {@code -1} if players are hidden using
|
||||
+ * {@link #shouldHidePlayers()}.</p>
|
||||
+ */
|
||||
+ @Override
|
||||
+ public int getNumPlayers() {
|
||||
+ if (this.hidePlayers) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return this.numPlayers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the number of players displayed in the server list.
|
||||
+ *
|
||||
+ * <p>Note that this won't have any effect if {@link #shouldHidePlayers()}
|
||||
+ * is enabled.</p>
|
||||
+ *
|
||||
+ * @param numPlayers The number of online players
|
||||
+ */
|
||||
+ public void setNumPlayers(int numPlayers) {
|
||||
+ if (this.numPlayers != numPlayers) {
|
||||
+ this.numPlayers = numPlayers;
|
||||
+ this.originalPlayerCount = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * <p>Returns {@code -1} if players are hidden using
|
||||
+ * {@link #shouldHidePlayers()}.</p>
|
||||
+ */
|
||||
+ @Override
|
||||
+ public int getMaxPlayers() {
|
||||
+ if (this.hidePlayers) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return super.getMaxPlayers();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns whether all player related information is hidden in the server
|
||||
+ * list. This will cause {@link #getNumPlayers()}, {@link #getMaxPlayers()}
|
||||
+ * and {@link #getPlayerSample()} to be skipped in the response.
|
||||
+ *
|
||||
+ * <p>The Vanilla Minecraft client will display the player count as {@code ???}
|
||||
+ * when this option is enabled.</p>
|
||||
+ *
|
||||
+ * @return {@code true} if the player count is hidden
|
||||
+ */
|
||||
+ public boolean shouldHidePlayers() {
|
||||
+ return hidePlayers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether all player related information is hidden in the server
|
||||
+ * list. This will cause {@link #getNumPlayers()}, {@link #getMaxPlayers()}
|
||||
+ * and {@link #getPlayerSample()} to be skipped in the response.
|
||||
+ *
|
||||
+ * <p>The Vanilla Minecraft client will display the player count as {@code ???}
|
||||
+ * when this option is enabled.</p>
|
||||
+ *
|
||||
+ * @param hidePlayers {@code true} if the player count should be hidden
|
||||
+ */
|
||||
+ public void setHidePlayers(boolean hidePlayers) {
|
||||
+ this.hidePlayers = hidePlayers;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a mutable list of {@link PlayerProfile} that will be displayed
|
||||
+ * as online players on the client.
|
||||
+ *
|
||||
+ * <p>The Vanilla Minecraft client will display them when hovering the
|
||||
+ * player count with the mouse.</p>
|
||||
+ *
|
||||
+ * @return The mutable player sample list
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public List<PlayerProfile> getPlayerSample() {
|
||||
+ return this.playerSample;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the version that will be sent as server version on the client.
|
||||
+ *
|
||||
+ * @return The server version
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getVersion() {
|
||||
+ return version;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the version that will be sent as server version to the client.
|
||||
+ *
|
||||
+ * @param version The server version
|
||||
+ */
|
||||
+ public void setVersion(@NotNull String version) {
|
||||
+ this.version = requireNonNull(version, "version");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the protocol version that will be sent as the protocol version
|
||||
+ * of the server to the client.
|
||||
+ *
|
||||
+ * @return The protocol version of the server, or {@code -1} if the server
|
||||
+ * has not finished initialization yet
|
||||
+ */
|
||||
+ public int getProtocolVersion() {
|
||||
+ return protocolVersion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the protocol version that will be sent as the protocol version
|
||||
+ * of the server to the client.
|
||||
+ *
|
||||
+ * @param protocolVersion The protocol version of the server
|
||||
+ */
|
||||
+ public void setProtocolVersion(int protocolVersion) {
|
||||
+ this.protocolVersion = protocolVersion;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the server icon sent to the client.
|
||||
+ *
|
||||
+ * @return The icon to send to the client, or {@code null} for none
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public CachedServerIcon getServerIcon() {
|
||||
+ return this.favicon;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the server icon sent to the client.
|
||||
+ *
|
||||
+ * @param icon The icon to send to the client, or {@code null} for none
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setServerIcon(@Nullable CachedServerIcon icon) {
|
||||
+ if (icon != null && icon.isEmpty()) {
|
||||
+ // Represent empty icons as null
|
||||
+ icon = null;
|
||||
+ }
|
||||
+
|
||||
+ this.favicon = icon;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * <p>Cancelling this event will cause the connection to be closed immediately,
|
||||
+ * without sending a response to the client.</p>
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * <p>Cancelling this event will cause the connection to be closed immediately,
|
||||
+ * without sending a response to the client.</p>
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * {@inheritDoc}
|
||||
+ *
|
||||
+ * <p><b>Note:</b> For compatibility reasons, this method will return all
|
||||
+ * online players, not just the ones referenced in {@link #getPlayerSample()}.
|
||||
+ * Removing a player will:</p>
|
||||
+ *
|
||||
+ * <ul>
|
||||
+ * <li>Decrement the online player count (if and only if) the player
|
||||
+ * count wasn't changed by another plugin before.</li>
|
||||
+ * <li>Remove all entries from {@link #getPlayerSample()} that refer to
|
||||
+ * the removed player (based on their {@link UUID}).</li>
|
||||
+ * </ul>
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Iterator<Player> iterator() {
|
||||
+ if (this.players == null) {
|
||||
+ this.players = getOnlinePlayers();
|
||||
+ }
|
||||
+
|
||||
+ return new PlayerIterator();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ protected Object[] getOnlinePlayers() {
|
||||
+ return Bukkit.getOnlinePlayers().toArray();
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ protected Player getBukkitPlayer(@NotNull Object player) {
|
||||
+ return (Player) player;
|
||||
+ }
|
||||
+
|
||||
+ private final class PlayerIterator implements Iterator<Player> {
|
||||
+
|
||||
+ private int next;
|
||||
+ private int current;
|
||||
+ @Nullable private Player player;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasNext() {
|
||||
+ for (; this.next < players.length; this.next++) {
|
||||
+ if (players[this.next] != null) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Player next() {
|
||||
+ if (!hasNext()) {
|
||||
+ this.player = null;
|
||||
+ throw new NoSuchElementException();
|
||||
+ }
|
||||
+
|
||||
+ this.current = this.next++;
|
||||
+ return this.player = getBukkitPlayer(players[this.current]);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void remove() {
|
||||
+ if (this.player == null) {
|
||||
+ throw new IllegalStateException();
|
||||
+ }
|
||||
+
|
||||
+ UUID uniqueId = this.player.getUniqueId();
|
||||
+ this.player = null;
|
||||
+
|
||||
+ // Remove player from iterator
|
||||
+ players[this.current] = null;
|
||||
+
|
||||
+ // Remove player from sample
|
||||
+ getPlayerSample().removeIf(p -> uniqueId.equals(p.getId()));
|
||||
+
|
||||
+ // Decrement player count
|
||||
+ if (originalPlayerCount) {
|
||||
+ numPlayers--;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/network/StatusClient.java b/src/main/java/com/destroystokyo/paper/network/StatusClient.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/network/StatusClient.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.network;
|
||||
+
|
||||
+import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a client requesting the current status from the server (e.g. from
|
||||
+ * the server list).
|
||||
+ *
|
||||
+ * @see PaperServerListPingEvent
|
||||
+ */
|
||||
+public interface StatusClient extends NetworkClient {
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/util/CachedServerIcon.java b/src/main/java/org/bukkit/util/CachedServerIcon.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/util/CachedServerIcon.java
|
||||
+++ b/src/main/java/org/bukkit/util/CachedServerIcon.java
|
||||
@@ -0,0 +0,0 @@ public interface CachedServerIcon {
|
||||
@Nullable
|
||||
public String getData(); // Paper
|
||||
|
||||
+ // Paper start
|
||||
+ default boolean isEmpty() {
|
||||
+ return getData() == null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
52
patches/api-unmapped/Add-getI18NDisplayName-API.patch
Normal file
52
patches/api-unmapped/Add-getI18NDisplayName-API.patch
Normal file
|
@ -0,0 +1,52 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 May 2016 23:55:48 -0400
|
||||
Subject: [PATCH] Add getI18NDisplayName API
|
||||
|
||||
Gets the Display name as seen in the Client.
|
||||
Currently the server only supports the English language. To override this,
|
||||
You must replace the language file embedded in the server jar.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
@@ -0,0 +0,0 @@ public interface ItemFactory {
|
||||
*/
|
||||
@NotNull
|
||||
ItemStack ensureServerConversions(@NotNull ItemStack item);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the Display name as seen in the Client.
|
||||
+ * Currently the server only supports the English language. To override this,
|
||||
+ * You must replace the language file embedded in the server jar.
|
||||
+ *
|
||||
+ * @param item Item to return Display name of
|
||||
+ * @return Display name of Item
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ String getI18NDisplayName(@Nullable ItemStack item);
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||
public ItemStack ensureServerConversions() {
|
||||
return Bukkit.getServer().getItemFactory().ensureServerConversions(this);
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the Display name as seen in the Client.
|
||||
+ * Currently the server only supports the English language. To override this,
|
||||
+ * You must replace the language file embedded in the server jar.
|
||||
+ *
|
||||
+ * @return Display name of Item
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getI18NDisplayName() {
|
||||
+ return Bukkit.getServer().getItemFactory().getI18NDisplayName(this);
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksander Jagiello <themolkapl@gmail.com>
|
||||
Date: Sun, 24 Jan 2021 22:17:29 +0100
|
||||
Subject: [PATCH] Add getMainThreadExecutor to BukkitScheduler
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
|
||||
+++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java
|
||||
@@ -0,0 +0,0 @@ public interface BukkitScheduler {
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public BukkitTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay, long period) throws IllegalArgumentException;
|
||||
+
|
||||
+ // Paper start - add getMainThreadExecutor
|
||||
+ /**
|
||||
+ * Returns an executor that will run tasks on the next server tick.
|
||||
+ *
|
||||
+ * @param plugin the reference to the plugin scheduling tasks
|
||||
+ * @return an executor associated with the given plugin
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public java.util.concurrent.Executor getMainThreadExecutor(@NotNull Plugin plugin);
|
||||
+ // Paper end
|
||||
}
|
275
patches/api-unmapped/Add-getNearbyXXX-methods-to-Location.patch
Normal file
275
patches/api-unmapped/Add-getNearbyXXX-methods-to-Location.patch
Normal file
|
@ -0,0 +1,275 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Mon, 18 Jun 2018 00:41:46 -0500
|
||||
Subject: [PATCH] Add "getNearbyXXX" methods to Location
|
||||
|
||||
|
||||
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.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
+// Paper start
|
||||
+import java.util.Collection;
|
||||
+import java.util.Collections;
|
||||
+import java.util.function.Predicate;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+// Paper end
|
||||
+
|
||||
/**
|
||||
* Represents a 3-dimensional position in a world.
|
||||
* <br>
|
||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
centerLoc.setZ(getBlockZ() + 0.5);
|
||||
return centerLoc;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a list of entities within a bounding box centered around a Location.
|
||||
+ *
|
||||
+ * Some implementations may impose artificial restrictions on the size of the search bounding box.
|
||||
+ *
|
||||
+ * @param x 1/2 the size of the box along x axis
|
||||
+ * @param y 1/2 the size of the box along y axis
|
||||
+ * @param z 1/2 the size of the box along z axis
|
||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<Entity> getNearbyEntities(double x, double y, double z) {
|
||||
+ World world = this.getWorld();
|
||||
+ if (world == null) {
|
||||
+ throw new IllegalArgumentException("Location has no world");
|
||||
+ }
|
||||
+ return world.getNearbyEntities(this, x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param radius X Radius
|
||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double radius) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, radius, radius, radius);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param xzRadius X/Z Radius
|
||||
+ * @param yRadius Y Radius
|
||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double xzRadius, double yRadius) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xzRadius, yRadius, xzRadius);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param xRadius X Radius
|
||||
+ * @param yRadius Y Radius
|
||||
+ * @param zRadius Z radius
|
||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double xRadius, double yRadius, double zRadius) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xRadius, yRadius, zRadius);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param radius Radius
|
||||
+ * @param predicate a predicate used to filter results
|
||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double radius, @Nullable Predicate<LivingEntity> predicate) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, radius, radius, radius, predicate);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param xzRadius X/Z Radius
|
||||
+ * @param yRadius Y Radius
|
||||
+ * @param predicate a predicate used to filter results
|
||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double xzRadius, double yRadius, @Nullable Predicate<LivingEntity> predicate) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xzRadius, yRadius, xzRadius, predicate);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param xRadius X Radius
|
||||
+ * @param yRadius Y Radius
|
||||
+ * @param zRadius Z radius
|
||||
+ * @param predicate a predicate used to filter results
|
||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double xRadius, double yRadius, double zRadius, @Nullable Predicate<LivingEntity> predicate) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xRadius, yRadius, zRadius, predicate);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param radius X/Y/Z Radius
|
||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<Player> getNearbyPlayers(double radius) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, radius, radius, radius);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param xzRadius X/Z Radius
|
||||
+ * @param yRadius Y Radius
|
||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<Player> getNearbyPlayers(double xzRadius, double yRadius) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xzRadius, yRadius, xzRadius);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param xRadius X Radius
|
||||
+ * @param yRadius Y Radius
|
||||
+ * @param zRadius Z Radius
|
||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<Player> getNearbyPlayers(double xRadius, double yRadius, double zRadius) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xRadius, yRadius, zRadius);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param radius X/Y/Z Radius
|
||||
+ * @param predicate a predicate used to filter results
|
||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<Player> getNearbyPlayers(double radius, @Nullable Predicate<Player> predicate) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, radius, radius, radius, predicate);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param xzRadius X/Z Radius
|
||||
+ * @param yRadius Y Radius
|
||||
+ * @param predicate a predicate used to filter results
|
||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<Player> getNearbyPlayers(double xzRadius, double yRadius, @Nullable Predicate<Player> predicate) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xzRadius, yRadius, xzRadius, predicate);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets nearby players within the specified radius (bounding box)
|
||||
+ * @param xRadius X Radius
|
||||
+ * @param yRadius Y Radius
|
||||
+ * @param zRadius Z Radius
|
||||
+ * @param predicate a predicate used to filter results
|
||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Collection<Player> getNearbyPlayers(double xRadius, double yRadius, double zRadius, @Nullable Predicate<Player> predicate) {
|
||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xRadius, yRadius, zRadius, predicate);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
||||
+ * @param clazz Type to filter by
|
||||
+ * @param radius X/Y/Z radius to search within
|
||||
+ * @param <T> the entity type
|
||||
+ * @return the collection of entities of type clazz near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, double radius) {
|
||||
+ return getNearbyEntitiesByType(clazz, radius, radius, radius, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)
|
||||
+ * @param clazz Type to filter by
|
||||
+ * @param xzRadius X/Z radius to search within
|
||||
+ * @param yRadius Y radius to search within
|
||||
+ * @param <T> the entity type
|
||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, double xzRadius, double yRadius) {
|
||||
+ return getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
||||
+ * @param clazz Type to filter by
|
||||
+ * @param xRadius X Radius
|
||||
+ * @param yRadius Y Radius
|
||||
+ * @param zRadius Z Radius
|
||||
+ * @param <T> the entity type
|
||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, double xRadius, double yRadius, double zRadius) {
|
||||
+ return getNearbyEntitiesByType(clazz, xRadius, yRadius, zRadius, null);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
||||
+ * @param clazz Type to filter by
|
||||
+ * @param radius X/Y/Z radius to search within
|
||||
+ * @param predicate a predicate used to filter results
|
||||
+ * @param <T> the entity type
|
||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, double radius, @Nullable Predicate<T> predicate) {
|
||||
+ return getNearbyEntitiesByType(clazz, radius, radius, radius, predicate);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)
|
||||
+ * @param clazz Type to filter by
|
||||
+ * @param xzRadius X/Z radius to search within
|
||||
+ * @param yRadius Y radius to search within
|
||||
+ * @param predicate a predicate used to filter results
|
||||
+ * @param <T> the entity type
|
||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, double xzRadius, double yRadius, @Nullable Predicate<T> predicate) {
|
||||
+ return getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, predicate);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
||||
+ * @param clazz Type to filter by
|
||||
+ * @param xRadius X Radius
|
||||
+ * @param yRadius Y Radius
|
||||
+ * @param zRadius Z Radius
|
||||
+ * @param predicate a predicate used to filter results
|
||||
+ * @param <T> the entity type
|
||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends Entity> clazz, double xRadius, double yRadius, double zRadius, @Nullable Predicate<T> predicate) {
|
||||
+ World world = this.getWorld();
|
||||
+ if (world == null) {
|
||||
+ throw new IllegalArgumentException("Location has no world");
|
||||
+ }
|
||||
+ return world.getNearbyEntitiesByType(clazz, this, xRadius, yRadius, zRadius, predicate);
|
||||
+ }
|
||||
// Paper end
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
|
@ -0,0 +1,68 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: oxygencraft <21054297+oxygencraft@users.noreply.github.com>
|
||||
Date: Sun, 25 Oct 2020 18:35:58 +1100
|
||||
Subject: [PATCH] Add getOfflinePlayerIfCached(String)
|
||||
|
||||
|
||||
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.getOfflinePlayer(name);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the player by the given name, regardless if they are offline or
|
||||
+ * online.
|
||||
+ * <p>
|
||||
+ * This will not make a web request to get the UUID for the given name,
|
||||
+ * thus this method will not block. However this method will return
|
||||
+ * {@code null} if the player is not cached.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @param name the name of the player to retrieve
|
||||
+ * @return an offline player if cached, {@code null} otherwise
|
||||
+ * @see #getOfflinePlayer(String)
|
||||
+ * @see #getOfflinePlayer(java.util.UUID)
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public static OfflinePlayer getOfflinePlayerIfCached(@NotNull String name) {
|
||||
+ return server.getOfflinePlayerIfCached(name);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the player by the given UUID, regardless if they are offline or
|
||||
* online.
|
||||
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 OfflinePlayer getOfflinePlayer(@NotNull String name);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the player by the given name, regardless if they are offline or
|
||||
+ * online.
|
||||
+ * <p>
|
||||
+ * This will not make a web request to get the UUID for the given name,
|
||||
+ * thus this method will not block. However this method will return
|
||||
+ * {@code null} if the player is not cached.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @param name the name of the player to retrieve
|
||||
+ * @return an offline player if cached, {@code null} otherwise
|
||||
+ * @see #getOfflinePlayer(String)
|
||||
+ * @see #getOfflinePlayer(java.util.UUID)
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public OfflinePlayer getOfflinePlayerIfCached(@NotNull String name);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the player by the given UUID, regardless if they are offline or
|
||||
* online.
|
49
patches/api-unmapped/Add-getTPS-method.patch
Normal file
49
patches/api-unmapped/Add-getTPS-method.patch
Normal file
|
@ -0,0 +1,49 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 29 Feb 2016 17:24:57 -0600
|
||||
Subject: [PATCH] Add getTPS method
|
||||
|
||||
|
||||
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.getEntity(uuid);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the current server TPS
|
||||
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static double[] getTPS() {
|
||||
+ return server.getTPS();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get the advancement specified by this key.
|
||||
*
|
||||
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
|
||||
@Nullable
|
||||
Entity getEntity(@NotNull UUID uuid);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the current server TPS
|
||||
+ *
|
||||
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public double[] getTPS();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get the advancement specified by this key.
|
||||
*
|
130
patches/api-unmapped/Add-hand-to-bucket-events.patch
Normal file
130
patches/api-unmapped/Add-hand-to-bucket-events.patch
Normal file
|
@ -0,0 +1,130 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 2 Aug 2018 08:44:20 -0500
|
||||
Subject: [PATCH] Add hand to bucket events
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketEmptyEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PlayerBucketEmptyEvent extends PlayerBucketEvent {
|
||||
public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
super(who, block, blockClicked, blockFace, bucket, itemInHand);
|
||||
}
|
||||
+ // Paper start - add EquipmentSlot
|
||||
+ @Deprecated
|
||||
+ public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @org.jetbrains.annotations.Nullable final EquipmentSlot hand) {
|
||||
+ super(who, blockClicked, blockFace, bucket, itemInHand, hand);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerBucketEmptyEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @org.jetbrains.annotations.Nullable final EquipmentSlot hand) {
|
||||
+ super(who, block, blockClicked, blockFace, bucket, itemInHand, hand);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
|
||||
private final Block blockClicked;
|
||||
private final BlockFace blockFace;
|
||||
private final Material bucket;
|
||||
+ private final EquipmentSlot hand; // Paper - add EquipmentSlot
|
||||
|
||||
@Deprecated
|
||||
public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
|
||||
}
|
||||
|
||||
public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand) {
|
||||
+ // Paper start - add EquipmentSlot
|
||||
+ this(who, block, blockClicked, blockFace, bucket, itemInHand, null);
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated
|
||||
+ public PlayerBucketEvent(@NotNull final Player who,@NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @Nullable final EquipmentSlot hand) {
|
||||
+ this(who, null, blockClicked, blockFace, bucket, itemInHand, hand);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerBucketEvent(@NotNull final Player who, @NotNull final Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @Nullable final EquipmentSlot hand) {
|
||||
+ // Paper end
|
||||
super(who);
|
||||
this.block = block;
|
||||
this.blockClicked = blockClicked;
|
||||
this.blockFace = blockFace;
|
||||
this.itemStack = itemInHand;
|
||||
this.bucket = bucket;
|
||||
+ this.hand = hand == null ? player.getInventory().getItemInMainHand().equals(itemInHand) ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND : hand; // Paper - add EquipmentSlot
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerBucketEvent extends PlayerEvent implements Cancellab
|
||||
return blockFace;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * The hand used to perform this action.
|
||||
+ *
|
||||
+ * @return the hand used
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public EquipmentSlot getHand() {
|
||||
+ return hand;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java b/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerBucketFillEvent.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class PlayerBucketFillEvent extends PlayerBucketEvent {
|
||||
super(who, block, blockClicked, blockFace, bucket, itemInHand);
|
||||
}
|
||||
|
||||
+ // Paper start - add EquipmentSlot
|
||||
+ @Deprecated
|
||||
+ public PlayerBucketFillEvent(@NotNull final Player who, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @org.jetbrains.annotations.Nullable final EquipmentSlot hand) {
|
||||
+ super(who, blockClicked, blockFace, bucket, itemInHand, hand);
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - add EquipmentSlot
|
||||
+ public PlayerBucketFillEvent(@NotNull final Player who, @NotNull Block block, @NotNull final Block blockClicked, @NotNull final BlockFace blockFace, @NotNull final Material bucket, @NotNull final ItemStack itemInHand, @org.jetbrains.annotations.Nullable final EquipmentSlot hand) {
|
||||
+ super(who, block, blockClicked, blockFace, bucket, itemInHand, hand);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
|
@ -0,0 +1,290 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Riley Park <rileysebastianpark@gmail.com>
|
||||
Date: Wed, 13 Apr 2016 20:20:18 -0700
|
||||
Subject: [PATCH] Add handshake event to allow plugins to handle client
|
||||
handshaking logic themselves
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import org.apache.commons.lang.Validate;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+
|
||||
+import java.util.UUID;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * This event is fired during a player handshake.
|
||||
+ *
|
||||
+ * <p>If there are no listeners listening to this event, the logic default
|
||||
+ * to your server platform will be ran.</p>
|
||||
+ *
|
||||
+ * <p>WARNING: TAMPERING WITH THIS EVENT CAN BE DANGEROUS</p>
|
||||
+ */
|
||||
+public class PlayerHandshakeEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLERS = new HandlerList();
|
||||
+ @NotNull private final String originalHandshake;
|
||||
+ @NotNull private final String originalSocketAddressHostname;
|
||||
+ private boolean cancelled;
|
||||
+ @Nullable private String serverHostname;
|
||||
+ @Nullable private String socketAddressHostname;
|
||||
+ @Nullable private UUID uniqueId;
|
||||
+ @Nullable private String propertiesJson;
|
||||
+ private boolean failed;
|
||||
+ private Component failMessage = Component.text("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!", NamedTextColor.YELLOW);
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new {@link PlayerHandshakeEvent}.
|
||||
+ *
|
||||
+ * @param originalHandshake the original handshake string
|
||||
+ * @param cancelled if this event is enabled
|
||||
+ *
|
||||
+ * @deprecated in favour of {@link PlayerHandshakeEvent(String, String, boolean)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public PlayerHandshakeEvent(@NotNull String originalHandshake, boolean cancelled) {
|
||||
+ this(originalHandshake, "127.0.0.1", cancelled);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new {@link PlayerHandshakeEvent}.
|
||||
+ *
|
||||
+ * @param originalHandshake the original handshake string
|
||||
+ * @param originalSocketAddressHostname the original socket address hostname
|
||||
+ * @param cancelled if this event is enabled
|
||||
+ */
|
||||
+ public PlayerHandshakeEvent(@NotNull String originalHandshake, @NotNull String originalSocketAddressHostname, boolean cancelled) {
|
||||
+ super(true);
|
||||
+ this.originalHandshake = originalHandshake;
|
||||
+ this.originalSocketAddressHostname = originalSocketAddressHostname;
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if this event is cancelled.
|
||||
+ *
|
||||
+ * <p>When this event is cancelled, custom handshake logic will not
|
||||
+ * be processed.</p>
|
||||
+ *
|
||||
+ * @return {@code true} if this event is cancelled, {@code false} otherwise
|
||||
+ */
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if this event is cancelled.
|
||||
+ *
|
||||
+ * <p>When this event is cancelled, custom handshake logic will not
|
||||
+ * be processed.</p>
|
||||
+ *
|
||||
+ * @param cancelled {@code true} if this event is cancelled, {@code false} otherwise
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the original handshake string.
|
||||
+ *
|
||||
+ * @return the original handshake string
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getOriginalHandshake() {
|
||||
+ return this.originalHandshake;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the original socket address hostname.
|
||||
+ *
|
||||
+ * <p>This does not include the port.</p>
|
||||
+ * <p>In cases where this event is manually fired and the plugin wasn't updated yet, the default is {@code "127.0.0.1"}.</p>
|
||||
+ *
|
||||
+ * @return the original socket address hostname
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public String getOriginalSocketAddressHostname() {
|
||||
+ return this.originalSocketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the server hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @return the server hostname string
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getServerHostname() {
|
||||
+ return this.serverHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the server hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @param serverHostname the server hostname string
|
||||
+ */
|
||||
+ public void setServerHostname(@NotNull String serverHostname) {
|
||||
+ this.serverHostname = serverHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the socket address hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @return the socket address hostname string
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getSocketAddressHostname() {
|
||||
+ return this.socketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the socket address hostname string.
|
||||
+ *
|
||||
+ * <p>This should not include the port.</p>
|
||||
+ *
|
||||
+ * @param socketAddressHostname the socket address hostname string
|
||||
+ */
|
||||
+ public void setSocketAddressHostname(@NotNull String socketAddressHostname) {
|
||||
+ this.socketAddressHostname = socketAddressHostname;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the unique id.
|
||||
+ *
|
||||
+ * @return the unique id
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public UUID getUniqueId() {
|
||||
+ return this.uniqueId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the unique id.
|
||||
+ *
|
||||
+ * @param uniqueId the unique id
|
||||
+ */
|
||||
+ public void setUniqueId(@NotNull UUID uniqueId) {
|
||||
+ this.uniqueId = uniqueId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the profile properties.
|
||||
+ *
|
||||
+ * <p>This should be a valid JSON string.</p>
|
||||
+ *
|
||||
+ * @return the profile properties, as JSON
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public String getPropertiesJson() {
|
||||
+ return this.propertiesJson;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Determines if authentication failed.
|
||||
+ *
|
||||
+ * <p>When {@code true}, the client connecting will be disconnected
|
||||
+ * with the {@link #getFailMessage() fail message}.</p>
|
||||
+ *
|
||||
+ * @return {@code true} if authentication failed, {@code false} otherwise
|
||||
+ */
|
||||
+ public boolean isFailed() {
|
||||
+ return this.failed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if authentication failed and the client should be disconnected.
|
||||
+ *
|
||||
+ * <p>When {@code true}, the client connecting will be disconnected
|
||||
+ * with the {@link #getFailMessage() fail message}.</p>
|
||||
+ *
|
||||
+ * @param failed {@code true} if authentication failed, {@code false} otherwise
|
||||
+ */
|
||||
+ public void setFailed(boolean failed) {
|
||||
+ this.failed = failed;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the profile properties.
|
||||
+ *
|
||||
+ * <p>This should be a valid JSON string.</p>
|
||||
+ *
|
||||
+ * @param propertiesJson the profile properties, as JSON
|
||||
+ */
|
||||
+ public void setPropertiesJson(@NotNull String propertiesJson) {
|
||||
+ this.propertiesJson = propertiesJson;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @return the message to display to the client
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Component failMessage() {
|
||||
+ return this.failMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @param failMessage the message to display to the client
|
||||
+ */
|
||||
+ public void failMessage(@NotNull Component failMessage) {
|
||||
+ this.failMessage = failMessage;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @return the message to display to the client
|
||||
+ * @deprecated use {@link #failMessage()}
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Deprecated
|
||||
+ public String getFailMessage() {
|
||||
+ return Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.failMessage());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the message to display to the client when authentication fails.
|
||||
+ *
|
||||
+ * @param failMessage the message to display to the client
|
||||
+ * @deprecated use {@link #failMessage(Component)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setFailMessage(@NotNull String failMessage) {
|
||||
+ Validate.notEmpty(failMessage, "fail message cannot be null or empty");
|
||||
+ this.failMessage(Bukkit.getUnsafe().legacyComponentSerializer().deserialize(failMessage));
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLERS;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLERS;
|
||||
+ }
|
||||
+}
|
52
patches/api-unmapped/Add-ignore-discounts-API.patch
Normal file
52
patches/api-unmapped/Add-ignore-discounts-API.patch
Normal file
|
@ -0,0 +1,52 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Mon, 9 Nov 2020 20:33:38 +0100
|
||||
Subject: [PATCH] Add ignore discounts API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/MerchantRecipe.java b/src/main/java/org/bukkit/inventory/MerchantRecipe.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/MerchantRecipe.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/MerchantRecipe.java
|
||||
@@ -0,0 +0,0 @@ public class MerchantRecipe implements Recipe {
|
||||
private boolean experienceReward;
|
||||
private int villagerExperience;
|
||||
private float priceMultiplier;
|
||||
+ private boolean ignoreDiscounts; // Paper
|
||||
|
||||
public MerchantRecipe(@NotNull ItemStack result, int maxUses) {
|
||||
this(result, 0, maxUses, false);
|
||||
@@ -0,0 +0,0 @@ public class MerchantRecipe implements Recipe {
|
||||
}
|
||||
|
||||
public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier) {
|
||||
+ // Paper start - add ignoreDiscounts param
|
||||
+ this(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier, false);
|
||||
+ }
|
||||
+ public MerchantRecipe(@NotNull ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier, boolean ignoreDiscounts) {
|
||||
+ this.ignoreDiscounts = ignoreDiscounts;
|
||||
+ // Paper end
|
||||
this.result = result;
|
||||
this.uses = uses;
|
||||
this.maxUses = maxUses;
|
||||
@@ -0,0 +0,0 @@ public class MerchantRecipe implements Recipe {
|
||||
public void setPriceMultiplier(float priceMultiplier) {
|
||||
this.priceMultiplier = priceMultiplier;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * @return Whether all discounts on this trade should be ignored.
|
||||
+ */
|
||||
+ public boolean shouldIgnoreDiscounts() {
|
||||
+ return ignoreDiscounts;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param ignoreDiscounts Whether all discounts on this trade should be ignored.
|
||||
+ */
|
||||
+ public void setIgnoreDiscounts(boolean ignoreDiscounts) {
|
||||
+ this.ignoreDiscounts = ignoreDiscounts;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
283
patches/api-unmapped/Add-item-slot-convenience-methods.patch
Normal file
283
patches/api-unmapped/Add-item-slot-convenience-methods.patch
Normal file
|
@ -0,0 +1,283 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Date: Sat, 25 Apr 2020 23:31:28 +0200
|
||||
Subject: [PATCH] Add item slot convenience methods
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/AnvilInventory.java b/src/main/java/org/bukkit/inventory/AnvilInventory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/AnvilInventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/AnvilInventory.java
|
||||
@@ -0,0 +0,0 @@ public interface AnvilInventory extends Inventory {
|
||||
* @param levels the maximum experience cost
|
||||
*/
|
||||
void setMaximumRepairCost(int levels);
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the item in the left input slot.
|
||||
+ *
|
||||
+ * @return item in the first slot
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getFirstItem() {
|
||||
+ return getItem(0);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the item in the left input slot.
|
||||
+ *
|
||||
+ * @param firstItem item to set
|
||||
+ */
|
||||
+ default void setFirstItem(@Nullable ItemStack firstItem) {
|
||||
+ setItem(0, firstItem);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the item in the right input slot.
|
||||
+ *
|
||||
+ * @return item in the second slot
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getSecondItem() {
|
||||
+ return getItem(1);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the item in the right input slot.
|
||||
+ *
|
||||
+ * @param secondItem item to set
|
||||
+ */
|
||||
+ default void setSecondItem(@Nullable ItemStack secondItem) {
|
||||
+ setItem(1, secondItem);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the item in the result slot.
|
||||
+ *
|
||||
+ * @return item in the result slot
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getResult() {
|
||||
+ return getItem(2);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the item in the result slot.
|
||||
+ * Note that the client might not be able to take out the item if it does not match the input items.
|
||||
+ *
|
||||
+ * @param result item to set
|
||||
+ */
|
||||
+ default void setResult(@Nullable ItemStack result) {
|
||||
+ setItem(2, result);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/GrindstoneInventory.java b/src/main/java/org/bukkit/inventory/GrindstoneInventory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/GrindstoneInventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/GrindstoneInventory.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.inventory;
|
||||
|
||||
+import org.jetbrains.annotations.Nullable; // Paper
|
||||
+
|
||||
/**
|
||||
* Interface to the inventory of a Grindstone.
|
||||
*/
|
||||
-public interface GrindstoneInventory extends Inventory { }
|
||||
+public interface GrindstoneInventory extends Inventory {
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the upper input item.
|
||||
+ *
|
||||
+ * @return upper input item
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getUpperItem() {
|
||||
+ return getItem(0);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the upper input item.
|
||||
+ *
|
||||
+ * @param upperItem item to set
|
||||
+ */
|
||||
+ default void setUpperItem(@Nullable ItemStack upperItem) {
|
||||
+ setItem(0, upperItem);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the lower input item.
|
||||
+ *
|
||||
+ * @return lower input item
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getLowerItem() {
|
||||
+ return getItem(1);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the lower input item.
|
||||
+ *
|
||||
+ * @param lowerItem item to set
|
||||
+ */
|
||||
+ default void setLowerItem(@Nullable ItemStack lowerItem) {
|
||||
+ setItem(1, lowerItem);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the result.
|
||||
+ *
|
||||
+ * @return result
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getResult() {
|
||||
+ return getItem(2);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the result.
|
||||
+ *
|
||||
+ * @param result item to set
|
||||
+ */
|
||||
+ default void setResult(@Nullable ItemStack result) {
|
||||
+ setItem(2, result);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/LecternInventory.java b/src/main/java/org/bukkit/inventory/LecternInventory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/LecternInventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/LecternInventory.java
|
||||
@@ -0,0 +0,0 @@ public interface LecternInventory extends Inventory {
|
||||
@Nullable
|
||||
@Override
|
||||
public Lectern getHolder();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the lectern's held book.
|
||||
+ *
|
||||
+ * @return book set in the lectern
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getBook() {
|
||||
+ return getItem(0);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the lectern's held book.
|
||||
+ *
|
||||
+ * @param book the new book
|
||||
+ */
|
||||
+ default void setBook(@Nullable ItemStack book) {
|
||||
+ setItem(0, book);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/SmithingInventory.java b/src/main/java/org/bukkit/inventory/SmithingInventory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/SmithingInventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/SmithingInventory.java
|
||||
@@ -0,0 +0,0 @@ public interface SmithingInventory extends Inventory {
|
||||
*/
|
||||
@Nullable
|
||||
Recipe getRecipe();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the input equipment (first slot).
|
||||
+ *
|
||||
+ * @return input equipment item
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getInputEquipment() {
|
||||
+ return getItem(0);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the input equipment (first slot).
|
||||
+ *
|
||||
+ * @param itemStack item to set
|
||||
+ */
|
||||
+ default void setInputEquipment(@Nullable ItemStack itemStack) {
|
||||
+ setItem(0, itemStack);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the input mineral (second slot).
|
||||
+ *
|
||||
+ * @return input mineral item
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getInputMineral() {
|
||||
+ return getItem(1);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the input mineral (second slot).
|
||||
+ *
|
||||
+ * @param itemStack item to set
|
||||
+ */
|
||||
+ default void setInputMineral(@Nullable ItemStack itemStack) {
|
||||
+ setItem(1, itemStack);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/StonecutterInventory.java b/src/main/java/org/bukkit/inventory/StonecutterInventory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/StonecutterInventory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/StonecutterInventory.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.inventory;
|
||||
|
||||
+import org.jetbrains.annotations.Nullable; // Paper
|
||||
+
|
||||
/**
|
||||
* Interface to the inventory of a Stonecutter.
|
||||
*/
|
||||
-public interface StonecutterInventory extends Inventory { }
|
||||
+public interface StonecutterInventory extends Inventory {
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the input item.
|
||||
+ *
|
||||
+ * @return input item
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getInputItem() {
|
||||
+ return getItem(0);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the input item.
|
||||
+ *
|
||||
+ * @param itemStack item to set
|
||||
+ */
|
||||
+ default void setInputItem(@Nullable ItemStack itemStack) {
|
||||
+ setItem(0, itemStack);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the result item.
|
||||
+ *
|
||||
+ * @return result
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ default ItemStack getResult() {
|
||||
+ return getItem(1);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the result item.
|
||||
+ *
|
||||
+ * @param itemStack item to set
|
||||
+ */
|
||||
+ default void setResult(@Nullable ItemStack itemStack) {
|
||||
+ setItem(1, itemStack);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+}
|
|
@ -0,0 +1,30 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Minecrell <minecrell@minecrell.net>
|
||||
Date: Wed, 11 Oct 2017 19:30:20 +0200
|
||||
Subject: [PATCH] Add legacy ping support to PaperServerListPingEvent
|
||||
|
||||
Add a new method to StatusClient check if the client is a legacy
|
||||
client that does not support all of the features provided in the
|
||||
event.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/network/StatusClient.java b/src/main/java/com/destroystokyo/paper/network/StatusClient.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/network/StatusClient.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/network/StatusClient.java
|
||||
@@ -0,0 +0,0 @@ import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
|
||||
*/
|
||||
public interface StatusClient extends NetworkClient {
|
||||
|
||||
+ /**
|
||||
+ * Returns whether the client is using an older version that doesn't
|
||||
+ * support all of the features in {@link PaperServerListPingEvent}.
|
||||
+ *
|
||||
+ * <p>For Vanilla, this returns {@code true} for all clients older than 1.7.</p>
|
||||
+ *
|
||||
+ * @return {@code true} if the client is using legacy ping
|
||||
+ */
|
||||
+ default boolean isLegacy() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Date: Sun, 1 Apr 2018 02:28:43 +0300
|
||||
Subject: [PATCH] Add method to open already placed sign
|
||||
|
||||
|
||||
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
|
||||
*/
|
||||
@Deprecated
|
||||
public void setShoulderEntityRight(@Nullable Entity entity);
|
||||
+ // Paper start - Add method to open already placed sign
|
||||
+ /**
|
||||
+ * Opens an editor window for the specified sign
|
||||
+ *
|
||||
+ * @param sign The sign to open
|
||||
+ */
|
||||
+ void openSign(@NotNull org.bukkit.block.Sign sign);
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
* Make the entity drop the item in their hand.
|
|
@ -0,0 +1,30 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: mrapple <tony@oc.tc>
|
||||
Date: Sun, 25 Nov 2012 13:47:27 -0600
|
||||
Subject: [PATCH] Add methods for working with arrows stuck in living entities
|
||||
|
||||
|
||||
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
|
||||
* @return Whether the entity is invisible
|
||||
*/
|
||||
public boolean isInvisible();
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get the number of arrows stuck in this entity
|
||||
+ * @return Number of arrows stuck
|
||||
+ */
|
||||
+ int getArrowsStuck();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the number of arrows stuck in this entity
|
||||
+ *
|
||||
+ * @param arrows Number of arrows to stick in this entity
|
||||
+ */
|
||||
+ void setArrowsStuck(int arrows);
|
||||
+ // Paper end
|
||||
}
|
76
patches/api-unmapped/Add-missing-effects.patch
Normal file
76
patches/api-unmapped/Add-missing-effects.patch
Normal file
|
@ -0,0 +1,76 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Pekov <ivan@mrivanplays.com>
|
||||
Date: Tue, 5 Jan 2021 10:19:11 +0200
|
||||
Subject: [PATCH] Add missing effects
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Effect.java
|
||||
+++ b/src/main/java/org/bukkit/Effect.java
|
||||
@@ -0,0 +0,0 @@ public enum Effect {
|
||||
* The sound of an enderdragon growling
|
||||
*/
|
||||
ENDERDRAGON_GROWL(3001, Type.SOUND),
|
||||
+ // Paper start - add missing effects
|
||||
+ /**
|
||||
+ * The sound of a wither spawning
|
||||
+ */
|
||||
+ WITHER_SPAWNED(1023, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of an ender dragon dying
|
||||
+ */
|
||||
+ ENDER_DRAGON_DEATH(1028, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of an ender portal being created in the overworld
|
||||
+ */
|
||||
+ END_PORTAL_CREATED_IN_OVERWORLD(1038, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of phantom's bites
|
||||
+ */
|
||||
+ PHANTOM_BITES(1039, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of zombie converting to drowned zombie
|
||||
+ */
|
||||
+ ZOMBIE_CONVERTS_TO_DROWNED(1040, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of a husk converting to zombie by drowning
|
||||
+ */
|
||||
+ HUSK_CONVERTS_TO_ZOMBIE(1041, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of a grindstone being used
|
||||
+ */
|
||||
+ GRINDSTONE_USED(1042, Type.SOUND),
|
||||
+ /**
|
||||
+ * The sound of a book page being turned
|
||||
+ */
|
||||
+ BOOK_PAGE_TURNED(1043, Type.SOUND),
|
||||
+ /**
|
||||
+ * Particles displayed when a composter composts
|
||||
+ */
|
||||
+ COMPOSTER_COMPOSTS(1500, Type.VISUAL),
|
||||
+ /**
|
||||
+ * Particles displayed when lava converts a block (either water to stone, or
|
||||
+ * removing existing blocks such as torches)
|
||||
+ */
|
||||
+ LAVA_CONVERTS_BLOCK(1501, Type.VISUAL),
|
||||
+ /**
|
||||
+ * Particles displayd when a redstone torch burns out
|
||||
+ */
|
||||
+ REDSTONE_TORCH_BURNS_OUT(1502, Type.VISUAL),
|
||||
+ /**
|
||||
+ * Particles displayed when an ender eye is placed
|
||||
+ */
|
||||
+ ENDER_EYE_PLACED(1503, Type.VISUAL),
|
||||
+ /**
|
||||
+ * Particles displayed when an ender dragon destroys block
|
||||
+ */
|
||||
+ ENDER_DRAGON_DESTROYS_BLOCK(2008, Type.VISUAL),
|
||||
+ /**
|
||||
+ * Particles displayed when a wet sponge vaporizes in nether.
|
||||
+ */
|
||||
+ WET_SPONGE_VAPORIZES_IN_NETHER(2009, Type.VISUAL)
|
||||
+ // Paper end
|
||||
;
|
||||
|
||||
private final int id;
|
65
patches/api-unmapped/Add-moon-phase-API.patch
Normal file
65
patches/api-unmapped/Add-moon-phase-API.patch
Normal file
|
@ -0,0 +1,65 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 23 Aug 2020 16:32:03 +0200
|
||||
Subject: [PATCH] Add moon phase API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/MoonPhase.java b/src/main/java/io/papermc/paper/world/MoonPhase.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/world/MoonPhase.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.world;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public enum MoonPhase {
|
||||
+ FULL_MOON(0L),
|
||||
+ WANING_GIBBOUS(1L),
|
||||
+ LAST_QUARTER(2L),
|
||||
+ WANING_CRESCENT(3L),
|
||||
+ NEW_MOON(4L),
|
||||
+ WAXING_CRESCENT(5L),
|
||||
+ FIRST_QUARTER(6L),
|
||||
+ WAXING_GIBBOUS(7L);
|
||||
+
|
||||
+ private final long day;
|
||||
+
|
||||
+ MoonPhase(long day) {
|
||||
+ this.day = day;
|
||||
+ }
|
||||
+
|
||||
+ private static final Map<Long, MoonPhase> BY_DAY = new HashMap<>();
|
||||
+
|
||||
+ static {
|
||||
+ for (MoonPhase phase : values()) {
|
||||
+ BY_DAY.put(phase.day, phase);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static MoonPhase getPhase(long day) {
|
||||
+ return BY_DAY.get(day % 8L);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
|
||||
* @return The amount of Players in this world
|
||||
*/
|
||||
int getPlayerCount();
|
||||
+
|
||||
+ /**
|
||||
+ * @return the current moon phase at the current time in the world
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ io.papermc.paper.world.MoonPhase getMoonPhase();
|
||||
// Paper end
|
||||
|
||||
/**
|
30
patches/api-unmapped/Add-more-Evoker-API.patch
Normal file
30
patches/api-unmapped/Add-more-Evoker-API.patch
Normal file
|
@ -0,0 +1,30 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 23 Aug 2020 15:22:44 +0200
|
||||
Subject: [PATCH] Add more Evoker API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Evoker.java b/src/main/java/org/bukkit/entity/Evoker.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Evoker.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Evoker.java
|
||||
@@ -0,0 +0,0 @@ public interface Evoker extends Spellcaster {
|
||||
*/
|
||||
@Deprecated
|
||||
void setCurrentSpell(@Nullable Spell spell);
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * @return the sheep being targeted by the {@link Spell#WOLOLO wololo spell}, or {@code null} if none
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ Sheep getWololoTarget();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the sheep to be the target of the {@link Spell#WOLOLO wololo spell}, or {@code null} to clear.
|
||||
+ *
|
||||
+ * @param sheep new wololo target
|
||||
+ */
|
||||
+ void setWololoTarget(@Nullable Sheep sheep);
|
||||
+ // Paper end
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue