+ Added the BlockHuntPass. Closes #11.
This commit is contained in:
		@@ -148,24 +148,24 @@ public class ArenaHandler {
 | 
			
		||||
									}
 | 
			
		||||
 | 
			
		||||
									if ((Boolean) W.config
 | 
			
		||||
											.get(ConfigC.shop_blockChooserEnabled) == true) {
 | 
			
		||||
											.get(ConfigC.shop_blockChooserv1Enabled) == true) {
 | 
			
		||||
										if (W.shop.getFile().get(
 | 
			
		||||
												player.getName()
 | 
			
		||||
														+ ".blockchooser") != null) {
 | 
			
		||||
											ItemStack shopBlockChooser = new ItemStack(
 | 
			
		||||
													Material.getMaterial((String) W.config
 | 
			
		||||
															.get(ConfigC.shop_blockChooserIDname)),
 | 
			
		||||
															.get(ConfigC.shop_blockChooserv1IDname)),
 | 
			
		||||
													1);
 | 
			
		||||
											ItemMeta shopBlockChooser_IM = shopBlockChooser
 | 
			
		||||
													.getItemMeta();
 | 
			
		||||
											shopBlockChooser_IM
 | 
			
		||||
													.setDisplayName(MessageM
 | 
			
		||||
															.replaceAll((String) W.config
 | 
			
		||||
																	.get(ConfigC.shop_blockChooserName)));
 | 
			
		||||
																	.get(ConfigC.shop_blockChooserv1Name)));
 | 
			
		||||
											List<String> lores = W.config
 | 
			
		||||
													.getFile()
 | 
			
		||||
													.getStringList(
 | 
			
		||||
															ConfigC.shop_blockChooserDescription.location);
 | 
			
		||||
															ConfigC.shop_blockChooserv1Description.location);
 | 
			
		||||
											List<String> lores2 = new ArrayList<String>();
 | 
			
		||||
											for (String lore : lores) {
 | 
			
		||||
												lores2.add(MessageM
 | 
			
		||||
@@ -179,6 +179,47 @@ public class ArenaHandler {
 | 
			
		||||
													shopBlockChooser);
 | 
			
		||||
										}
 | 
			
		||||
									}
 | 
			
		||||
 | 
			
		||||
									if ((Boolean) W.config
 | 
			
		||||
											.get(ConfigC.shop_BlockHuntPassv2Enabled) == true) {
 | 
			
		||||
										if (W.shop.getFile().getInt(
 | 
			
		||||
												player.getName()
 | 
			
		||||
														+ ".blockhuntpass") != 0) {
 | 
			
		||||
											ItemStack shopBlockHuntPass = new ItemStack(
 | 
			
		||||
													Material.getMaterial((String) W.config
 | 
			
		||||
															.get(ConfigC.shop_BlockHuntPassv2IDName)),
 | 
			
		||||
													1);
 | 
			
		||||
											ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass
 | 
			
		||||
													.getItemMeta();
 | 
			
		||||
											shopBlockHuntPass_IM
 | 
			
		||||
													.setDisplayName(MessageM
 | 
			
		||||
															.replaceAll((String) W.config
 | 
			
		||||
																	.get(ConfigC.shop_BlockHuntPassv2Name)));
 | 
			
		||||
											List<String> lores = W.config
 | 
			
		||||
													.getFile()
 | 
			
		||||
													.getStringList(
 | 
			
		||||
															ConfigC.shop_BlockHuntPassv2Description.location);
 | 
			
		||||
											List<String> lores2 = new ArrayList<String>();
 | 
			
		||||
											for (String lore : lores) {
 | 
			
		||||
												lores2.add(MessageM
 | 
			
		||||
														.replaceAll(lore));
 | 
			
		||||
											}
 | 
			
		||||
 | 
			
		||||
											shopBlockHuntPass_IM
 | 
			
		||||
													.setLore(lores2);
 | 
			
		||||
											shopBlockHuntPass
 | 
			
		||||
													.setItemMeta(shopBlockHuntPass_IM);
 | 
			
		||||
											shopBlockHuntPass
 | 
			
		||||
													.setAmount(W.shop
 | 
			
		||||
															.getFile()
 | 
			
		||||
															.getInt(player
 | 
			
		||||
																	.getName()
 | 
			
		||||
																	+ ".blockhuntpass"));
 | 
			
		||||
 | 
			
		||||
											player.getInventory().addItem(
 | 
			
		||||
													shopBlockHuntPass);
 | 
			
		||||
										}
 | 
			
		||||
									}
 | 
			
		||||
									player.updateInventory();
 | 
			
		||||
 | 
			
		||||
									DisguiseAPI.undisguiseToAll(player);
 | 
			
		||||
 
 | 
			
		||||
@@ -379,20 +379,42 @@ public class BlockHunt extends JavaPlugin implements Listener {
 | 
			
		||||
											+ arena.waitingTimeSeeker);
 | 
			
		||||
 | 
			
		||||
							for (int i = arena.amountSeekersOnStart; i > 0; i = i - 1) {
 | 
			
		||||
								boolean loop = true;
 | 
			
		||||
								Player seeker = arena.playersInArena
 | 
			
		||||
										.get(W.random
 | 
			
		||||
												.nextInt(arena.playersInArena
 | 
			
		||||
														.size()));
 | 
			
		||||
								if (!arena.seekers.contains(seeker)) {
 | 
			
		||||
									ArenaHandler.sendFMessage(arena,
 | 
			
		||||
											ConfigC.normal_ingameSeekerChoosen,
 | 
			
		||||
											"seeker-" + seeker.getName());
 | 
			
		||||
									arena.seekers.add(seeker);
 | 
			
		||||
									seeker.teleport(arena.seekersWarp);
 | 
			
		||||
									W.seekertime.put(seeker,
 | 
			
		||||
											arena.waitingTimeSeeker);
 | 
			
		||||
								} else {
 | 
			
		||||
									i = i + 1;
 | 
			
		||||
 | 
			
		||||
								for (Player playerCheck : arena.playersInArena) {
 | 
			
		||||
									if (W.choosenSeeker.get(playerCheck) != null) {
 | 
			
		||||
										if (W.choosenSeeker.get(playerCheck) == true) {
 | 
			
		||||
											seeker = playerCheck;
 | 
			
		||||
										} else {
 | 
			
		||||
											if (seeker.equals(playerCheck)) {
 | 
			
		||||
												i = i + 1;
 | 
			
		||||
												loop = false;
 | 
			
		||||
											}
 | 
			
		||||
										}
 | 
			
		||||
									}
 | 
			
		||||
 | 
			
		||||
									W.choosenSeeker.remove(playerCheck);
 | 
			
		||||
								}
 | 
			
		||||
 | 
			
		||||
								if (loop) {
 | 
			
		||||
									if (!arena.seekers.contains(seeker)) {
 | 
			
		||||
										ArenaHandler
 | 
			
		||||
												.sendFMessage(
 | 
			
		||||
														arena,
 | 
			
		||||
														ConfigC.normal_ingameSeekerChoosen,
 | 
			
		||||
														"seeker-"
 | 
			
		||||
																+ seeker.getName());
 | 
			
		||||
										arena.seekers.add(seeker);
 | 
			
		||||
										seeker.teleport(arena.seekersWarp);
 | 
			
		||||
										W.seekertime.put(seeker,
 | 
			
		||||
												arena.waitingTimeSeeker);
 | 
			
		||||
									} else {
 | 
			
		||||
										i = i + 1;
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -53,23 +53,25 @@ public enum ConfigC {
 | 
			
		||||
 | 
			
		||||
	shop_title ("%H&lBlockHunt %NShop", W.config),
 | 
			
		||||
	shop_price ("%NPrice: %A%amount% %Ntokens.", W.config),
 | 
			
		||||
	shop_blockChooserEnabled (true, W.config),
 | 
			
		||||
	shop_blockChooserIDname ("BOOK", W.config),
 | 
			
		||||
	shop_blockChooserPrice (3000, W.config),
 | 
			
		||||
	shop_blockChooserName ("%H&lBlock Chooser", W.config),
 | 
			
		||||
	shop_blockChooserDescription (new String[] {
 | 
			
		||||
 | 
			
		||||
	shop_blockChooserv1Enabled (true, W.config),
 | 
			
		||||
	shop_blockChooserv1IDname ("BOOK", W.config),
 | 
			
		||||
	shop_blockChooserv1Price (3000, W.config),
 | 
			
		||||
	shop_blockChooserv1Name ("%H&lBlock Chooser", W.config),
 | 
			
		||||
	shop_blockChooserv1Description (new String[] {
 | 
			
		||||
			"%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_BlockHuntPassIDname ("NAME_TAG", W.config),
 | 
			
		||||
	shop_BlockHuntPassPrice (150, W.config),
 | 
			
		||||
	shop_BlockHuntPassName ("%H&lBlockHunt Pass", W.config),
 | 
			
		||||
	shop_BlockHuntPassDescription (new String[] {
 | 
			
		||||
 | 
			
		||||
	shop_BlockHuntPassv2Enabled (true, W.config),
 | 
			
		||||
	shop_BlockHuntPassv2IDName ("NAME_TAG", W.config),
 | 
			
		||||
	shop_BlockHuntPassv2Price (150, W.config),
 | 
			
		||||
	shop_BlockHuntPassv2Name ("%H&lBlockHunt Pass", W.config),
 | 
			
		||||
	shop_BlockHuntPassv2Description (new String[] {
 | 
			
		||||
			"%NUse this item before the arena starts.",
 | 
			
		||||
			"%ARight-Click%N in the lobby and choose",
 | 
			
		||||
			"%Nif you want to be a Hider or a Seeker!", "&61 use.",
 | 
			
		||||
			"&c&lCOMING SOON!" }, W.config),
 | 
			
		||||
			"%Nif you want to be a Hider or a Seeker!", "&61 time use.", },
 | 
			
		||||
			W.config),
 | 
			
		||||
 | 
			
		||||
	sign_LEAVE (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
 | 
			
		||||
			"&4LEAVE", "&8Right-Click", "&8To leave." }, W.config),
 | 
			
		||||
@@ -171,6 +173,10 @@ public enum ConfigC {
 | 
			
		||||
			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),
 | 
			
		||||
 | 
			
		||||
	warning_lobbyNeedAtleast ("%TAG%WYou need atleast %A%1%%W player(s) to start the game!",
 | 
			
		||||
			W.messages),
 | 
			
		||||
@@ -228,6 +234,10 @@ public enum ConfigC {
 | 
			
		||||
	error_tokensUnknownsetting ("%TAG%E'%A%option%%E' is not a known option!",
 | 
			
		||||
			W.messages),
 | 
			
		||||
	error_shopNeedMoreTokens ("%TAG%EYou need more tokens before you can buy this item.",
 | 
			
		||||
			W.messages),
 | 
			
		||||
	error_shopMaxSeekersReached ("%TAG%ESorry, the maximum amount of seekers has been reached!",
 | 
			
		||||
			W.messages),
 | 
			
		||||
	error_shopMaxHidersReached ("%TAG%ESorry, the maximum amount of hiders has been reached!",
 | 
			
		||||
			W.messages);
 | 
			
		||||
 | 
			
		||||
	public Object value;
 | 
			
		||||
 
 | 
			
		||||
@@ -268,13 +268,13 @@ public class InventoryHandler {
 | 
			
		||||
 | 
			
		||||
		ItemStack shopBlockChooser = new ItemStack(
 | 
			
		||||
				Material.getMaterial((String) W.config
 | 
			
		||||
						.get(ConfigC.shop_blockChooserIDname)), 1);
 | 
			
		||||
						.get(ConfigC.shop_blockChooserv1IDname)), 1);
 | 
			
		||||
		ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
 | 
			
		||||
		shopBlockChooser_IM.setDisplayName(MessageM
 | 
			
		||||
				.replaceAll((String) W.config
 | 
			
		||||
						.get(ConfigC.shop_blockChooserName)));
 | 
			
		||||
						.get(ConfigC.shop_blockChooserv1Name)));
 | 
			
		||||
		lores = W.config.getFile().getStringList(
 | 
			
		||||
				ConfigC.shop_blockChooserDescription.location);
 | 
			
		||||
				ConfigC.shop_blockChooserv1Description.location);
 | 
			
		||||
		lores2 = new ArrayList<String>();
 | 
			
		||||
		for (String lore : lores) {
 | 
			
		||||
			lores2.add(MessageM.replaceAll(lore));
 | 
			
		||||
@@ -282,20 +282,20 @@ public class InventoryHandler {
 | 
			
		||||
 | 
			
		||||
		lores2.add(MessageM.replaceAll(
 | 
			
		||||
				(String) W.config.get(ConfigC.shop_price),
 | 
			
		||||
				"amount-" + W.config.get(ConfigC.shop_blockChooserPrice)));
 | 
			
		||||
				"amount-" + W.config.get(ConfigC.shop_blockChooserv1Price)));
 | 
			
		||||
 | 
			
		||||
		shopBlockChooser_IM.setLore(lores2);
 | 
			
		||||
		shopBlockChooser.setItemMeta(shopBlockChooser_IM);
 | 
			
		||||
 | 
			
		||||
		ItemStack shopBlockHuntPass = new ItemStack(
 | 
			
		||||
				Material.getMaterial((String) W.config
 | 
			
		||||
						.get(ConfigC.shop_BlockHuntPassIDname)), 1);
 | 
			
		||||
						.get(ConfigC.shop_BlockHuntPassv2IDName)), 1);
 | 
			
		||||
		ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
 | 
			
		||||
		shopBlockHuntPass_IM.setDisplayName(MessageM
 | 
			
		||||
				.replaceAll((String) W.config
 | 
			
		||||
						.get(ConfigC.shop_BlockHuntPassName)));
 | 
			
		||||
						.get(ConfigC.shop_BlockHuntPassv2Name)));
 | 
			
		||||
		lores = W.config.getFile().getStringList(
 | 
			
		||||
				ConfigC.shop_BlockHuntPassDescription.location);
 | 
			
		||||
				ConfigC.shop_BlockHuntPassv2Description.location);
 | 
			
		||||
		lores2 = new ArrayList<String>();
 | 
			
		||||
		for (String lore : lores) {
 | 
			
		||||
			lores2.add(MessageM.replaceAll(lore));
 | 
			
		||||
@@ -303,20 +303,18 @@ public class InventoryHandler {
 | 
			
		||||
 | 
			
		||||
		lores2.add(MessageM.replaceAll(
 | 
			
		||||
				(String) W.config.get(ConfigC.shop_price),
 | 
			
		||||
				"amount-" + W.config.get(ConfigC.shop_BlockHuntPassPrice)));
 | 
			
		||||
				"amount-" + W.config.get(ConfigC.shop_BlockHuntPassv2Price)));
 | 
			
		||||
 | 
			
		||||
		shopBlockHuntPass_IM.setLore(lores2);
 | 
			
		||||
		shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
 | 
			
		||||
 | 
			
		||||
		shop.setItem(0, shopTokens);
 | 
			
		||||
		if ((Boolean) W.config.get(ConfigC.shop_blockChooserEnabled) == true
 | 
			
		||||
		if ((Boolean) W.config.get(ConfigC.shop_blockChooserv1Enabled) == true
 | 
			
		||||
				&& (Boolean) W.shop.getFile().get(
 | 
			
		||||
						player.getName() + ".blockchooser") == null) {
 | 
			
		||||
			shop.setItem(1, shopBlockChooser);
 | 
			
		||||
		}
 | 
			
		||||
		if ((Boolean) W.config.get(ConfigC.shop_BlockHuntPassEnabled) == true
 | 
			
		||||
				&& (Boolean) W.shop.getFile().get(
 | 
			
		||||
						player.getName() + ".blockhuntpass") == null) {
 | 
			
		||||
		if ((Boolean) W.config.get(ConfigC.shop_BlockHuntPassv2Enabled) == true) {
 | 
			
		||||
			shop.setItem(2, shopBlockHuntPass);
 | 
			
		||||
		}
 | 
			
		||||
		player.openInventory(shop);
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,7 @@ import org.bukkit.inventory.ItemStack;
 | 
			
		||||
 | 
			
		||||
public class OnInventoryClickEvent implements Listener {
 | 
			
		||||
 | 
			
		||||
	@SuppressWarnings("deprecation")
 | 
			
		||||
	@EventHandler(priority = EventPriority.NORMAL)
 | 
			
		||||
	public void onInventoryClickEvent(InventoryClickEvent event) {
 | 
			
		||||
		Player player = (Player) event.getWhoClicked();
 | 
			
		||||
@@ -59,28 +60,68 @@ public class OnInventoryClickEvent implements Listener {
 | 
			
		||||
							player.getName() + ".tokens");
 | 
			
		||||
					if (item == null)
 | 
			
		||||
						return;
 | 
			
		||||
					if (item.getType().equals(Material.AIR))
 | 
			
		||||
						return;
 | 
			
		||||
					if (item.getItemMeta().getDisplayName() == null)
 | 
			
		||||
						return;
 | 
			
		||||
					if (item.getItemMeta()
 | 
			
		||||
							.getDisplayName()
 | 
			
		||||
							.equals(MessageM.replaceAll(W.config.get(
 | 
			
		||||
									ConfigC.shop_blockChooserName).toString()))) {
 | 
			
		||||
							.equals(MessageM
 | 
			
		||||
									.replaceAll(W.config.get(
 | 
			
		||||
											ConfigC.shop_blockChooserv1Name)
 | 
			
		||||
											.toString()))) {
 | 
			
		||||
						if (playerTokens >= (Integer) W.config
 | 
			
		||||
								.get(ConfigC.shop_blockChooserPrice)) {
 | 
			
		||||
								.get(ConfigC.shop_blockChooserv1Price)) {
 | 
			
		||||
							W.shop.getFile().set(
 | 
			
		||||
									player.getName() + ".blockchooser", true);
 | 
			
		||||
							W.shop.getFile()
 | 
			
		||||
									.set(player.getName() + ".tokens",
 | 
			
		||||
											playerTokens
 | 
			
		||||
													- (Integer) W.config
 | 
			
		||||
															.get(ConfigC.shop_blockChooserPrice));
 | 
			
		||||
															.get(ConfigC.shop_blockChooserv1Price));
 | 
			
		||||
							W.shop.save();
 | 
			
		||||
							MessageM.sendFMessage(
 | 
			
		||||
									player,
 | 
			
		||||
									ConfigC.normal_shopBoughtItem,
 | 
			
		||||
									"itemname-"
 | 
			
		||||
											+ W.config
 | 
			
		||||
													.get(ConfigC.shop_blockChooserName));
 | 
			
		||||
													.get(ConfigC.shop_blockChooserv1Name));
 | 
			
		||||
						} else {
 | 
			
		||||
							MessageM.sendFMessage(player,
 | 
			
		||||
									ConfigC.error_shopNeedMoreTokens);
 | 
			
		||||
						}
 | 
			
		||||
					} else if (item
 | 
			
		||||
							.getItemMeta()
 | 
			
		||||
							.getDisplayName()
 | 
			
		||||
							.equals(MessageM.replaceAll(W.config.get(
 | 
			
		||||
									ConfigC.shop_BlockHuntPassv2Name)
 | 
			
		||||
									.toString()))) {
 | 
			
		||||
						if (playerTokens >= (Integer) W.config
 | 
			
		||||
								.get(ConfigC.shop_BlockHuntPassv2Price)) {
 | 
			
		||||
							if (W.shop.getFile().get(
 | 
			
		||||
									player.getName() + ".blockhuntpass") == null) {
 | 
			
		||||
								W.shop.getFile().set(
 | 
			
		||||
										player.getName() + ".blockhuntpass", 0);
 | 
			
		||||
								W.shop.save();
 | 
			
		||||
							}
 | 
			
		||||
 | 
			
		||||
							W.shop.getFile().set(
 | 
			
		||||
									player.getName() + ".blockhuntpass",
 | 
			
		||||
									(Integer) W.shop.getFile()
 | 
			
		||||
											.get(player.getName()
 | 
			
		||||
													+ ".blockhuntpass") + 1);
 | 
			
		||||
							W.shop.getFile()
 | 
			
		||||
									.set(player.getName() + ".tokens",
 | 
			
		||||
											playerTokens
 | 
			
		||||
													- (Integer) W.config
 | 
			
		||||
															.get(ConfigC.shop_BlockHuntPassv2Price));
 | 
			
		||||
							W.shop.save();
 | 
			
		||||
							MessageM.sendFMessage(
 | 
			
		||||
									player,
 | 
			
		||||
									ConfigC.normal_shopBoughtItem,
 | 
			
		||||
									"itemname-"
 | 
			
		||||
											+ W.config
 | 
			
		||||
													.get(ConfigC.shop_BlockHuntPassv2Name));
 | 
			
		||||
						} else {
 | 
			
		||||
							MessageM.sendFMessage(player,
 | 
			
		||||
									ConfigC.error_shopNeedMoreTokens);
 | 
			
		||||
@@ -90,7 +131,7 @@ public class OnInventoryClickEvent implements Listener {
 | 
			
		||||
					InventoryHandler.openShop(player);
 | 
			
		||||
				} else if (inv.getName().contains(
 | 
			
		||||
						MessageM.replaceAll((String) W.config
 | 
			
		||||
								.get(ConfigC.shop_blockChooserName)))) {
 | 
			
		||||
								.get(ConfigC.shop_blockChooserv1Name)))) {
 | 
			
		||||
					event.setCancelled(true);
 | 
			
		||||
					if (event.getCurrentItem().getType() != Material.AIR) {
 | 
			
		||||
						if (event.getCurrentItem().getType().isBlock()) {
 | 
			
		||||
@@ -109,6 +150,108 @@ public class OnInventoryClickEvent implements Listener {
 | 
			
		||||
									ConfigC.error_setNotABlock);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				} else if (inv.getName().contains(
 | 
			
		||||
						MessageM.replaceAll((String) W.config
 | 
			
		||||
								.get(ConfigC.shop_BlockHuntPassv2Name)))) {
 | 
			
		||||
					event.setCancelled(true);
 | 
			
		||||
					if (event.getCurrentItem().getType() != Material.AIR) {
 | 
			
		||||
						if (event.getCurrentItem().getType()
 | 
			
		||||
								.equals(Material.WOOL)
 | 
			
		||||
								&& event.getCurrentItem().getDurability() == (short) 11) {
 | 
			
		||||
							int i = 0;
 | 
			
		||||
							for (Arena arena : W.arenaList) {
 | 
			
		||||
								if (arena.playersInArena.contains(player)) {
 | 
			
		||||
									for (Player playerCheck : arena.playersInArena) {
 | 
			
		||||
										if (W.choosenSeeker.get(playerCheck) != null) {
 | 
			
		||||
											if (W.choosenSeeker
 | 
			
		||||
													.get(playerCheck) == true) {
 | 
			
		||||
												i = i + 1;
 | 
			
		||||
											}
 | 
			
		||||
										}
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
 | 
			
		||||
								if (i >= arena.amountSeekersOnStart) {
 | 
			
		||||
									MessageM.sendFMessage(player,
 | 
			
		||||
											ConfigC.error_shopMaxSeekersReached);
 | 
			
		||||
								} else {
 | 
			
		||||
									W.choosenSeeker.put(player, true);
 | 
			
		||||
									player.getInventory().setItemInHand(
 | 
			
		||||
											new ItemStack(Material.AIR));
 | 
			
		||||
									player.updateInventory();
 | 
			
		||||
									MessageM.sendFMessage(player,
 | 
			
		||||
											ConfigC.normal_shopChoosenSeeker);
 | 
			
		||||
									inv.clear();
 | 
			
		||||
									if (W.shop.getFile()
 | 
			
		||||
											.getInt(player.getName()
 | 
			
		||||
													+ ".blockhuntpass") == 1) {
 | 
			
		||||
										W.shop.getFile().set(
 | 
			
		||||
												player.getName()
 | 
			
		||||
														+ ".blockhuntpass",
 | 
			
		||||
												null);
 | 
			
		||||
										W.shop.save();
 | 
			
		||||
									} else {
 | 
			
		||||
										W.shop.getFile()
 | 
			
		||||
												.set(player.getName()
 | 
			
		||||
														+ ".blockhuntpass",
 | 
			
		||||
														W.shop.getFile()
 | 
			
		||||
																.getInt(player
 | 
			
		||||
																		.getName()
 | 
			
		||||
																		+ ".blockhuntpass") - 1);
 | 
			
		||||
										W.shop.save();
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
 | 
			
		||||
						} else if (event.getCurrentItem().getType()
 | 
			
		||||
								.equals(Material.WOOL)
 | 
			
		||||
								&& event.getCurrentItem().getDurability() == (short) 14) {
 | 
			
		||||
							int i = 0;
 | 
			
		||||
							for (Arena arena : W.arenaList) {
 | 
			
		||||
								if (arena.playersInArena.contains(player)) {
 | 
			
		||||
									for (Player playerCheck : arena.playersInArena) {
 | 
			
		||||
										if (W.choosenSeeker.get(playerCheck) != null) {
 | 
			
		||||
											if (W.choosenSeeker
 | 
			
		||||
													.get(playerCheck) == false) {
 | 
			
		||||
												i = i + 1;
 | 
			
		||||
											}
 | 
			
		||||
										}
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
 | 
			
		||||
								if (i >= (arena.playersInArena.size() - 1)) {
 | 
			
		||||
									MessageM.sendFMessage(player,
 | 
			
		||||
											ConfigC.error_shopMaxHidersReached);
 | 
			
		||||
								} else {
 | 
			
		||||
									W.choosenSeeker.put(player, false);
 | 
			
		||||
									player.getInventory().setItemInHand(
 | 
			
		||||
											new ItemStack(Material.AIR));
 | 
			
		||||
									player.updateInventory();
 | 
			
		||||
									MessageM.sendFMessage(player,
 | 
			
		||||
											ConfigC.normal_shopChoosenHiders);
 | 
			
		||||
									inv.clear();
 | 
			
		||||
									if (W.shop.getFile()
 | 
			
		||||
											.getInt(player.getName()
 | 
			
		||||
													+ ".blockhuntpass") == 1) {
 | 
			
		||||
										W.shop.getFile().set(
 | 
			
		||||
												player.getName()
 | 
			
		||||
														+ ".blockhuntpass",
 | 
			
		||||
												null);
 | 
			
		||||
										W.shop.save();
 | 
			
		||||
									} else {
 | 
			
		||||
										W.shop.getFile()
 | 
			
		||||
												.set(player.getName()
 | 
			
		||||
														+ ".blockhuntpass",
 | 
			
		||||
														W.shop.getFile()
 | 
			
		||||
																.getInt(player
 | 
			
		||||
																		.getName()
 | 
			
		||||
																		+ ".blockhuntpass") - 1);
 | 
			
		||||
										W.shop.save();
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					event.setCancelled(true);
 | 
			
		||||
					ItemStack item = event.getCurrentItem();
 | 
			
		||||
 
 | 
			
		||||
@@ -175,14 +175,14 @@ public class OnPlayerInteractEvent implements Listener {
 | 
			
		||||
						if (item.getItemMeta()
 | 
			
		||||
								.getDisplayName()
 | 
			
		||||
								.equals(MessageM.replaceAll((String) W.config
 | 
			
		||||
										.get(ConfigC.shop_blockChooserName)))) {
 | 
			
		||||
										.get(ConfigC.shop_blockChooserv1Name)))) {
 | 
			
		||||
							Inventory blockChooser = Bukkit
 | 
			
		||||
									.createInventory(
 | 
			
		||||
											null,
 | 
			
		||||
											36,
 | 
			
		||||
											MessageM.replaceAll("\u00A7r"
 | 
			
		||||
													+ W.config
 | 
			
		||||
															.get(ConfigC.shop_blockChooserName)));
 | 
			
		||||
															.get(ConfigC.shop_blockChooserv1Name)));
 | 
			
		||||
							if (arena.disguiseBlocks != null) {
 | 
			
		||||
								for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
 | 
			
		||||
									blockChooser.setItem(i - 1,
 | 
			
		||||
@@ -192,6 +192,36 @@ public class OnPlayerInteractEvent implements Listener {
 | 
			
		||||
 | 
			
		||||
							player.openInventory(blockChooser);
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
						if (item.getItemMeta()
 | 
			
		||||
								.getDisplayName()
 | 
			
		||||
								.equals(MessageM.replaceAll((String) W.config
 | 
			
		||||
										.get(ConfigC.shop_BlockHuntPassv2Name)))) {
 | 
			
		||||
							Inventory BlockHuntPass = Bukkit
 | 
			
		||||
									.createInventory(
 | 
			
		||||
											null,
 | 
			
		||||
											9,
 | 
			
		||||
											MessageM.replaceAll("\u00A7r"
 | 
			
		||||
													+ W.config
 | 
			
		||||
															.get(ConfigC.shop_BlockHuntPassv2Name)));
 | 
			
		||||
							ItemStack BlockHuntPassSEEKER = new ItemStack(
 | 
			
		||||
									Material.WOOL, 1, (short) 11);
 | 
			
		||||
							ItemMeta BlockHuntPassIM = BlockHuntPassSEEKER
 | 
			
		||||
									.getItemMeta();
 | 
			
		||||
							BlockHuntPassIM.setDisplayName(MessageM
 | 
			
		||||
									.replaceAll("&eSEEKER"));
 | 
			
		||||
							BlockHuntPassSEEKER.setItemMeta(BlockHuntPassIM);
 | 
			
		||||
							BlockHuntPass.setItem(1, BlockHuntPassSEEKER);
 | 
			
		||||
 | 
			
		||||
							ItemStack BlockHuntPassHIDER = new ItemStack(
 | 
			
		||||
									Material.WOOL, 1, (short) 14);
 | 
			
		||||
							BlockHuntPassIM.setDisplayName(MessageM
 | 
			
		||||
									.replaceAll("&eHIDER"));
 | 
			
		||||
							BlockHuntPassHIDER.setItemMeta(BlockHuntPassIM);
 | 
			
		||||
							BlockHuntPass.setItem(7, BlockHuntPassHIDER);
 | 
			
		||||
 | 
			
		||||
							player.openInventory(BlockHuntPass);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
@@ -53,6 +53,7 @@ public class W {
 | 
			
		||||
 | 
			
		||||
	public static HashMap<Player, PlayerArenaData> pData = new HashMap<Player, PlayerArenaData>();
 | 
			
		||||
	public static HashMap<Player, ItemStack> choosenBlock = new HashMap<Player, ItemStack>();
 | 
			
		||||
	public static HashMap<Player, Boolean> choosenSeeker = new HashMap<Player, Boolean>();
 | 
			
		||||
 | 
			
		||||
	public static HashMap<Player, ItemStack> pBlock = new HashMap<Player, ItemStack>();
 | 
			
		||||
	public static HashMap<Player, Location> moveLoc = new HashMap<Player, Location>();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user