diff --git a/pom.xml b/pom.xml
index b5f18c1d..fb67ad69 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
+ * If the randomly selected point is in the ground, the point is moved 1 block + * down until air is found or until it goes under + * {@link org.bukkit.World#getMinHeight()}. + *
+ * This method will return false if this Enderman is not alive, or if the
+ * teleport location was obstructed, or if the teleport location is in water.
+ *
+ * @return true if the teleport succeeded.
+ */
+ @ApiStatus.Experimental
+ public boolean teleport();
+
+ /**
+ * Randomly teleports the Enderman towards the given entity
.
+ *
+ * The point is selected by drawing a vector between this enderman and the
+ * given entity
. That vector's length is set to 16 blocks.
+ * That point is then moved within a 8x8x8 cuboid region. If the randomly
+ * selected point is in the ground, the point is moved 1 block down until
+ * air is found or until it goes under
+ * {@link org.bukkit.World#getMinHeight()}.
+ *
+ * This method will return false if this Enderman is not alive, or if the + * teleport location was obstructed, or if the teleport location is in water. + * + * @param entity The entity to teleport towards. + * @return true if the teleport succeeded. + */ + @ApiStatus.Experimental + public boolean teleportTowards(@NotNull Entity entity); } diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index f5e3f43e..5a5ac318 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -21,6 +21,7 @@ import org.bukkit.advancement.AdvancementProgress; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.Sign; +import org.bukkit.block.TileState; import org.bukkit.block.data.BlockData; import org.bukkit.block.sign.Side; import org.bukkit.conversations.Conversable; @@ -629,6 +630,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM *
* If the client does not have a sign at the given location it will * display an error message to the user. + *
+ * To change all attributes of a sign, including the back Side, use + * {@link #sendBlockUpdate(org.bukkit.Location, org.bukkit.block.TileState)}. * * @param loc the location of the sign * @param lines the new text on the sign or null to clear it @@ -646,6 +650,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM *
* If the client does not have a sign at the given location it will * display an error message to the user. + *
+ * To change all attributes of a sign, including the back Side, use + * {@link #sendBlockUpdate(org.bukkit.Location, org.bukkit.block.TileState)}. * * @param loc the location of the sign * @param lines the new text on the sign or null to clear it @@ -665,6 +672,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM *
* If the client does not have a sign at the given location it will * display an error message to the user. + *
+ * To change all attributes of a sign, including the back Side, use + * {@link #sendBlockUpdate(org.bukkit.Location, org.bukkit.block.TileState)}. * * @param loc the location of the sign * @param lines the new text on the sign or null to clear it @@ -676,6 +686,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException; + /** + * Send a TileState change. This fakes a TileState change for a user at + * the given location. This will not actually change the world in any way. + * This method will use a TileState at the location's block or a faked TileState + * sent via + * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.block.data.BlockData)}. + *
+ * If the client does not have an appropriate tile at the given location it + * may display an error message to the user. + *
+ * {@link BlockData#createBlockState()} can be used to create a {@link BlockState}. + * + * @param loc the location of the sign + * @param tileState the tile state + * @throws IllegalArgumentException if location is null + * @throws IllegalArgumentException if tileState is null + */ + @ApiStatus.Experimental + public void sendBlockUpdate(@NotNull Location loc, @NotNull TileState tileState) throws IllegalArgumentException; + /** * Render a map and send it to the player in its entirety. This may be * used when streaming the map in the normal manner is not desirable. diff --git a/src/main/java/org/bukkit/event/inventory/ClickType.java b/src/main/java/org/bukkit/event/inventory/ClickType.java index 1b0b47df..fa96e8c2 100644 --- a/src/main/java/org/bukkit/event/inventory/ClickType.java +++ b/src/main/java/org/bukkit/event/inventory/ClickType.java @@ -75,7 +75,17 @@ public enum ClickType { * @return true if this ClickType represents the pressing of a key */ public boolean isKeyboardClick() { - return (this == ClickType.NUMBER_KEY) || (this == ClickType.DROP) || (this == ClickType.CONTROL_DROP); + return (this == ClickType.NUMBER_KEY) || (this == ClickType.DROP) || (this == ClickType.CONTROL_DROP) || (this == ClickType.SWAP_OFFHAND); + } + + /** + * Gets whether this ClickType represents the pressing of a mouse button + * + * @return true if this ClickType represents the pressing of a mouse button + */ + public boolean isMouseClick() { + return (this == ClickType.DOUBLE_CLICK) || (this == ClickType.LEFT) || (this == ClickType.RIGHT) || (this == ClickType.MIDDLE) + || (this == ClickType.WINDOW_BORDER_LEFT) || (this == ClickType.SHIFT_LEFT) || (this == ClickType.SHIFT_RIGHT) || (this == ClickType.WINDOW_BORDER_RIGHT); } /**