Merge branch 'RobotoRaccoon-feature' + Made additional changes/improvements

This commit is contained in:
addstar 2015-01-25 00:42:53 +11:00
commit fc4072e780
5 changed files with 46 additions and 5 deletions

View File

@ -27,6 +27,7 @@ public class Arena implements ConfigurationSerializable {
public int waitingTimeSeeker; public int waitingTimeSeeker;
public int gameTime; public int gameTime;
public int timeUntilHidersSword; public int timeUntilHidersSword;
public int blockAnnouncerTime;
public ArrayList<ItemStack> disguiseBlocks; public ArrayList<ItemStack> disguiseBlocks;
public LocationSerializable lobbyWarp; public LocationSerializable lobbyWarp;
public LocationSerializable hidersWarp; public LocationSerializable hidersWarp;
@ -46,7 +47,7 @@ public class Arena implements ConfigurationSerializable {
public Scoreboard scoreboard; public Scoreboard scoreboard;
public Arena(String arenaName, LocationSerializable pos1, LocationSerializable pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart, public Arena(String arenaName, LocationSerializable pos1, LocationSerializable pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart,
int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, ArrayList<ItemStack> disguiseBlocks, int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime, ArrayList<ItemStack> disguiseBlocks,
LocationSerializable lobbyWarp, LocationSerializable hidersWarp, LocationSerializable seekersWarp, LocationSerializable spawnWarp, LocationSerializable lobbyWarp, LocationSerializable hidersWarp, LocationSerializable seekersWarp, LocationSerializable spawnWarp,
List<String> seekersWinCommands, List<String> hidersWinCommands, List<String> allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens, List<String> seekersWinCommands, List<String> hidersWinCommands, List<String> allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens,
List<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers, Scoreboard scoreboard) { List<Player> playersInArena, ArenaState gameState, int timer, List<Player> seekers, Scoreboard scoreboard) {
@ -60,6 +61,7 @@ public class Arena implements ConfigurationSerializable {
this.waitingTimeSeeker = waitingTimeSeeker; this.waitingTimeSeeker = waitingTimeSeeker;
this.gameTime = gameTime; this.gameTime = gameTime;
this.timeUntilHidersSword = timeUntilHidersSword; this.timeUntilHidersSword = timeUntilHidersSword;
this.blockAnnouncerTime = blockAnnouncerTime;
this.disguiseBlocks = disguiseBlocks; this.disguiseBlocks = disguiseBlocks;
this.lobbyWarp = lobbyWarp; this.lobbyWarp = lobbyWarp;
this.hidersWarp = hidersWarp; this.hidersWarp = hidersWarp;
@ -89,7 +91,8 @@ public class Arena implements ConfigurationSerializable {
timeUntilHidersSword, timeUntilHidersSword,
hidersTokenWin, hidersTokenWin,
seekersTokenWin, seekersTokenWin,
killTokens; killTokens,
blockAnnouncerTime;
} }
public enum ArenaState { public enum ArenaState {
@ -111,6 +114,7 @@ public class Arena implements ConfigurationSerializable {
map.put("amountSeekersOnStart", amountSeekersOnStart); map.put("amountSeekersOnStart", amountSeekersOnStart);
map.put("timeInLobbyUntilStart", timeInLobbyUntilStart); map.put("timeInLobbyUntilStart", timeInLobbyUntilStart);
map.put("waitingTimeSeeker", waitingTimeSeeker); map.put("waitingTimeSeeker", waitingTimeSeeker);
map.put("blockAnnouncerTime", blockAnnouncerTime);
map.put("gameTime", gameTime); map.put("gameTime", gameTime);
map.put("timeUntilHidersSword", timeUntilHidersSword); map.put("timeUntilHidersSword", timeUntilHidersSword);
map.put("disguiseBlocks", disguiseBlocks); map.put("disguiseBlocks", disguiseBlocks);
@ -133,7 +137,7 @@ public class Arena implements ConfigurationSerializable {
return new Arena((String) M.g(map, "arenaName", "UNKNOWN_NAME"), (LocationSerializable) M.g(map, "pos1", loc), (LocationSerializable) M.g(map, "pos2", loc), return new Arena((String) M.g(map, "arenaName", "UNKNOWN_NAME"), (LocationSerializable) M.g(map, "pos1", loc), (LocationSerializable) M.g(map, "pos2", loc),
(Integer) M.g(map, "maxPlayers", 12), (Integer) M.g(map, "minPlayers", 3), (Integer) M.g(map, "amountSeekersOnStart", 1), (Integer) M.g(map, (Integer) M.g(map, "maxPlayers", 12), (Integer) M.g(map, "minPlayers", 3), (Integer) M.g(map, "amountSeekersOnStart", 1), (Integer) M.g(map,
"timeInLobbyUntilStart", 90), (Integer) M.g(map, "waitingTimeSeeker", 20), (Integer) M.g(map, "gameTime", 200), (Integer) M.g(map, "timeInLobbyUntilStart", 90), (Integer) M.g(map, "waitingTimeSeeker", 20), (Integer) M.g(map, "gameTime", 200), (Integer) M.g(map,
"timeUntilHidersSword", 30), (ArrayList<ItemStack>) M.g(map, "disguiseBlocks", new ArrayList<ItemStack>()), (LocationSerializable) M.g(map, "timeUntilHidersSword", 30), (Integer) M.g(map, "blockAnnouncerTime", 45), (ArrayList<ItemStack>) M.g(map, "disguiseBlocks", new ArrayList<ItemStack>()), (LocationSerializable) M.g(map,
"lobbyWarp", loc), (LocationSerializable) M.g(map, "hidersWarp", loc), (LocationSerializable) M.g(map, "seekersWarp", loc), "lobbyWarp", loc), (LocationSerializable) M.g(map, "hidersWarp", loc), (LocationSerializable) M.g(map, "seekersWarp", loc),
(LocationSerializable) M.g(map, "spawnWarp", loc), (ArrayList<String>) M.g(map, "seekersWinCommands", new ArrayList<String>()), (ArrayList<String>) M.g( (LocationSerializable) M.g(map, "spawnWarp", loc), (ArrayList<String>) M.g(map, "seekersWinCommands", new ArrayList<String>()), (ArrayList<String>) M.g(
map, "hidersWinCommands", new ArrayList<String>()), (ArrayList<String>) M.g(map, "allowedCommands", new ArrayList<String>()), (Integer) M.g(map, map, "hidersWinCommands", new ArrayList<String>()), (ArrayList<String>) M.g(map, "allowedCommands", new ArrayList<String>()), (Integer) M.g(map,

View File

@ -41,6 +41,8 @@ import nl.Steffion.BlockHunt.Managers.MessageM;
import nl.Steffion.BlockHunt.Managers.PermissionsM; import nl.Steffion.BlockHunt.Managers.PermissionsM;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable; import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
@ -329,6 +331,23 @@ public class BlockHunt extends JavaPlugin implements Listener {
} }
} }
} }
// blockAnnouncer code.
if ((arena.blockAnnouncerTime > 0) && (arena.timer == arena.blockAnnouncerTime)) {
ArrayList<String> remainingBlocks = new ArrayList<String>();
for (Player arenaPlayer : arena.playersInArena) {
if (!arena.seekers.contains(arenaPlayer)) {
String block = arenaPlayer.getInventory().getItem(8).getType().name();
block = WordUtils.capitalizeFully(block.replace("_", " "));
if (!remainingBlocks.contains(block)) { //Don't print double up block names.
remainingBlocks.add(block);
}
}
}
String blocklist = StringUtils.join(remainingBlocks, ", ");
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameBlocksLeft, "1-" + blocklist);
}
if (arena.timer == 190) { if (arena.timer == 190) {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-190"); ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameArenaEnd, "1-190");
} else if (arena.timer == 60) { } else if (arena.timer == 60) {

View File

@ -79,7 +79,7 @@ public enum ConfigC {
"%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% your tokens.", W.messages), normal_ingameNowSolid( "%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'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 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( 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( "%TAG%WThe last seeker left and a new seeker has been choosen!", W.messages), warning_unableToCommand(

View File

@ -69,7 +69,11 @@ public class InventoryHandler {
ItemMeta disguiseBlocks_NOTE_IM = disguiseBlocks_NOTE.getItemMeta(); ItemMeta disguiseBlocks_NOTE_IM = disguiseBlocks_NOTE.getItemMeta();
disguiseBlocks_NOTE_IM.setDisplayName(MessageM.replaceAll("%NSet the %AdisguiseBlocks%N.")); disguiseBlocks_NOTE_IM.setDisplayName(MessageM.replaceAll("%NSet the %AdisguiseBlocks%N."));
disguiseBlocks_NOTE.setItemMeta(disguiseBlocks_NOTE_IM); disguiseBlocks_NOTE.setItemMeta(disguiseBlocks_NOTE_IM);
panel.setItem(37, disguiseBlocks_NOTE); panel.setItem(36, disguiseBlocks_NOTE);
ItemStack blockAnnouncerTime_UP = new ItemStack(Material.GOLD_NUGGET, 1);
ItemStack blockAnnouncerTime = new ItemStack(Material.BEDROCK, arena.blockAnnouncerTime);
ItemStack blockAnnouncerTime_DOWN = new ItemStack(Material.GOLD_NUGGET, 1);
ItemStack timeUntilHidersSword_UP = new ItemStack(Material.GOLD_NUGGET, 1); ItemStack timeUntilHidersSword_UP = new ItemStack(Material.GOLD_NUGGET, 1);
ItemStack timeUntilHidersSword = new ItemStack(Material.BEDROCK, arena.timeUntilHidersSword); ItemStack timeUntilHidersSword = new ItemStack(Material.BEDROCK, arena.timeUntilHidersSword);
@ -104,6 +108,9 @@ public class InventoryHandler {
updownButton(panel, arena, ArenaType.gameTime, "gameTime", "1 %Nsecond", gameTime_UP, gameTime, gameTime_DOWN, 8, 17, 26); updownButton(panel, arena, ArenaType.gameTime, "gameTime", "1 %Nsecond", gameTime_UP, gameTime, gameTime_DOWN, 8, 17, 26);
updownButton(panel, arena, ArenaType.blockAnnouncerTime, "blockAnnouncerTime", "5 %Nseconds", blockAnnouncerTime_UP, blockAnnouncerTime,
blockAnnouncerTime_DOWN, 29, 38, 47);
updownButton(panel, arena, ArenaType.timeUntilHidersSword, "timeUntilHidersSword", "1 %Nsecond", timeUntilHidersSword_UP, timeUntilHidersSword, updownButton(panel, arena, ArenaType.timeUntilHidersSword, "timeUntilHidersSword", "1 %Nsecond", timeUntilHidersSword_UP, timeUntilHidersSword,
timeUntilHidersSword_DOWN, 30, 39, 48); timeUntilHidersSword_DOWN, 30, 39, 48);
@ -148,6 +155,9 @@ public class InventoryHandler {
case timeUntilHidersSword: case timeUntilHidersSword:
setting = arena.timeUntilHidersSword; setting = arena.timeUntilHidersSword;
break; break;
case blockAnnouncerTime:
setting = arena.blockAnnouncerTime;
break;
case hidersTokenWin: case hidersTokenWin:
setting = arena.hidersTokenWin; setting = arena.hidersTokenWin;
break; break;

View File

@ -202,6 +202,8 @@ public class OnInventoryClickEvent implements Listener {
updownButton(player, item, arena, ArenaType.waitingTimeSeeker, arena.waitingTimeSeeker, 1000, 5, 1, 1); updownButton(player, item, arena, ArenaType.waitingTimeSeeker, arena.waitingTimeSeeker, 1000, 5, 1, 1);
} else if (item.getItemMeta().getDisplayName().contains("gameTime")) { } else if (item.getItemMeta().getDisplayName().contains("gameTime")) {
updownButton(player, item, arena, ArenaType.gameTime, arena.gameTime, 1000, 5, 1, 1); updownButton(player, item, arena, ArenaType.gameTime, arena.gameTime, 1000, 5, 1, 1);
} else if (item.getItemMeta().getDisplayName().contains("blockAnnouncerTime")) {
updownButton(player, item, arena, ArenaType.blockAnnouncerTime, arena.blockAnnouncerTime, 1000, 0, 5, 5);
} else if (item.getItemMeta().getDisplayName().contains("timeUntilHidersSword")) { } else if (item.getItemMeta().getDisplayName().contains("timeUntilHidersSword")) {
updownButton(player, item, arena, ArenaType.timeUntilHidersSword, arena.timeUntilHidersSword, 1000, 0, 1, 1); updownButton(player, item, arena, ArenaType.timeUntilHidersSword, arena.timeUntilHidersSword, 1000, 0, 1, 1);
} else if (item.getItemMeta().getDisplayName().contains("hidersTokenWin")) { } else if (item.getItemMeta().getDisplayName().contains("hidersTokenWin")) {
@ -253,6 +255,9 @@ public class OnInventoryClickEvent implements Listener {
case gameTime: case gameTime:
arena.gameTime = option + add; arena.gameTime = option + add;
break; break;
case blockAnnouncerTime:
arena.blockAnnouncerTime = option + add;
break;
case timeUntilHidersSword: case timeUntilHidersSword:
arena.timeUntilHidersSword = option + add; arena.timeUntilHidersSword = option + add;
break; break;
@ -290,6 +295,9 @@ public class OnInventoryClickEvent implements Listener {
case gameTime: case gameTime:
arena.gameTime = option - remove; arena.gameTime = option - remove;
break; break;
case blockAnnouncerTime:
arena.blockAnnouncerTime = option - remove;
break;
case timeUntilHidersSword: case timeUntilHidersSword:
arena.timeUntilHidersSword = option - remove; arena.timeUntilHidersSword = option - remove;
break; break;