From f1dd65ed73b7cca00527ff81d02ce4d27c456a37 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 13 Jun 2023 07:00:00 +1000 Subject: [PATCH 1/5] Update to Minecraft 1.20.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 01b2f2ec..a04d2c57 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.bukkit bukkit - 1.20-R0.1-SNAPSHOT + 1.20.1-R0.1-SNAPSHOT jar Bukkit From beced2b248b54fe9657c5a73f9a0d2493baa96f7 Mon Sep 17 00:00:00 2001 From: Yannick Lamprecht Date: Wed, 14 Jun 2023 18:36:08 +1000 Subject: [PATCH 2/5] #867: Add Player#sendBlockUpdate to send tile entity updates --- .../java/org/bukkit/block/data/BlockData.java | 12 +++++++++++ src/main/java/org/bukkit/entity/Player.java | 21 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java index 96dbcc34..2e223295 100644 --- a/src/main/java/org/bukkit/block/data/BlockData.java +++ b/src/main/java/org/bukkit/block/data/BlockData.java @@ -6,11 +6,13 @@ import org.bukkit.Server; import org.bukkit.SoundGroup; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.BlockState; import org.bukkit.block.BlockSupport; import org.bukkit.block.PistonMoveReaction; import org.bukkit.block.structure.Mirror; import org.bukkit.block.structure.StructureRotation; import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -235,4 +237,14 @@ public interface BlockData extends Cloneable { * @param mirror the mirror */ void mirror(@NotNull Mirror mirror); + + /** + * Creates a new default {@link BlockState} for this type of Block, not + * bound to a location. + * + * @return a new {@link BlockState} + */ + @NotNull + @ApiStatus.Experimental + BlockState createBlockState(); } diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index 3c8e37b3..39cca34d 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -22,6 +22,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; @@ -688,6 +689,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.Material, byte)}. + *

+ * 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. From dfd86ee728ae4094198643663918a92b24a95786 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 14 Jun 2023 18:36:11 +1000 Subject: [PATCH 3/5] Improve sendSignChange and related documentation --- src/main/java/org/bukkit/entity/Player.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index 39cca34d..6536a542 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -638,10 +638,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * a certain location. This will not actually change the world in any way. * This method will use a sign at the location's block or a faked sign * sent via - * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}. + * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.block.data.BlockData)}. *

* 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 @@ -655,10 +658,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * a certain location. This will not actually change the world in any way. * This method will use a sign at the location's block or a faked sign * sent via - * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}. + * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.block.data.BlockData)}. *

* 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 @@ -674,10 +680,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * a certain location. This will not actually change the world in any way. * This method will use a sign at the location's block or a faked sign * sent via - * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}. + * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.block.data.BlockData)}. *

* 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 @@ -694,7 +703,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * 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.Material, byte)}. + * {@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. From fdff0cd477bff16874060e6ebb82671955c04e78 Mon Sep 17 00:00:00 2001 From: Collin Date: Wed, 14 Jun 2023 18:36:11 +1000 Subject: [PATCH 4/5] #869: Add Enderman#teleport and Enderman#teleportTowards --- src/main/java/org/bukkit/entity/Enderman.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java index bb325d9c..0a03dc43 100644 --- a/src/main/java/org/bukkit/entity/Enderman.java +++ b/src/main/java/org/bukkit/entity/Enderman.java @@ -2,6 +2,7 @@ package org.bukkit.entity; import org.bukkit.block.data.BlockData; import org.bukkit.material.MaterialData; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -39,4 +40,38 @@ public interface Enderman extends Monster { * @param blockData data to set the carried block to, or null to remove */ public void setCarriedBlock(@Nullable BlockData blockData); + + /** + * Randomly teleports the Enderman in a 64x64x64 block 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. + * + * @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); } From be1f33449ea205e494a7bcf2e9322319c6166204 Mon Sep 17 00:00:00 2001 From: TheRealRyGuy Date: Thu, 15 Jun 2023 20:27:43 +1000 Subject: [PATCH 5/5] SPIGOT-7326: Add ClickType#isMouseClick() --- .../java/org/bukkit/event/inventory/ClickType.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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); } /**