From 718ee0265dcdf14dfc1196b16f912d6ae5a36c68 Mon Sep 17 00:00:00 2001 From: RobotoRaccoon Date: Fri, 16 Jan 2015 12:11:53 +1100 Subject: [PATCH] Added a blockAnnouncer * Configurable time to announce when the remaining hiders have their block types announced to everyone in the arena. --- src/nl/Steffion/BlockHunt/BlockHunt.java | 16 ++++++++++++++++ src/nl/Steffion/BlockHunt/ConfigC.java | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/nl/Steffion/BlockHunt/BlockHunt.java b/src/nl/Steffion/BlockHunt/BlockHunt.java index 8d27f22..e9bf05b 100644 --- a/src/nl/Steffion/BlockHunt/BlockHunt.java +++ b/src/nl/Steffion/BlockHunt/BlockHunt.java @@ -329,6 +329,22 @@ public class BlockHunt extends JavaPlugin implements Listener { } } } + + // blockAnnouncer code. + if (arena.timer == (Integer)W.config.get(ConfigC.blockAnnouncer_timer) && (Boolean)W.config.get(ConfigC.blockAnnouncer_enabled)) { + ArrayList remainingBlocks = new ArrayList(); + for (Player arenaPlayer : arena.playersInArena) { + if (!arena.seekers.contains(arenaPlayer)) { + String block = arenaPlayer.getInventory().getItem(8).getType().name(); + block = block.substring(0, 1).toUpperCase() + block.substring(1).toLowerCase(); //Make lowercase and capitalise first letter. + if (!remainingBlocks.contains(block)) { //Don't print double up block names. + remainingBlocks.add(block); + } + } + } + ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameBlocksLeft, "1-" + remainingBlocks.toString()); + } + if (arena.timer == 190) { ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-190"); } else if (arena.timer == 60) { diff --git a/src/nl/Steffion/BlockHunt/ConfigC.java b/src/nl/Steffion/BlockHunt/ConfigC.java index 04a2cfc..aedd825 100644 --- a/src/nl/Steffion/BlockHunt/ConfigC.java +++ b/src/nl/Steffion/BlockHunt/ConfigC.java @@ -50,6 +50,8 @@ public enum ConfigC { requireInventoryClearOnJoin(false, W.config), + blockAnnouncer_enabled(true, W.config), blockAnnouncer_timer(20, W.config), + log_enabledPlugin("%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%autors%%N.", W.messages), log_disabledPlugin( "%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%autors%%N.", W.messages), @@ -79,7 +81,7 @@ public enum ConfigC { "%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% your tokens.", W.messages), normal_ingameNowSolid( "%TAG%NYou're now a solid '%A%block%%N' block!", W.messages), normal_ingameNoMoreSolid("%TAG%NYou're no longer a solid block!", W.messages), normal_shopBoughtItem( "%TAG%NYou've bought the '%A%itemname%%N' item!", W.messages), normal_shopChoosenBlock("%TAG%NYou've choosen to be a(n) '%A%block%%N' block!", W.messages), normal_shopChoosenSeeker( - "%TAG%NYou've choosen to be a %Aseeker%N!", W.messages), normal_shopChoosenHiders("%TAG%NYou've choosen to be a %Ahider%N!", W.messages), + "%TAG%NYou've choosen to be a %Aseeker%N!", W.messages), normal_shopChoosenHiders("%TAG%NYou've choosen to be a %Ahider%N!", W.messages), normal_ingameBlocksLeft("%TAG%NRemaining blocks: %A%1%%N", W.messages), warning_lobbyNeedAtleast("%TAG%WYou need atleast %A%1%%W player(s) to start the game!", W.messages), warning_ingameNEWSeekerChoosen( "%TAG%WThe last seeker left and a new seeker has been choosen!", W.messages), warning_unableToCommand(