Revert previous changes to Arena serialization back to LocationSerializable until we work out a migration of existing configs.
Refactor a few classes so that the naming makes more sense Create Command abstraction layer properly
This commit is contained in:
parent
ad01ed1e75
commit
898f03ca43
@ -22,12 +22,12 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
|
|
||||||
public class ArenaHandler {
|
public class ArenaHandler {
|
||||||
public static void loadArenas() {
|
public static void loadArenas() {
|
||||||
W.arenaList.clear();
|
MemoryStorage.arenaList.clear();
|
||||||
for (String arenaName : W.arenas.getFile().getKeys(false)) {
|
for (String arenaName : MemoryStorage.arenas.getFile().getKeys(false)) {
|
||||||
W.arenaList.add((Arena) W.arenas.getFile().get(arenaName));
|
MemoryStorage.arenaList.add((Arena) MemoryStorage.arenas.getFile().get(arenaName));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
ScoreboardHandler.createScoreboard(arena);
|
ScoreboardHandler.createScoreboard(arena);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ public class ArenaHandler {
|
|||||||
public static void playerJoinArena(Player player, String arenaname) {
|
public static void playerJoinArena(Player player, String arenaname) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
boolean alreadyJoined = false;
|
boolean alreadyJoined = false;
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena != null) {
|
if (arena.playersInArena != null) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
alreadyJoined = true;
|
alreadyJoined = true;
|
||||||
@ -58,7 +58,7 @@ public class ArenaHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!alreadyJoined) {
|
if (!alreadyJoined) {
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.arenaName.equalsIgnoreCase(arenaname)) {
|
if (arena.arenaName.equalsIgnoreCase(arenaname)) {
|
||||||
found = true;
|
found = true;
|
||||||
if (arena.disguiseBlocks.isEmpty()) {
|
if (arena.disguiseBlocks.isEmpty()) {
|
||||||
@ -81,7 +81,7 @@ public class ArenaHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Boolean) W.config.get(ConfigC.requireInventoryClearOnJoin) && !inventoryempty) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.requireInventoryClearOnJoin) && !inventoryempty) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_joinInventoryNotEmpty);
|
MessageManager.sendFMessage(player, ConfigC.error_joinInventoryNotEmpty);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ public class ArenaHandler {
|
|||||||
.getInventory().getArmorContents(), player.getExp(), player.getLevel(), player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(), player.getHealth(), player.getFoodLevel(),
|
.getInventory().getArmorContents(), player.getExp(), player.getLevel(), player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(), player.getHealth(), player.getFoodLevel(),
|
||||||
player.getActivePotionEffects(), player.getAllowFlight());
|
player.getActivePotionEffects(), player.getAllowFlight());
|
||||||
|
|
||||||
W.pData.put(player, pad);
|
MemoryStorage.pData.put(player, pad);
|
||||||
|
|
||||||
player.teleport(arena.lobbyWarp);
|
player.teleport(arena.lobbyWarp);
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
@ -146,13 +146,13 @@ public class ArenaHandler {
|
|||||||
// player
|
// player
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Boolean) W.config.get(ConfigC.shop_blockChooserv1Enabled)) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Enabled)) {
|
||||||
if (W.shop.getFile().get(player.getName() + ".blockchooser") != null
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") != null
|
||||||
|| PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false)) {
|
|| PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false)) {
|
||||||
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) W.config.get(ConfigC.shop_blockChooserv1IDname)), 1);
|
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1IDname)), 1);
|
||||||
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
||||||
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)));
|
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)));
|
||||||
List<String> lores = W.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
|
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
|
||||||
List<String> lores2 = new ArrayList<>();
|
List<String> lores2 = new ArrayList<>();
|
||||||
for (String lore : lores) {
|
for (String lore : lores) {
|
||||||
lores2.add(MessageManager.replaceAll(lore));
|
lores2.add(MessageManager.replaceAll(lore));
|
||||||
@ -164,13 +164,13 @@ public class ArenaHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Boolean) W.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
||||||
if (W.shop.getFile().getInt(player.getName() + ".blockhuntpass") != 0) {
|
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") != 0) {
|
||||||
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) W.config.get(ConfigC.shop_BlockHuntPassv2IDName)),
|
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2IDName)),
|
||||||
1);
|
1);
|
||||||
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
||||||
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
||||||
List<String> lores = W.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
|
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
|
||||||
List<String> lores2 = new ArrayList<>();
|
List<String> lores2 = new ArrayList<>();
|
||||||
for (String lore : lores) {
|
for (String lore : lores) {
|
||||||
lores2.add(MessageManager.replaceAll(lore));
|
lores2.add(MessageManager.replaceAll(lore));
|
||||||
@ -178,7 +178,7 @@ public class ArenaHandler {
|
|||||||
|
|
||||||
shopBlockHuntPass_IM.setLore(lores2);
|
shopBlockHuntPass_IM.setLore(lores2);
|
||||||
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
||||||
shopBlockHuntPass.setAmount(W.shop.getFile().getInt(player.getName() + ".blockhuntpass"));
|
shopBlockHuntPass.setAmount(MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass"));
|
||||||
|
|
||||||
player.getInventory().addItem(shopBlockHuntPass);
|
player.getInventory().addItem(shopBlockHuntPass);
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ public class ArenaHandler {
|
|||||||
public static void playerLeaveArena(Player player, boolean message, boolean cleanup) {
|
public static void playerLeaveArena(Player player, boolean message, boolean cleanup) {
|
||||||
|
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : W.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.playersInArena != null) {
|
if (arena2.playersInArena != null) {
|
||||||
if (arena2.playersInArena.contains(player)) {
|
if (arena2.playersInArena.contains(player)) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
@ -258,7 +258,7 @@ public class ArenaHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (arena.seekers.size() <= 0 && arena.gameState == ArenaState.INGAME) {
|
if (arena.seekers.size() <= 0 && arena.gameState == ArenaState.INGAME) {
|
||||||
Player seeker = arena.playersInArena.get(W.random.nextInt(arena.playersInArena.size()));
|
Player seeker = arena.playersInArena.get(MemoryStorage.random.nextInt(arena.playersInArena.size()));
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.warning_ingameNEWSeekerChoosen, "seeker-" + seeker.getName());
|
ArenaHandler.sendFMessage(arena, ConfigC.warning_ingameNEWSeekerChoosen, "seeker-" + seeker.getName());
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerChoosen, "seeker-" + seeker.getName());
|
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerChoosen, "seeker-" + seeker.getName());
|
||||||
DisguiseAPI.undisguiseToAll(seeker);
|
DisguiseAPI.undisguiseToAll(seeker);
|
||||||
@ -268,7 +268,7 @@ public class ArenaHandler {
|
|||||||
seeker.getInventory().clear();
|
seeker.getInventory().clear();
|
||||||
arena.seekers.add(seeker);
|
arena.seekers.add(seeker);
|
||||||
seeker.teleport(arena.seekersWarp);
|
seeker.teleport(arena.seekersWarp);
|
||||||
W.seekertime.put(seeker, arena.waitingTimeSeeker);
|
MemoryStorage.seekertime.put(seeker, arena.waitingTimeSeeker);
|
||||||
seeker.setWalkSpeed(0.3F);
|
seeker.setWalkSpeed(0.3F);
|
||||||
|
|
||||||
// Fix for client not showing players after they join
|
// Fix for client not showing players after they join
|
||||||
@ -286,8 +286,8 @@ public class ArenaHandler {
|
|||||||
|
|
||||||
PlayerArenaData pad = new PlayerArenaData(null, null, null, null, null, null, null, null, null, null, false);
|
PlayerArenaData pad = new PlayerArenaData(null, null, null, null, null, null, null, null, null, null, false);
|
||||||
|
|
||||||
if (W.pData.get(player) != null) {
|
if (MemoryStorage.pData.get(player) != null) {
|
||||||
pad = W.pData.get(player);
|
pad = MemoryStorage.pData.get(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
@ -308,14 +308,14 @@ public class ArenaHandler {
|
|||||||
}
|
}
|
||||||
player.setWalkSpeed(0.2F);
|
player.setWalkSpeed(0.2F);
|
||||||
|
|
||||||
W.pData.remove(player);
|
MemoryStorage.pData.remove(player);
|
||||||
|
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||||
pl.showPlayer(player);
|
pl.showPlayer(player);
|
||||||
if (W.hiddenLoc.get(player) != null) {
|
if (MemoryStorage.hiddenLoc.get(player) != null) {
|
||||||
if (W.hiddenLocWater.get(player) != null) {
|
if (MemoryStorage.hiddenLocWater.get(player) != null) {
|
||||||
Block pBlock = W.hiddenLoc.get(player).getBlock();
|
Block pBlock = MemoryStorage.hiddenLoc.get(player).getBlock();
|
||||||
if (W.hiddenLocWater.get(player)) {
|
if (MemoryStorage.hiddenLocWater.get(player)) {
|
||||||
pl.sendBlockChange(pBlock.getLocation(), Material.STATIONARY_WATER, (byte) 0);
|
pl.sendBlockChange(pBlock.getLocation(), Material.STATIONARY_WATER, (byte) 0);
|
||||||
} else {
|
} else {
|
||||||
pl.sendBlockChange(pBlock.getLocation(), Material.AIR, (byte) 0);
|
pl.sendBlockChange(pBlock.getLocation(), Material.AIR, (byte) 0);
|
||||||
@ -344,8 +344,7 @@ public class ArenaHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void seekersWin(Arena arena) {
|
public static void seekersWin(Arena arena) {
|
||||||
System.out.println("[BlockHunt] Seekers have won " + arena.arenaName);
|
String cause = "[BlockHunt] Seekers have won " + arena.arenaName;
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_winSeekers);
|
|
||||||
|
|
||||||
List<Player> winners = new ArrayList<>();
|
List<Player> winners = new ArrayList<>();
|
||||||
List<Player> losers = new ArrayList<>();
|
List<Player> losers = new ArrayList<>();
|
||||||
@ -361,13 +360,13 @@ public class ArenaHandler {
|
|||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getDisplayName()));
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (W.shop.getFile().get(player.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
||||||
W.shop.getFile().set(player.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int playerTokens = W.shop.getFile().getInt(player.getName() + ".tokens");
|
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||||
W.shop.getFile().set(player.getName() + ".tokens", playerTokens + arena.seekersTokenWin);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens + arena.seekersTokenWin);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.seekersTokenWin);
|
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.seekersTokenWin);
|
||||||
|
|
||||||
@ -380,22 +379,11 @@ public class ArenaHandler {
|
|||||||
|
|
||||||
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
stopArena(arena, cause, ConfigC.normal_winSeekers);
|
||||||
arena.seekers.clear();
|
|
||||||
|
|
||||||
for (Player player : arena.playersInArena) {
|
|
||||||
playerLeaveArena(player, false, false);
|
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
arena.gameState = ArenaState.WAITING;
|
|
||||||
arena.timer = 0;
|
|
||||||
arena.playersInArena.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void hidersWin(Arena arena) {
|
public static void hidersWin(Arena arena) {
|
||||||
System.out.println("[BlockHunt] Hiders have won " + arena.arenaName);
|
String cause = "[BlockHunt] Hiders have won " + arena.arenaName;
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_winHiders);
|
|
||||||
|
|
||||||
List<Player> winners = new ArrayList<>();
|
List<Player> winners = new ArrayList<>();
|
||||||
List<Player> losers = new ArrayList<>();
|
List<Player> losers = new ArrayList<>();
|
||||||
@ -413,13 +401,13 @@ public class ArenaHandler {
|
|||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getDisplayName()));
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replaceAll("%player%", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (W.shop.getFile().get(player.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
||||||
W.shop.getFile().set(player.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int playerTokens = W.shop.getFile().getInt(player.getName() + ".tokens");
|
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||||
W.shop.getFile().set(player.getName() + ".tokens", playerTokens + arena.hidersTokenWin);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens + arena.hidersTokenWin);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.hidersTokenWin);
|
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.hidersTokenWin);
|
||||||
}
|
}
|
||||||
@ -429,23 +417,12 @@ public class ArenaHandler {
|
|||||||
|
|
||||||
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
EndArenaEvent event = new EndArenaEvent(winners, losers, arena);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
stopArena(arena, cause, ConfigC.normal_winHiders);
|
||||||
arena.seekers.clear();
|
|
||||||
|
|
||||||
for (Player player : arena.playersInArena) {
|
|
||||||
playerLeaveArena(player, false, false);
|
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
arena.gameState = ArenaState.WAITING;
|
|
||||||
arena.timer = 0;
|
|
||||||
arena.playersInArena.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void stopArena(Arena arena) {
|
public static void stopArena(Arena arena,String cause, ConfigC message) {
|
||||||
System.out.println("[BlockHunt] Arena " + arena.arenaName + " has been stopped");
|
System.out.println(cause);
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.warning_arenaStopped);
|
ArenaHandler.sendFMessage(arena, message);
|
||||||
|
|
||||||
arena.seekers.clear();
|
arena.seekers.clear();
|
||||||
|
|
||||||
for (Player player : arena.playersInArena) {
|
for (Player player : arena.playersInArena) {
|
||||||
@ -460,7 +437,7 @@ public class ArenaHandler {
|
|||||||
|
|
||||||
public static boolean noPlayersInArenas() {
|
public static boolean noPlayersInArenas() {
|
||||||
// Check if there are any players in any arena (quick way to early exit for event handlers)
|
// Check if there are any players in any arena (quick way to early exit for event handlers)
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.size() > 0) {
|
if (arena.playersInArena.size() > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -140,37 +140,37 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
ConfigManager.newFiles();
|
ConfigManager.newFiles();
|
||||||
|
|
||||||
CMD = new CommandManager("BlockHunt", "BlockHunt", null, null, Permissions.info, ConfigC.help_info, (Boolean) W.config.get(ConfigC.commandEnabled_info), BlockHuntCMD,
|
CMD = new CommandManager("BlockHunt", "BlockHunt", null, null, Permissions.info, ConfigC.help_info, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_info), BlockHuntCMD,
|
||||||
new CMDinfo(), null);
|
new CMDinfo(), null);
|
||||||
CMDinfo = new CommandManager("BlockHunt INFO", "BlockHunt", "info", "i", Permissions.info, ConfigC.help_info, (Boolean) W.config.get(ConfigC.commandEnabled_info),
|
CMDinfo = new CommandManager("BlockHunt INFO", "BlockHunt", "info", "i", Permissions.info, ConfigC.help_info, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_info),
|
||||||
BlockHuntCMD, new CMDinfo(), "/BlockHunt [info|i]");
|
BlockHuntCMD, new CMDinfo(), "/BlockHunt [info|i]");
|
||||||
CMDhelp = new CommandManager("BlockHunt HELP", "BlockHunt", "help", "h", Permissions.help, ConfigC.help_help, (Boolean) W.config.get(ConfigC.commandEnabled_help),
|
CMDhelp = new CommandManager("BlockHunt HELP", "BlockHunt", "help", "h", Permissions.help, ConfigC.help_help, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_help),
|
||||||
BlockHuntCMD, new CMDhelp(), "/BlockHunt <help|h> [page number]");
|
BlockHuntCMD, new CMDhelp(), "/BlockHunt <help|h> [page number]");
|
||||||
CMDreload = new CommandManager("BlockHunt RELOAD", "BlockHunt", "reload", "r", Permissions.reload, ConfigC.help_reload,
|
CMDreload = new CommandManager("BlockHunt RELOAD", "BlockHunt", "reload", "r", Permissions.reload, ConfigC.help_reload,
|
||||||
(Boolean) W.config.get(ConfigC.commandEnabled_reload), BlockHuntCMD, new CMDreload(), "/BlockHunt <reload|r>");
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_reload), BlockHuntCMD, new CMDreload(), "/BlockHunt <reload|r>");
|
||||||
CMDjoin = new CommandManager("BlockHunt JOIN", "BlockHunt", "join", "j", Permissions.join, ConfigC.help_join, (Boolean) W.config.get(ConfigC.commandEnabled_join),
|
CMDjoin = new CommandManager("BlockHunt JOIN", "BlockHunt", "join", "j", Permissions.join, ConfigC.help_join, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_join),
|
||||||
BlockHuntCMD, new CMDjoin(), "/BlockHunt <join|j> <arenaname>");
|
BlockHuntCMD, new CMDjoin(), "/BlockHunt <join|j> <arenaname>");
|
||||||
CMDleave = new CommandManager("BlockHunt LEAVE", "BlockHunt", "leave", "l", Permissions.leave, ConfigC.help_leave,
|
CMDleave = new CommandManager("BlockHunt LEAVE", "BlockHunt", "leave", "l", Permissions.leave, ConfigC.help_leave,
|
||||||
(Boolean) W.config.get(ConfigC.commandEnabled_leave), BlockHuntCMD, new CMDleave(), "/BlockHunt <leave|l>");
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_leave), BlockHuntCMD, new CMDleave(), "/BlockHunt <leave|l>");
|
||||||
CMDlist = new CommandManager("BlockHunt LIST", "BlockHunt", "list", "li", Permissions.list, ConfigC.help_list, (Boolean) W.config.get(ConfigC.commandEnabled_list),
|
CMDlist = new CommandManager("BlockHunt LIST", "BlockHunt", "list", "li", Permissions.list, ConfigC.help_list, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_list),
|
||||||
BlockHuntCMD, new CMDlist(), "/BlockHunt <list|li>");
|
BlockHuntCMD, new CMDlist(), "/BlockHunt <list|li>");
|
||||||
CMDshop = new CommandManager("BlockHunt SHOP", "BlockHunt", "shop", "sh", Permissions.shop, ConfigC.help_shop, (Boolean) W.config.get(ConfigC.commandEnabled_shop),
|
CMDshop = new CommandManager("BlockHunt SHOP", "BlockHunt", "shop", "sh", Permissions.shop, ConfigC.help_shop, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_shop),
|
||||||
BlockHuntCMD, new CMDshop(), "/BlockHunt <shop|sh>");
|
BlockHuntCMD, new CMDshop(), "/BlockHunt <shop|sh>");
|
||||||
CMDstart = new CommandManager("BlockHunt START", "BlockHunt", "start", "go", Permissions.start, ConfigC.help_start,
|
CMDstart = new CommandManager("BlockHunt START", "BlockHunt", "start", "go", Permissions.start, ConfigC.help_start,
|
||||||
(Boolean) W.config.get(ConfigC.commandEnabled_start), BlockHuntCMD, new CMDstart(), "/BlockHunt <start|go> <arenaname>");
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_start), BlockHuntCMD, new CMDstart(), "/BlockHunt <start|go> <arenaname>");
|
||||||
CMDwand = new CommandManager("BlockHunt WAND", "BlockHunt", "wand", "w", Permissions.create, ConfigC.help_wand, (Boolean) W.config.get(ConfigC.commandEnabled_wand),
|
CMDwand = new CommandManager("BlockHunt WAND", "BlockHunt", "wand", "w", Permissions.create, ConfigC.help_wand, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_wand),
|
||||||
BlockHuntCMD, new CMDwand(), "/BlockHunt <wand|w>");
|
BlockHuntCMD, new CMDwand(), "/BlockHunt <wand|w>");
|
||||||
CMDcreate = new CommandManager("BlockHunt CREATE", "BlockHunt", "create", "c", Permissions.create, ConfigC.help_create,
|
CMDcreate = new CommandManager("BlockHunt CREATE", "BlockHunt", "create", "c", Permissions.create, ConfigC.help_create,
|
||||||
(Boolean) W.config.get(ConfigC.commandEnabled_create), BlockHuntCMD, new CMDcreate(), "/BlockHunt <create|c> <arenaname>");
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_create), BlockHuntCMD, new CMDcreate(), "/BlockHunt <create|c> <arenaname>");
|
||||||
CMDset = new CommandManager("BlockHunt SET", "BlockHunt", "set", "s", Permissions.set, ConfigC.help_set, (Boolean) W.config.get(ConfigC.commandEnabled_set),
|
CMDset = new CommandManager("BlockHunt SET", "BlockHunt", "set", "s", Permissions.set, ConfigC.help_set, (Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_set),
|
||||||
BlockHuntCMD, new CMDset(), "/BlockHunt <set|s> <arenaname>");
|
BlockHuntCMD, new CMDset(), "/BlockHunt <set|s> <arenaname>");
|
||||||
CMDsetwarp = new CommandManager("BlockHunt SETWARP", "BlockHunt", "setwarp", "sw", Permissions.setwarp, ConfigC.help_setwarp,
|
CMDsetwarp = new CommandManager("BlockHunt SETWARP", "BlockHunt", "setwarp", "sw", Permissions.setwarp, ConfigC.help_setwarp,
|
||||||
(Boolean) W.config.get(ConfigC.commandEnabled_setwarp), BlockHuntCMD, new CMDsetwarp(),
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_setwarp), BlockHuntCMD, new CMDsetwarp(),
|
||||||
"/BlockHunt <setwarp|sw> <lobby|hiders|seekers|spawn> <arenaname>");
|
"/BlockHunt <setwarp|sw> <lobby|hiders|seekers|spawn> <arenaname>");
|
||||||
CMDremove = new CommandManager("BlockHunt REMOVE", "BlockHunt", "remove", "delete", Permissions.remove, ConfigC.help_remove,
|
CMDremove = new CommandManager("BlockHunt REMOVE", "BlockHunt", "remove", "delete", Permissions.remove, ConfigC.help_remove,
|
||||||
(Boolean) W.config.get(ConfigC.commandEnabled_remove), BlockHuntCMD, new CMDremove(), "/BlockHunt <remove|delete> <arenaname>");
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_remove), BlockHuntCMD, new CMDremove(), "/BlockHunt <remove|delete> <arenaname>");
|
||||||
CMDtokens = new CommandManager("BlockHunt TOKENS", "BlockHunt", "tokens", "t", Permissions.tokens, ConfigC.help_tokens,
|
CMDtokens = new CommandManager("BlockHunt TOKENS", "BlockHunt", "tokens", "t", Permissions.tokens, ConfigC.help_tokens,
|
||||||
(Boolean) W.config.get(ConfigC.commandEnabled_tokens), BlockHuntCMD, new CMDtokens(), "/BlockHunt <tokens|t> <set|add|take> <playername> <amount>");
|
(Boolean) MemoryStorage.config.get(ConfigC.commandEnabled_tokens), BlockHuntCMD, new CMDtokens(), "/BlockHunt <tokens|t> <set|add|take> <playername> <amount>");
|
||||||
|
|
||||||
if (!getServer().getPluginManager().isPluginEnabled("LibsDisguises")) {
|
if (!getServer().getPluginManager().isPluginEnabled("LibsDisguises")) {
|
||||||
MessageManager.broadcastFMessage(ConfigC.error_libsDisguisesNotInstalled);
|
MessageManager.broadcastFMessage(ConfigC.error_libsDisguisesNotInstalled);
|
||||||
@ -191,7 +191,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
// Welcome to the massive game loop!!
|
// Welcome to the massive game loop!!
|
||||||
getServer().getScheduler().runTaskTimer(this, () -> {
|
getServer().getScheduler().runTaskTimer(this, () -> {
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.gameState == ArenaState.WAITING) {
|
if (arena.gameState == ArenaState.WAITING) {
|
||||||
if (arena.playersInArena.size() >= arena.minPlayers) {
|
if (arena.playersInArena.size() >= arena.minPlayers) {
|
||||||
arena.gameState = ArenaState.STARTING;
|
arena.gameState = ArenaState.STARTING;
|
||||||
@ -230,13 +230,13 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
for (int i = arena.amountSeekersOnStart; i > 0; i = i - 1) {
|
for (int i = arena.amountSeekersOnStart; i > 0; i = i - 1) {
|
||||||
boolean loop = true;
|
boolean loop = true;
|
||||||
Player seeker = arena.playersInArena.get(W.random.nextInt(arena.playersInArena.size()));
|
Player seeker = arena.playersInArena.get(MemoryStorage.random.nextInt(arena.playersInArena.size()));
|
||||||
|
|
||||||
for (Player playerCheck : arena.playersInArena) {
|
for (Player playerCheck : arena.playersInArena) {
|
||||||
if (W.choosenSeeker.get(playerCheck) != null) {
|
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
||||||
if (W.choosenSeeker.get(playerCheck)) {
|
if (MemoryStorage.choosenSeeker.get(playerCheck)) {
|
||||||
seeker = playerCheck;
|
seeker = playerCheck;
|
||||||
W.choosenSeeker.remove(playerCheck);
|
MemoryStorage.choosenSeeker.remove(playerCheck);
|
||||||
} else {
|
} else {
|
||||||
if (seeker.equals(playerCheck)) {
|
if (seeker.equals(playerCheck)) {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
@ -254,7 +254,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
seeker.getInventory().clear();
|
seeker.getInventory().clear();
|
||||||
seeker.updateInventory();
|
seeker.updateInventory();
|
||||||
seeker.setWalkSpeed(0.3F);
|
seeker.setWalkSpeed(0.3F);
|
||||||
W.seekertime.put(seeker, arena.waitingTimeSeeker);
|
MemoryStorage.seekertime.put(seeker, arena.waitingTimeSeeker);
|
||||||
} else {
|
} else {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
@ -265,11 +265,11 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
if (!arena.seekers.contains(arenaPlayer)) {
|
if (!arena.seekers.contains(arenaPlayer)) {
|
||||||
arenaPlayer.getInventory().clear();
|
arenaPlayer.getInventory().clear();
|
||||||
arenaPlayer.updateInventory();
|
arenaPlayer.updateInventory();
|
||||||
ItemStack block = arena.disguiseBlocks.get(W.random.nextInt(arena.disguiseBlocks.size()));
|
ItemStack block = arena.disguiseBlocks.get(MemoryStorage.random.nextInt(arena.disguiseBlocks.size()));
|
||||||
|
|
||||||
if (W.choosenBlock.get(arenaPlayer) != null) {
|
if (MemoryStorage.choosenBlock.get(arenaPlayer) != null) {
|
||||||
block = W.choosenBlock.get(arenaPlayer);
|
block = MemoryStorage.choosenBlock.get(arenaPlayer);
|
||||||
W.choosenBlock.remove(arenaPlayer);
|
MemoryStorage.choosenBlock.remove(arenaPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getTypeId(), block.getDurability());
|
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getTypeId(), block.getDurability());
|
||||||
@ -281,7 +281,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
blockCount.setDurability(block.getDurability());
|
blockCount.setDurability(block.getDurability());
|
||||||
arenaPlayer.getInventory().setItem(8, blockCount);
|
arenaPlayer.getInventory().setItem(8, blockCount);
|
||||||
arenaPlayer.getInventory().setHelmet(new ItemStack(block));
|
arenaPlayer.getInventory().setHelmet(new ItemStack(block));
|
||||||
W.pBlock.put(arenaPlayer, block);
|
MemoryStorage.pBlock.put(arenaPlayer, block);
|
||||||
|
|
||||||
if (block.getDurability() != 0) {
|
if (block.getDurability() != 0) {
|
||||||
MessageManager.sendFMessage(arenaPlayer, ConfigC.normal_ingameBlock,
|
MessageManager.sendFMessage(arenaPlayer, ConfigC.normal_ingameBlock,
|
||||||
@ -311,11 +311,11 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 1, 1);
|
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (W.seekertime.get(player) != null) {
|
if (MemoryStorage.seekertime.get(player) != null) {
|
||||||
W.seekertime.put(player, W.seekertime.get(player) - 1);
|
MemoryStorage.seekertime.put(player, MemoryStorage.seekertime.get(player) - 1);
|
||||||
if (W.seekertime.get(player) <= 0) {
|
if (MemoryStorage.seekertime.get(player) <= 0) {
|
||||||
player.teleport(arena.hidersWarp);
|
player.teleport(arena.hidersWarp);
|
||||||
W.seekertime.remove(player);
|
MemoryStorage.seekertime.remove(player);
|
||||||
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerSpawned, "playername-" + player.getName());
|
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerSpawned, "playername-" + player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -383,12 +383,12 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
for (Player player : arena.playersInArena) {
|
for (Player player : arena.playersInArena) {
|
||||||
if (!arena.seekers.contains(player)) {
|
if (!arena.seekers.contains(player)) {
|
||||||
Location pLoc = player.getLocation();
|
Location pLoc = player.getLocation();
|
||||||
Location moveLoc = W.moveLoc.get(player);
|
Location moveLoc = MemoryStorage.moveLoc.get(player);
|
||||||
ItemStack block = player.getInventory().getItem(8);
|
ItemStack block = player.getInventory().getItem(8);
|
||||||
|
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
if (W.pBlock.get(player) != null) {
|
if (MemoryStorage.pBlock.get(player) != null) {
|
||||||
block = W.pBlock.get(player);
|
block = MemoryStorage.pBlock.get(player);
|
||||||
player.getInventory().setItem(8, block);
|
player.getInventory().setItem(8, block);
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
@ -403,9 +403,9 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
if (pBlock.getType().equals(Material.AIR) || pBlock.getType().equals(Material.WATER)
|
if (pBlock.getType().equals(Material.AIR) || pBlock.getType().equals(Material.WATER)
|
||||||
|| pBlock.getType().equals(Material.STATIONARY_WATER)) {
|
|| pBlock.getType().equals(Material.STATIONARY_WATER)) {
|
||||||
if (pBlock.getType().equals(Material.WATER) || pBlock.getType().equals(Material.STATIONARY_WATER)) {
|
if (pBlock.getType().equals(Material.WATER) || pBlock.getType().equals(Material.STATIONARY_WATER)) {
|
||||||
W.hiddenLocWater.put(player, true);
|
MemoryStorage.hiddenLocWater.put(player, true);
|
||||||
} else {
|
} else {
|
||||||
W.hiddenLocWater.put(player, false);
|
MemoryStorage.hiddenLocWater.put(player, false);
|
||||||
}
|
}
|
||||||
if (DisguiseAPI.isDisguised(player)) {
|
if (DisguiseAPI.isDisguised(player)) {
|
||||||
DisguiseAPI.undisguiseToAll(player);
|
DisguiseAPI.undisguiseToAll(player);
|
||||||
@ -418,7 +418,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
block.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
block.addUnsafeEnchantment(Enchantment.DURABILITY, 10);
|
||||||
player.playSound(pLoc, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
player.playSound(pLoc, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
||||||
W.hiddenLoc.put(player, moveLoc);
|
MemoryStorage.hiddenLoc.put(player, moveLoc);
|
||||||
if (block.getDurability() != 0) {
|
if (block.getDurability() != 0) {
|
||||||
MessageManager.sendFMessage(
|
MessageManager.sendFMessage(
|
||||||
player,
|
player,
|
||||||
@ -462,8 +462,9 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
ArenaHandler.stopArena(arena);
|
String cause = "[BlockHunt] Arena " + arena.arenaName + " has been stopped";
|
||||||
|
ArenaHandler.stopArena(arena, cause, ConfigC.warning_arenaStopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageManager.sendFMessage(null, ConfigC.log_disabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "autors-"
|
MessageManager.sendFMessage(null, ConfigC.log_disabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "autors-"
|
||||||
@ -498,7 +499,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
player = (Player) sender;
|
player = (Player) sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CommandManager command : W.commands) {
|
for (CommandManager command : MemoryStorage.commands) {
|
||||||
String[] argsSplit = null;
|
String[] argsSplit = null;
|
||||||
String[] argsSplitAlias = null;
|
String[] argsSplitAlias = null;
|
||||||
|
|
||||||
@ -528,7 +529,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
if (equals) {
|
if (equals) {
|
||||||
if (PermissionsManager.hasPerm(player, command.permission, true)) {
|
if (PermissionsManager.hasPerm(player, command.permission, true)) {
|
||||||
if (command.enabled) {
|
if (command.enabled) {
|
||||||
command.CMD.exectue(player, cmd, label, args);
|
command.CMD.execute(player, cmd, label, args);
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_commandNotEnabled);
|
MessageManager.sendFMessage(player, ConfigC.error_commandNotEnabled);
|
||||||
}
|
}
|
||||||
@ -538,15 +539,14 @@ public class BlockHunt extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
new CMDnotfound().execute(player,cmd,label, args);;
|
||||||
CMDnotfound.exectue(player, cmd, label, args);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
|
||||||
for (CommandManager command : W.commands) {
|
for (CommandManager command : MemoryStorage.commands) {
|
||||||
if (cmd.getName().equalsIgnoreCase(command.label)) {
|
if (cmd.getName().equalsIgnoreCase(command.label)) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
return command.mainTABlist;
|
return command.mainTABlist;
|
||||||
|
@ -2,14 +2,12 @@ package nl.Steffion.BlockHunt.Commands;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.*;
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
|
||||||
import nl.Steffion.BlockHunt.ScoreboardHandler;
|
|
||||||
import nl.Steffion.BlockHunt.W;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
|
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -17,21 +15,21 @@ import org.bukkit.entity.Player;
|
|||||||
public class CMDcreate extends DefaultCMD {
|
public class CMDcreate extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDcreate.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDcreate.usage);
|
||||||
} else {
|
} else {
|
||||||
if (W.pos1.get(player) != null && W.pos2.get(player) != null) {
|
if (MemoryStorage.pos1.get(player) != null && MemoryStorage.pos2.get(player) != null) {
|
||||||
if (W.pos1.get(player).getWorld().equals(W.pos2.get(player).getWorld())) {
|
if (MemoryStorage.pos1.get(player).getWorld().equals(MemoryStorage.pos2.get(player).getWorld())) {
|
||||||
Arena arena = new Arena(args[1], W.pos1.get(player), W.pos2.get(player), 12, 3, 1, 50, 20, 300, 30, 45, false, false, false, false, false, new ArrayList<>(), null, null, null,
|
Arena arena = new Arena(args[1], new LocationSerializable(MemoryStorage.pos1.get(player)), new LocationSerializable(MemoryStorage.pos2.get(player)), 12, 3, 1, 50, 20, 300, 30, 45, false, false, false, false, false, new ArrayList<>(), null, null, null,
|
||||||
null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), 10, 50, 8, new ArrayList<>(), ArenaState.WAITING,
|
null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), 10, 50, 8, new ArrayList<>(), ArenaState.WAITING,
|
||||||
0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());
|
0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard());
|
||||||
W.arenas.getFile().set(args[1], arena);
|
MemoryStorage.arenas.getFile().set(args[1], arena);
|
||||||
W.arenas.save();
|
MemoryStorage.arenas.save();
|
||||||
W.signs.load();
|
MemoryStorage.signs.load();
|
||||||
|
|
||||||
W.arenaList.add(arena);
|
MemoryStorage.arenaList.add(arena);
|
||||||
ScoreboardHandler.createScoreboard(arena);
|
ScoreboardHandler.createScoreboard(arena);
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_createCreatedArena, "name-" + args[1]);
|
MessageManager.sendFMessage(player, ConfigC.normal_createCreatedArena, "name-" + args[1]);
|
||||||
|
@ -12,7 +12,7 @@ package nl.Steffion.BlockHunt.Commands;
|
|||||||
*/
|
*/
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
import nl.Steffion.BlockHunt.Managers.CommandManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||||
@ -24,9 +24,9 @@ public class CMDhelp extends DefaultCMD {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
int amountCommands = 0;
|
int amountCommands = 0;
|
||||||
for (CommandManager command : W.commands) {
|
for (CommandManager command : MemoryStorage.commands) {
|
||||||
if (command.usage != null) {
|
if (command.usage != null) {
|
||||||
amountCommands = amountCommands + 1;
|
amountCommands = amountCommands + 1;
|
||||||
}
|
}
|
||||||
@ -41,13 +41,13 @@ public class CMDhelp extends DefaultCMD {
|
|||||||
int page = 1;
|
int page = 1;
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName() + " %Nhelp page %A" + page + "%N/%A" + maxPages);
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName() + " %Nhelp page %A" + page + "%N/%A" + maxPages);
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (CommandManager command : W.commands) {
|
for (CommandManager command : MemoryStorage.commands) {
|
||||||
if (i <= 4) {
|
if (i <= 4) {
|
||||||
if (command.usage != null) {
|
if (command.usage != null) {
|
||||||
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
||||||
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + W.messages.getFile().get(command.help.location));
|
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendMessage(player, "%W" + command.usage + "%N - " + W.messages.getFile().get(command.help.location));
|
MessageManager.sendMessage(player, "%MemoryStorage" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
@ -70,14 +70,14 @@ public class CMDhelp extends DefaultCMD {
|
|||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName() + " %Nhelp page %A" + page + "%N/%A" + maxPages);
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName() + " %Nhelp page %A" + page + "%N/%A" + maxPages);
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (CommandManager command : W.commands) {
|
for (CommandManager command : MemoryStorage.commands) {
|
||||||
if (i <= (page * 4) + 4) {
|
if (i <= (page * 4) + 4) {
|
||||||
if (command.usage != null) {
|
if (command.usage != null) {
|
||||||
if (i >= ((page - 1) * 4) + 1 && i <= ((page - 1) * 4) + 4) {
|
if (i >= ((page - 1) * 4) + 1 && i <= ((page - 1) * 4) + 4) {
|
||||||
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
if (PermissionsManager.hasPerm(player, command.permission, false)) {
|
||||||
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + W.messages.getFile().get(command.help.location));
|
MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendMessage(player, "%W" + command.usage + "%N - " + W.messages.getFile().get(command.help.location));
|
MessageManager.sendMessage(player, "%MemoryStorage" + command.usage + "%N - " + MemoryStorage.messages.getFile().get(command.help.location));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
|
@ -21,7 +21,7 @@ public class CMDinfo extends DefaultCMD {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName());
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName());
|
||||||
MessageManager.sendMessage(player, "%A%name%%N made by %A%autors%%N.", "name-" + BlockHunt.pdfFile.getName(), "autors-" + BlockHunt.pdfFile.getAuthors().get(0));
|
MessageManager.sendMessage(player, "%A%name%%N made by %A%autors%%N.", "name-" + BlockHunt.pdfFile.getName(), "autors-" + BlockHunt.pdfFile.getAuthors().get(0));
|
||||||
MessageManager.sendMessage(player, "%NVersion: %A%version%%N.", "version-" + BlockHunt.pdfFile.getVersion());
|
MessageManager.sendMessage(player, "%NVersion: %A%version%%N.", "version-" + BlockHunt.pdfFile.getVersion());
|
||||||
|
@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class CMDjoin extends DefaultCMD {
|
public class CMDjoin extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDjoin.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDjoin.usage);
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class CMDleave extends DefaultCMD {
|
public class CMDleave extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ArenaHandler.playerLeaveArena(player, true, true);
|
ArenaHandler.playerLeaveArena(player, true, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,7 +3,7 @@ package nl.Steffion.BlockHunt.Commands;
|
|||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -12,11 +12,11 @@ import org.bukkit.entity.Player;
|
|||||||
public class CMDlist extends DefaultCMD {
|
public class CMDlist extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName());
|
MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName());
|
||||||
if (W.arenaList.size() >= 1) {
|
if (MemoryStorage.arenaList.size() >= 1) {
|
||||||
MessageManager.sendMessage(player, "&7Available arena(s):");
|
MessageManager.sendMessage(player, "&7Available arena(s):");
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
MessageManager.sendMessage(player, "%A" + arena.arenaName);
|
MessageManager.sendMessage(player, "%A" + arena.arenaName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,10 +16,10 @@ import nl.Steffion.BlockHunt.Managers.MessageManager;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CMDnotfound {
|
public class CMDnotfound extends DefaultCMD {
|
||||||
|
|
||||||
|
@Override
|
||||||
public static boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_commandNotFound);
|
MessageManager.sendFMessage(player, ConfigC.error_commandNotFound);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ package nl.Steffion.BlockHunt.Commands;
|
|||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
@ -24,16 +24,17 @@ public class CMDreload extends DefaultCMD {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
ConfigManager.newFiles();
|
ConfigManager.newFiles();
|
||||||
|
|
||||||
W.config.load();
|
MemoryStorage.config.load();
|
||||||
W.messages.load();
|
MemoryStorage.messages.load();
|
||||||
W.arenas.load();
|
MemoryStorage.arenas.load();
|
||||||
W.signs.load();
|
MemoryStorage.signs.load();
|
||||||
W.shop.load();
|
MemoryStorage.shop.load();
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
ArenaHandler.stopArena(arena);
|
String cause = "[BlockHunt] Arena " + arena.arenaName + " has been stopped";
|
||||||
|
ArenaHandler.stopArena(arena, cause, ConfigC.warning_arenaStopped);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArenaHandler.loadArenas();
|
ArenaHandler.loadArenas();
|
||||||
|
@ -3,7 +3,7 @@ package nl.Steffion.BlockHunt.Commands;
|
|||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
@ -16,29 +16,29 @@ import org.bukkit.entity.Player;
|
|||||||
public class CMDremove extends DefaultCMD {
|
public class CMDremove extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDremove.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDremove.usage);
|
||||||
} else {
|
} else {
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (args[1].equalsIgnoreCase(arena.arenaName)) {
|
if (args[1].equalsIgnoreCase(arena.arenaName)) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_removeRemovedArena, "name-" + args[1]);
|
MessageManager.sendFMessage(player, ConfigC.normal_removeRemovedArena, "name-" + args[1]);
|
||||||
W.arenas.getFile().set(args[1], null);
|
MemoryStorage.arenas.getFile().set(args[1], null);
|
||||||
for (String sign : W.signs.getFile().getKeys(false)) {
|
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||||
if (W.signs.getFile().get(sign + ".arenaName").toString().equalsIgnoreCase(args[1])) {
|
if (MemoryStorage.signs.getFile().get(sign + ".arenaName").toString().equalsIgnoreCase(args[1])) {
|
||||||
Location signLoc = (Location) W.signs.getFile().get(sign + ".location");
|
Location signLoc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||||
signLoc.getBlock().setType(Material.AIR);
|
signLoc.getBlock().setType(Material.AIR);
|
||||||
signLoc.getWorld().playEffect(signLoc, Effect.MOBSPAWNER_FLAMES, 0);
|
signLoc.getWorld().playEffect(signLoc, Effect.MOBSPAWNER_FLAMES, 0);
|
||||||
signLoc.getWorld().playSound(signLoc, Sound.ENTITY_ENDERDRAGON_FLAP, 1, 1);
|
signLoc.getWorld().playSound(signLoc, Sound.ENTITY_ENDERDRAGON_FLAP, 1, 1);
|
||||||
W.signs.getFile().set(sign, null);
|
MemoryStorage.signs.getFile().set(sign, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
W.arenas.save();
|
MemoryStorage.arenas.save();
|
||||||
W.signs.load();
|
MemoryStorage.signs.load();
|
||||||
|
|
||||||
W.arenaList.remove(arena);
|
MemoryStorage.arenaList.remove(arena);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class CMDset extends DefaultCMD {
|
public class CMDset extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDset.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDset.usage);
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package nl.Steffion.BlockHunt.Commands;
|
package nl.Steffion.BlockHunt.Commands;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.*;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
|
||||||
import nl.Steffion.BlockHunt.W;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
|
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -14,7 +12,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class CMDsetwarp extends DefaultCMD {
|
public class CMDsetwarp extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 2) {
|
if (args.length <= 2) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDsetwarp.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDsetwarp.usage);
|
||||||
@ -23,7 +21,7 @@ public class CMDsetwarp extends DefaultCMD {
|
|||||||
String warpname = args[1];
|
String warpname = args[1];
|
||||||
|
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : W.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
}
|
}
|
||||||
@ -31,19 +29,19 @@ public class CMDsetwarp extends DefaultCMD {
|
|||||||
if (arena != null) {
|
if (arena != null) {
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
if (warpname.equalsIgnoreCase("lobby")) {
|
if (warpname.equalsIgnoreCase("lobby")) {
|
||||||
arena.lobbyWarp = loc;
|
arena.lobbyWarp = new LocationSerializable(loc);
|
||||||
save(arena);
|
save(arena);
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||||
} else if (warpname.equalsIgnoreCase("hiders")) {
|
} else if (warpname.equalsIgnoreCase("hiders")) {
|
||||||
arena.hidersWarp = loc;
|
arena.hidersWarp = new LocationSerializable(loc);
|
||||||
save(arena);
|
save(arena);
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||||
} else if (warpname.equalsIgnoreCase("seekers")) {
|
} else if (warpname.equalsIgnoreCase("seekers")) {
|
||||||
arena.seekersWarp = loc;
|
arena.seekersWarp = new LocationSerializable(loc);
|
||||||
save(arena);
|
save(arena);
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||||
} else if (warpname.equalsIgnoreCase("spawn")) {
|
} else if (warpname.equalsIgnoreCase("spawn")) {
|
||||||
arena.spawnWarp = loc;
|
arena.spawnWarp = new LocationSerializable(loc);
|
||||||
save(arena);
|
save(arena);
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname);
|
||||||
} else {
|
} else {
|
||||||
@ -60,8 +58,8 @@ public class CMDsetwarp extends DefaultCMD {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void save(Arena arena) {
|
public void save(Arena arena) {
|
||||||
W.arenas.getFile().set(arena.arenaName, arena);
|
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||||
W.arenas.save();
|
MemoryStorage.arenas.save();
|
||||||
ArenaHandler.loadArenas();
|
ArenaHandler.loadArenas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class CMDshop extends DefaultCMD {
|
public class CMDshop extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
InventoryHandler.openShop(player);
|
InventoryHandler.openShop(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import nl.Steffion.BlockHunt.Arena;
|
|||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -13,13 +13,13 @@ import org.bukkit.entity.Player;
|
|||||||
public class CMDstart extends DefaultCMD {
|
public class CMDstart extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDstart.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDstart.usage);
|
||||||
} else {
|
} else {
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : W.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.arenaName.equalsIgnoreCase(args[1])) {
|
if (arena2.arenaName.equalsIgnoreCase(args[1])) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ package nl.Steffion.BlockHunt.Commands;
|
|||||||
*/
|
*/
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -23,7 +23,7 @@ public class CMDtokens extends DefaultCMD {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (args.length <= 3) {
|
if (args.length <= 3) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDtokens.usage);
|
MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDtokens.usage);
|
||||||
} else {
|
} else {
|
||||||
@ -48,26 +48,26 @@ public class CMDtokens extends DefaultCMD {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (option.equalsIgnoreCase("set")) {
|
if (option.equalsIgnoreCase("set")) {
|
||||||
W.shop.getFile().set(tokenPlayer.getName() + ".tokens", amount);
|
MemoryStorage.shop.getFile().set(tokenPlayer.getName() + ".tokens", amount);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Set", "playername-" + tokenPlayer.getName(), "option2-to", "amount-" + amount);
|
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Set", "playername-" + tokenPlayer.getName(), "option2-to", "amount-" + amount);
|
||||||
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-set", "playername-" + name, "option2-to", "amount-" + amount);
|
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-set", "playername-" + name, "option2-to", "amount-" + amount);
|
||||||
} else if (option.equalsIgnoreCase("add")) {
|
} else if (option.equalsIgnoreCase("add")) {
|
||||||
int tokens = 0;
|
int tokens = 0;
|
||||||
if (W.shop.getFile().getInt(tokenPlayer.getName() + ".tokens") != 0) {
|
if (MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens") != 0) {
|
||||||
tokens = W.shop.getFile().getInt(tokenPlayer.getName() + ".tokens");
|
tokens = MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens");
|
||||||
}
|
}
|
||||||
W.shop.getFile().set(tokenPlayer.getName() + ".tokens", tokens + amount);
|
MemoryStorage.shop.getFile().set(tokenPlayer.getName() + ".tokens", tokens + amount);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Added", "playername-" + tokenPlayer.getName(), "option2-to", "amount-" + amount);
|
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Added", "playername-" + tokenPlayer.getName(), "option2-to", "amount-" + amount);
|
||||||
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-added", "playername-" + name, "option2-to", "amount-" + amount);
|
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-added", "playername-" + name, "option2-to", "amount-" + amount);
|
||||||
} else if (option.equalsIgnoreCase("take")) {
|
} else if (option.equalsIgnoreCase("take")) {
|
||||||
int tokens = 0;
|
int tokens = 0;
|
||||||
if (W.shop.getFile().getInt(tokenPlayer.getName() + ".tokens") != 0) {
|
if (MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens") != 0) {
|
||||||
tokens = W.shop.getFile().getInt(tokenPlayer.getName() + ".tokens");
|
tokens = MemoryStorage.shop.getFile().getInt(tokenPlayer.getName() + ".tokens");
|
||||||
}
|
}
|
||||||
W.shop.getFile().set(tokenPlayer.getName() + ".tokens", tokens - amount);
|
MemoryStorage.shop.getFile().set(tokenPlayer.getName() + ".tokens", tokens - amount);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Took", "playername-" + tokenPlayer.getName(), "option2-from", "amount-" + amount);
|
MessageManager.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Took", "playername-" + tokenPlayer.getName(), "option2-from", "amount-" + amount);
|
||||||
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-took", "playername-" + name, "option2-from", "amount-" + amount);
|
MessageManager.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-took", "playername-" + name, "option2-from", "amount-" + amount);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -17,13 +17,13 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
public class CMDwand extends DefaultCMD {
|
public class CMDwand extends DefaultCMD {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public boolean execute(Player player, Command cmd, String label, String[] args) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ItemStack wand = new ItemStack(Material.getMaterial((String) W.config.get(ConfigC.wandIDname)));
|
ItemStack wand = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.wandIDname)));
|
||||||
ItemMeta im = wand.getItemMeta();
|
ItemMeta im = wand.getItemMeta();
|
||||||
im.setDisplayName(MessageManager.replaceAll((String) W.config.get(ConfigC.wandName)));
|
im.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.wandName)));
|
||||||
W.config.load();
|
MemoryStorage.config.load();
|
||||||
List<String> lores = W.config.getFile().getStringList(ConfigC.wandDescription.location);
|
List<String> lores = MemoryStorage.config.getFile().getStringList(ConfigC.wandDescription.location);
|
||||||
List<String> lores2 = new ArrayList<>();
|
List<String> lores2 = new ArrayList<>();
|
||||||
for (String lore : lores) {
|
for (String lore : lores) {
|
||||||
lores2.add(MessageManager.replaceAll(lore));
|
lores2.add(MessageManager.replaceAll(lore));
|
||||||
|
@ -10,17 +10,12 @@ package nl.Steffion.BlockHunt.Commands;
|
|||||||
*
|
*
|
||||||
* @author Steffion
|
* @author Steffion
|
||||||
*/
|
*/
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class DefaultCMD {
|
public abstract class DefaultCMD {
|
||||||
|
|
||||||
|
|
||||||
public boolean exectue(Player player, Command cmd, String label, String[] args) {
|
public abstract boolean execute(Player player, Command cmd, String label, String[] args);
|
||||||
MessageManager.sendMessage(player, "%TAG%NExample of a Command!");
|
|
||||||
// TODO Place the command stuff here.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,95 +15,95 @@ import nl.Steffion.BlockHunt.Managers.ConfigManager;
|
|||||||
public enum ConfigC {
|
public enum ConfigC {
|
||||||
|
|
||||||
|
|
||||||
chat_tag("[" + BlockHunt.pdfFile.getName() + "] ", W.config), chat_normal("&b", W.config), chat_warning("&c", W.config), chat_error("&c", W.config), chat_arg("&e",
|
chat_tag("[" + BlockHunt.pdfFile.getName() + "] ", MemoryStorage.config), chat_normal("&b", MemoryStorage.config), chat_warning("&c", MemoryStorage.config), chat_error("&c", MemoryStorage.config), chat_arg("&e",
|
||||||
W.config), chat_header("&9", W.config), chat_headerhigh("%H_______.[ %A%header%%H ]._______", W.config),
|
MemoryStorage.config), chat_header("&9", MemoryStorage.config), chat_headerhigh("%H_______.[ %A%header%%H ]._______", MemoryStorage.config),
|
||||||
|
|
||||||
commandEnabled_info(true, W.config), commandEnabled_help(true, W.config), commandEnabled_reload(true, W.config), commandEnabled_join(true, W.config), commandEnabled_leave(
|
commandEnabled_info(true, MemoryStorage.config), commandEnabled_help(true, MemoryStorage.config), commandEnabled_reload(true, MemoryStorage.config), commandEnabled_join(true, MemoryStorage.config), commandEnabled_leave(
|
||||||
true, W.config), commandEnabled_list(true, W.config), commandEnabled_shop(true, W.config), commandEnabled_start(true, W.config), commandEnabled_wand(true,
|
true, MemoryStorage.config), commandEnabled_list(true, MemoryStorage.config), commandEnabled_shop(true, MemoryStorage.config), commandEnabled_start(true, MemoryStorage.config), commandEnabled_wand(true,
|
||||||
W.config), commandEnabled_create(true, W.config), commandEnabled_set(true, W.config), commandEnabled_setwarp(true, W.config), commandEnabled_remove(true,
|
MemoryStorage.config), commandEnabled_create(true, MemoryStorage.config), commandEnabled_set(true, MemoryStorage.config), commandEnabled_setwarp(true, MemoryStorage.config), commandEnabled_remove(true,
|
||||||
W.config), commandEnabled_tokens(true, W.config),
|
MemoryStorage.config), commandEnabled_tokens(true, MemoryStorage.config),
|
||||||
|
|
||||||
autoUpdateCheck(true, W.config), autoDownloadUpdate(false, W.config),
|
autoUpdateCheck(true, MemoryStorage.config), autoDownloadUpdate(false, MemoryStorage.config),
|
||||||
|
|
||||||
wandIDname("STICK", W.config), wandName("%A&l" + BlockHunt.pdfFile.getName() + "%N's selection wand", W.config), wandDescription(new String[] {
|
wandIDname("STICK", MemoryStorage.config), wandName("%A&l" + BlockHunt.pdfFile.getName() + "%N's selection wand", MemoryStorage.config), wandDescription(new String[] {
|
||||||
"%NUse this item to select an arena for your arena.", "%ALeft-Click%N to select point #1.", "%ARight-Click%N to select point #2.",
|
"%NUse this item to select an arena for your arena.", "%ALeft-Click%N to select point #1.", "%ARight-Click%N to select point #2.",
|
||||||
"%NUse the create command to define your arena.", "%A/" + BlockHunt.pdfFile.getName() + " <help|h>" }, W.config),
|
"%NUse the create command to define your arena.", "%A/" + BlockHunt.pdfFile.getName() + " <help|h>" }, MemoryStorage.config),
|
||||||
|
|
||||||
shop_title("%H&lBlockHunt %NShop", W.config), shop_price("%NPrice: %A%amount% %Ntokens.", W.config),
|
shop_title("%H&lBlockHunt %NShop", MemoryStorage.config), shop_price("%NPrice: %A%amount% %Ntokens.", MemoryStorage.config),
|
||||||
|
|
||||||
shop_blockChooserv1Enabled(true, W.config), shop_blockChooserv1IDname("BOOK", W.config), shop_blockChooserv1Price(3000, W.config), shop_blockChooserv1Name(
|
shop_blockChooserv1Enabled(true, MemoryStorage.config), shop_blockChooserv1IDname("BOOK", MemoryStorage.config), shop_blockChooserv1Price(3000, MemoryStorage.config), shop_blockChooserv1Name(
|
||||||
"%H&lBlockHunt Chooser", W.config), shop_blockChooserv1Description(new String[] { "%NUse this item before the arena starts.",
|
"%H&lBlockHunt Chooser", MemoryStorage.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),
|
"%ARight-Click%N in the lobby and choose", "%Nthe block you want to be!", "&6Unlimited uses." }, MemoryStorage.config),
|
||||||
|
|
||||||
shop_BlockHuntPassv2Enabled(true, W.config), shop_BlockHuntPassv2IDName("NAME_TAG", W.config), shop_BlockHuntPassv2Price(150, W.config), shop_BlockHuntPassv2Name(
|
shop_BlockHuntPassv2Enabled(true, MemoryStorage.config), shop_BlockHuntPassv2IDName("NAME_TAG", MemoryStorage.config), shop_BlockHuntPassv2Price(150, MemoryStorage.config), shop_BlockHuntPassv2Name(
|
||||||
"%H&lBlockHunt Pass", W.config), shop_BlockHuntPassv2Description(new String[] { "%NUse this item before the arena starts.",
|
"%H&lBlockHunt Pass", MemoryStorage.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 time use.", }, W.config),
|
"%ARight-Click%N in the lobby and choose", "%Nif you want to be a Hider or a Seeker!", "&61 time use.", }, MemoryStorage.config),
|
||||||
|
|
||||||
sign_LEAVE(new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]", "&4LEAVE", "&8Right-Click", "&8To leave." }, W.config), sign_SHOP(new String[] {
|
sign_LEAVE(new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]", "&4LEAVE", "&8Right-Click", "&8To leave." }, MemoryStorage.config), sign_SHOP(new String[] {
|
||||||
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "&4SHOP", "&8Right-Click", "&8To shop." }, W.config), sign_WAITING(new String[] {
|
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "&4SHOP", "&8Right-Click", "&8To shop." }, MemoryStorage.config), sign_WAITING(new String[] {
|
||||||
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&8Waiting..." }, W.config), sign_STARTING(new String[] {
|
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&8Waiting..." }, MemoryStorage.config), sign_STARTING(new String[] {
|
||||||
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&2Start: %A%timeleft%" }, W.config), sign_INGAME(new String[] {
|
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&2Start: %A%timeleft%" }, MemoryStorage.config), sign_INGAME(new String[] {
|
||||||
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "%EIngame: %A%timeleft%" }, W.config),
|
"%H[" + BlockHunt.pdfFile.getName() + "%H]", "%A%arenaname%", "%A%players%%N/%A%maxplayers%", "%EIngame: %A%timeleft%" }, MemoryStorage.config),
|
||||||
|
|
||||||
scoreboard_enabled(true, W.config), scoreboard_title("%H[" + BlockHunt.pdfFile.getName() + "]", W.config), scoreboard_timeleft("%ATime left:", W.config), scoreboard_seekers(
|
scoreboard_enabled(true, MemoryStorage.config), scoreboard_title("%H[" + BlockHunt.pdfFile.getName() + "]", MemoryStorage.config), scoreboard_timeleft("%ATime left:", MemoryStorage.config), scoreboard_seekers(
|
||||||
"%NSeekers:", W.config), scoreboard_hiders("%NHiders:", W.config),
|
"%NSeekers:", MemoryStorage.config), scoreboard_hiders("%NHiders:", MemoryStorage.config),
|
||||||
|
|
||||||
requireInventoryClearOnJoin(false, W.config),
|
requireInventoryClearOnJoin(false, MemoryStorage.config),
|
||||||
|
|
||||||
log_enabledPlugin("%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%autors%%N.", W.messages), log_disabledPlugin(
|
log_enabledPlugin("%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%autors%%N.", MemoryStorage.messages), log_disabledPlugin(
|
||||||
"%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%autors%%N.", W.messages),
|
"%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%autors%%N.", MemoryStorage.messages),
|
||||||
|
|
||||||
help_info("%NDisplays the plugin's info.", W.messages), help_help("%NShows a list of commands.", W.messages), help_reload("%NReloads all configs.", W.messages), help_join(
|
help_info("%NDisplays the plugin's info.", MemoryStorage.messages), help_help("%NShows a list of commands.", MemoryStorage.messages), help_reload("%NReloads all configs.", MemoryStorage.messages), help_join(
|
||||||
"%NJoins a " + BlockHunt.pdfFile.getName() + " game.", W.messages), help_leave("%NLeave a " + BlockHunt.pdfFile.getName() + " game.", W.messages), help_list(
|
"%NJoins a " + BlockHunt.pdfFile.getName() + " game.", MemoryStorage.messages), help_leave("%NLeave a " + BlockHunt.pdfFile.getName() + " game.", MemoryStorage.messages), help_list(
|
||||||
"%NShows a list of available arenas.", W.messages), help_shop("%NOpens the " + BlockHunt.pdfFile.getName() + " shop.", W.messages), help_start(
|
"%NShows a list of available arenas.", MemoryStorage.messages), help_shop("%NOpens the " + BlockHunt.pdfFile.getName() + " shop.", MemoryStorage.messages), help_start(
|
||||||
"%NForces an arena to start.", W.messages), help_wand("%NGives you the wand selection tool.", W.messages), help_create(
|
"%NForces an arena to start.", MemoryStorage.messages), help_wand("%NGives you the wand selection tool.", MemoryStorage.messages), help_create(
|
||||||
"%NCreates an arena from your selection.", W.messages), help_set("%NOpens a panel to set settings.", W.messages), help_setwarp(
|
"%NCreates an arena from your selection.", MemoryStorage.messages), help_set("%NOpens a panel to set settings.", MemoryStorage.messages), help_setwarp(
|
||||||
"%NSets warps for your arena.", W.messages), help_remove("%NDeletes an Arena.", W.messages), help_tokens("%NChange someones tokens.", W.messages),
|
"%NSets warps for your arena.", MemoryStorage.messages), help_remove("%NDeletes an Arena.", MemoryStorage.messages), help_tokens("%NChange someones tokens.", MemoryStorage.messages),
|
||||||
|
|
||||||
button_add("%NAdd %A%1%%N to %A%2%%N", W.messages), button_add2("Add", W.messages), button_setting("%NSetting %A%1%%N is now: %A%2%%N.", W.messages), button_remove(
|
button_add("%NAdd %A%1%%N to %A%2%%N", MemoryStorage.messages), button_add2("Add", MemoryStorage.messages), button_setting("%NSetting %A%1%%N is now: %A%2%%N.", MemoryStorage.messages), button_remove(
|
||||||
"%NRemove %A%1%%N from %A%2%%N", W.messages), button_remove2("Remove", W.messages),
|
"%NRemove %A%1%%N from %A%2%%N", MemoryStorage.messages), button_remove2("Remove", MemoryStorage.messages),
|
||||||
|
|
||||||
normal_reloadedConfigs("%TAG&aReloaded all configs!", W.messages), normal_joinJoinedArena("%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)", W.messages), normal_leaveYouLeft(
|
normal_reloadedConfigs("%TAG&aReloaded all configs!", MemoryStorage.messages), normal_joinJoinedArena("%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)", MemoryStorage.messages), normal_leaveYouLeft(
|
||||||
"%TAG%NYou left the arena! Thanks for playing!", W.messages), normal_leaveLeftArena("%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)", W.messages), normal_startForced(
|
"%TAG%NYou left the arena! Thanks for playing!", MemoryStorage.messages), normal_leaveLeftArena("%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)", MemoryStorage.messages), normal_startForced(
|
||||||
"%TAG%NYou forced to start arena '%A%arenaname%%N'!", W.messages), normal_wandGaveWand("%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)", W.messages), normal_wandSetPosition(
|
"%TAG%NYou forced to start arena '%A%arenaname%%N'!", MemoryStorage.messages), normal_wandGaveWand("%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)", MemoryStorage.messages), normal_wandSetPosition(
|
||||||
"%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N, %A%z%%N).", W.messages), normal_createCreatedArena(
|
"%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N, %A%z%%N).", MemoryStorage.messages), normal_createCreatedArena(
|
||||||
"%TAG%NCreated an arena with the name '%A%name%%N'.", W.messages), normal_lobbyArenaIsStarting("%TAG%NThe arena will start in %A%1%%N second(s)!", W.messages), normal_lobbyArenaStarted(
|
"%TAG%NCreated an arena with the name '%A%name%%N'.", MemoryStorage.messages), normal_lobbyArenaIsStarting("%TAG%NThe arena will start in %A%1%%N second(s)!", MemoryStorage.messages), normal_lobbyArenaStarted(
|
||||||
"%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!", W.messages), normal_ingameSeekerChoosen(
|
"%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!", MemoryStorage.messages), normal_ingameSeekerChoosen(
|
||||||
"%TAG%NPlayer %A%seeker%%N has been choosen as seeker!", W.messages), normal_ingameBlock("%TAG%NYou're disguised as a(n) '%A%block%%N' block.", W.messages), normal_ingameArenaEnd(
|
"%TAG%NPlayer %A%seeker%%N has been choosen as seeker!", MemoryStorage.messages), normal_ingameBlock("%TAG%NYou're disguised as a(n) '%A%block%%N' block.", MemoryStorage.messages), normal_ingameArenaEnd(
|
||||||
"%TAG%NThe arena will end in %A%1%%N second(s)!", W.messages), normal_ingameSeekerSpawned("%TAG%A%playername%%N has spawned as a seeker!", W.messages), normal_ingameGivenSword(
|
"%TAG%NThe arena will end in %A%1%%N second(s)!", MemoryStorage.messages), normal_ingameSeekerSpawned("%TAG%A%playername%%N has spawned as a seeker!", MemoryStorage.messages), normal_ingameGivenSword(
|
||||||
"%TAG%NYou were given a sword!", W.messages), normal_ingameHiderDied("%TAG%NHider %A%playername%%N was killed by %A%killer%%N!", W.messages), normal_ingameHidersLeft(
|
"%TAG%NYou were given a sword!", MemoryStorage.messages), normal_ingameHiderDied("%TAG%NHider %A%playername%%N was killed by %A%killer%%N!", MemoryStorage.messages), normal_ingameHidersLeft(
|
||||||
"%NHider(s) left: %A%left%%N", W.messages), normal_ingameSeekerDied("%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!", W.messages), normal_winSeekers(
|
"%NHider(s) left: %A%left%%N", MemoryStorage.messages), normal_ingameSeekerDied("%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!", MemoryStorage.messages), normal_winSeekers(
|
||||||
"%TAG%NThe %ASEEKERS%N have won!", W.messages), normal_winHiders("%TAG%NThe %AHIDERS%N have won!", W.messages), normal_setwarpWarpSet(
|
"%TAG%NThe %ASEEKERS%N have won!", MemoryStorage.messages), normal_winHiders("%TAG%NThe %AHIDERS%N have won!", MemoryStorage.messages), normal_setwarpWarpSet(
|
||||||
"%TAG%NSet warp '%A%warp%%N' to your location!", W.messages), normal_addedToken("%TAG%A%amount%%N tokens were added to your account!", W.messages), normal_removeRemovedArena(
|
"%TAG%NSet warp '%A%warp%%N' to your location!", MemoryStorage.messages), normal_addedToken("%TAG%A%amount%%N tokens were added to your account!", MemoryStorage.messages), normal_removeRemovedArena(
|
||||||
"%TAG%NRemoved arena '%A%name%%N'!", W.messages), normal_tokensChanged("%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.", W.messages), normal_tokensChangedPerson(
|
"%TAG%NRemoved arena '%A%name%%N'!", MemoryStorage.messages), normal_tokensChanged("%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.", MemoryStorage.messages), normal_tokensChangedPerson(
|
||||||
"%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.", MemoryStorage.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!", MemoryStorage.messages), normal_ingameNoMoreSolid("%TAG%NYou're no longer a solid block!", MemoryStorage.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!", MemoryStorage.messages), normal_shopChoosenBlock("%TAG%NYou've choosen to be a(n) '%A%block%%N' block!", MemoryStorage.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), normal_ingameBlocksLeft("%TAG%NRemaining blocks: %A%1%%N", W.messages),
|
"%TAG%NYou've choosen to be a %Aseeker%N!", MemoryStorage.messages), normal_shopChoosenHiders("%TAG%NYou've choosen to be a %Ahider%N!", MemoryStorage.messages), normal_ingameBlocksLeft("%TAG%NRemaining blocks: %A%1%%N", MemoryStorage.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%%MemoryStorage player(s) to start the game!", MemoryStorage.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!", MemoryStorage.messages), warning_unableToCommand(
|
||||||
"%TAG%WSorry but that command is disabled in the arena.", W.messages), warning_ingameNoSolidPlace("%TAG%WThat's not a valid place to become solid!",
|
"%TAG%WSorry but that command is disabled in the arena.", MemoryStorage.messages), warning_ingameNoSolidPlace("%TAG%WThat's not a valid place to become solid!",
|
||||||
W.messages), warning_arenaStopped("%TAG%WThe arena has been forced to stop!", W.messages),
|
MemoryStorage.messages), warning_arenaStopped("%TAG%WThe arena has been forced to stop!", MemoryStorage.messages),
|
||||||
|
|
||||||
error_noPermission("%TAG%EYou don't have the permissions to do that!", W.messages), error_notANumber("%TAG%E'%A%1%%E' is not a number!", W.messages), error_commandNotEnabled(
|
error_noPermission("%TAG%EYou don't have the permissions to do that!", MemoryStorage.messages), error_notANumber("%TAG%E'%A%1%%E' is not a number!", MemoryStorage.messages), error_commandNotEnabled(
|
||||||
"%TAG%EThis command has been disabled!", W.messages), error_commandNotFound("%TAG%ECouldn't find the command. Try %A/" + BlockHunt.pdfFile.getName()
|
"%TAG%EThis command has been disabled!", MemoryStorage.messages), error_commandNotFound("%TAG%ECouldn't find the command. Try %A/" + BlockHunt.pdfFile.getName()
|
||||||
+ " help %Efor more info.", W.messages), error_notEnoughArguments("%TAG%EYou're missing arguments, correct syntax: %A%syntax%", W.messages), error_libsDisguisesNotInstalled(
|
+ " help %Efor more info.", MemoryStorage.messages), error_notEnoughArguments("%TAG%EYou're missing arguments, correct syntax: %A%syntax%", MemoryStorage.messages), error_libsDisguisesNotInstalled(
|
||||||
"%TAG%EThe plugin '%ALib's Disguises%E' is required to run this plugin! Intall it or it won't work!", W.messages), error_protocolLibNotInstalled(
|
"%TAG%EThe plugin '%ALib's Disguises%E' is required to run this plugin! Intall it or it won't work!", MemoryStorage.messages), error_protocolLibNotInstalled(
|
||||||
"%TAG%EThe plugin '%AProtocolLib%E' is required to run this plugin! Intall it or it won't work!", W.messages), error_noArena(
|
"%TAG%EThe plugin '%AProtocolLib%E' is required to run this plugin! Intall it or it won't work!", MemoryStorage.messages), error_noArena(
|
||||||
"%TAG%ENo arena found with the name '%A%name%%E'.", W.messages), error_onlyIngame("%TAG%EThis is an only in-game command!", W.messages), error_joinAlreadyJoined(
|
"%TAG%ENo arena found with the name '%A%name%%E'.", MemoryStorage.messages), error_onlyIngame("%TAG%EThis is an only in-game command!", MemoryStorage.messages), error_joinAlreadyJoined(
|
||||||
"%TAG%EYou've already joined an arena!", W.messages), error_joinNoBlocksSet("%TAG%EThere are none blocks set for this arena. Notify the administrator.",
|
"%TAG%EYou've already joined an arena!", MemoryStorage.messages), error_joinNoBlocksSet("%TAG%EThere are none blocks set for this arena. Notify the administrator.",
|
||||||
W.messages), error_joinWarpsNotSet("%TAG%EThere are no warps set for this arena. Notify the administrator.", W.messages), error_joinArenaIngame(
|
MemoryStorage.messages), error_joinWarpsNotSet("%TAG%EThere are no warps set for this arena. Notify the administrator.", MemoryStorage.messages), error_joinArenaIngame(
|
||||||
"%TAG%EThis game has already started.", W.messages), error_joinFull("%TAG%EUnable to join this arena. It's full!", W.messages), error_joinInventoryNotEmpty(
|
"%TAG%EThis game has already started.", MemoryStorage.messages), error_joinFull("%TAG%EUnable to join this arena. It's full!", MemoryStorage.messages), error_joinInventoryNotEmpty(
|
||||||
"%TAG%EYour inventory should be empty before joining!", W.messages), error_leaveNotInArena("%TAG%EYou're not in an arena!", W.messages), error_createSelectionFirst(
|
"%TAG%EYour inventory should be empty before joining!", MemoryStorage.messages), error_leaveNotInArena("%TAG%EYou're not in an arena!", MemoryStorage.messages), error_createSelectionFirst(
|
||||||
"%TAG%EMake a selection first. Use the wand command: %A/" + BlockHunt.pdfFile.getName() + " <wand|w>%E.", W.messages), error_createNotSameWorld(
|
"%TAG%EMake a selection first. Use the wand command: %A/" + BlockHunt.pdfFile.getName() + " <wand|w>%E.", MemoryStorage.messages), error_createNotSameWorld(
|
||||||
"%TAG%EMake your selection points in the same world!", W.messages), error_setTooHighNumber("%TAG%EThat amount is too high! Max amount is: %A%max%%E.",
|
"%TAG%EMake your selection points in the same world!", MemoryStorage.messages), error_setTooHighNumber("%TAG%EThat amount is too high! Max amount is: %A%max%%E.",
|
||||||
W.messages), error_setTooLowNumber("%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.", W.messages), error_setNotABlock(
|
MemoryStorage.messages), error_setTooLowNumber("%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.", MemoryStorage.messages), error_setNotABlock(
|
||||||
"%TAG%EThat is not a block!", W.messages), error_setwarpWarpNotFound("%TAG%EWarp '%A%warp%%E' is not valid!", W.messages), error_tokensPlayerNotOnline(
|
"%TAG%EThat is not a block!", MemoryStorage.messages), error_setwarpWarpNotFound("%TAG%EWarp '%A%warp%%E' is not valid!", MemoryStorage.messages), error_tokensPlayerNotOnline(
|
||||||
"%TAG%ENo player found with the name '%A%playername%%E'!", W.messages), error_tokensUnknownsetting("%TAG%E'%A%option%%E' is not a known option!", W.messages), error_shopNeedMoreTokens(
|
"%TAG%ENo player found with the name '%A%playername%%E'!", MemoryStorage.messages), error_tokensUnknownsetting("%TAG%E'%A%option%%E' is not a known option!", MemoryStorage.messages), error_shopNeedMoreTokens(
|
||||||
"%TAG%EYou need more tokens before you can buy this item.", W.messages), error_shopMaxSeekersReached(
|
"%TAG%EYou need more tokens before you can buy this item.", MemoryStorage.messages), error_shopMaxSeekersReached(
|
||||||
"%TAG%ESorry, the maximum amount of seekers has been reached!", W.messages), error_shopMaxHidersReached(
|
"%TAG%ESorry, the maximum amount of seekers has been reached!", MemoryStorage.messages), error_shopMaxHidersReached(
|
||||||
"%TAG%ESorry, the maximum amount of hiders has been reached!", W.messages);
|
"%TAG%ESorry, the maximum amount of hiders has been reached!", MemoryStorage.messages);
|
||||||
|
|
||||||
public Object value;
|
public Object value;
|
||||||
public ConfigManager config;
|
public ConfigManager config;
|
||||||
|
@ -20,7 +20,7 @@ public class InventoryHandler {
|
|||||||
public static void openPanel(Player player, String arenaname) {
|
public static void openPanel(Player player, String arenaname) {
|
||||||
|
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : W.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ public class InventoryHandler {
|
|||||||
public static void updownButton(Inventory panel, Arena arena, ArenaType at, String option, String addremove, ItemStack UP, ItemStack BUTTON, ItemStack DOWN, int up,
|
public static void updownButton(Inventory panel, Arena arena, ArenaType at, String option, String addremove, ItemStack UP, ItemStack BUTTON, ItemStack DOWN, int up,
|
||||||
int button, int down) {
|
int button, int down) {
|
||||||
ItemMeta UP_IM = UP.getItemMeta();
|
ItemMeta UP_IM = UP.getItemMeta();
|
||||||
UP_IM.setDisplayName(MessageManager.replaceAll((String) W.messages.get(ConfigC.button_add), "1-" + addremove, "2-" + option));
|
UP_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_add), "1-" + addremove, "2-" + option));
|
||||||
UP.setItemMeta(UP_IM);
|
UP.setItemMeta(UP_IM);
|
||||||
|
|
||||||
int setting = 0;
|
int setting = 0;
|
||||||
@ -170,11 +170,11 @@ public class InventoryHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemMeta BUTTON_IM = BUTTON.getItemMeta();
|
ItemMeta BUTTON_IM = BUTTON.getItemMeta();
|
||||||
BUTTON_IM.setDisplayName(MessageManager.replaceAll((String) W.messages.get(ConfigC.button_setting), "1-" + option, "2-" + setting));
|
BUTTON_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_setting), "1-" + option, "2-" + setting));
|
||||||
BUTTON.setItemMeta(BUTTON_IM);
|
BUTTON.setItemMeta(BUTTON_IM);
|
||||||
|
|
||||||
ItemMeta DOWN_IM = DOWN.getItemMeta();
|
ItemMeta DOWN_IM = DOWN.getItemMeta();
|
||||||
DOWN_IM.setDisplayName(MessageManager.replaceAll((String) W.messages.get(ConfigC.button_remove), "1-" + addremove, "2-" + option));
|
DOWN_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.messages.get(ConfigC.button_remove), "1-" + addremove, "2-" + option));
|
||||||
DOWN.setItemMeta(DOWN_IM);
|
DOWN.setItemMeta(DOWN_IM);
|
||||||
|
|
||||||
panel.setItem(up, UP);
|
panel.setItem(up, UP);
|
||||||
@ -203,12 +203,12 @@ public class InventoryHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void openShop(Player player) {
|
public static void openShop(Player player) {
|
||||||
Inventory shop = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_title)));
|
Inventory shop = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_title)));
|
||||||
if (W.shop.getFile().get(player.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
||||||
W.shop.getFile().set(player.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int playerTokens = W.shop.getFile().getInt(player.getName() + ".tokens");
|
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||||
List<String> lores = new ArrayList<>();
|
List<String> lores = new ArrayList<>();
|
||||||
List<String> lores2 = new ArrayList<>();
|
List<String> lores2 = new ArrayList<>();
|
||||||
|
|
||||||
@ -217,40 +217,40 @@ public class InventoryHandler {
|
|||||||
shopTokens_IM.setDisplayName(MessageManager.replaceAll("%N&lTokens: %A" + playerTokens));
|
shopTokens_IM.setDisplayName(MessageManager.replaceAll("%N&lTokens: %A" + playerTokens));
|
||||||
shopTokens.setItemMeta(shopTokens_IM);
|
shopTokens.setItemMeta(shopTokens_IM);
|
||||||
|
|
||||||
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) W.config.get(ConfigC.shop_blockChooserv1IDname)), 1);
|
ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1IDname)), 1);
|
||||||
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta();
|
||||||
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)));
|
shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)));
|
||||||
lores = W.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
|
lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location);
|
||||||
lores2 = new ArrayList<>();
|
lores2 = new ArrayList<>();
|
||||||
for (String lore : lores) {
|
for (String lore : lores) {
|
||||||
lores2.add(MessageManager.replaceAll(lore));
|
lores2.add(MessageManager.replaceAll(lore));
|
||||||
}
|
}
|
||||||
|
|
||||||
lores2.add(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_price), "amount-" + W.config.get(ConfigC.shop_blockChooserv1Price)));
|
lores2.add(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_price), "amount-" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price)));
|
||||||
|
|
||||||
shopBlockChooser_IM.setLore(lores2);
|
shopBlockChooser_IM.setLore(lores2);
|
||||||
shopBlockChooser.setItemMeta(shopBlockChooser_IM);
|
shopBlockChooser.setItemMeta(shopBlockChooser_IM);
|
||||||
|
|
||||||
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) W.config.get(ConfigC.shop_BlockHuntPassv2IDName)), 1);
|
ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2IDName)), 1);
|
||||||
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta();
|
||||||
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
||||||
lores = W.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
|
lores = MemoryStorage.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location);
|
||||||
lores2 = new ArrayList<>();
|
lores2 = new ArrayList<>();
|
||||||
for (String lore : lores) {
|
for (String lore : lores) {
|
||||||
lores2.add(MessageManager.replaceAll(lore));
|
lores2.add(MessageManager.replaceAll(lore));
|
||||||
}
|
}
|
||||||
|
|
||||||
lores2.add(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_price), "amount-" + W.config.get(ConfigC.shop_BlockHuntPassv2Price)));
|
lores2.add(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_price), "amount-" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Price)));
|
||||||
|
|
||||||
shopBlockHuntPass_IM.setLore(lores2);
|
shopBlockHuntPass_IM.setLore(lores2);
|
||||||
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM);
|
||||||
|
|
||||||
shop.setItem(0, shopTokens);
|
shop.setItem(0, shopTokens);
|
||||||
if ((Boolean) W.config.get(ConfigC.shop_blockChooserv1Enabled)
|
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Enabled)
|
||||||
&& (W.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false))) {
|
&& (MemoryStorage.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false))) {
|
||||||
shop.setItem(1, shopBlockChooser);
|
shop.setItem(1, shopBlockChooser);
|
||||||
}
|
}
|
||||||
if ((Boolean) W.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) {
|
||||||
shop.setItem(2, shopBlockHuntPass);
|
shop.setItem(2, shopBlockHuntPass);
|
||||||
}
|
}
|
||||||
player.openInventory(shop);
|
player.openInventory(shop);
|
||||||
|
@ -2,7 +2,7 @@ package nl.Steffion.BlockHunt.Listeners;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -17,7 +17,7 @@ public class OnBlockBreakEvent implements Listener {
|
|||||||
if (ArenaHandler.noPlayersInArenas()) return;
|
if (ArenaHandler.noPlayersInArenas()) return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package nl.Steffion.BlockHunt.Listeners;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -18,7 +18,7 @@ public class OnBlockPlaceEvent implements Listener {
|
|||||||
if (ArenaHandler.noPlayersInArenas()) return;
|
if (ArenaHandler.noPlayersInArenas()) return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import nl.Steffion.BlockHunt.Arena;
|
|||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@ -26,7 +26,6 @@ import org.bukkit.projectiles.ProjectileSource;
|
|||||||
|
|
||||||
public class OnEntityDamageByEntityEvent implements Listener {
|
public class OnEntityDamageByEntityEvent implements Listener {
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||||
if (!(event.getEntity() instanceof Player) || event.getEntity() == null) {
|
if (!(event.getEntity() instanceof Player) || event.getEntity() == null) {
|
||||||
@ -58,7 +57,7 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) {
|
||||||
// Always cancel damage when players are waiting
|
// Always cancel damage when players are waiting
|
||||||
@ -96,27 +95,27 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
DisguiseAPI.undisguiseToAll(player);
|
DisguiseAPI.undisguiseToAll(player);
|
||||||
W.pBlock.remove(player);
|
MemoryStorage.pBlock.remove(player);
|
||||||
|
|
||||||
if (!arena.seekers.contains(player)) {
|
if (!arena.seekers.contains(player)) {
|
||||||
if (W.shop.getFile().get(damager.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(damager.getName() + ".tokens") == null) {
|
||||||
W.shop.getFile().set(damager.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(damager.getName() + ".tokens", 0);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int damagerTokens = W.shop.getFile().getInt(damager.getName() + ".tokens");
|
int damagerTokens = MemoryStorage.shop.getFile().getInt(damager.getName() + ".tokens");
|
||||||
W.shop.getFile().set(damager.getName() + ".tokens", damagerTokens + arena.killTokens);
|
MemoryStorage.shop.getFile().set(damager.getName() + ".tokens", damagerTokens + arena.killTokens);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
|
|
||||||
MessageManager.sendFMessage(damager, ConfigC.normal_addedToken, "amount-" + arena.killTokens);
|
MessageManager.sendFMessage(damager, ConfigC.normal_addedToken, "amount-" + arena.killTokens);
|
||||||
|
|
||||||
if (W.shop.getFile().get(player.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
||||||
W.shop.getFile().set(player.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int playerTokens = W.shop.getFile().getInt(player.getName() + ".tokens");
|
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||||
float addingTokens = ((float) arena.hidersTokenWin - (((float) arena.timer / (float) arena.gameTime) * (float) arena.hidersTokenWin));
|
float addingTokens = ((float) arena.hidersTokenWin - (((float) arena.timer / (float) arena.gameTime) * (float) arena.hidersTokenWin));
|
||||||
W.shop.getFile().set(player.getName() + ".tokens", playerTokens + (int) addingTokens);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens + (int) addingTokens);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + (int) addingTokens);
|
MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + (int) addingTokens);
|
||||||
|
|
||||||
@ -147,7 +146,7 @@ public class OnEntityDamageByEntityEvent implements Listener {
|
|||||||
ArenaHandler.seekersWin(arena);
|
ArenaHandler.seekersWin(arena);
|
||||||
} else {
|
} else {
|
||||||
DisguiseAPI.undisguiseToAll(player);
|
DisguiseAPI.undisguiseToAll(player);
|
||||||
W.seekertime.put(player, arena.waitingTimeSeeker);
|
MemoryStorage.seekertime.put(player, arena.waitingTimeSeeker);
|
||||||
player.teleport(arena.seekersWarp);
|
player.teleport(arena.seekersWarp);
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
player.setWalkSpeed(0.3F);
|
player.setWalkSpeed(0.3F);
|
||||||
|
@ -2,7 +2,7 @@ package nl.Steffion.BlockHunt.Listeners;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -22,7 +22,7 @@ public class OnEntityDamageEvent implements Listener {
|
|||||||
Entity ent = event.getEntity();
|
Entity ent = event.getEntity();
|
||||||
if (ent instanceof Player) {
|
if (ent instanceof Player) {
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
DamageCause cause = event.getCause();
|
DamageCause cause = event.getCause();
|
||||||
switch (cause) {
|
switch (cause) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
package nl.Steffion.BlockHunt.Listeners;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -15,7 +15,7 @@ public class OnFoodLevelChangeEvent implements Listener {
|
|||||||
public void onFoodLevelChangeEvent(FoodLevelChangeEvent event) {
|
public void onFoodLevelChangeEvent(FoodLevelChangeEvent event) {
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
package nl.Steffion.BlockHunt.Listeners;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.*;
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaType;
|
import nl.Steffion.BlockHunt.Arena.ArenaType;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
|
||||||
import nl.Steffion.BlockHunt.InventoryHandler;
|
|
||||||
import nl.Steffion.BlockHunt.W;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -21,12 +18,11 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class OnInventoryClickEvent implements Listener {
|
public class OnInventoryClickEvent implements Listener {
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onInventoryClickEvent(InventoryClickEvent event) {
|
public void onInventoryClickEvent(InventoryClickEvent event) {
|
||||||
Player player = (Player) event.getWhoClicked();
|
Player player = (Player) event.getWhoClicked();
|
||||||
|
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player) && !arena.seekers.contains(player)) {
|
if (arena.playersInArena.contains(player) && !arena.seekers.contains(player)) {
|
||||||
if (event.getSlot() == 8 || event.getSlot() == 39) {
|
if (event.getSlot() == 8 || event.getSlot() == 39) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -54,67 +50,67 @@ public class OnInventoryClickEvent implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (inv.getName().startsWith("\u00A7r")) {
|
if (inv.getName().startsWith("\u00A7r")) {
|
||||||
if (inv.getName().equals(MessageManager.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_title)))) {
|
if (inv.getName().equals(MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_title)))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
ItemStack item = event.getCurrentItem();
|
ItemStack item = event.getCurrentItem();
|
||||||
if (W.shop.getFile().get(player.getName() + ".tokens") == null) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".tokens") == null) {
|
||||||
W.shop.getFile().set(player.getName() + ".tokens", 0);
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", 0);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
int playerTokens = W.shop.getFile().getInt(player.getName() + ".tokens");
|
int playerTokens = MemoryStorage.shop.getFile().getInt(player.getName() + ".tokens");
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
if (item.getType().equals(Material.AIR))
|
if (item.getType().equals(Material.AIR))
|
||||||
return;
|
return;
|
||||||
if (item.getItemMeta().getDisplayName() == null)
|
if (item.getItemMeta().getDisplayName() == null)
|
||||||
return;
|
return;
|
||||||
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(W.config.get(ConfigC.shop_blockChooserv1Name).toString()))) {
|
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name).toString()))) {
|
||||||
if (playerTokens >= (Integer) W.config.get(ConfigC.shop_blockChooserv1Price)) {
|
if (playerTokens >= (Integer) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price)) {
|
||||||
W.shop.getFile().set(player.getName() + ".blockchooser", true);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockchooser", true);
|
||||||
W.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) W.config.get(ConfigC.shop_blockChooserv1Price));
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Price));
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + W.config.get(ConfigC.shop_blockChooserv1Name));
|
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name));
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
||||||
}
|
}
|
||||||
} else if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(W.config.get(ConfigC.shop_BlockHuntPassv2Name).toString()))) {
|
} else if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name).toString()))) {
|
||||||
if (playerTokens >= (Integer) W.config.get(ConfigC.shop_BlockHuntPassv2Price)) {
|
if (playerTokens >= (Integer) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Price)) {
|
||||||
if (W.shop.getFile().get(player.getName() + ".blockhuntpass") == null) {
|
if (MemoryStorage.shop.getFile().get(player.getName() + ".blockhuntpass") == null) {
|
||||||
W.shop.getFile().set(player.getName() + ".blockhuntpass", 0);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", 0);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
W.shop.getFile().set(player.getName() + ".blockhuntpass", (Integer) W.shop.getFile().get(player.getName() + ".blockhuntpass") + 1);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", (Integer) MemoryStorage.shop.getFile().get(player.getName() + ".blockhuntpass") + 1);
|
||||||
W.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) W.config.get(ConfigC.shop_BlockHuntPassv2Price));
|
MemoryStorage.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Price));
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + W.config.get(ConfigC.shop_BlockHuntPassv2Name));
|
MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name));
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryHandler.openShop(player);
|
InventoryHandler.openShop(player);
|
||||||
} else if (inv.getName().contains(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)))) {
|
} else if (inv.getName().contains(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (event.getCurrentItem().getType() != Material.AIR) {
|
if (event.getCurrentItem().getType() != Material.AIR) {
|
||||||
if (event.getCurrentItem().getType().isBlock()) {
|
if (event.getCurrentItem().getType().isBlock()) {
|
||||||
W.choosenBlock.put(player, event.getCurrentItem());
|
MemoryStorage.choosenBlock.put(player, event.getCurrentItem());
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenBlock, "block-"
|
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenBlock, "block-"
|
||||||
+ event.getCurrentItem().getType().toString().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase());
|
+ event.getCurrentItem().getType().toString().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_setNotABlock);
|
MessageManager.sendFMessage(player, ConfigC.error_setNotABlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (inv.getName().contains(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name)))) {
|
} else if (inv.getName().contains(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (event.getCurrentItem().getType() != Material.AIR) {
|
if (event.getCurrentItem().getType() != Material.AIR) {
|
||||||
if (event.getCurrentItem().getType().equals(Material.WOOL) && event.getCurrentItem().getDurability() == (short) 11) {
|
if (event.getCurrentItem().getType().equals(Material.WOOL) && event.getCurrentItem().getDurability() == (short) 11) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
for (Player playerCheck : arena.playersInArena) {
|
for (Player playerCheck : arena.playersInArena) {
|
||||||
if (W.choosenSeeker.get(playerCheck) != null) {
|
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
||||||
if (W.choosenSeeker.get(playerCheck)) {
|
if (MemoryStorage.choosenSeeker.get(playerCheck)) {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,28 +120,28 @@ public class OnInventoryClickEvent implements Listener {
|
|||||||
if (i >= arena.amountSeekersOnStart) {
|
if (i >= arena.amountSeekersOnStart) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_shopMaxSeekersReached);
|
MessageManager.sendFMessage(player, ConfigC.error_shopMaxSeekersReached);
|
||||||
} else {
|
} else {
|
||||||
W.choosenSeeker.put(player, true);
|
MemoryStorage.choosenSeeker.put(player, true);
|
||||||
player.getInventory().setItemInHand(new ItemStack(Material.AIR));
|
player.getInventory().setItemInHand(new ItemStack(Material.AIR));
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenSeeker);
|
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenSeeker);
|
||||||
inv.clear();
|
inv.clear();
|
||||||
if (W.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
||||||
W.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
} else {
|
} else {
|
||||||
W.shop.getFile().set(player.getName() + ".blockhuntpass", W.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (event.getCurrentItem().getType().equals(Material.WOOL) && event.getCurrentItem().getDurability() == (short) 14) {
|
} else if (event.getCurrentItem().getType().equals(Material.WOOL) && event.getCurrentItem().getDurability() == (short) 14) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
for (Player playerCheck : arena.playersInArena) {
|
for (Player playerCheck : arena.playersInArena) {
|
||||||
if (W.choosenSeeker.get(playerCheck) != null) {
|
if (MemoryStorage.choosenSeeker.get(playerCheck) != null) {
|
||||||
if (!W.choosenSeeker.get(playerCheck)) {
|
if (!MemoryStorage.choosenSeeker.get(playerCheck)) {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,17 +151,17 @@ public class OnInventoryClickEvent implements Listener {
|
|||||||
if (i >= (arena.playersInArena.size() - 1)) {
|
if (i >= (arena.playersInArena.size() - 1)) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_shopMaxHidersReached);
|
MessageManager.sendFMessage(player, ConfigC.error_shopMaxHidersReached);
|
||||||
} else {
|
} else {
|
||||||
W.choosenSeeker.put(player, false);
|
MemoryStorage.choosenSeeker.put(player, false);
|
||||||
player.getInventory().setItemInHand(new ItemStack(Material.AIR));
|
player.getInventory().setItemInHand(new ItemStack(Material.AIR));
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenHiders);
|
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenHiders);
|
||||||
inv.clear();
|
inv.clear();
|
||||||
if (W.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
if (MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) {
|
||||||
W.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", null);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
} else {
|
} else {
|
||||||
W.shop.getFile().set(player.getName() + ".blockhuntpass", W.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
MemoryStorage.shop.getFile().set(player.getName() + ".blockhuntpass", MemoryStorage.shop.getFile().getInt(player.getName() + ".blockhuntpass") - 1);
|
||||||
W.shop.save();
|
MemoryStorage.shop.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +173,7 @@ public class OnInventoryClickEvent implements Listener {
|
|||||||
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NBlockHunt arena: %A"), "");
|
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NBlockHunt arena: %A"), "");
|
||||||
|
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : W.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
}
|
}
|
||||||
@ -228,13 +224,13 @@ public class OnInventoryClickEvent implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void save(Arena arena) {
|
public void save(Arena arena) {
|
||||||
W.arenas.getFile().set(arena.arenaName, arena);
|
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||||
W.arenas.save();
|
MemoryStorage.arenas.save();
|
||||||
ArenaHandler.loadArenas();
|
ArenaHandler.loadArenas();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updownButton(Player player, ItemStack item, Arena arena, ArenaType at, int option, int max, int min, int add, int remove) {
|
public static void updownButton(Player player, ItemStack item, Arena arena, ArenaType at, int option, int max, int min, int add, int remove) {
|
||||||
if (item.getItemMeta().getDisplayName().contains((String) W.messages.get(ConfigC.button_add2))) {
|
if (item.getItemMeta().getDisplayName().contains((String) MemoryStorage.messages.get(ConfigC.button_add2))) {
|
||||||
if (option < max) {
|
if (option < max) {
|
||||||
switch (at) {
|
switch (at) {
|
||||||
case maxPlayers:
|
case maxPlayers:
|
||||||
@ -274,7 +270,7 @@ public class OnInventoryClickEvent implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
MessageManager.sendFMessage(player, ConfigC.error_setTooHighNumber, "max-" + max);
|
MessageManager.sendFMessage(player, ConfigC.error_setTooHighNumber, "max-" + max);
|
||||||
}
|
}
|
||||||
} else if (item.getItemMeta().getDisplayName().contains((String) W.messages.get(ConfigC.button_remove2))) {
|
} else if (item.getItemMeta().getDisplayName().contains((String) MemoryStorage.messages.get(ConfigC.button_remove2))) {
|
||||||
if (option > min) {
|
if (option > min) {
|
||||||
switch (at) {
|
switch (at) {
|
||||||
case maxPlayers:
|
case maxPlayers:
|
||||||
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -26,7 +26,7 @@ public class OnInventoryCloseEvent implements Listener {
|
|||||||
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A"), "");
|
String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A"), "");
|
||||||
|
|
||||||
Arena arena = null;
|
Arena arena = null;
|
||||||
for (Arena arena2 : W.arenaList) {
|
for (Arena arena2 : MemoryStorage.arenaList) {
|
||||||
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
if (arena2.arenaName.equalsIgnoreCase(arenaname)) {
|
||||||
arena = arena2;
|
arena = arena2;
|
||||||
}
|
}
|
||||||
@ -52,8 +52,8 @@ public class OnInventoryCloseEvent implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void save(Arena arena) {
|
public void save(Arena arena) {
|
||||||
W.arenas.getFile().set(arena.arenaName, arena);
|
MemoryStorage.arenas.getFile().set(arena.arenaName, arena);
|
||||||
W.arenas.save();
|
MemoryStorage.arenas.save();
|
||||||
ArenaHandler.loadArenas();
|
ArenaHandler.loadArenas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
|
||||||
import nl.Steffion.BlockHunt.W;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
|
|
||||||
public class OnPlayerCommandPreprocessEvent implements Listener {
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
|
||||||
public void onPlayerCommandPreprocessEvent(PlayerCommandPreprocessEvent event) {
|
|
||||||
// Early exit if no one is in any arena
|
|
||||||
if (ArenaHandler.noPlayersInArenas()) return;
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
for (Arena arena : W.arenaList) {
|
|
||||||
if (arena.playersInArena.contains(player)) {
|
|
||||||
String m = event.getMessage();
|
|
||||||
if (m.startsWith("/blockhunt") || m.startsWith("/bh") || m.startsWith("/seekandfind") || m.startsWith("/seekandfind") || m.startsWith("/saf")
|
|
||||||
|| m.startsWith("/sf") || m.startsWith("/hideandseek") || m.startsWith("/has") || m.startsWith("/hs") || m.startsWith("/ban")
|
|
||||||
|| m.startsWith("/kick") || m.startsWith("/tempban") || m.startsWith("/mute") || m.startsWith("/reload")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String command : arena.allowedCommands) {
|
|
||||||
if (m.startsWith("/" + command)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PermissionsManager.hasPerm(player, Permissions.allcommands, false)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageManager.sendFMessage(player, ConfigC.warning_unableToCommand);
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
package nl.Steffion.BlockHunt.Listeners;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -15,7 +15,7 @@ public class OnPlayerDropItemEvent implements Listener {
|
|||||||
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
|
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
package nl.Steffion.BlockHunt.Listeners;
|
package nl.Steffion.BlockHunt.Listeners;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.*;
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
|
||||||
import nl.Steffion.BlockHunt.InventoryHandler;
|
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||||
import nl.Steffion.BlockHunt.SignsHandler;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.SolidBlockHandler;
|
|
||||||
import nl.Steffion.BlockHunt.W;
|
|
||||||
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
import nl.Steffion.BlockHunt.Managers.MessageManager;
|
||||||
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
import nl.Steffion.BlockHunt.Managers.PermissionsManager;
|
||||||
|
|
||||||
@ -39,25 +34,25 @@ public class OnPlayerInteractEvent implements Listener {
|
|||||||
if (item.getType() != Material.AIR) {
|
if (item.getType() != Material.AIR) {
|
||||||
if (item.getItemMeta().hasDisplayName()) {
|
if (item.getItemMeta().hasDisplayName()) {
|
||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
if (im.getDisplayName().equals(MessageManager.replaceAll((String) W.config.get(ConfigC.wandName)))) {
|
if (im.getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.wandName)))) {
|
||||||
Action action = event.getAction();
|
Action action = event.getAction();
|
||||||
if (event.hasBlock()) {
|
if (event.hasBlock()) {
|
||||||
Location location = event.getClickedBlock().getLocation();
|
Location location = event.getClickedBlock().getLocation();
|
||||||
if (action.equals(Action.LEFT_CLICK_BLOCK)) {
|
if (action.equals(Action.LEFT_CLICK_BLOCK)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (W.pos1.get(player) == null || !W.pos1.get(player).equals(location)) {
|
if (MemoryStorage.pos1.get(player) == null || !MemoryStorage.pos1.get(player).equals(location)) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-1",
|
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-1",
|
||||||
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
||||||
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
||||||
W.pos1.put(player, location);
|
MemoryStorage.pos1.put(player, location);
|
||||||
}
|
}
|
||||||
} else if (action.equals(Action.RIGHT_CLICK_BLOCK)) {
|
} else if (action.equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (W.pos2.get(player) == null || !W.pos2.get(player).equals(location)) {
|
if (MemoryStorage.pos2.get(player) == null || !MemoryStorage.pos2.get(player).equals(location)) {
|
||||||
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-2",
|
MessageManager.sendFMessage(player, ConfigC.normal_wandSetPosition, "number-2",
|
||||||
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
"pos-%N(%A" + location.getBlockX() + "%N, %A" + location.getBlockY() + "%N, %A" + location.getBlockZ() + "%N)", "x-"
|
||||||
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
+ location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ());
|
||||||
W.pos2.put(player, location);
|
MemoryStorage.pos2.put(player, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,16 +67,16 @@ public class OnPlayerInteractEvent implements Listener {
|
|||||||
if (SignsHandler.isSign(event.getClickedBlock().getLocation())) {
|
if (SignsHandler.isSign(event.getClickedBlock().getLocation())) {
|
||||||
Sign sign = (Sign) event.getClickedBlock().getState();
|
Sign sign = (Sign) event.getClickedBlock().getState();
|
||||||
if (sign.getLine(1) != null) {
|
if (sign.getLine(1) != null) {
|
||||||
if (sign.getLine(1).equals(MessageManager.replaceAll(W.config.getFile().getStringList(ConfigC.sign_LEAVE.location).get(1)))) {
|
if (sign.getLine(1).equals(MessageManager.replaceAll(MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location).get(1)))) {
|
||||||
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
||||||
ArenaHandler.playerLeaveArena(player, true, true);
|
ArenaHandler.playerLeaveArena(player, true, true);
|
||||||
}
|
}
|
||||||
} else if (sign.getLine(1).equals(MessageManager.replaceAll(W.config.getFile().getStringList(ConfigC.sign_SHOP.location).get(1)))) {
|
} else if (sign.getLine(1).equals(MessageManager.replaceAll(MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location).get(1)))) {
|
||||||
if (PermissionsManager.hasPerm(player, Permissions.shop, true)) {
|
if (PermissionsManager.hasPerm(player, Permissions.shop, true)) {
|
||||||
InventoryHandler.openShop(player);
|
InventoryHandler.openShop(player);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (sign.getLines()[1].contains(arena.arenaName)) {
|
if (sign.getLines()[1].contains(arena.arenaName)) {
|
||||||
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) {
|
||||||
ArenaHandler.playerJoinArena(player, arena.arenaName);
|
ArenaHandler.playerJoinArena(player, arena.arenaName);
|
||||||
@ -101,7 +96,7 @@ public class OnPlayerInteractEvent implements Listener {
|
|||||||
|| event.getClickedBlock().getType().equals(Material.FURNACE) || event.getClickedBlock().getType().equals(Material.CHEST)
|
|| event.getClickedBlock().getType().equals(Material.FURNACE) || event.getClickedBlock().getType().equals(Material.CHEST)
|
||||||
|| event.getClickedBlock().getType().equals(Material.ANVIL) || event.getClickedBlock().getType().equals(Material.ENDER_CHEST)
|
|| event.getClickedBlock().getType().equals(Material.ANVIL) || event.getClickedBlock().getType().equals(Material.ENDER_CHEST)
|
||||||
|| event.getClickedBlock().getType().equals(Material.JUKEBOX) || block.getRelative(event.getBlockFace()).getType().equals(Material.FIRE)) {
|
|| event.getClickedBlock().getType().equals(Material.JUKEBOX) || block.getRelative(event.getBlockFace()).getType().equals(Material.FIRE)) {
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -111,14 +106,14 @@ public class OnPlayerInteractEvent implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.seekers.contains(player)) {
|
if (arena.seekers.contains(player)) {
|
||||||
for (Player pl : arena.playersInArena) {
|
for (Player pl : arena.playersInArena) {
|
||||||
if (W.hiddenLoc.get(pl) != null) {
|
if (MemoryStorage.hiddenLoc.get(pl) != null) {
|
||||||
Block pLoc = event.getClickedBlock();
|
Block pLoc = event.getClickedBlock();
|
||||||
Block moveLocBlock = W.hiddenLoc.get(pl).getBlock();
|
Block moveLocBlock = MemoryStorage.hiddenLoc.get(pl).getBlock();
|
||||||
if (moveLocBlock.getX() == pLoc.getX() && moveLocBlock.getY() == pLoc.getY() && moveLocBlock.getZ() == pLoc.getZ()) {
|
if (moveLocBlock.getX() == pLoc.getX() && moveLocBlock.getY() == pLoc.getY() && moveLocBlock.getZ() == pLoc.getZ()) {
|
||||||
W.moveLoc.put(pl, new Location(pl.getWorld(), 0, 0, 0));
|
MemoryStorage.moveLoc.put(pl, new Location(pl.getWorld(), 0, 0, 0));
|
||||||
pl.getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1);
|
pl.getWorld().playSound(player.getLocation(), Sound.ENTITY_PLAYER_HURT, 1, 1);
|
||||||
SolidBlockHandler.makePlayerUnsolid(pl);
|
SolidBlockHandler.makePlayerUnsolid(pl);
|
||||||
}
|
}
|
||||||
@ -128,14 +123,14 @@ public class OnPlayerInteractEvent implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player) && (arena.gameState.equals(ArenaState.WAITING) || arena.gameState.equals(ArenaState.STARTING))) {
|
if (arena.playersInArena.contains(player) && (arena.gameState.equals(ArenaState.WAITING) || arena.gameState.equals(ArenaState.STARTING))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
ItemStack item = player.getInventory().getItemInMainHand();
|
ItemStack item = player.getInventory().getItemInMainHand();
|
||||||
if (item.getType() != Material.AIR) {
|
if (item.getType() != Material.AIR) {
|
||||||
if (item.getItemMeta().getDisplayName() != null) {
|
if (item.getItemMeta().getDisplayName() != null) {
|
||||||
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)))) {
|
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)))) {
|
||||||
Inventory blockChooser = Bukkit.createInventory(null, 36, MessageManager.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_blockChooserv1Name)));
|
Inventory blockChooser = Bukkit.createInventory(null, 36, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_blockChooserv1Name)));
|
||||||
if (arena.disguiseBlocks != null) {
|
if (arena.disguiseBlocks != null) {
|
||||||
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
|
for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) {
|
||||||
blockChooser.setItem(i - 1, arena.disguiseBlocks.get(i - 1));
|
blockChooser.setItem(i - 1, arena.disguiseBlocks.get(i - 1));
|
||||||
@ -145,8 +140,8 @@ public class OnPlayerInteractEvent implements Listener {
|
|||||||
player.openInventory(blockChooser);
|
player.openInventory(blockChooser);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name)))) {
|
if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)))) {
|
||||||
Inventory BlockHuntPass = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
Inventory BlockHuntPass = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + MemoryStorage.config.get(ConfigC.shop_BlockHuntPassv2Name)));
|
||||||
ItemStack BlockHuntPassSEEKER = new ItemStack(Material.WOOL, 1, (short) 11);
|
ItemStack BlockHuntPassSEEKER = new ItemStack(Material.WOOL, 1, (short) 11);
|
||||||
ItemMeta BlockHuntPassIM = BlockHuntPassSEEKER.getItemMeta();
|
ItemMeta BlockHuntPassIM = BlockHuntPassSEEKER.getItemMeta();
|
||||||
BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eSEEKER"));
|
BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eSEEKER"));
|
||||||
|
@ -4,9 +4,8 @@ import nl.Steffion.BlockHunt.Arena;
|
|||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -23,10 +22,10 @@ public class OnPlayerMoveEvent implements Listener {
|
|||||||
// Early exit if no one is in any arena
|
// Early exit if no one is in any arena
|
||||||
if (ArenaHandler.noPlayersInArenas()) return;
|
if (ArenaHandler.noPlayersInArenas()) return;
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (arena.playersInArena.contains(player)) {
|
if (arena.playersInArena.contains(player)) {
|
||||||
if (arena.gameState == ArenaState.INGAME) {
|
if (arena.gameState == ArenaState.INGAME) {
|
||||||
W.moveLoc.put(player, player.getLocation());
|
MemoryStorage.moveLoc.put(player, player.getLocation());
|
||||||
if(arena.pos1 == null || arena.pos2 == null){
|
if(arena.pos1 == null || arena.pos2 == null){
|
||||||
BlockHunt.plugin.getLogger().info("Arena:"+
|
BlockHunt.plugin.getLogger().info("Arena:"+
|
||||||
arena.arenaName+" appears to have bad coords : pos1:"+
|
arena.arenaName+" appears to have bad coords : pos1:"+
|
||||||
|
@ -2,10 +2,7 @@ package nl.Steffion.BlockHunt.Listeners;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.Arena;
|
import nl.Steffion.BlockHunt.Arena;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -18,14 +15,15 @@ public class OnPlayerQuitEvent implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerQuitEvent(PlayerQuitEvent event) {
|
public void onPlayerQuitEvent(PlayerQuitEvent event) {
|
||||||
Player playerLeaving = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
for (Arena arena : W.arenaList) {
|
|
||||||
if (arena.playersInArena.contains(playerLeaving)) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
ArenaHandler.playerLeaveArena(playerLeaving, true, true);
|
if (arena.playersInArena.contains(player)) {
|
||||||
|
ArenaHandler.playerLeaveArena(player, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerJoinEvent(PlayerJoinEvent event) {
|
public void onPlayerJoinEvent(PlayerJoinEvent event) {
|
||||||
Player playerJoining = event.getPlayer();
|
Player playerJoining = event.getPlayer();
|
||||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
import nl.Steffion.BlockHunt.Commands.DefaultCMD;
|
import nl.Steffion.BlockHunt.Commands.DefaultCMD;
|
||||||
|
|
||||||
public class CommandManager {
|
public class CommandManager {
|
||||||
@ -44,6 +44,6 @@ public class CommandManager {
|
|||||||
this.CMD = CMD;
|
this.CMD = CMD;
|
||||||
this.usage = usage;
|
this.usage = usage;
|
||||||
|
|
||||||
W.commands.add(this);
|
MemoryStorage.commands.add(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import java.io.File;
|
|||||||
|
|
||||||
import nl.Steffion.BlockHunt.BlockHunt;
|
import nl.Steffion.BlockHunt.BlockHunt;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -70,11 +70,11 @@ public class ConfigManager {
|
|||||||
*/
|
*/
|
||||||
public static void newFiles() {
|
public static void newFiles() {
|
||||||
ConfigManager.setDefaults();
|
ConfigManager.setDefaults();
|
||||||
for (String fileName : W.newFiles) {
|
for (String fileName : MemoryStorage.newFiles) {
|
||||||
MessageManager.sendMessage(null, "%TAG%WCouldn't find '%A%fileName%.yml%W' creating new one.", "fileName-" + fileName);
|
MessageManager.sendMessage(null, "%TAG%WCouldn't find '%A%fileName%.yml%MemoryStorage' creating new one.", "fileName-" + fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
W.newFiles.clear();
|
MemoryStorage.newFiles.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,7 +99,7 @@ public class ConfigManager {
|
|||||||
this.file.getParentFile().mkdirs();
|
this.file.getParentFile().mkdirs();
|
||||||
this.file.createNewFile();
|
this.file.createNewFile();
|
||||||
if(file.exists()) {
|
if(file.exists()) {
|
||||||
W.newFiles.add(this.fileName);
|
MemoryStorage.newFiles.add(this.fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package nl.Steffion.BlockHunt.Managers;
|
package nl.Steffion.BlockHunt.Managers;
|
||||||
|
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
import nl.Steffion.BlockHunt.W;
|
import nl.Steffion.BlockHunt.MemoryStorage;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -165,27 +165,27 @@ public class MessageManager {
|
|||||||
public static class CType {
|
public static class CType {
|
||||||
|
|
||||||
public static String NORMAL() {
|
public static String NORMAL() {
|
||||||
return (String) W.config.get(ConfigC.chat_normal);
|
return (String) MemoryStorage.config.get(ConfigC.chat_normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String WARNING() {
|
public static String WARNING() {
|
||||||
return (String) W.config.get(ConfigC.chat_warning);
|
return (String) MemoryStorage.config.get(ConfigC.chat_warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String ERROR() {
|
public static String ERROR() {
|
||||||
return (String) W.config.get(ConfigC.chat_error);
|
return (String) MemoryStorage.config.get(ConfigC.chat_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String ARG() {
|
public static String ARG() {
|
||||||
return (String) W.config.get(ConfigC.chat_arg);
|
return (String) MemoryStorage.config.get(ConfigC.chat_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String HEADER() {
|
public static String HEADER() {
|
||||||
return (String) W.config.get(ConfigC.chat_header);
|
return (String) MemoryStorage.config.get(ConfigC.chat_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String TAG() {
|
public static String TAG() {
|
||||||
return (String)W.config.get(ConfigC.chat_header) + W.config.get(ConfigC.chat_tag) + W.config.get(ConfigC.chat_normal);
|
return (String) MemoryStorage.config.get(ConfigC.chat_header) + MemoryStorage.config.get(ConfigC.chat_tag) + MemoryStorage.config.get(ConfigC.chat_normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class W {
|
public class MemoryStorage {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Standard stuff.
|
* Standard stuff.
|
@ -12,7 +12,7 @@ import org.bukkit.scoreboard.Scoreboard;
|
|||||||
|
|
||||||
public class ScoreboardHandler {
|
public class ScoreboardHandler {
|
||||||
public static void createScoreboard(Arena arena) {
|
public static void createScoreboard(Arena arena) {
|
||||||
if ((Boolean) W.config.get(ConfigC.scoreboard_enabled)) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.scoreboard_enabled)) {
|
||||||
Scoreboard board = arena.scoreboard;
|
Scoreboard board = arena.scoreboard;
|
||||||
if (board.getObjective(arena.arenaName) != null) {
|
if (board.getObjective(arena.arenaName) != null) {
|
||||||
updateScoreboard(arena);
|
updateScoreboard(arena);
|
||||||
@ -22,17 +22,17 @@ public class ScoreboardHandler {
|
|||||||
Objective object = board.registerNewObjective(BlockHunt.cutString(arena.arenaName, 32), "dummy");
|
Objective object = board.registerNewObjective(BlockHunt.cutString(arena.arenaName, 32), "dummy");
|
||||||
|
|
||||||
object.setDisplaySlot(DisplaySlot.SIDEBAR);
|
object.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||||
object.setDisplayName(BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_title)), 32));
|
object.setDisplayName(BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_title)), 32));
|
||||||
|
|
||||||
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_timeleft)), 32);
|
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_timeleft)), 32);
|
||||||
Score timeleft = object.getScore(temp);
|
Score timeleft = object.getScore(temp);
|
||||||
timeleft.setScore(arena.timer);
|
timeleft.setScore(arena.timer);
|
||||||
|
|
||||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_seekers)), 32);
|
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_seekers)), 32);
|
||||||
Score seekers = object.getScore(temp);
|
Score seekers = object.getScore(temp);
|
||||||
seekers.setScore(arena.seekers.size());
|
seekers.setScore(arena.seekers.size());
|
||||||
|
|
||||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_hiders)), 32);
|
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_hiders)), 32);
|
||||||
Score hiders = object.getScore(temp);
|
Score hiders = object.getScore(temp);
|
||||||
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
||||||
|
|
||||||
@ -49,20 +49,20 @@ public class ScoreboardHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateScoreboard(Arena arena) {
|
public static void updateScoreboard(Arena arena) {
|
||||||
if ((Boolean) W.config.get(ConfigC.scoreboard_enabled)) {
|
if ((Boolean) MemoryStorage.config.get(ConfigC.scoreboard_enabled)) {
|
||||||
Scoreboard board = arena.scoreboard;
|
Scoreboard board = arena.scoreboard;
|
||||||
Objective object = board.getObjective(DisplaySlot.SIDEBAR);
|
Objective object = board.getObjective(DisplaySlot.SIDEBAR);
|
||||||
object.setDisplayName(BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_title)), 32));
|
object.setDisplayName(BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_title)), 32));
|
||||||
|
|
||||||
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_timeleft)), 32);
|
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_timeleft)), 32);
|
||||||
Score timeleft = object.getScore(temp);
|
Score timeleft = object.getScore(temp);
|
||||||
timeleft.setScore(arena.timer);
|
timeleft.setScore(arena.timer);
|
||||||
|
|
||||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_seekers)), 32);
|
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_seekers)), 32);
|
||||||
Score seekers = object.getScore(temp);
|
Score seekers = object.getScore(temp);
|
||||||
seekers.setScore(arena.seekers.size());
|
seekers.setScore(arena.seekers.size());
|
||||||
|
|
||||||
temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_hiders)), 32);
|
temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_hiders)), 32);
|
||||||
Score hiders = object.getScore(temp);
|
Score hiders = object.getScore(temp);
|
||||||
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
hiders.setScore(arena.playersInArena.size() - arena.seekers.size());
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@ public class SignsHandler {
|
|||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
int number = 1;
|
int number = 1;
|
||||||
while (!saved) {
|
while (!saved) {
|
||||||
if (W.signs.getFile().get("leave_" + number) == null) {
|
if (MemoryStorage.signs.getFile().get("leave_" + number) == null) {
|
||||||
W.signs.getFile().set("leave_" + number + ".arenaName", "leave");
|
MemoryStorage.signs.getFile().set("leave_" + number + ".arenaName", "leave");
|
||||||
W.signs.getFile().set("leave_" + number + ".location", location);
|
MemoryStorage.signs.getFile().set("leave_" + number + ".location", location);
|
||||||
W.signs.save();
|
MemoryStorage.signs.save();
|
||||||
|
|
||||||
saved = true;
|
saved = true;
|
||||||
} else {
|
} else {
|
||||||
@ -31,10 +31,10 @@ public class SignsHandler {
|
|||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
int number = 1;
|
int number = 1;
|
||||||
while (!saved) {
|
while (!saved) {
|
||||||
if (W.signs.getFile().get("shop_" + number) == null) {
|
if (MemoryStorage.signs.getFile().get("shop_" + number) == null) {
|
||||||
W.signs.getFile().set("shop_" + number + ".arenaName", "shop");
|
MemoryStorage.signs.getFile().set("shop_" + number + ".arenaName", "shop");
|
||||||
W.signs.getFile().set("shop_" + number + ".location", location);
|
MemoryStorage.signs.getFile().set("shop_" + number + ".location", location);
|
||||||
W.signs.save();
|
MemoryStorage.signs.save();
|
||||||
|
|
||||||
saved = true;
|
saved = true;
|
||||||
} else {
|
} else {
|
||||||
@ -43,14 +43,14 @@ public class SignsHandler {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (lines[1].equals(arena.arenaName)) {
|
if (lines[1].equals(arena.arenaName)) {
|
||||||
int number = 1;
|
int number = 1;
|
||||||
while (!saved) {
|
while (!saved) {
|
||||||
if (W.signs.getFile().get(arena.arenaName + "_" + number) == null) {
|
if (MemoryStorage.signs.getFile().get(arena.arenaName + "_" + number) == null) {
|
||||||
W.signs.getFile().set(arena.arenaName + "_" + number + ".arenaName", lines[1]);
|
MemoryStorage.signs.getFile().set(arena.arenaName + "_" + number + ".arenaName", lines[1]);
|
||||||
W.signs.getFile().set(arena.arenaName + "_" + number + ".location", location);
|
MemoryStorage.signs.getFile().set(arena.arenaName + "_" + number + ".location", location);
|
||||||
W.signs.save();
|
MemoryStorage.signs.save();
|
||||||
|
|
||||||
saved = true;
|
saved = true;
|
||||||
} else {
|
} else {
|
||||||
@ -68,18 +68,18 @@ public class SignsHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void removeSign(Location location) {
|
public static void removeSign(Location location) {
|
||||||
for (String sign : W.signs.getFile().getKeys(false)) {
|
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||||
Location loc = (Location) W.signs.getFile().get(sign + ".location");
|
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||||
if (loc.equals(location)) {
|
if (loc.equals(location)) {
|
||||||
W.signs.getFile().set(sign, null);
|
MemoryStorage.signs.getFile().set(sign, null);
|
||||||
W.signs.save();
|
MemoryStorage.signs.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSign(Location location) {
|
public static boolean isSign(Location location) {
|
||||||
for (String sign : W.signs.getFile().getKeys(false)) {
|
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||||
Location loc = (Location) W.signs.getFile().get(sign + ".location");
|
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||||
if (loc.equals(location)) {
|
if (loc.equals(location)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -89,15 +89,15 @@ public class SignsHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void updateSigns() {
|
public static void updateSigns() {
|
||||||
W.signs.load();
|
MemoryStorage.signs.load();
|
||||||
for (String sign : W.signs.getFile().getKeys(false)) {
|
for (String sign : MemoryStorage.signs.getFile().getKeys(false)) {
|
||||||
Location loc = (Location) W.signs.getFile().get(sign + ".location");
|
Location loc = (Location) MemoryStorage.signs.getFile().get(sign + ".location");
|
||||||
if (loc.getBlock().getType().equals(Material.SIGN_POST) || loc.getBlock().getType().equals(Material.WALL_SIGN)) {
|
if (loc.getBlock().getType().equals(Material.SIGN_POST) || loc.getBlock().getType().equals(Material.WALL_SIGN)) {
|
||||||
Sign signblock = (Sign) loc.getBlock().getState();
|
Sign signblock = (Sign) loc.getBlock().getState();
|
||||||
String[] lines = signblock.getLines();
|
String[] lines = signblock.getLines();
|
||||||
if (sign.contains("leave")) {
|
if (sign.contains("leave")) {
|
||||||
|
|
||||||
ArrayList<String> signLines = (ArrayList<String>) W.config.getFile().getStringList(ConfigC.sign_LEAVE.location);
|
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_LEAVE.location);
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
for (String line : signLines) {
|
for (String line : signLines) {
|
||||||
if (linecount <= 3) {
|
if (linecount <= 3) {
|
||||||
@ -108,7 +108,7 @@ public class SignsHandler {
|
|||||||
}
|
}
|
||||||
signblock.update();
|
signblock.update();
|
||||||
} else if (sign.contains("shop")) {
|
} else if (sign.contains("shop")) {
|
||||||
ArrayList<String> signLines = (ArrayList<String>) W.config.getFile().getStringList(ConfigC.sign_SHOP.location);
|
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_SHOP.location);
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
for (String line : signLines) {
|
for (String line : signLines) {
|
||||||
if (linecount <= 3) {
|
if (linecount <= 3) {
|
||||||
@ -119,10 +119,10 @@ public class SignsHandler {
|
|||||||
}
|
}
|
||||||
signblock.update();
|
signblock.update();
|
||||||
} else {
|
} else {
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : MemoryStorage.arenaList) {
|
||||||
if (lines[1].endsWith(arena.arenaName)) {
|
if (lines[1].endsWith(arena.arenaName)) {
|
||||||
if (arena.gameState.equals(ArenaState.WAITING)) {
|
if (arena.gameState.equals(ArenaState.WAITING)) {
|
||||||
ArrayList<String> signLines = (ArrayList<String>) W.config.getFile().getStringList(ConfigC.sign_WAITING.location);
|
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_WAITING.location);
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
if (signLines != null) {
|
if (signLines != null) {
|
||||||
for (String line : signLines) {
|
for (String line : signLines) {
|
||||||
@ -138,7 +138,7 @@ public class SignsHandler {
|
|||||||
}
|
}
|
||||||
signblock.update();
|
signblock.update();
|
||||||
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
} else if (arena.gameState.equals(ArenaState.STARTING)) {
|
||||||
ArrayList<String> signLines = (ArrayList<String>) W.config.getFile().getStringList(ConfigC.sign_STARTING.location);
|
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_STARTING.location);
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
if (signLines != null) {
|
if (signLines != null) {
|
||||||
for (String line : signLines) {
|
for (String line : signLines) {
|
||||||
@ -154,7 +154,7 @@ public class SignsHandler {
|
|||||||
}
|
}
|
||||||
signblock.update();
|
signblock.update();
|
||||||
} else if (arena.gameState.equals(ArenaState.INGAME)) {
|
} else if (arena.gameState.equals(ArenaState.INGAME)) {
|
||||||
ArrayList<String> signLines = (ArrayList<String>) W.config.getFile().getStringList(ConfigC.sign_INGAME.location);
|
ArrayList<String> signLines = (ArrayList<String>) MemoryStorage.config.getFile().getStringList(ConfigC.sign_INGAME.location);
|
||||||
int linecount = 0;
|
int linecount = 0;
|
||||||
if (signLines != null) {
|
if (signLines != null) {
|
||||||
for (String line : signLines) {
|
for (String line : signLines) {
|
||||||
|
@ -26,15 +26,15 @@ public class SolidBlockHandler {
|
|||||||
|
|
||||||
Block pBlock = player.getLocation().getBlock();
|
Block pBlock = player.getLocation().getBlock();
|
||||||
|
|
||||||
if (W.hiddenLoc.get(player) != null) {
|
if (MemoryStorage.hiddenLoc.get(player) != null) {
|
||||||
pBlock = W.hiddenLoc.get(player).getBlock();
|
pBlock = MemoryStorage.hiddenLoc.get(player).getBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
block.setAmount(5);
|
block.setAmount(5);
|
||||||
for (Player pl : Bukkit.getOnlinePlayers()) {
|
for (Player pl : Bukkit.getOnlinePlayers()) {
|
||||||
if (!pl.equals(player)) {
|
if (!pl.equals(player)) {
|
||||||
if (W.hiddenLocWater.get(player) != null) {
|
if (MemoryStorage.hiddenLocWater.get(player) != null) {
|
||||||
if (W.hiddenLocWater.get(player)) {
|
if (MemoryStorage.hiddenLocWater.get(player)) {
|
||||||
pl.sendBlockChange(pBlock.getLocation(), Material.STATIONARY_WATER, (byte) 0);
|
pl.sendBlockChange(pBlock.getLocation(), Material.STATIONARY_WATER, (byte) 0);
|
||||||
} else {
|
} else {
|
||||||
pl.sendBlockChange(pBlock.getLocation(), Material.AIR, (byte) 0);
|
pl.sendBlockChange(pBlock.getLocation(), Material.AIR, (byte) 0);
|
||||||
@ -43,7 +43,7 @@ public class SolidBlockHandler {
|
|||||||
pl.sendBlockChange(pBlock.getLocation(), Material.AIR, (byte) 0);
|
pl.sendBlockChange(pBlock.getLocation(), Material.AIR, (byte) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
W.hiddenLocWater.remove(player);
|
MemoryStorage.hiddenLocWater.remove(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,4 +19,4 @@ commands:
|
|||||||
- hs
|
- hs
|
||||||
- seekandfind
|
- seekandfind
|
||||||
- saf
|
- saf
|
||||||
- sf
|
- sf
|
@ -60,7 +60,7 @@ normal:
|
|||||||
shopChoosenHiders: '%TAG%NYou''ve choosen to be a %Ahider%N!'
|
shopChoosenHiders: '%TAG%NYou''ve choosen to be a %Ahider%N!'
|
||||||
ingameBlocksLeft: '%TAG%NRemaining blocks: %A%1%%N'
|
ingameBlocksLeft: '%TAG%NRemaining blocks: %A%1%%N'
|
||||||
warning:
|
warning:
|
||||||
lobbyNeedAtleast: '%TAG%WYou need atleast %A%1%%W player(s) to start the game!'
|
lobbyNeedAtleast: '%TAG%WYou need atleast %A%1%%MemoryStorage player(s) to start the game!'
|
||||||
ingameNEWSeekerChoosen: '%TAG%WThe last seeker left and a new seeker has been choosen!'
|
ingameNEWSeekerChoosen: '%TAG%WThe last seeker left and a new seeker has been choosen!'
|
||||||
unableToCommand: '%TAG%WSorry but that command is disabled in the arena.'
|
unableToCommand: '%TAG%WSorry but that command is disabled in the arena.'
|
||||||
ingameNoSolidPlace: '%TAG%WThat''s not a valid place to become solid!'
|
ingameNoSolidPlace: '%TAG%WThat''s not a valid place to become solid!'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user