+ Added a delay on getting a sword as hider.
This commit is contained in:
		@@ -26,6 +26,7 @@ public class Arena implements ConfigurationSerializable {
 | 
			
		||||
	public int timeInLobbyUntilStart;
 | 
			
		||||
	public int waitingTimeSeeker;
 | 
			
		||||
	public int gameTime;
 | 
			
		||||
	public int timeUntilHidersSword;
 | 
			
		||||
	public ArrayList<ItemStack> disguiseBlocks;
 | 
			
		||||
	public LocationSerializable lobbyWarp;
 | 
			
		||||
	public LocationSerializable hidersWarp;
 | 
			
		||||
@@ -43,7 +44,7 @@ public class Arena implements ConfigurationSerializable {
 | 
			
		||||
	public Arena (String arenaName, LocationSerializable pos1,
 | 
			
		||||
			LocationSerializable pos2, int maxPlayers, int minPlayers,
 | 
			
		||||
			int amountSeekersOnStart, int timeInLobbyUntilStart,
 | 
			
		||||
			int waitingTimeSeeker, int gameTime,
 | 
			
		||||
			int waitingTimeSeeker, int gameTime, int timeUntilHidersSword,
 | 
			
		||||
			ArrayList<ItemStack> disguiseBlocks,
 | 
			
		||||
			LocationSerializable lobbyWarp, LocationSerializable hidersWarp,
 | 
			
		||||
			LocationSerializable seekersWarp, List<String> seekersWinCommands,
 | 
			
		||||
@@ -59,6 +60,7 @@ public class Arena implements ConfigurationSerializable {
 | 
			
		||||
		this.timeInLobbyUntilStart = timeInLobbyUntilStart;
 | 
			
		||||
		this.waitingTimeSeeker = waitingTimeSeeker;
 | 
			
		||||
		this.gameTime = gameTime;
 | 
			
		||||
		this.timeUntilHidersSword = timeUntilHidersSword;
 | 
			
		||||
		this.disguiseBlocks = disguiseBlocks;
 | 
			
		||||
		this.lobbyWarp = lobbyWarp;
 | 
			
		||||
		this.hidersWarp = hidersWarp;
 | 
			
		||||
@@ -80,7 +82,8 @@ public class Arena implements ConfigurationSerializable {
 | 
			
		||||
		amountSeekersOnStart,
 | 
			
		||||
		timeInLobbyUntilStart,
 | 
			
		||||
		waitingTimeSeeker,
 | 
			
		||||
		gameTime;
 | 
			
		||||
		gameTime,
 | 
			
		||||
		timeUntilHidersSword;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public enum ArenaState {
 | 
			
		||||
@@ -99,6 +102,7 @@ public class Arena implements ConfigurationSerializable {
 | 
			
		||||
		map.put("timeInLobbyUntilStart", timeInLobbyUntilStart);
 | 
			
		||||
		map.put("waitingTimeSeeker", waitingTimeSeeker);
 | 
			
		||||
		map.put("gameTime", gameTime);
 | 
			
		||||
		map.put("timeUntilHidersSword", timeUntilHidersSword);
 | 
			
		||||
		map.put("disguiseBlocks", disguiseBlocks);
 | 
			
		||||
		map.put("lobbyWarp", lobbyWarp);
 | 
			
		||||
		map.put("hidersWarp", hidersWarp);
 | 
			
		||||
@@ -121,8 +125,10 @@ public class Arena implements ConfigurationSerializable {
 | 
			
		||||
						"amountSeekersOnStart", 1), (Integer) M.g(map,
 | 
			
		||||
						"timeInLobbyUntilStart", 90), (Integer) M.g(map,
 | 
			
		||||
						"waitingTimeSeeker", 20), (Integer) M.g(map,
 | 
			
		||||
						"gameTime", 200), (ArrayList<ItemStack>) M.g(map,
 | 
			
		||||
						"disguiseBlocks", new ArrayList<ItemStack>()),
 | 
			
		||||
						"gameTime", 200), (Integer) M.g(map,
 | 
			
		||||
						"timeUntilHidersSword", 30),
 | 
			
		||||
				(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),
 | 
			
		||||
 
 | 
			
		||||
@@ -251,12 +251,6 @@ public class BlockHunt extends JavaPlugin implements Listener {
 | 
			
		||||
									}
 | 
			
		||||
 | 
			
		||||
									arenaPlayer.teleport(arena.hidersWarp);
 | 
			
		||||
									ItemStack sword = new ItemStack(
 | 
			
		||||
											Material.WOOD_SWORD, 1);
 | 
			
		||||
									sword.addUnsafeEnchantment(
 | 
			
		||||
											Enchantment.KNOCKBACK, 1);
 | 
			
		||||
 | 
			
		||||
									arenaPlayer.getInventory().addItem(sword);
 | 
			
		||||
 | 
			
		||||
									ItemStack blockCount = new ItemStack(block
 | 
			
		||||
											.getType(), 5);
 | 
			
		||||
@@ -334,6 +328,23 @@ public class BlockHunt extends JavaPlugin implements Listener {
 | 
			
		||||
					if (arena.gameState == ArenaState.INGAME) {
 | 
			
		||||
						arena.timer = arena.timer - 1;
 | 
			
		||||
						if (arena.timer > 0) {
 | 
			
		||||
							if (arena.timer == arena.gameTime
 | 
			
		||||
									- arena.timeUntilHidersSword) {
 | 
			
		||||
								ItemStack sword = new ItemStack(
 | 
			
		||||
										Material.WOOD_SWORD, 1);
 | 
			
		||||
								sword.addUnsafeEnchantment(
 | 
			
		||||
										Enchantment.KNOCKBACK, 1);
 | 
			
		||||
								for (Player arenaPlayer : arena.playersInArena) {
 | 
			
		||||
									if (!arena.seekers.contains(arenaPlayer)) {
 | 
			
		||||
										arenaPlayer.getInventory().addItem(
 | 
			
		||||
												sword);
 | 
			
		||||
										MessageM.sendFMessage(
 | 
			
		||||
												arenaPlayer,
 | 
			
		||||
												ConfigC.normal_ingameGivenSword,
 | 
			
		||||
												true);
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
							if (arena.timer == 190) {
 | 
			
		||||
								ArenaHandler.sendFMessage(arena,
 | 
			
		||||
										ConfigC.normal_ingameArenaEnd, true,
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ public class CMDcreate extends DefaultCMD {
 | 
			
		||||
								.equals(W.pos2.get(player).getWorld())) {
 | 
			
		||||
							Arena arena = new Arena(args[1],
 | 
			
		||||
									W.pos1.get(player), W.pos2.get(player), 12,
 | 
			
		||||
									3, 1, 50, 20, 300,
 | 
			
		||||
									3, 1, 50, 20, 300, 30,
 | 
			
		||||
									new ArrayList<ItemStack>(), null, null,
 | 
			
		||||
									null, new ArrayList<String>(),
 | 
			
		||||
									new ArrayList<String>(),
 | 
			
		||||
 
 | 
			
		||||
@@ -88,6 +88,13 @@ public class InventoryHandler {
 | 
			
		||||
			disguiseBlocks_NOTE.setItemMeta(disguiseBlocks_NOTE_IM);
 | 
			
		||||
			panel.setItem(37, disguiseBlocks_NOTE);
 | 
			
		||||
 | 
			
		||||
			ItemStack timeUntilHidersSword_UP = new ItemStack(
 | 
			
		||||
					Material.GOLD_NUGGET, 1);
 | 
			
		||||
			ItemStack timeUntilHidersSword = new ItemStack(
 | 
			
		||||
					Material.PISTON_MOVING_PIECE, arena.timeUntilHidersSword);
 | 
			
		||||
			ItemStack timeUntilHidersSword_DOWN = new ItemStack(
 | 
			
		||||
					Material.GOLD_NUGGET, 1);
 | 
			
		||||
 | 
			
		||||
			//
 | 
			
		||||
 | 
			
		||||
			updownButton(panel, arena, ArenaType.maxPlayers, "maxPlayers", "1",
 | 
			
		||||
@@ -113,6 +120,11 @@ public class InventoryHandler {
 | 
			
		||||
					"1 %Nsecond", gameTime_UP, gameTime, gameTime_DOWN, 8, 17,
 | 
			
		||||
					26);
 | 
			
		||||
 | 
			
		||||
			updownButton(panel, arena, ArenaType.timeUntilHidersSword,
 | 
			
		||||
					"timeUntilHidersSword", "1 %Nsecond",
 | 
			
		||||
					timeUntilHidersSword_UP, timeUntilHidersSword,
 | 
			
		||||
					timeUntilHidersSword_DOWN, 30, 39, 48);
 | 
			
		||||
 | 
			
		||||
			player.openInventory(panel);
 | 
			
		||||
		} else {
 | 
			
		||||
			MessageM.sendFMessage(player, ConfigC.error_noArena, true, "name-"
 | 
			
		||||
@@ -149,6 +161,9 @@ public class InventoryHandler {
 | 
			
		||||
		case gameTime:
 | 
			
		||||
			setting = arena.gameTime;
 | 
			
		||||
			break;
 | 
			
		||||
		case timeUntilHidersSword:
 | 
			
		||||
			setting = arena.timeUntilHidersSword;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ItemMeta BUTTON_IM = BUTTON.getItemMeta();
 | 
			
		||||
 
 | 
			
		||||
@@ -98,6 +98,11 @@ public class OnInventoryClickEvent implements Listener {
 | 
			
		||||
							.contains("gameTime")) {
 | 
			
		||||
						updownButton(player, item, arena, ArenaType.gameTime,
 | 
			
		||||
								arena.gameTime, 1000, 5, 1, 1);
 | 
			
		||||
					} else if (item.getItemMeta().getDisplayName()
 | 
			
		||||
							.contains("timeUntilHidersSword")) {
 | 
			
		||||
						updownButton(player, item, arena,
 | 
			
		||||
								ArenaType.timeUntilHidersSword,
 | 
			
		||||
								arena.timeUntilHidersSword, 1000, 0, 1, 1);
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					save(arena);
 | 
			
		||||
@@ -124,9 +129,6 @@ public class OnInventoryClickEvent implements Listener {
 | 
			
		||||
		if (item.getItemMeta().getDisplayName()
 | 
			
		||||
				.contains((String) W.messages.get(ConfigC.button_add2))) {
 | 
			
		||||
			if (option < max) {
 | 
			
		||||
 | 
			
		||||
				// W.arenas.getFile().set(arenaname + "." + option, option +
 | 
			
		||||
				// add);
 | 
			
		||||
				switch (at) {
 | 
			
		||||
				case maxPlayers:
 | 
			
		||||
					arena.maxPlayers = option + add;
 | 
			
		||||
@@ -146,6 +148,9 @@ public class OnInventoryClickEvent implements Listener {
 | 
			
		||||
				case gameTime:
 | 
			
		||||
					arena.gameTime = option + add;
 | 
			
		||||
					break;
 | 
			
		||||
				case timeUntilHidersSword:
 | 
			
		||||
					arena.timeUntilHidersSword = option + add;
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				MessageM.sendFMessage(player, ConfigC.error_setTooHighNumber,
 | 
			
		||||
@@ -154,8 +159,6 @@ public class OnInventoryClickEvent implements Listener {
 | 
			
		||||
		} else if (item.getItemMeta().getDisplayName()
 | 
			
		||||
				.contains((String) W.messages.get(ConfigC.button_remove2))) {
 | 
			
		||||
			if (option > min) {
 | 
			
		||||
				// W.arenas.getFile().set(arenaname + "." + option,
 | 
			
		||||
				// option - remove);
 | 
			
		||||
				switch (at) {
 | 
			
		||||
				case maxPlayers:
 | 
			
		||||
					arena.maxPlayers = option - remove;
 | 
			
		||||
@@ -175,6 +178,9 @@ public class OnInventoryClickEvent implements Listener {
 | 
			
		||||
				case gameTime:
 | 
			
		||||
					arena.gameTime = option - remove;
 | 
			
		||||
					break;
 | 
			
		||||
				case timeUntilHidersSword:
 | 
			
		||||
					arena.timeUntilHidersSword = option - remove;
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				MessageM.sendFMessage(player, ConfigC.error_setTooLowNumber,
 | 
			
		||||
 
 | 
			
		||||
@@ -104,6 +104,7 @@ public enum ConfigC {
 | 
			
		||||
			W.messages),
 | 
			
		||||
	normal_ingameArenaEnd ("%NThe arena will end in %A%1%%N second(s)!",
 | 
			
		||||
			W.messages),
 | 
			
		||||
	normal_ingameGivenSword ("%NYou were given a sword!", W.messages),
 | 
			
		||||
	normal_HiderDied ("%NHider %A%playername%%N died! %A%left%%N hider(s) remain...",
 | 
			
		||||
			W.messages),
 | 
			
		||||
	normal_SeekerDied ("%NSeeker %A%playername%%N died! He will respawn in %A%secs%%N seconds!",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user