From e893684dece752c6378611e7985c3a34e42cf79e Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 20 Aug 2022 14:54:40 +0200 Subject: [PATCH] Prevents consumption of dye when clicking plugin signs --- README.md | 12 ++++++------ .../listener/SignEventListener.java | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1692a20..ec3075a 100644 --- a/README.md +++ b/README.md @@ -48,15 +48,15 @@ An in-game description of available commands is available through the /bwb comma - encryptbook \ \[encryption style] - Encrypts the book the player is holding. "key" is required and can be any phrase or number excluding spaces. "style" is not required. Possible values are "DNA" or "" - /formatbook - Formats the held written book (converts color and formatting codes to the corresponding formatted text) -- /givebook \ \ \[# of copies (num)] \[signed (true/false)] - Gives the selected player a - book from your personal directory -- /givepublicbook \ \ \[# of copies (num)] \[signed (true/false)] - Same as givebook, but - uses books from the public directory +- /givebook \ \ \[# of copies (num)] \[signed (true/false)] - Gives the selected player + a book from your personal directory +- /givepublicbook \ \ \[# of copies (num)] \[signed (true/false)] - Same as givebook, + but uses books from the public directory - /loadbook \ \[# of copies] \[signed (true/false)] - Creates a book from the specified file and gives it to the player. If no file is specified, a list of available files is returned. If true is specified, the book will be signed, if false it will be unsigned -- /loadpublicbook \ \[# of copies] \[signed (true/false)] - Same as loadbook, but views files in the - public directory +- /loadpublicbook \ \[# of copies] \[signed (true/false)] - Same as loadbook, but views files in + the public directory - /reload - Reloads BwB's configuration file - /savebook \[overwrite (true/false)] - Saves the book the player is holding to a text file in a private directory. If true is specified, a book of the same name by the same author will be overwritten by the new book diff --git a/src/main/java/net/knarcraft/bookswithoutborders/listener/SignEventListener.java b/src/main/java/net/knarcraft/bookswithoutborders/listener/SignEventListener.java index 709325e..3bbecdf 100644 --- a/src/main/java/net/knarcraft/bookswithoutborders/listener/SignEventListener.java +++ b/src/main/java/net/knarcraft/bookswithoutborders/listener/SignEventListener.java @@ -12,6 +12,7 @@ import org.bukkit.Material; import org.bukkit.Tag; import org.bukkit.block.Sign; import org.bukkit.entity.Player; +import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; @@ -96,6 +97,7 @@ public class SignEventListener implements Listener { if (event.getAction() == Action.RIGHT_CLICK_BLOCK && (Tag.SIGNS.isTagged(clickedBlockType) || Tag.WALL_SIGNS.isTagged(clickedBlockType))) { + event.setUseItemInHand(Event.Result.DENY); //The player right-clicked a sign Sign sign = (Sign) event.getClickedBlock().getState(); if (signLineEquals(sign, 0, "[BwB]", ChatColor.DARK_GREEN)) {