From c3d4585b74d9a73eaa4464921d9a3931ab72ecca Mon Sep 17 00:00:00 2001 From: Steffion Date: Sun, 22 Sep 2013 16:17:31 +0200 Subject: [PATCH] + Added ability to change the scoreboard's title and shops's title. Also able to disable the scoreboard. --- src/nl/Steffion/BlockHunt/ConfigC.java | 4 ++-- src/nl/Steffion/BlockHunt/InventoryHandler.java | 7 +++++-- .../BlockHunt/Listeners/OnInventoryClickEvent.java | 4 +++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/nl/Steffion/BlockHunt/ConfigC.java b/src/nl/Steffion/BlockHunt/ConfigC.java index ca9f84a..9f1104e 100644 --- a/src/nl/Steffion/BlockHunt/ConfigC.java +++ b/src/nl/Steffion/BlockHunt/ConfigC.java @@ -50,6 +50,7 @@ public enum ConfigC { "%NUse the create command to define your arena.", "%A/" + BlockHunt.pdfFile.getName() + " " }, W.config), + shop_title ("%H&lBlockHunt %NShop", W.config), shop_price ("%NPrice: %A%amount% %Ntokens.", W.config), shop_blockChooserEnabled (true, W.config), shop_blockChooserID (340, W.config), @@ -59,7 +60,6 @@ public enum ConfigC { "%NUse this item before the arena starts.", "%ARight-Click%N in the lobby and choose", "%Nthe block you want to be!", "&6Unlimited uses." }, W.config), - shop_BlockHuntPassEnabled (true, W.config), shop_BlockHuntPassID (421, W.config), shop_BlockHuntPassPrice (150, W.config), @@ -83,7 +83,7 @@ public enum ConfigC { "%EIngame: %A%timeleft%" }, W.config), scoreboard_enabled (true, W.config), - scoreboard_title ("[" + BlockHunt.pdfFile.getName() + "]", W.config), + scoreboard_title ("%H[" + BlockHunt.pdfFile.getName() + "]", W.config), scoreboard_timeleft ("%ATime left:", W.config), scoreboard_seekers ("%NSeekers:", W.config), scoreboard_hiders ("%NHiders:", W.config), diff --git a/src/nl/Steffion/BlockHunt/InventoryHandler.java b/src/nl/Steffion/BlockHunt/InventoryHandler.java index 754198b..e619e8b 100644 --- a/src/nl/Steffion/BlockHunt/InventoryHandler.java +++ b/src/nl/Steffion/BlockHunt/InventoryHandler.java @@ -246,8 +246,11 @@ public class InventoryHandler { } public static void openShop(Player player) { - Inventory shop = Bukkit.createInventory(null, 9, - MessageM.replaceAll("\u00A7r%H&lBlockHunt %NShop")); + Inventory shop = Bukkit.createInventory( + null, + 9, + MessageM.replaceAll("\u00A7r" + + W.config.get(ConfigC.shop_title))); if (W.shop.getFile().get(player.getName() + ".tokens") == null) { W.shop.getFile().set(player.getName() + ".tokens", 0); W.shop.save(); diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnInventoryClickEvent.java b/src/nl/Steffion/BlockHunt/Listeners/OnInventoryClickEvent.java index 440ade7..1c27e55 100644 --- a/src/nl/Steffion/BlockHunt/Listeners/OnInventoryClickEvent.java +++ b/src/nl/Steffion/BlockHunt/Listeners/OnInventoryClickEvent.java @@ -46,7 +46,9 @@ public class OnInventoryClickEvent implements Listener { return; } else if (inv.getName().startsWith("\u00A7r")) { - if (inv.getName().contains("Shop")) { + if (inv.getName().equals( + MessageM.replaceAll((String) "\u00A7r" + + W.config.get(ConfigC.shop_title)))) { event.setCancelled(true); ItemStack item = event.getCurrentItem(); if (W.shop.getFile().get(player.getName() + ".tokens") == null) {