From 7cc965ecb4af30fb573bf48736d62015a4ddfa5c Mon Sep 17 00:00:00 2001 From: mfnalex Date: Sun, 12 Aug 2018 17:07:28 +0200 Subject: [PATCH] new config option: show-message-when-using-chest-and-sorting-is-enabled --- config.yml | 15 +++++++++++++-- plugin.yml | 2 +- .../JeffChestSort/JeffChestSortListener.java | 7 +++++++ .../JeffChestSort/JeffChestSortMessages.java | 4 +++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/config.yml b/config.yml index 5e31923..95a03bf 100644 --- a/config.yml +++ b/config.yml @@ -6,12 +6,21 @@ # once to enable automatic chest sorting. sorting-enabled-by-default: false -# when set to true, players with sorting disabled will be +# when set to true, players with sorting DISABLED will be # shown a message on how to enable automatic chest sorting # when they use a chest for the first time. +# consider setting this to true when you disable sorting by default. +# see also -> message-when-using-chest show-message-when-using-chest: true -# when set to true, the message is shown again when a player +# when set to true, players with sorting ENABLED will be +# shown a message on how to disable automatic chest sorting +# when they use a chest for the first time. +# consider setting this to true when you enable sorting by default. +# see also -> message-when-using-chest2 +show-message-when-using-chest-and-sorting-is-enabled: false + +# when set to true, the messages are shown again when a player # logs out and back in and then uses a chest again. show-message-again-after-logout: true @@ -22,12 +31,14 @@ show-message-again-after-logout: true ##### English message-when-using-chest: "&7Hint: Type &6/chestsort&7 to enable automatic chest sorting." +message-when-using-chest2: "&7Hint: Type &6/chestsort&7 to disable automatic chest sorting." message-sorting-disabled: "&7Automatic chest sorting has been &cdisabled&7.&r" message-sorting-enabled: "&7Automatic chest sorting has been &aenabled&7.&r" message-error-players-only: "&cError: This command can only be run by players.&r" ##### German #message-when-using-chest: "&7Hinweis: Benutze &6/chestsort&7 um die automatische Kistensortierung zu aktivieren." +#message-when-using-chest2: "&7Hinweis: Benutze &6/chestsort&7 um die automatische Kistensortierung zu deaktivieren." #message-sorting-disabled: "&7Automatische Kistensortierung &cdeaktiviert&7.&r" #message-sorting-enabled: "&7Automatische Kistensortierung &aaktiviert&7.&r" #message-error-players-only: "&cFehler: Dieser Befehl ist nur für Spieler verfügbar.&r" \ No newline at end of file diff --git a/plugin.yml b/plugin.yml index 8498968..63a5e2d 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ main: de.jeffclan.JeffChestSort.JeffChestSortPlugin name: ChestSort -version: 1.3.2 +version: 1.3.3 api-version: 1.13 description: Allows automatic chest sorting author: mfnalex diff --git a/src/de/jeffclan/JeffChestSort/JeffChestSortListener.java b/src/de/jeffclan/JeffChestSort/JeffChestSortListener.java index a740ea1..c815ee7 100644 --- a/src/de/jeffclan/JeffChestSort/JeffChestSortListener.java +++ b/src/de/jeffclan/JeffChestSort/JeffChestSortListener.java @@ -98,6 +98,13 @@ public class JeffChestSortListener implements Listener { } } return; + } else { + if (!setting.hasSeenMessage) { + setting.hasSeenMessage = true; + if (plugin.getConfig().getBoolean("show-message-when-using-chest-and-sorting-is-enabled")) { + p.sendMessage(plugin.msg.MSG_COMMANDMESSAGE2); + } + } } Inventory inv = event.getInventory(); diff --git a/src/de/jeffclan/JeffChestSort/JeffChestSortMessages.java b/src/de/jeffclan/JeffChestSort/JeffChestSortMessages.java index 042a883..b1b1429 100644 --- a/src/de/jeffclan/JeffChestSort/JeffChestSortMessages.java +++ b/src/de/jeffclan/JeffChestSort/JeffChestSortMessages.java @@ -6,7 +6,7 @@ public class JeffChestSortMessages { JeffChestSortPlugin plugin; - final String MSG_ACTIVATED, MSG_DEACTIVATED, MSG_COMMANDMESSAGE, MSG_PLAYERSONLY; + final String MSG_ACTIVATED, MSG_DEACTIVATED, MSG_COMMANDMESSAGE, MSG_COMMANDMESSAGE2, MSG_PLAYERSONLY; JeffChestSortMessages(JeffChestSortPlugin plugin) { this.plugin = plugin; @@ -17,6 +17,8 @@ public class JeffChestSortMessages { plugin.getConfig().getString("message-sorting-disabled")); MSG_COMMANDMESSAGE = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("message-when-using-chest")); + MSG_COMMANDMESSAGE2 = ChatColor.translateAlternateColorCodes('&', + plugin.getConfig().getString("message-when-using-chest2")); MSG_PLAYERSONLY = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("message-error-players-only")); }