diff --git a/pom.xml b/pom.xml index 0291450..271af79 100644 --- a/pom.xml +++ b/pom.xml @@ -76,16 +76,24 @@ - . - true - ${basedir}/src - - plugin.yml - + . + true + ${basedir}/src/main/resources + + *.yml + + + . + src/main/resources/lang + false + + *.properties + + - src + src/main/java org.apache.maven.plugins diff --git a/src/nl/Steffion/BlockHunt/Arena.java b/src/main/java/nl/Steffion/BlockHunt/Arena.java similarity index 65% rename from src/nl/Steffion/BlockHunt/Arena.java rename to src/main/java/nl/Steffion/BlockHunt/Arena.java index 3491106..f5ff151 100644 --- a/src/nl/Steffion/BlockHunt/Arena.java +++ b/src/main/java/nl/Steffion/BlockHunt/Arena.java @@ -5,10 +5,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import nl.Steffion.BlockHunt.Serializables.LocationSerializable; -import nl.Steffion.BlockHunt.Serializables.M; import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.configuration.serialization.SerializableAs; import org.bukkit.entity.Player; @@ -18,8 +17,8 @@ import org.bukkit.scoreboard.Scoreboard; @SerializableAs("BlockHuntArena") public class Arena implements ConfigurationSerializable { public String arenaName; - public LocationSerializable pos1; - public LocationSerializable pos2; + public Location pos1; + public Location pos2; public int maxPlayers; public int minPlayers; public int amountSeekersOnStart; @@ -34,10 +33,10 @@ public class Arena implements ConfigurationSerializable { public boolean seekersTakeFallDamage; public boolean hidersTakeFallDamage; public ArrayList disguiseBlocks; - public LocationSerializable lobbyWarp; - public LocationSerializable hidersWarp; - public LocationSerializable seekersWarp; - public LocationSerializable spawnWarp; + public Location lobbyWarp; + public Location hidersWarp; + public Location seekersWarp; + public Location spawnWarp; public List seekersWinCommands; public List hidersWinCommands; public List allowedCommands; @@ -51,10 +50,10 @@ public class Arena implements ConfigurationSerializable { public List seekers; public Scoreboard scoreboard; - public Arena(String arenaName, LocationSerializable pos1, LocationSerializable pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart, + public Arena(String arenaName, Location pos1, Location pos2, int maxPlayers, int minPlayers, int amountSeekersOnStart, int timeInLobbyUntilStart, int waitingTimeSeeker, int gameTime, int timeUntilHidersSword, int blockAnnouncerTime, boolean seekersCanHurtSeekers, boolean hidersCanHurtSeekers, boolean hidersCanHurtHiders, boolean seekersTakeFallDamage, boolean hidersTakeFallDamage, - ArrayList disguiseBlocks, LocationSerializable lobbyWarp, LocationSerializable hidersWarp, LocationSerializable seekersWarp, LocationSerializable spawnWarp, + ArrayList disguiseBlocks, Location lobbyWarp, Location hidersWarp, Location seekersWarp, Location spawnWarp, List seekersWinCommands, List hidersWinCommands, List allowedCommands, int seekersTokenWin, int hidersTokenWin, int killTokens, List playersInArena, ArenaState gameState, int timer, List seekers, Scoreboard scoreboard) { this.arenaName = arenaName; @@ -68,6 +67,11 @@ public class Arena implements ConfigurationSerializable { this.gameTime = gameTime; this.timeUntilHidersSword = timeUntilHidersSword; this.blockAnnouncerTime = blockAnnouncerTime; + this.seekersCanHurtSeekers = seekersCanHurtSeekers; + this.hidersCanHurtHiders = hidersCanHurtHiders; + this.hidersCanHurtSeekers = hidersCanHurtSeekers; + this.seekersTakeFallDamage = seekersTakeFallDamage; + this.hidersTakeFallDamage = hidersTakeFallDamage; this.disguiseBlocks = disguiseBlocks; this.lobbyWarp = lobbyWarp; this.hidersWarp = hidersWarp; @@ -139,15 +143,15 @@ public class Arena implements ConfigurationSerializable { @SuppressWarnings("unchecked") public static Arena deserialize(Map map) { - LocationSerializable loc = new LocationSerializable(Bukkit.getWorld("world"), 0, 0, 0, 0, 0); - return new Arena((String) M.g(map, "arenaName", "UNKNOWN_NAME"), (LocationSerializable) M.g(map, "pos1", loc), (LocationSerializable) M.g(map, "pos2", loc), - (Integer) M.g(map, "maxPlayers", 12), (Integer) M.g(map, "minPlayers", 3), (Integer) M.g(map, "amountSeekersOnStart", 1), (Integer) M.g(map, "timeInLobbyUntilStart", 90), - (Integer) M.g(map, "waitingTimeSeeker", 20), (Integer) M.g(map, "gameTime", 200), (Integer) M.g(map, "timeUntilHidersSword", 30),(Integer) M.g(map, "blockAnnouncerTime", 45), - (Boolean) M.g(map, "seekersCanHurtSeekers", false),(Boolean) M.g(map, "hidersCanHurtSeekers", false),(Boolean) M.g(map, "hidersCanHurtHiders", false),(Boolean) M.g(map, "seekersTakeFallDamage", false),(Boolean) M.g(map, "hidersTakeFallDamage", false), - (ArrayList) M.g(map, "disguiseBlocks", new ArrayList()),(LocationSerializable) M.g(map, "lobbyWarp", loc), (LocationSerializable) M.g(map, "hidersWarp", loc), (LocationSerializable) M.g(map, "seekersWarp", loc), - (LocationSerializable) M.g(map, "spawnWarp", loc), (ArrayList) M.g(map, "seekersWinCommands", new ArrayList()), - (ArrayList) M.g(map, "hidersWinCommands", new ArrayList()), (ArrayList) M.g(map, "allowedCommands", new ArrayList()), - (Integer) M.g(map, "seekersTokenWin", 10), (Integer) M.g(map, "hidersTokenWin", 50), (Integer) M.g(map, "killTokens", 8), new ArrayList<>(), + Location loc = new Location(Bukkit.getWorld("world"), 0, 0, 0, 0, 0); + return new Arena((String) map.getOrDefault("arenaName", "UNKNOWN_NAME"), (Location) map.getOrDefault("pos1", loc), (Location) map.getOrDefault( "pos2", loc), + (Integer) map.getOrDefault( "maxPlayers", 12), (Integer) map.getOrDefault( "minPlayers", 3), (Integer) map.getOrDefault( "amountSeekersOnStart", 1), (Integer) map.getOrDefault( "timeInLobbyUntilStart", 90), + (Integer) map.getOrDefault( "waitingTimeSeeker", 20), (Integer) map.getOrDefault( "gameTime", 200), (Integer) map.getOrDefault( "timeUntilHidersSword", 30),(Integer) map.getOrDefault( "blockAnnouncerTime", 45), + (Boolean) map.getOrDefault( "seekersCanHurtSeekers", false),(Boolean) map.getOrDefault( "hidersCanHurtSeekers", false),(Boolean) map.getOrDefault( "hidersCanHurtHiders", false),(Boolean) map.getOrDefault( "seekersTakeFallDamage", false),(Boolean) map.getOrDefault( "hidersTakeFallDamage", false), + (ArrayList) map.getOrDefault( "disguiseBlocks", new ArrayList()),(Location) map.getOrDefault( "lobbyWarp", loc), (Location) map.getOrDefault( "hidersWarp", loc), (Location) map.getOrDefault( "seekersWarp", loc), + (Location) map.getOrDefault( "spawnWarp", loc), (ArrayList) map.getOrDefault( "seekersWinCommands", new ArrayList()), + (ArrayList) map.getOrDefault("hidersWinCommands", new ArrayList()), (ArrayList) map.getOrDefault( "allowedCommands", new ArrayList()), + (Integer) map.getOrDefault( "seekersTokenWin", 10), (Integer) map.getOrDefault( "hidersTokenWin", 50), (Integer) map.getOrDefault( "killTokens", 8), new ArrayList<>(), ArenaState.WAITING, 0, new ArrayList<>(), Bukkit.getScoreboardManager().getNewScoreboard()); } } \ No newline at end of file diff --git a/src/nl/Steffion/BlockHunt/ArenaHandler.java b/src/main/java/nl/Steffion/BlockHunt/ArenaHandler.java similarity index 87% rename from src/nl/Steffion/BlockHunt/ArenaHandler.java rename to src/main/java/nl/Steffion/BlockHunt/ArenaHandler.java index 3d54469..3ddc299 100644 --- a/src/nl/Steffion/BlockHunt/ArenaHandler.java +++ b/src/main/java/nl/Steffion/BlockHunt/ArenaHandler.java @@ -9,14 +9,10 @@ import nl.Steffion.BlockHunt.Events.EndArenaEvent; import nl.Steffion.BlockHunt.Events.JoinArenaEvent; import nl.Steffion.BlockHunt.Events.LeaveArenaEvent; import nl.Steffion.BlockHunt.PermissionsC.Permissions; -import nl.Steffion.BlockHunt.Managers.MessageM; -import nl.Steffion.BlockHunt.Managers.PermissionsM; -import nl.Steffion.BlockHunt.Serializables.LocationSerializable; +import nl.Steffion.BlockHunt.Managers.MessageManager; +import nl.Steffion.BlockHunt.Managers.PermissionsManager; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Sound; +import org.bukkit.*; import org.bukkit.attribute.Attribute; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -39,14 +35,14 @@ public class ArenaHandler { public static void sendMessage(Arena arena, String message, String... vars) { for (Player player : arena.playersInArena) { String pMessage = message.replaceAll("%player%", player.getDisplayName()); - player.sendMessage(MessageM.replaceAll(pMessage, vars)); + player.sendMessage(MessageManager.replaceAll(pMessage, vars)); } } public static void sendFMessage(Arena arena, ConfigC location, String... vars) { for (Player player : arena.playersInArena) { String pMessage = location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName()); - player.sendMessage(MessageM.replaceAll(pMessage, vars)); + player.sendMessage(MessageManager.replaceAll(pMessage, vars)); } } @@ -66,7 +62,7 @@ public class ArenaHandler { if (arena.arenaName.equalsIgnoreCase(arenaname)) { found = true; if (arena.disguiseBlocks.isEmpty()) { - MessageM.sendFMessage(player, ConfigC.error_joinNoBlocksSet); + MessageManager.sendFMessage(player, ConfigC.error_joinNoBlocksSet); } else { boolean inventoryempty = true; for (ItemStack invitem : player.getInventory()) { @@ -86,17 +82,17 @@ public class ArenaHandler { } if ((Boolean) W.config.get(ConfigC.requireInventoryClearOnJoin) && !inventoryempty) { - MessageM.sendFMessage(player, ConfigC.error_joinInventoryNotEmpty); + MessageManager.sendFMessage(player, ConfigC.error_joinInventoryNotEmpty); return; } - LocationSerializable zero = new LocationSerializable(Bukkit.getWorld(player.getWorld().getName()), 0, 0, 0, 0, 0); + Location zero = new Location(Bukkit.getWorld(player.getWorld().getName()), 0, 0, 0, 0, 0); if (arena.lobbyWarp != null && arena.hidersWarp != null && arena.seekersWarp != null && arena.spawnWarp != null) { if (!arena.lobbyWarp.equals(zero) && !arena.hidersWarp.equals(zero) && !arena.seekersWarp.equals(zero) && !arena.spawnWarp.equals(zero)) { if (arena.gameState == ArenaState.WAITING || arena.gameState == ArenaState.STARTING) { if (arena.playersInArena.size() >= arena.maxPlayers) { - if (!PermissionsM.hasPerm(player, Permissions.joinfull, false)) { - MessageM.sendFMessage(player, ConfigC.error_joinFull); + if (!PermissionsManager.hasPerm(player, Permissions.joinfull, false)) { + MessageManager.sendFMessage(player, ConfigC.error_joinFull); return; } } @@ -152,14 +148,14 @@ public class ArenaHandler { if ((Boolean) W.config.get(ConfigC.shop_blockChooserv1Enabled)) { if (W.shop.getFile().get(player.getName() + ".blockchooser") != null - || PermissionsM.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); ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta(); - shopBlockChooser_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name))); + shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name))); List lores = W.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location); List lores2 = new ArrayList<>(); for (String lore : lores) { - lores2.add(MessageM.replaceAll(lore)); + lores2.add(MessageManager.replaceAll(lore)); } shopBlockChooser_IM.setLore(lores2); shopBlockChooser.setItemMeta(shopBlockChooser_IM); @@ -173,11 +169,11 @@ public class ArenaHandler { ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) W.config.get(ConfigC.shop_BlockHuntPassv2IDName)), 1); ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta(); - shopBlockHuntPass_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name))); + shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name))); List lores = W.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location); List lores2 = new ArrayList<>(); for (String lore : lores) { - lores2.add(MessageM.replaceAll(lore)); + lores2.add(MessageManager.replaceAll(lore)); } shopBlockHuntPass_IM.setLore(lores2); @@ -197,24 +193,24 @@ public class ArenaHandler { ArenaHandler.sendFMessage(arena, ConfigC.warning_lobbyNeedAtleast, "1-" + arena.minPlayers); } } else { - MessageM.sendFMessage(player, ConfigC.error_joinArenaIngame); + MessageManager.sendFMessage(player, ConfigC.error_joinArenaIngame); } } else { - MessageM.sendFMessage(player, ConfigC.error_joinWarpsNotSet); + MessageManager.sendFMessage(player, ConfigC.error_joinWarpsNotSet); } } else { - MessageM.sendFMessage(player, ConfigC.error_joinWarpsNotSet); + MessageManager.sendFMessage(player, ConfigC.error_joinWarpsNotSet); } } } } } else { - MessageM.sendFMessage(player, ConfigC.error_joinAlreadyJoined); + MessageManager.sendFMessage(player, ConfigC.error_joinAlreadyJoined); return; } if (!found) { - MessageM.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname); + MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname); } SignsHandler.updateSigns(); @@ -277,8 +273,13 @@ public class ArenaHandler { // Fix for client not showing players after they join for (Player otherplayer : arena.playersInArena) { - otherplayer.showPlayer(player); - player.showPlayer(otherplayer); + if (otherplayer.canSee(player)) + otherplayer.showPlayer(player); // Make new player + // visible to others + if (player.canSee(otherplayer)) + player.showPlayer(otherplayer); // Make other + // players visible + // to new player } } } @@ -327,14 +328,14 @@ public class ArenaHandler { ScoreboardHandler.removeScoreboard(player); - MessageM.sendFMessage(player, ConfigC.normal_leaveYouLeft); + MessageManager.sendFMessage(player, ConfigC.normal_leaveYouLeft); if (message) { ArenaHandler.sendFMessage(arena, ConfigC.normal_leaveLeftArena, "playername-" + player.getName(), "1-" + arena.playersInArena.size(), "2-" + arena.maxPlayers); } } else { if (message) { - MessageM.sendFMessage(player, ConfigC.error_leaveNotInArena); + MessageManager.sendFMessage(player, ConfigC.error_leaveNotInArena); } return; } @@ -368,7 +369,7 @@ public class ArenaHandler { W.shop.getFile().set(player.getName() + ".tokens", playerTokens + arena.seekersTokenWin); W.shop.save(); - MessageM.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.seekersTokenWin); + MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.seekersTokenWin); } @@ -420,7 +421,7 @@ public class ArenaHandler { W.shop.getFile().set(player.getName() + ".tokens", playerTokens + arena.hidersTokenWin); W.shop.save(); - MessageM.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.hidersTokenWin); + MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + arena.hidersTokenWin); } } diff --git a/src/nl/Steffion/BlockHunt/BlockHunt.java b/src/main/java/nl/Steffion/BlockHunt/BlockHunt.java similarity index 85% rename from src/nl/Steffion/BlockHunt/BlockHunt.java rename to src/main/java/nl/Steffion/BlockHunt/BlockHunt.java index e5b9bc9..0dfa4d1 100644 --- a/src/nl/Steffion/BlockHunt/BlockHunt.java +++ b/src/main/java/nl/Steffion/BlockHunt/BlockHunt.java @@ -35,10 +35,10 @@ import nl.Steffion.BlockHunt.Listeners.OnPlayerInteractEvent; import nl.Steffion.BlockHunt.Listeners.OnPlayerMoveEvent; import nl.Steffion.BlockHunt.Listeners.OnPlayerQuitEvent; import nl.Steffion.BlockHunt.Listeners.OnSignChangeEvent; -import nl.Steffion.BlockHunt.Managers.CommandM; -import nl.Steffion.BlockHunt.Managers.ConfigM; -import nl.Steffion.BlockHunt.Managers.MessageM; -import nl.Steffion.BlockHunt.Managers.PermissionsM; +import nl.Steffion.BlockHunt.Managers.CommandManager; +import nl.Steffion.BlockHunt.Managers.ConfigManager; +import nl.Steffion.BlockHunt.Managers.MessageManager; +import nl.Steffion.BlockHunt.Managers.PermissionsManager; import nl.Steffion.BlockHunt.Serializables.LocationSerializable; import org.apache.commons.lang.StringUtils; @@ -95,21 +95,21 @@ public class BlockHunt extends JavaPlugin implements Listener { } }; - public static CommandM CMD; - public static CommandM CMDinfo; - public static CommandM CMDhelp; - public static CommandM CMDreload; - public static CommandM CMDjoin; - public static CommandM CMDleave; - public static CommandM CMDlist; - public static CommandM CMDshop; - public static CommandM CMDstart; - public static CommandM CMDwand; - public static CommandM CMDcreate; - public static CommandM CMDset; - public static CommandM CMDsetwarp; - public static CommandM CMDremove; - public static CommandM CMDtokens; + public static CommandManager CMD; + public static CommandManager CMDinfo; + public static CommandManager CMDhelp; + public static CommandManager CMDreload; + public static CommandManager CMDjoin; + public static CommandManager CMDleave; + public static CommandManager CMDlist; + public static CommandManager CMDshop; + public static CommandManager CMDstart; + public static CommandManager CMDwand; + public static CommandManager CMDcreate; + public static CommandManager CMDset; + public static CommandManager CMDsetwarp; + public static CommandManager CMDremove; + public static CommandManager CMDtokens; public void onEnable() { getServer().getPluginManager().registerEvents(this, this); @@ -138,55 +138,55 @@ public class BlockHunt extends JavaPlugin implements Listener { pdfFile = getDescription(); plugin = this; - ConfigM.newFiles(); + ConfigManager.newFiles(); - CMD = new CommandM("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) W.config.get(ConfigC.commandEnabled_info), BlockHuntCMD, new CMDinfo(), null); - CMDinfo = new CommandM("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) W.config.get(ConfigC.commandEnabled_info), BlockHuntCMD, new CMDinfo(), "/BlockHunt [info|i]"); - CMDhelp = new CommandM("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) W.config.get(ConfigC.commandEnabled_help), BlockHuntCMD, new CMDhelp(), "/BlockHunt [page number]"); - CMDreload = new CommandM("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 "); - CMDjoin = new CommandM("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) W.config.get(ConfigC.commandEnabled_join), BlockHuntCMD, new CMDjoin(), "/BlockHunt "); - CMDleave = new CommandM("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 "); - CMDlist = new CommandM("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) W.config.get(ConfigC.commandEnabled_list), BlockHuntCMD, new CMDlist(), "/BlockHunt "); - CMDshop = new CommandM("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) W.config.get(ConfigC.commandEnabled_shop), BlockHuntCMD, new CMDshop(), "/BlockHunt "); - CMDstart = new CommandM("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 "); - CMDwand = new CommandM("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) W.config.get(ConfigC.commandEnabled_wand), BlockHuntCMD, new CMDwand(), "/BlockHunt "); - CMDcreate = new CommandM("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 "); - CMDset = new CommandM("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) W.config.get(ConfigC.commandEnabled_set), BlockHuntCMD, new CMDset(), "/BlockHunt "); - CMDsetwarp = new CommandM("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(), "/BlockHunt "); - CMDremove = new CommandM("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 "); - CMDtokens = new CommandM("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 "); if (!getServer().getPluginManager().isPluginEnabled("LibsDisguises")) { - MessageM.broadcastFMessage(ConfigC.error_libsDisguisesNotInstalled); - Bukkit.getServer().getPluginManager().disablePlugin(this); - return; + MessageManager.broadcastFMessage(ConfigC.error_libsDisguisesNotInstalled); + Bukkit.getServer().getPluginManager().disablePlugin(this); + return; } if (!getServer().getPluginManager().isPluginEnabled("ProtocolLib")) { - MessageM.broadcastFMessage(ConfigC.error_protocolLibNotInstalled); + MessageManager.broadcastFMessage(ConfigC.error_protocolLibNotInstalled); Bukkit.getServer().getPluginManager().disablePlugin(this); return; - } + } ArenaHandler.loadArenas(); - MessageM.sendFMessage(null, ConfigC.log_enabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "authors-" + MessageManager.sendFMessage(null, ConfigC.log_enabledPlugin, "name-" + BlockHunt.pdfFile.getName(), "version-" + BlockHunt.pdfFile.getVersion(), "autors-" + BlockHunt.pdfFile.getAuthors().get(0)); // Welcome to the massive game loop!! @@ -284,10 +284,10 @@ public class BlockHunt extends JavaPlugin implements Listener { W.pBlock.put(arenaPlayer, block); if (block.getDurability() != 0) { - MessageM.sendFMessage(arenaPlayer, ConfigC.normal_ingameBlock, + MessageManager.sendFMessage(arenaPlayer, ConfigC.normal_ingameBlock, "block-" + block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase() + ":" + block.getDurability()); } else { - MessageM.sendFMessage(arenaPlayer, ConfigC.normal_ingameBlock, + MessageManager.sendFMessage(arenaPlayer, ConfigC.normal_ingameBlock, "block-" + block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase()); } } @@ -330,7 +330,7 @@ public class BlockHunt extends JavaPlugin implements Listener { for (Player arenaPlayer : arena.playersInArena) { if (!arena.seekers.contains(arenaPlayer)) { arenaPlayer.getInventory().addItem(sword); - MessageM.sendFMessage(arenaPlayer, ConfigC.normal_ingameGivenSword); + MessageManager.sendFMessage(arenaPlayer, ConfigC.normal_ingameGivenSword); } } } @@ -420,13 +420,13 @@ public class BlockHunt extends JavaPlugin implements Listener { player.playSound(pLoc, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1); W.hiddenLoc.put(player, moveLoc); if (block.getDurability() != 0) { - MessageM.sendFMessage( + MessageManager.sendFMessage( player, ConfigC.normal_ingameNowSolid, "block-" + block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase() + ":" + block.getDurability()); } else { - MessageM.sendFMessage(player, ConfigC.normal_ingameNowSolid, "block-" + MessageManager.sendFMessage(player, ConfigC.normal_ingameNowSolid, "block-" + block.getType().name().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase()); } } @@ -437,7 +437,7 @@ public class BlockHunt extends JavaPlugin implements Listener { } } } else { - MessageM.sendFMessage(player, ConfigC.warning_ingameNoSolidPlace); + MessageManager.sendFMessage(player, ConfigC.warning_ingameNoSolidPlace); } } } else { @@ -466,7 +466,7 @@ public class BlockHunt extends JavaPlugin implements Listener { ArenaHandler.stopArena(arena); } - MessageM.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-" + BlockHunt.pdfFile.getAuthors().get(0)); } @@ -498,7 +498,7 @@ public class BlockHunt extends JavaPlugin implements Listener { player = (Player) sender; } - for (CommandM command : W.commands) { + for (CommandManager command : W.commands) { String[] argsSplit = null; String[] argsSplitAlias = null; @@ -526,11 +526,11 @@ public class BlockHunt extends JavaPlugin implements Listener { } if (equals) { - if (PermissionsM.hasPerm(player, command.permission, true)) { + if (PermissionsManager.hasPerm(player, command.permission, true)) { if (command.enabled) { command.CMD.exectue(player, cmd, label, args); } else { - MessageM.sendFMessage(player, ConfigC.error_commandNotEnabled); + MessageManager.sendFMessage(player, ConfigC.error_commandNotEnabled); } } @@ -546,7 +546,7 @@ public class BlockHunt extends JavaPlugin implements Listener { @Override public List onTabComplete(CommandSender sender, Command cmd, String label, String[] args) { - for (CommandM command : W.commands) { + for (CommandManager command : W.commands) { if (cmd.getName().equalsIgnoreCase(command.label)) { if (args.length == 1) { return command.mainTABlist; diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDcreate.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDcreate.java similarity index 74% rename from src/nl/Steffion/BlockHunt/Commands/CMDcreate.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDcreate.java index 0a8c0ba..095d0c4 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDcreate.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDcreate.java @@ -8,7 +8,7 @@ import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.ScoreboardHandler; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.Bukkit; import org.bukkit.command.Command; @@ -20,7 +20,7 @@ public class CMDcreate extends DefaultCMD { public boolean exectue(Player player, Command cmd, String label, String[] args) { if (player != null) { if (args.length <= 1) { - MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDcreate.usage); + MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDcreate.usage); } else { if (W.pos1.get(player) != null && W.pos2.get(player) != null) { if (W.pos1.get(player).getWorld().equals(W.pos2.get(player).getWorld())) { @@ -34,16 +34,16 @@ public class CMDcreate extends DefaultCMD { W.arenaList.add(arena); ScoreboardHandler.createScoreboard(arena); - MessageM.sendFMessage(player, ConfigC.normal_createCreatedArena, "name-" + args[1]); + MessageManager.sendFMessage(player, ConfigC.normal_createCreatedArena, "name-" + args[1]); } else { - MessageM.sendFMessage(player, ConfigC.error_createNotSameWorld); + MessageManager.sendFMessage(player, ConfigC.error_createNotSameWorld); } } else { - MessageM.sendFMessage(player, ConfigC.error_createSelectionFirst); + MessageManager.sendFMessage(player, ConfigC.error_createSelectionFirst); } } } else { - MessageM.sendFMessage(player, ConfigC.error_onlyIngame); + MessageManager.sendFMessage(player, ConfigC.error_onlyIngame); } return true; } diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDhelp.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDhelp.java similarity index 50% rename from src/nl/Steffion/BlockHunt/Commands/CMDhelp.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDhelp.java index 6a0c2c7..4f0ae91 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDhelp.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDhelp.java @@ -13,9 +13,9 @@ package nl.Steffion.BlockHunt.Commands; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.CommandM; -import nl.Steffion.BlockHunt.Managers.MessageM; -import nl.Steffion.BlockHunt.Managers.PermissionsM; +import nl.Steffion.BlockHunt.Managers.CommandManager; +import nl.Steffion.BlockHunt.Managers.MessageManager; +import nl.Steffion.BlockHunt.Managers.PermissionsManager; import org.bukkit.command.Command; import org.bukkit.entity.Player; @@ -26,7 +26,7 @@ public class CMDhelp extends DefaultCMD { @Override public boolean exectue(Player player, Command cmd, String label, String[] args) { int amountCommands = 0; - for (CommandM command : W.commands) { + for (CommandManager command : W.commands) { if (command.usage != null) { amountCommands = amountCommands + 1; } @@ -39,22 +39,22 @@ public class CMDhelp extends DefaultCMD { if (args.length == 1) { int page = 1; - MessageM.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; - for (CommandM command : W.commands) { + for (CommandManager command : W.commands) { if (i <= 4) { if (command.usage != null) { - if (PermissionsM.hasPerm(player, command.permission, false)) { - MessageM.sendMessage(player, "%A" + command.usage + "%N - " + W.messages.getFile().get(command.help.location)); + if (PermissionsManager.hasPerm(player, command.permission, false)) { + MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + W.messages.getFile().get(command.help.location)); } else { - MessageM.sendMessage(player, "%W" + command.usage + "%N - " + W.messages.getFile().get(command.help.location)); + MessageManager.sendMessage(player, "%W" + command.usage + "%N - " + W.messages.getFile().get(command.help.location)); } i = i + 1; } } } - MessageM.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oHelp Page"); + MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oHelp Page"); } else { int page = 1; try { @@ -67,24 +67,24 @@ public class CMDhelp extends DefaultCMD { maxPages = page; } - MessageM.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; - for (CommandM command : W.commands) { + for (CommandManager command : W.commands) { if (i <= (page * 4) + 4) { if (command.usage != null) { if (i >= ((page - 1) * 4) + 1 && i <= ((page - 1) * 4) + 4) { - if (PermissionsM.hasPerm(player, command.permission, false)) { - MessageM.sendMessage(player, "%A" + command.usage + "%N - " + W.messages.getFile().get(command.help.location)); + if (PermissionsManager.hasPerm(player, command.permission, false)) { + MessageManager.sendMessage(player, "%A" + command.usage + "%N - " + W.messages.getFile().get(command.help.location)); } else { - MessageM.sendMessage(player, "%W" + command.usage + "%N - " + W.messages.getFile().get(command.help.location)); + MessageManager.sendMessage(player, "%W" + command.usage + "%N - " + W.messages.getFile().get(command.help.location)); } } i = i + 1; } } } - MessageM.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oHelp Page"); + MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oHelp Page"); } return true; } diff --git a/src/main/java/nl/Steffion/BlockHunt/Commands/CMDinfo.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDinfo.java new file mode 100644 index 0000000..af48211 --- /dev/null +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDinfo.java @@ -0,0 +1,35 @@ +package nl.Steffion.BlockHunt.Commands; +/** + * Steffion's Engine - Made by Steffion. + * + * You're allowed to use this engine for own usage, you're not allowed to + * republish the engine. Using this for your own plugin is allowed when a + * credit is placed somewhere in the plugin. + * + * Thanks for your cooperate! + * + * @author Steffion + */ +import nl.Steffion.BlockHunt.BlockHunt; +import nl.Steffion.BlockHunt.ConfigC; +import nl.Steffion.BlockHunt.Managers.MessageManager; + +import org.bukkit.command.Command; +import org.bukkit.entity.Player; + +public class CMDinfo extends DefaultCMD { + + + @Override + public boolean exectue(Player player, Command cmd, String label, String[] args) { + 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, "%NVersion: %A%version%%N.", "version-" + BlockHunt.pdfFile.getVersion()); + MessageManager.sendMessage(player, "%NType %A%helpusage% %Nfor help.", "helpusage-" + BlockHunt.CMDhelp.usage); + MessageManager.sendMessage(player, "%NDev-Page: %Ahttp://dev.bukkit.org/bukkit-plugins/blockhunt/"); + MessageManager.sendMessage(player, "%NDonations are welcome!"); + MessageManager.sendMessage(player, "%NMade by help from some friends &c<3%N!"); + MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oInfo Page"); + return true; + } +} diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDjoin.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDjoin.java similarity index 69% rename from src/nl/Steffion/BlockHunt/Commands/CMDjoin.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDjoin.java index a2e8556..b47b969 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDjoin.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDjoin.java @@ -3,7 +3,7 @@ package nl.Steffion.BlockHunt.Commands; import nl.Steffion.BlockHunt.ArenaHandler; import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.ConfigC; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.command.Command; import org.bukkit.entity.Player; @@ -14,12 +14,12 @@ public class CMDjoin extends DefaultCMD { public boolean exectue(Player player, Command cmd, String label, String[] args) { if (player != null) { if (args.length <= 1) { - MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDjoin.usage); + MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDjoin.usage); } else { ArenaHandler.playerJoinArena(player, args[1]); } } else { - MessageM.sendFMessage(player, ConfigC.error_onlyIngame); + MessageManager.sendFMessage(player, ConfigC.error_onlyIngame); } return true; } diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDleave.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDleave.java similarity index 78% rename from src/nl/Steffion/BlockHunt/Commands/CMDleave.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDleave.java index 04601c8..2a8f0e4 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDleave.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDleave.java @@ -2,7 +2,7 @@ package nl.Steffion.BlockHunt.Commands; import nl.Steffion.BlockHunt.ArenaHandler; import nl.Steffion.BlockHunt.ConfigC; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.command.Command; import org.bukkit.entity.Player; @@ -14,7 +14,7 @@ public class CMDleave extends DefaultCMD { if (player != null) { ArenaHandler.playerLeaveArena(player, true, true); } else { - MessageM.sendFMessage(player, ConfigC.error_onlyIngame); + MessageManager.sendFMessage(player, ConfigC.error_onlyIngame); } return true; } diff --git a/src/main/java/nl/Steffion/BlockHunt/Commands/CMDlist.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDlist.java new file mode 100644 index 0000000..8f8eb4d --- /dev/null +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDlist.java @@ -0,0 +1,29 @@ +package nl.Steffion.BlockHunt.Commands; + +import nl.Steffion.BlockHunt.Arena; +import nl.Steffion.BlockHunt.BlockHunt; +import nl.Steffion.BlockHunt.ConfigC; +import nl.Steffion.BlockHunt.W; +import nl.Steffion.BlockHunt.Managers.MessageManager; + +import org.bukkit.command.Command; +import org.bukkit.entity.Player; + +public class CMDlist extends DefaultCMD { + + @Override + public boolean exectue(Player player, Command cmd, String label, String[] args) { + MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName()); + if (W.arenaList.size() >= 1) { + MessageManager.sendMessage(player, "&7Available arena(s):"); + for (Arena arena : W.arenaList) { + MessageManager.sendMessage(player, "%A" + arena.arenaName); + } + } else { + MessageManager.sendMessage(player, "&7&oNo arenas available..."); + MessageManager.sendMessage(player, "&7&oCreate an arena first please."); + } + MessageManager.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oArenas list"); + return true; + } +} diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDnotfound.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDnotfound.java similarity index 82% rename from src/nl/Steffion/BlockHunt/Commands/CMDnotfound.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDnotfound.java index f074389..ab12d84 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDnotfound.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDnotfound.java @@ -11,7 +11,7 @@ package nl.Steffion.BlockHunt.Commands; * @author Steffion */ import nl.Steffion.BlockHunt.ConfigC; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.command.Command; import org.bukkit.entity.Player; @@ -20,7 +20,7 @@ public class CMDnotfound { public static boolean exectue(Player player, Command cmd, String label, String[] args) { - MessageM.sendFMessage(player, ConfigC.error_commandNotFound); + MessageManager.sendFMessage(player, ConfigC.error_commandNotFound); return true; } } diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDreload.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDreload.java similarity index 81% rename from src/nl/Steffion/BlockHunt/Commands/CMDreload.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDreload.java index b9360c2..315dc5c 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDreload.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDreload.java @@ -14,8 +14,8 @@ import nl.Steffion.BlockHunt.Arena; import nl.Steffion.BlockHunt.ArenaHandler; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.ConfigM; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.ConfigManager; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.command.Command; import org.bukkit.entity.Player; @@ -25,7 +25,7 @@ public class CMDreload extends DefaultCMD { @Override public boolean exectue(Player player, Command cmd, String label, String[] args) { - ConfigM.newFiles(); + ConfigManager.newFiles(); W.config.load(); W.messages.load(); @@ -37,7 +37,7 @@ public class CMDreload extends DefaultCMD { } ArenaHandler.loadArenas(); - MessageM.sendFMessage(player, ConfigC.normal_reloadedConfigs); + MessageManager.sendFMessage(player, ConfigC.normal_reloadedConfigs); return true; } } diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDremove.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDremove.java similarity index 69% rename from src/nl/Steffion/BlockHunt/Commands/CMDremove.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDremove.java index 973930b..346022f 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDremove.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDremove.java @@ -4,8 +4,7 @@ import nl.Steffion.BlockHunt.Arena; import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; -import nl.Steffion.BlockHunt.Serializables.LocationSerializable; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.Effect; import org.bukkit.Location; @@ -20,15 +19,15 @@ public class CMDremove extends DefaultCMD { public boolean exectue(Player player, Command cmd, String label, String[] args) { if (player != null) { if (args.length <= 1) { - MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDremove.usage); + MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDremove.usage); } else { for (Arena arena : W.arenaList) { if (args[1].equalsIgnoreCase(arena.arenaName)) { - MessageM.sendFMessage(player, ConfigC.normal_removeRemovedArena, "name-" + args[1]); + MessageManager.sendFMessage(player, ConfigC.normal_removeRemovedArena, "name-" + args[1]); W.arenas.getFile().set(args[1], null); for (String sign : W.signs.getFile().getKeys(false)) { if (W.signs.getFile().get(sign + ".arenaName").toString().equalsIgnoreCase(args[1])) { - LocationSerializable signLoc = new LocationSerializable((Location) W.signs.getFile().get(sign + ".location")); + Location signLoc = (Location) W.signs.getFile().get(sign + ".location"); signLoc.getBlock().setType(Material.AIR); signLoc.getWorld().playEffect(signLoc, Effect.MOBSPAWNER_FLAMES, 0); signLoc.getWorld().playSound(signLoc, Sound.ENTITY_ENDERDRAGON_FLAP, 1, 1); @@ -44,10 +43,10 @@ public class CMDremove extends DefaultCMD { } } - MessageM.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]); + MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]); } } else { - MessageM.sendFMessage(player, ConfigC.error_onlyIngame); + MessageManager.sendFMessage(player, ConfigC.error_onlyIngame); } return true; } diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDset.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDset.java similarity index 70% rename from src/nl/Steffion/BlockHunt/Commands/CMDset.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDset.java index 222dfd3..c44701a 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDset.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDset.java @@ -3,7 +3,7 @@ package nl.Steffion.BlockHunt.Commands; import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.InventoryHandler; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.command.Command; import org.bukkit.entity.Player; @@ -14,13 +14,13 @@ public class CMDset extends DefaultCMD { public boolean exectue(Player player, Command cmd, String label, String[] args) { if (player != null) { if (args.length <= 1) { - MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDset.usage); + MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDset.usage); } else { String arenaname = args[1]; InventoryHandler.openPanel(player, arenaname); } } else { - MessageM.sendFMessage(player, ConfigC.error_onlyIngame); + MessageManager.sendFMessage(player, ConfigC.error_onlyIngame); } return true; } diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDsetwarp.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDsetwarp.java similarity index 60% rename from src/nl/Steffion/BlockHunt/Commands/CMDsetwarp.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDsetwarp.java index 76c3d97..755379f 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDsetwarp.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDsetwarp.java @@ -5,9 +5,9 @@ import nl.Steffion.BlockHunt.ArenaHandler; import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; -import nl.Steffion.BlockHunt.Serializables.LocationSerializable; +import nl.Steffion.BlockHunt.Managers.MessageManager; +import org.bukkit.Location; import org.bukkit.command.Command; import org.bukkit.entity.Player; @@ -17,7 +17,7 @@ public class CMDsetwarp extends DefaultCMD { public boolean exectue(Player player, Command cmd, String label, String[] args) { if (player != null) { if (args.length <= 2) { - MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDsetwarp.usage); + MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDsetwarp.usage); } else { String arenaname = args[2]; String warpname = args[1]; @@ -29,32 +29,32 @@ public class CMDsetwarp extends DefaultCMD { } } if (arena != null) { - LocationSerializable loc = new LocationSerializable(player.getLocation()); + Location loc = player.getLocation(); if (warpname.equalsIgnoreCase("lobby")) { arena.lobbyWarp = loc; save(arena); - MessageM.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname); + MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname); } else if (warpname.equalsIgnoreCase("hiders")) { arena.hidersWarp = loc; save(arena); - MessageM.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname); + MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname); } else if (warpname.equalsIgnoreCase("seekers")) { arena.seekersWarp = loc; save(arena); - MessageM.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname); + MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname); } else if (warpname.equalsIgnoreCase("spawn")) { arena.spawnWarp = loc; save(arena); - MessageM.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname); + MessageManager.sendFMessage(player, ConfigC.normal_setwarpWarpSet, "warp-" + warpname); } else { - MessageM.sendFMessage(player, ConfigC.error_setwarpWarpNotFound, "warp-" + warpname); + MessageManager.sendFMessage(player, ConfigC.error_setwarpWarpNotFound, "warp-" + warpname); } } else { - MessageM.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname); + MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname); } } } else { - MessageM.sendFMessage(player, ConfigC.error_onlyIngame); + MessageManager.sendFMessage(player, ConfigC.error_onlyIngame); } return true; } diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDshop.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDshop.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Commands/CMDshop.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDshop.java diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDstart.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDstart.java similarity index 66% rename from src/nl/Steffion/BlockHunt/Commands/CMDstart.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDstart.java index 78ba921..2f485d4 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDstart.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDstart.java @@ -5,7 +5,7 @@ import nl.Steffion.BlockHunt.Arena.ArenaState; import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.command.Command; import org.bukkit.entity.Player; @@ -16,7 +16,7 @@ public class CMDstart extends DefaultCMD { public boolean exectue(Player player, Command cmd, String label, String[] args) { if (player != null) { if (args.length <= 1) { - MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDstart.usage); + MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDstart.usage); } else { Arena arena = null; for (Arena arena2 : W.arenaList) { @@ -30,9 +30,9 @@ public class CMDstart extends DefaultCMD { if (arena.playersInArena.size() >= 2) { arena.timer = 11; arena.gameState = ArenaState.STARTING; - MessageM.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName); + MessageManager.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName); } else { - MessageM.sendFMessage(player, ConfigC.warning_lobbyNeedAtleast, "1-2"); + MessageManager.sendFMessage(player, ConfigC.warning_lobbyNeedAtleast, "1-2"); } } else if (arena.gameState.equals(ArenaState.STARTING)) { if (arena.playersInArena.size() < arena.maxPlayers) { @@ -43,14 +43,14 @@ public class CMDstart extends DefaultCMD { arena.timer = 1; } - MessageM.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName); + MessageManager.sendFMessage(player, ConfigC.normal_startForced, "arenaname-" + arena.arenaName); } } else { - MessageM.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]); + MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + args[1]); } } } else { - MessageM.sendFMessage(player, ConfigC.error_onlyIngame); + MessageManager.sendFMessage(player, ConfigC.error_onlyIngame); } return true; } diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDtokens.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDtokens.java similarity index 60% rename from src/nl/Steffion/BlockHunt/Commands/CMDtokens.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDtokens.java index 41b387b..2855fe9 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDtokens.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDtokens.java @@ -13,7 +13,7 @@ package nl.Steffion.BlockHunt.Commands; import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.Bukkit; import org.bukkit.command.Command; @@ -25,7 +25,7 @@ public class CMDtokens extends DefaultCMD { @Override public boolean exectue(Player player, Command cmd, String label, String[] args) { if (args.length <= 3) { - MessageM.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDtokens.usage); + MessageManager.sendFMessage(player, ConfigC.error_notEnoughArguments, "syntax-" + BlockHunt.CMDtokens.usage); } else { String option = args[1]; String playerName = args[2]; @@ -33,13 +33,13 @@ public class CMDtokens extends DefaultCMD { try { amount = Integer.valueOf(args[3]); } catch (NumberFormatException e) { - MessageM.sendFMessage(player, ConfigC.error_notANumber, "1-" + args[3]); + MessageManager.sendFMessage(player, ConfigC.error_notANumber, "1-" + args[3]); return true; } Player tokenPlayer = Bukkit.getPlayer(playerName); if (tokenPlayer == null) { - MessageM.sendFMessage(player, ConfigC.error_tokensPlayerNotOnline, "playername-" + playerName); + MessageManager.sendFMessage(player, ConfigC.error_tokensPlayerNotOnline, "playername-" + playerName); return true; } String name = "\u00A78Console"; @@ -50,8 +50,8 @@ public class CMDtokens extends DefaultCMD { if (option.equalsIgnoreCase("set")) { W.shop.getFile().set(tokenPlayer.getName() + ".tokens", amount); W.shop.save(); - MessageM.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Set", "playername-" + tokenPlayer.getName(), "option2-to", "amount-" + amount); - MessageM.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-set", "playername-" + name, "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); } else if (option.equalsIgnoreCase("add")) { int tokens = 0; if (W.shop.getFile().getInt(tokenPlayer.getName() + ".tokens") != 0) { @@ -59,8 +59,8 @@ public class CMDtokens extends DefaultCMD { } W.shop.getFile().set(tokenPlayer.getName() + ".tokens", tokens + amount); W.shop.save(); - MessageM.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Added", "playername-" + tokenPlayer.getName(), "option2-to", "amount-" + amount); - MessageM.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-added", "playername-" + name, "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); } else if (option.equalsIgnoreCase("take")) { int tokens = 0; if (W.shop.getFile().getInt(tokenPlayer.getName() + ".tokens") != 0) { @@ -68,10 +68,10 @@ public class CMDtokens extends DefaultCMD { } W.shop.getFile().set(tokenPlayer.getName() + ".tokens", tokens - amount); W.shop.save(); - MessageM.sendFMessage(player, ConfigC.normal_tokensChanged, "option-Took", "playername-" + tokenPlayer.getName(), "option2-from", "amount-" + amount); - MessageM.sendFMessage(tokenPlayer, ConfigC.normal_tokensChangedPerson, "option-took", "playername-" + name, "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); } else { - MessageM.sendFMessage(player, ConfigC.error_tokensUnknownsetting, "option-" + option); + MessageManager.sendFMessage(player, ConfigC.error_tokensUnknownsetting, "option-" + option); } } return true; diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDwand.java b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDwand.java similarity index 72% rename from src/nl/Steffion/BlockHunt/Commands/CMDwand.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/CMDwand.java index 206385d..74c1d17 100644 --- a/src/nl/Steffion/BlockHunt/Commands/CMDwand.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/CMDwand.java @@ -5,7 +5,7 @@ import java.util.List; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.Material; import org.bukkit.Sound; @@ -21,21 +21,21 @@ public class CMDwand extends DefaultCMD { if (player != null) { ItemStack wand = new ItemStack(Material.getMaterial((String) W.config.get(ConfigC.wandIDname))); ItemMeta im = wand.getItemMeta(); - im.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.wandName))); + im.setDisplayName(MessageManager.replaceAll((String) W.config.get(ConfigC.wandName))); W.config.load(); List lores = W.config.getFile().getStringList(ConfigC.wandDescription.location); List lores2 = new ArrayList<>(); for (String lore : lores) { - lores2.add(MessageM.replaceAll(lore)); + lores2.add(MessageManager.replaceAll(lore)); } im.setLore(lores2); wand.setItemMeta(im); player.getInventory().addItem(wand); player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 5, 0); - MessageM.sendFMessage(player, ConfigC.normal_wandGaveWand, "type-" + wand.getType().toString().replaceAll("_", " ").toLowerCase()); + MessageManager.sendFMessage(player, ConfigC.normal_wandGaveWand, "type-" + wand.getType().toString().replaceAll("_", " ").toLowerCase()); } else { - MessageM.sendFMessage(player, ConfigC.error_onlyIngame); + MessageManager.sendFMessage(player, ConfigC.error_onlyIngame); } return true; } diff --git a/src/nl/Steffion/BlockHunt/Commands/DefaultCMD.java b/src/main/java/nl/Steffion/BlockHunt/Commands/DefaultCMD.java similarity index 82% rename from src/nl/Steffion/BlockHunt/Commands/DefaultCMD.java rename to src/main/java/nl/Steffion/BlockHunt/Commands/DefaultCMD.java index 30f7ca0..ff20f65 100644 --- a/src/nl/Steffion/BlockHunt/Commands/DefaultCMD.java +++ b/src/main/java/nl/Steffion/BlockHunt/Commands/DefaultCMD.java @@ -10,7 +10,7 @@ package nl.Steffion.BlockHunt.Commands; * * @author Steffion */ -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.command.Command; import org.bukkit.entity.Player; @@ -19,7 +19,7 @@ public class DefaultCMD { public boolean exectue(Player player, Command cmd, String label, String[] args) { - MessageM.sendMessage(player, "%TAG%NExample of a Command!"); + MessageManager.sendMessage(player, "%TAG%NExample of a Command!"); // TODO Place the command stuff here. return true; } diff --git a/src/nl/Steffion/BlockHunt/ConfigC.java b/src/main/java/nl/Steffion/BlockHunt/ConfigC.java similarity index 98% rename from src/nl/Steffion/BlockHunt/ConfigC.java rename to src/main/java/nl/Steffion/BlockHunt/ConfigC.java index 7ae9ea1..5957701 100644 --- a/src/nl/Steffion/BlockHunt/ConfigC.java +++ b/src/main/java/nl/Steffion/BlockHunt/ConfigC.java @@ -10,7 +10,7 @@ package nl.Steffion.BlockHunt; * * @author Steffion */ -import nl.Steffion.BlockHunt.Managers.ConfigM; +import nl.Steffion.BlockHunt.Managers.ConfigManager; public enum ConfigC { @@ -106,7 +106,7 @@ public enum ConfigC { "%TAG%ESorry, the maximum amount of hiders has been reached!", W.messages); public Object value; - public ConfigM config; + public ConfigManager config; public String location; /** @@ -117,7 +117,7 @@ public enum ConfigC { * @param config * The config file. */ - ConfigC(Object value, ConfigM config) { + ConfigC(Object value, ConfigManager config) { this.value = value; this.config = config; this.location = this.name().replaceAll("_", "."); diff --git a/src/nl/Steffion/BlockHunt/Events/EndArenaEvent.java b/src/main/java/nl/Steffion/BlockHunt/Events/EndArenaEvent.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Events/EndArenaEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Events/EndArenaEvent.java diff --git a/src/nl/Steffion/BlockHunt/Events/JoinArenaEvent.java b/src/main/java/nl/Steffion/BlockHunt/Events/JoinArenaEvent.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Events/JoinArenaEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Events/JoinArenaEvent.java diff --git a/src/nl/Steffion/BlockHunt/Events/LeaveArenaEvent.java b/src/main/java/nl/Steffion/BlockHunt/Events/LeaveArenaEvent.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Events/LeaveArenaEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Events/LeaveArenaEvent.java diff --git a/src/nl/Steffion/BlockHunt/InventoryHandler.java b/src/main/java/nl/Steffion/BlockHunt/InventoryHandler.java similarity index 81% rename from src/nl/Steffion/BlockHunt/InventoryHandler.java rename to src/main/java/nl/Steffion/BlockHunt/InventoryHandler.java index f27d87a..d273925 100644 --- a/src/nl/Steffion/BlockHunt/InventoryHandler.java +++ b/src/main/java/nl/Steffion/BlockHunt/InventoryHandler.java @@ -4,8 +4,8 @@ import java.util.ArrayList; import java.util.List; import nl.Steffion.BlockHunt.Arena.ArenaType; -import nl.Steffion.BlockHunt.Managers.MessageM; -import nl.Steffion.BlockHunt.Managers.PermissionsM; +import nl.Steffion.BlockHunt.Managers.MessageManager; +import nl.Steffion.BlockHunt.Managers.PermissionsManager; import nl.Steffion.BlockHunt.PermissionsC.Permissions; import org.bukkit.Bukkit; @@ -31,11 +31,11 @@ public class InventoryHandler { arenaname = arena.arenaName; if (shorten.length() > 6) shorten = shorten.substring(0, 6); - Inventory panel = Bukkit.createInventory(null, 54, MessageM.replaceAll("\u00A7r%N&lBlockHunt Arena: %A" + shorten)); + Inventory panel = Bukkit.createInventory(null, 54, MessageManager.replaceAll("\u00A7r%N&lBlockHunt Arena: %A" + shorten)); ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1); ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta(); - arenaNameNote_IM.setDisplayName(MessageM.replaceAll("%NBlockHunt arena: %A" + arena.arenaName)); + arenaNameNote_IM.setDisplayName(MessageManager.replaceAll("%NBlockHunt arena: %A" + arena.arenaName)); arenaNameNote.setItemMeta(arenaNameNote_IM); panel.setItem(0, arenaNameNote); @@ -67,7 +67,7 @@ public class InventoryHandler { ItemStack disguiseBlocks_NOTE = new ItemStack(Material.BOOK, 1); ItemMeta disguiseBlocks_NOTE_IM = disguiseBlocks_NOTE.getItemMeta(); - disguiseBlocks_NOTE_IM.setDisplayName(MessageM.replaceAll("%NSet the %AdisguiseBlocks%N.")); + disguiseBlocks_NOTE_IM.setDisplayName(MessageManager.replaceAll("%NSet the %AdisguiseBlocks%N.")); disguiseBlocks_NOTE.setItemMeta(disguiseBlocks_NOTE_IM); panel.setItem(36, disguiseBlocks_NOTE); @@ -122,14 +122,14 @@ public class InventoryHandler { player.openInventory(panel); } else { - MessageM.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname); + MessageManager.sendFMessage(player, ConfigC.error_noArena, "name-" + arenaname); } } 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) { ItemMeta UP_IM = UP.getItemMeta(); - UP_IM.setDisplayName(MessageM.replaceAll((String) W.messages.get(ConfigC.button_add), "1-" + addremove, "2-" + option)); + UP_IM.setDisplayName(MessageManager.replaceAll((String) W.messages.get(ConfigC.button_add), "1-" + addremove, "2-" + option)); UP.setItemMeta(UP_IM); int setting = 0; @@ -170,11 +170,11 @@ public class InventoryHandler { } ItemMeta BUTTON_IM = BUTTON.getItemMeta(); - BUTTON_IM.setDisplayName(MessageM.replaceAll((String) W.messages.get(ConfigC.button_setting), "1-" + option, "2-" + setting)); + BUTTON_IM.setDisplayName(MessageManager.replaceAll((String) W.messages.get(ConfigC.button_setting), "1-" + option, "2-" + setting)); BUTTON.setItemMeta(BUTTON_IM); ItemMeta DOWN_IM = DOWN.getItemMeta(); - DOWN_IM.setDisplayName(MessageM.replaceAll((String) W.messages.get(ConfigC.button_remove), "1-" + addremove, "2-" + option)); + DOWN_IM.setDisplayName(MessageManager.replaceAll((String) W.messages.get(ConfigC.button_remove), "1-" + addremove, "2-" + option)); DOWN.setItemMeta(DOWN_IM); panel.setItem(up, UP); @@ -184,13 +184,13 @@ public class InventoryHandler { public static void openDisguiseBlocks(Arena arena, Player player) { String arenaname = arena.arenaName; - Inventory panel = Bukkit.createInventory(null, 36, MessageM.replaceAll("%N&lDisguiseBlocks")); + Inventory panel = Bukkit.createInventory(null, 36, MessageManager.replaceAll("%N&lDisguiseBlocks")); ItemStack arenaNameNote = new ItemStack(Material.PAPER, 1); ItemMeta arenaNameNote_IM = arenaNameNote.getItemMeta(); - arenaNameNote_IM.setDisplayName(MessageM.replaceAll("%NDisguiseBlocks of arena: %A" + arenaname)); + arenaNameNote_IM.setDisplayName(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A" + arenaname)); ArrayList lores = new ArrayList<>(); - lores.add(MessageM.replaceAll("%NPlace the DisguiseBlocks inside this inventory.")); + lores.add(MessageManager.replaceAll("%NPlace the DisguiseBlocks inside this inventory.")); arenaNameNote_IM.setLore(lores); arenaNameNote.setItemMeta(arenaNameNote_IM); panel.setItem(0, arenaNameNote); @@ -203,7 +203,7 @@ public class InventoryHandler { } public static void openShop(Player player) { - Inventory shop = Bukkit.createInventory(null, 9, MessageM.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_title))); + Inventory shop = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_title))); if (W.shop.getFile().get(player.getName() + ".tokens") == null) { W.shop.getFile().set(player.getName() + ".tokens", 0); W.shop.save(); @@ -214,40 +214,40 @@ public class InventoryHandler { ItemStack shopTokens = new ItemStack(Material.EMERALD, 1); ItemMeta shopTokens_IM = shopTokens.getItemMeta(); - shopTokens_IM.setDisplayName(MessageM.replaceAll("%N&lTokens: %A" + playerTokens)); + shopTokens_IM.setDisplayName(MessageManager.replaceAll("%N&lTokens: %A" + playerTokens)); shopTokens.setItemMeta(shopTokens_IM); ItemStack shopBlockChooser = new ItemStack(Material.getMaterial((String) W.config.get(ConfigC.shop_blockChooserv1IDname)), 1); ItemMeta shopBlockChooser_IM = shopBlockChooser.getItemMeta(); - shopBlockChooser_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name))); + shopBlockChooser_IM.setDisplayName(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name))); lores = W.config.getFile().getStringList(ConfigC.shop_blockChooserv1Description.location); lores2 = new ArrayList<>(); for (String lore : lores) { - lores2.add(MessageM.replaceAll(lore)); + lores2.add(MessageManager.replaceAll(lore)); } - lores2.add(MessageM.replaceAll((String) W.config.get(ConfigC.shop_price), "amount-" + W.config.get(ConfigC.shop_blockChooserv1Price))); + lores2.add(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_price), "amount-" + W.config.get(ConfigC.shop_blockChooserv1Price))); shopBlockChooser_IM.setLore(lores2); shopBlockChooser.setItemMeta(shopBlockChooser_IM); ItemStack shopBlockHuntPass = new ItemStack(Material.getMaterial((String) W.config.get(ConfigC.shop_BlockHuntPassv2IDName)), 1); ItemMeta shopBlockHuntPass_IM = shopBlockHuntPass.getItemMeta(); - shopBlockHuntPass_IM.setDisplayName(MessageM.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name))); + shopBlockHuntPass_IM.setDisplayName(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name))); lores = W.config.getFile().getStringList(ConfigC.shop_BlockHuntPassv2Description.location); lores2 = new ArrayList<>(); for (String lore : lores) { - lores2.add(MessageM.replaceAll(lore)); + lores2.add(MessageManager.replaceAll(lore)); } - lores2.add(MessageM.replaceAll((String) W.config.get(ConfigC.shop_price), "amount-" + W.config.get(ConfigC.shop_BlockHuntPassv2Price))); + lores2.add(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_price), "amount-" + W.config.get(ConfigC.shop_BlockHuntPassv2Price))); shopBlockHuntPass_IM.setLore(lores2); shopBlockHuntPass.setItemMeta(shopBlockHuntPass_IM); shop.setItem(0, shopTokens); if ((Boolean) W.config.get(ConfigC.shop_blockChooserv1Enabled) - && (W.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsM.hasPerm(player, Permissions.shopblockchooser, false))) { + && (W.shop.getFile().get(player.getName() + ".blockchooser") == null && !PermissionsManager.hasPerm(player, Permissions.shopblockchooser, false))) { shop.setItem(1, shopBlockChooser); } if ((Boolean) W.config.get(ConfigC.shop_BlockHuntPassv2Enabled)) { diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnBlockBreakEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnBlockBreakEvent.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Listeners/OnBlockBreakEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnBlockBreakEvent.java diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnBlockPlaceEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnBlockPlaceEvent.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Listeners/OnBlockPlaceEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnBlockPlaceEvent.java diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnEntityDamageByEntityEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnEntityDamageByEntityEvent.java similarity index 95% rename from src/nl/Steffion/BlockHunt/Listeners/OnEntityDamageByEntityEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnEntityDamageByEntityEvent.java index 0a34454..84b4228 100644 --- a/src/nl/Steffion/BlockHunt/Listeners/OnEntityDamageByEntityEvent.java +++ b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnEntityDamageByEntityEvent.java @@ -10,7 +10,7 @@ import nl.Steffion.BlockHunt.Arena.ArenaState; import nl.Steffion.BlockHunt.ArenaHandler; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.apache.commons.lang.StringUtils; import org.bukkit.GameMode; @@ -107,7 +107,7 @@ public class OnEntityDamageByEntityEvent implements Listener { W.shop.getFile().set(damager.getName() + ".tokens", damagerTokens + arena.killTokens); W.shop.save(); - MessageM.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) { W.shop.getFile().set(player.getName() + ".tokens", 0); @@ -118,7 +118,7 @@ public class OnEntityDamageByEntityEvent implements Listener { W.shop.getFile().set(player.getName() + ".tokens", playerTokens + (int) addingTokens); W.shop.save(); - MessageM.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + (int) addingTokens); + MessageManager.sendFMessage(player, ConfigC.normal_addedToken, "amount-" + (int) addingTokens); arena.seekers.add(player); player.setWalkSpeed(0.3F); diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnEntityDamageEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnEntityDamageEvent.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Listeners/OnEntityDamageEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnEntityDamageEvent.java diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnFoodLevelChangeEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnFoodLevelChangeEvent.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Listeners/OnFoodLevelChangeEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnFoodLevelChangeEvent.java diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnInventoryClickEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnInventoryClickEvent.java similarity index 85% rename from src/nl/Steffion/BlockHunt/Listeners/OnInventoryClickEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnInventoryClickEvent.java index 4be9ef6..53c84cb 100644 --- a/src/nl/Steffion/BlockHunt/Listeners/OnInventoryClickEvent.java +++ b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnInventoryClickEvent.java @@ -6,7 +6,7 @@ import nl.Steffion.BlockHunt.ArenaHandler; import nl.Steffion.BlockHunt.ConfigC; import nl.Steffion.BlockHunt.InventoryHandler; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -41,7 +41,7 @@ public class OnInventoryClickEvent implements Listener { if (!event.getCurrentItem().getType().isBlock()) { if (!event.getCurrentItem().getType().equals(Material.FLOWER_POT_ITEM)) { event.setCancelled(true); - MessageM.sendFMessage(player, ConfigC.error_setNotABlock); + MessageManager.sendFMessage(player, ConfigC.error_setNotABlock); } } } @@ -54,7 +54,7 @@ public class OnInventoryClickEvent implements Listener { return; if (inv.getName().startsWith("\u00A7r")) { - if (inv.getName().equals(MessageM.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_title)))) { + if (inv.getName().equals(MessageManager.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_title)))) { event.setCancelled(true); ItemStack item = event.getCurrentItem(); if (W.shop.getFile().get(player.getName() + ".tokens") == null) { @@ -68,16 +68,16 @@ public class OnInventoryClickEvent implements Listener { return; if (item.getItemMeta().getDisplayName() == null) return; - if (item.getItemMeta().getDisplayName().equals(MessageM.replaceAll(W.config.get(ConfigC.shop_blockChooserv1Name).toString()))) { + if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(W.config.get(ConfigC.shop_blockChooserv1Name).toString()))) { if (playerTokens >= (Integer) W.config.get(ConfigC.shop_blockChooserv1Price)) { W.shop.getFile().set(player.getName() + ".blockchooser", true); W.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) W.config.get(ConfigC.shop_blockChooserv1Price)); W.shop.save(); - MessageM.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + W.config.get(ConfigC.shop_blockChooserv1Name)); + MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + W.config.get(ConfigC.shop_blockChooserv1Name)); } else { - MessageM.sendFMessage(player, ConfigC.error_shopNeedMoreTokens); + MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens); } - } else if (item.getItemMeta().getDisplayName().equals(MessageM.replaceAll(W.config.get(ConfigC.shop_BlockHuntPassv2Name).toString()))) { + } else if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll(W.config.get(ConfigC.shop_BlockHuntPassv2Name).toString()))) { if (playerTokens >= (Integer) W.config.get(ConfigC.shop_BlockHuntPassv2Price)) { if (W.shop.getFile().get(player.getName() + ".blockhuntpass") == null) { W.shop.getFile().set(player.getName() + ".blockhuntpass", 0); @@ -87,25 +87,25 @@ public class OnInventoryClickEvent implements Listener { W.shop.getFile().set(player.getName() + ".blockhuntpass", (Integer) W.shop.getFile().get(player.getName() + ".blockhuntpass") + 1); W.shop.getFile().set(player.getName() + ".tokens", playerTokens - (Integer) W.config.get(ConfigC.shop_BlockHuntPassv2Price)); W.shop.save(); - MessageM.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + W.config.get(ConfigC.shop_BlockHuntPassv2Name)); + MessageManager.sendFMessage(player, ConfigC.normal_shopBoughtItem, "itemname-" + W.config.get(ConfigC.shop_BlockHuntPassv2Name)); } else { - MessageM.sendFMessage(player, ConfigC.error_shopNeedMoreTokens); + MessageManager.sendFMessage(player, ConfigC.error_shopNeedMoreTokens); } } InventoryHandler.openShop(player); - } else if (inv.getName().contains(MessageM.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)))) { + } else if (inv.getName().contains(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)))) { event.setCancelled(true); if (event.getCurrentItem().getType() != Material.AIR) { if (event.getCurrentItem().getType().isBlock()) { W.choosenBlock.put(player, event.getCurrentItem()); - MessageM.sendFMessage(player, ConfigC.normal_shopChoosenBlock, "block-" + MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenBlock, "block-" + event.getCurrentItem().getType().toString().replaceAll("_", "").replaceAll("BLOCK", "").toLowerCase()); } else { - MessageM.sendFMessage(player, ConfigC.error_setNotABlock); + MessageManager.sendFMessage(player, ConfigC.error_setNotABlock); } } - } else if (inv.getName().contains(MessageM.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name)))) { + } else if (inv.getName().contains(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name)))) { event.setCancelled(true); if (event.getCurrentItem().getType() != Material.AIR) { if (event.getCurrentItem().getType().equals(Material.WOOL) && event.getCurrentItem().getDurability() == (short) 11) { @@ -122,12 +122,12 @@ public class OnInventoryClickEvent implements Listener { } if (i >= arena.amountSeekersOnStart) { - MessageM.sendFMessage(player, ConfigC.error_shopMaxSeekersReached); + MessageManager.sendFMessage(player, ConfigC.error_shopMaxSeekersReached); } else { W.choosenSeeker.put(player, true); player.getInventory().setItemInHand(new ItemStack(Material.AIR)); player.updateInventory(); - MessageM.sendFMessage(player, ConfigC.normal_shopChoosenSeeker); + MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenSeeker); inv.clear(); if (W.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) { W.shop.getFile().set(player.getName() + ".blockhuntpass", null); @@ -153,12 +153,12 @@ public class OnInventoryClickEvent implements Listener { } if (i >= (arena.playersInArena.size() - 1)) { - MessageM.sendFMessage(player, ConfigC.error_shopMaxHidersReached); + MessageManager.sendFMessage(player, ConfigC.error_shopMaxHidersReached); } else { W.choosenSeeker.put(player, false); player.getInventory().setItemInHand(new ItemStack(Material.AIR)); player.updateInventory(); - MessageM.sendFMessage(player, ConfigC.normal_shopChoosenHiders); + MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenHiders); inv.clear(); if (W.shop.getFile().getInt(player.getName() + ".blockhuntpass") == 1) { W.shop.getFile().set(player.getName() + ".blockhuntpass", null); @@ -174,7 +174,7 @@ public class OnInventoryClickEvent implements Listener { } else { event.setCancelled(true); ItemStack item = event.getCurrentItem(); - String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageM.replaceAll("%NBlockHunt arena: %A"), ""); + String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NBlockHunt arena: %A"), ""); Arena arena = null; for (Arena arena2 : W.arenaList) { @@ -272,7 +272,7 @@ public class OnInventoryClickEvent implements Listener { break; } } else { - MessageM.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))) { if (option > min) { @@ -312,7 +312,7 @@ public class OnInventoryClickEvent implements Listener { break; } } else { - MessageM.sendFMessage(player, ConfigC.error_setTooLowNumber, "min-" + min); + MessageManager.sendFMessage(player, ConfigC.error_setTooLowNumber, "min-" + min); } } } diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnInventoryCloseEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnInventoryCloseEvent.java similarity index 92% rename from src/nl/Steffion/BlockHunt/Listeners/OnInventoryCloseEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnInventoryCloseEvent.java index ddb5b29..5fed197 100644 --- a/src/nl/Steffion/BlockHunt/Listeners/OnInventoryCloseEvent.java +++ b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnInventoryCloseEvent.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import nl.Steffion.BlockHunt.Arena; import nl.Steffion.BlockHunt.ArenaHandler; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.Material; import org.bukkit.event.EventHandler; @@ -23,7 +23,7 @@ public class OnInventoryCloseEvent implements Listener { Inventory inv = event.getInventory(); if (inv.getType().equals(InventoryType.CHEST)) { if (inv.getName().contains("DisguiseBlocks")) { - String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageM.replaceAll("%NDisguiseBlocks of arena: %A"), ""); + String arenaname = inv.getItem(0).getItemMeta().getDisplayName().replaceAll(MessageManager.replaceAll("%NDisguiseBlocks of arena: %A"), ""); Arena arena = null; for (Arena arena2 : W.arenaList) { diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnPlayerCommandPreprocessEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerCommandPreprocessEvent.java similarity index 85% rename from src/nl/Steffion/BlockHunt/Listeners/OnPlayerCommandPreprocessEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerCommandPreprocessEvent.java index 014d076..8faca8f 100644 --- a/src/nl/Steffion/BlockHunt/Listeners/OnPlayerCommandPreprocessEvent.java +++ b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerCommandPreprocessEvent.java @@ -5,8 +5,8 @@ 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.MessageM; -import nl.Steffion.BlockHunt.Managers.PermissionsM; +import nl.Steffion.BlockHunt.Managers.MessageManager; +import nl.Steffion.BlockHunt.Managers.PermissionsManager; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -37,11 +37,11 @@ public class OnPlayerCommandPreprocessEvent implements Listener { } } - if (PermissionsM.hasPerm(player, Permissions.allcommands, false)) { + if (PermissionsManager.hasPerm(player, Permissions.allcommands, false)) { return; } - MessageM.sendFMessage(player, ConfigC.warning_unableToCommand); + MessageManager.sendFMessage(player, ConfigC.warning_unableToCommand); event.setCancelled(true); } } diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnPlayerDropItemEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerDropItemEvent.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Listeners/OnPlayerDropItemEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerDropItemEvent.java diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnPlayerInteractEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerInteractEvent.java similarity index 77% rename from src/nl/Steffion/BlockHunt/Listeners/OnPlayerInteractEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerInteractEvent.java index 1cb699c..66301c8 100644 --- a/src/nl/Steffion/BlockHunt/Listeners/OnPlayerInteractEvent.java +++ b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerInteractEvent.java @@ -9,9 +9,8 @@ import nl.Steffion.BlockHunt.PermissionsC.Permissions; import nl.Steffion.BlockHunt.SignsHandler; import nl.Steffion.BlockHunt.SolidBlockHandler; import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; -import nl.Steffion.BlockHunt.Managers.PermissionsM; -import nl.Steffion.BlockHunt.Serializables.LocationSerializable; +import nl.Steffion.BlockHunt.Managers.MessageManager; +import nl.Steffion.BlockHunt.Managers.PermissionsManager; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -35,19 +34,19 @@ public class OnPlayerInteractEvent implements Listener { public void onPlayerInteractEvent(PlayerInteractEvent event) { Player player = event.getPlayer(); Block block = event.getClickedBlock(); - if (PermissionsM.hasPerm(player, Permissions.create, false)) { + if (PermissionsManager.hasPerm(player, Permissions.create, false)) { ItemStack item = player.getInventory().getItemInMainHand(); if (item.getType() != Material.AIR) { if (item.getItemMeta().hasDisplayName()) { ItemMeta im = item.getItemMeta(); - if (im.getDisplayName().equals(MessageM.replaceAll((String) W.config.get(ConfigC.wandName)))) { + if (im.getDisplayName().equals(MessageManager.replaceAll((String) W.config.get(ConfigC.wandName)))) { Action action = event.getAction(); if (event.hasBlock()) { - LocationSerializable location = new LocationSerializable(event.getClickedBlock().getLocation()); + Location location = event.getClickedBlock().getLocation(); if (action.equals(Action.LEFT_CLICK_BLOCK)) { event.setCancelled(true); if (W.pos1.get(player) == null || !W.pos1.get(player).equals(location)) { - MessageM.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-" + location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ()); W.pos1.put(player, location); @@ -55,7 +54,7 @@ public class OnPlayerInteractEvent implements Listener { } else if (action.equals(Action.RIGHT_CLICK_BLOCK)) { event.setCancelled(true); if (W.pos2.get(player) == null || !W.pos2.get(player).equals(location)) { - MessageM.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-" + location.getBlockX(), "y-" + location.getBlockY(), "z-" + location.getBlockZ()); W.pos2.put(player, location); @@ -70,21 +69,21 @@ public class OnPlayerInteractEvent implements Listener { if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (event.getClickedBlock() != null) { if (event.getClickedBlock().getType().equals(Material.SIGN_POST) || event.getClickedBlock().getType().equals(Material.WALL_SIGN)) { - if (SignsHandler.isSign(new LocationSerializable(event.getClickedBlock().getLocation()))) { + if (SignsHandler.isSign(event.getClickedBlock().getLocation())) { Sign sign = (Sign) event.getClickedBlock().getState(); if (sign.getLine(1) != null) { - if (sign.getLine(1).equals(MessageM.replaceAll(W.config.getFile().getStringList(ConfigC.sign_LEAVE.location).get(1)))) { - if (PermissionsM.hasPerm(player, Permissions.joinsign, true)) { + if (sign.getLine(1).equals(MessageManager.replaceAll(W.config.getFile().getStringList(ConfigC.sign_LEAVE.location).get(1)))) { + if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) { ArenaHandler.playerLeaveArena(player, true, true); } - } else if (sign.getLine(1).equals(MessageM.replaceAll(W.config.getFile().getStringList(ConfigC.sign_SHOP.location).get(1)))) { - if (PermissionsM.hasPerm(player, Permissions.shop, true)) { + } else if (sign.getLine(1).equals(MessageManager.replaceAll(W.config.getFile().getStringList(ConfigC.sign_SHOP.location).get(1)))) { + if (PermissionsManager.hasPerm(player, Permissions.shop, true)) { InventoryHandler.openShop(player); } } else { for (Arena arena : W.arenaList) { if (sign.getLines()[1].contains(arena.arenaName)) { - if (PermissionsM.hasPerm(player, Permissions.joinsign, true)) { + if (PermissionsManager.hasPerm(player, Permissions.joinsign, true)) { ArenaHandler.playerJoinArena(player, arena.arenaName); } } @@ -135,8 +134,8 @@ public class OnPlayerInteractEvent implements Listener { ItemStack item = player.getInventory().getItemInMainHand(); if (item.getType() != Material.AIR) { if (item.getItemMeta().getDisplayName() != null) { - if (item.getItemMeta().getDisplayName().equals(MessageM.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)))) { - Inventory blockChooser = Bukkit.createInventory(null, 36, MessageM.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_blockChooserv1Name))); + if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_blockChooserv1Name)))) { + Inventory blockChooser = Bukkit.createInventory(null, 36, MessageManager.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_blockChooserv1Name))); if (arena.disguiseBlocks != null) { for (int i = arena.disguiseBlocks.size(); i > 0; i = i - 1) { blockChooser.setItem(i - 1, arena.disguiseBlocks.get(i - 1)); @@ -146,16 +145,16 @@ public class OnPlayerInteractEvent implements Listener { player.openInventory(blockChooser); } - if (item.getItemMeta().getDisplayName().equals(MessageM.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name)))) { - Inventory BlockHuntPass = Bukkit.createInventory(null, 9, MessageM.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_BlockHuntPassv2Name))); + if (item.getItemMeta().getDisplayName().equals(MessageManager.replaceAll((String) W.config.get(ConfigC.shop_BlockHuntPassv2Name)))) { + Inventory BlockHuntPass = Bukkit.createInventory(null, 9, MessageManager.replaceAll("\u00A7r" + W.config.get(ConfigC.shop_BlockHuntPassv2Name))); ItemStack BlockHuntPassSEEKER = new ItemStack(Material.WOOL, 1, (short) 11); ItemMeta BlockHuntPassIM = BlockHuntPassSEEKER.getItemMeta(); - BlockHuntPassIM.setDisplayName(MessageM.replaceAll("&eSEEKER")); + BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eSEEKER")); BlockHuntPassSEEKER.setItemMeta(BlockHuntPassIM); BlockHuntPass.setItem(1, BlockHuntPassSEEKER); ItemStack BlockHuntPassHIDER = new ItemStack(Material.WOOL, 1, (short) 14); - BlockHuntPassIM.setDisplayName(MessageM.replaceAll("&eHIDER")); + BlockHuntPassIM.setDisplayName(MessageManager.replaceAll("&eHIDER")); BlockHuntPassHIDER.setItemMeta(BlockHuntPassIM); BlockHuntPass.setItem(7, BlockHuntPassHIDER); diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnPlayerMoveEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerMoveEvent.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Listeners/OnPlayerMoveEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerMoveEvent.java diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnPlayerQuitEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerQuitEvent.java similarity index 100% rename from src/nl/Steffion/BlockHunt/Listeners/OnPlayerQuitEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnPlayerQuitEvent.java diff --git a/src/nl/Steffion/BlockHunt/Listeners/OnSignChangeEvent.java b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnSignChangeEvent.java similarity index 72% rename from src/nl/Steffion/BlockHunt/Listeners/OnSignChangeEvent.java rename to src/main/java/nl/Steffion/BlockHunt/Listeners/OnSignChangeEvent.java index 50e2191..f00804c 100644 --- a/src/nl/Steffion/BlockHunt/Listeners/OnSignChangeEvent.java +++ b/src/main/java/nl/Steffion/BlockHunt/Listeners/OnSignChangeEvent.java @@ -3,8 +3,7 @@ package nl.Steffion.BlockHunt.Listeners; import nl.Steffion.BlockHunt.BlockHunt; import nl.Steffion.BlockHunt.PermissionsC.Permissions; import nl.Steffion.BlockHunt.SignsHandler; -import nl.Steffion.BlockHunt.Managers.PermissionsM; -import nl.Steffion.BlockHunt.Serializables.LocationSerializable; +import nl.Steffion.BlockHunt.Managers.PermissionsManager; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -20,8 +19,8 @@ public class OnSignChangeEvent implements Listener { String[] lines = event.getLines(); if (lines[0] != null) { if (lines[0].equalsIgnoreCase("[" + BlockHunt.pdfFile.getName() + "]")) { - if (PermissionsM.hasPerm(player, Permissions.signcreate, true)) { - SignsHandler.createSign(event, lines, new LocationSerializable(event.getBlock().getLocation())); + if (PermissionsManager.hasPerm(player, Permissions.signcreate, true)) { + SignsHandler.createSign(event, lines, event.getBlock().getLocation()); } } } diff --git a/src/nl/Steffion/BlockHunt/Managers/CommandM.java b/src/main/java/nl/Steffion/BlockHunt/Managers/CommandManager.java similarity index 82% rename from src/nl/Steffion/BlockHunt/Managers/CommandM.java rename to src/main/java/nl/Steffion/BlockHunt/Managers/CommandManager.java index ed6636f..2b09bac 100644 --- a/src/nl/Steffion/BlockHunt/Managers/CommandM.java +++ b/src/main/java/nl/Steffion/BlockHunt/Managers/CommandManager.java @@ -17,7 +17,7 @@ import nl.Steffion.BlockHunt.PermissionsC.Permissions; import nl.Steffion.BlockHunt.W; import nl.Steffion.BlockHunt.Commands.DefaultCMD; -public class CommandM { +public class CommandManager { public String name; @@ -31,8 +31,8 @@ public class CommandM { public DefaultCMD CMD; public String usage; - public CommandM(String name, String label, String args, String argsalias, Permissions permission, ConfigC help, Boolean enabled, List mainTABlist, - DefaultCMD CMD, String usage) { + public CommandManager(String name, String label, String args, String argsalias, Permissions permission, ConfigC help, Boolean enabled, List mainTABlist, + DefaultCMD CMD, String usage) { this.name = name; this.label = label; this.args = args; diff --git a/src/nl/Steffion/BlockHunt/Managers/ConfigM.java b/src/main/java/nl/Steffion/BlockHunt/Managers/ConfigManager.java similarity index 76% rename from src/nl/Steffion/BlockHunt/Managers/ConfigM.java rename to src/main/java/nl/Steffion/BlockHunt/Managers/ConfigManager.java index eeb723f..89efa3f 100644 --- a/src/nl/Steffion/BlockHunt/Managers/ConfigM.java +++ b/src/main/java/nl/Steffion/BlockHunt/Managers/ConfigManager.java @@ -20,14 +20,14 @@ import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; -public class ConfigM { +public class ConfigManager { - String fileName; - File file; - FileConfiguration fileC; - ConfigurationSection fileCS; - String fileLocation; + private String fileName; + private File file; + private FileConfiguration fileC; + private ConfigurationSection fileCS; + private File fileLocation; /** * Use this class to create an automated config file. @@ -35,10 +35,10 @@ public class ConfigM { * @param fileName * Name of the file. */ - public ConfigM(String fileName) { + public ConfigManager(String fileName) { this.fileName = fileName; - this.file = new File("plugins/" + BlockHunt.pdfFile.getName(), fileName + ".yml"); - this.fileLocation = BlockHunt.pdfFile.getName(); + this.file = new File(BlockHunt.plugin.getDataFolder(), fileName + ".yml"); + this.fileLocation = BlockHunt.plugin.getDataFolder(); this.fileC = new YamlConfiguration(); this.checkFile(); this.fileCS = fileC.getConfigurationSection(""); @@ -50,13 +50,14 @@ public class ConfigM { * * @param fileName * Name of the file. - * @param fileLocation + * @param subdirectory * Sub-Location of the file. */ - public ConfigM(String fileName, String fileLocation) { + public ConfigManager(String fileName, String subdirectory) { this.fileName = fileName; - this.file = new File("plugins/" + BlockHunt.pdfFile.getName() + "/" + fileLocation, fileName + ".yml"); - this.fileLocation = BlockHunt.pdfFile.getName() + "/" + fileLocation; + File directory = new File( BlockHunt.plugin.getDataFolder() , subdirectory ); + this.file = new File( directory,fileName + ".yml"); + this.fileLocation = directory; this.fileC = new YamlConfiguration(); this.checkFile(); this.fileCS = fileC.getConfigurationSection(""); @@ -68,9 +69,9 @@ public class ConfigM { * console. */ public static void newFiles() { - ConfigM.setDefaults(); + ConfigManager.setDefaults(); for (String fileName : W.newFiles) { - MessageM.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%W' creating new one.", "fileName-" + fileName); } W.newFiles.clear(); @@ -97,11 +98,10 @@ public class ConfigM { try { this.file.getParentFile().mkdirs(); this.file.createNewFile(); - if (this.fileLocation.equals(BlockHunt.pdfFile.getName())) { + if(file.exists()) { W.newFiles.add(this.fileName); - } else { - W.newFiles.add(this.fileLocation + this.fileName); } + } catch (Exception e) { e.printStackTrace(); } diff --git a/src/nl/Steffion/BlockHunt/Managers/MessageM.java b/src/main/java/nl/Steffion/BlockHunt/Managers/MessageManager.java similarity index 80% rename from src/nl/Steffion/BlockHunt/Managers/MessageM.java rename to src/main/java/nl/Steffion/BlockHunt/Managers/MessageManager.java index e15f09f..3cd76d6 100644 --- a/src/nl/Steffion/BlockHunt/Managers/MessageM.java +++ b/src/main/java/nl/Steffion/BlockHunt/Managers/MessageManager.java @@ -6,7 +6,7 @@ import nl.Steffion.BlockHunt.W; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -public class MessageM { +public class MessageManager { /** * Steffion's Engine - Made by Steffion. * @@ -33,9 +33,9 @@ public class MessageM { */ public static void sendMessage(Player player, String message, String... vars) { if (player == null) { - Bukkit.getConsoleSender().sendMessage(MessageM.replaceAll(message.replaceAll("%player%", "Console"), vars)); + Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", "Console"), vars)); } else { - player.sendMessage(MessageM.replaceAll(message.replaceAll("%player%", player.getDisplayName()), vars)); + player.sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", player.getDisplayName()), vars)); } } @@ -54,9 +54,9 @@ public class MessageM { public static void sendFMessage(Player player, ConfigC location, String... vars) { if (player == null) { Bukkit.getConsoleSender().sendMessage( - MessageM.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", "Console"), vars)); + MessageManager.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", "Console"), vars)); } else { - player.sendMessage(MessageM.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName()), vars)); + player.sendMessage(MessageManager.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName()), vars)); } } @@ -74,10 +74,10 @@ public class MessageM { for (Player player : Bukkit.getOnlinePlayers()) { // String pMessage = message.replaceAll("%player%", // player.getName()); - player.sendMessage(MessageM.replaceAll(message.replaceAll("%player%", player.getDisplayName()), vars)); + player.sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", player.getDisplayName()), vars)); } // message = message.replaceAll("%player%", "Console"); - Bukkit.getConsoleSender().sendMessage(MessageM.replaceAll(message.replaceAll("%player%", "Console"), vars)); + Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(message.replaceAll("%player%", "Console"), vars)); } /** @@ -95,11 +95,11 @@ public class MessageM { // String pMessage = // location.config.getFile().get(location.location) // .toString().replaceAll("%player%", player.getName()); - player.sendMessage(MessageM.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName()), vars)); + player.sendMessage(MessageManager.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", player.getDisplayName()), vars)); } // String message = location.config.getFile().get(location.location) // .toString().replaceAll("%player%", "Console"); - Bukkit.getConsoleSender().sendMessage(MessageM.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", "Console"), vars)); + Bukkit.getConsoleSender().sendMessage(MessageManager.replaceAll(location.config.getFile().get(location.location).toString().replaceAll("%player%", "Console"), vars)); } /** @@ -113,7 +113,7 @@ public class MessageM { * @return String with the message with values replaced */ public static String replaceAll(String message, String... vars) { - return MessageM.replaceColours(MessageM.replaceColourVars(MessageM.replaceVars(message, vars))); + return MessageManager.replaceColours(MessageManager.replaceColourVars(MessageManager.replaceVars(message, vars))); } /** diff --git a/src/nl/Steffion/BlockHunt/Managers/PermissionsM.java b/src/main/java/nl/Steffion/BlockHunt/Managers/PermissionsManager.java similarity index 95% rename from src/nl/Steffion/BlockHunt/Managers/PermissionsM.java rename to src/main/java/nl/Steffion/BlockHunt/Managers/PermissionsManager.java index 8f3041e..14db731 100644 --- a/src/nl/Steffion/BlockHunt/Managers/PermissionsM.java +++ b/src/main/java/nl/Steffion/BlockHunt/Managers/PermissionsManager.java @@ -7,7 +7,7 @@ import nl.Steffion.BlockHunt.PermissionsC.Permissions; import org.bukkit.entity.Player; -public class PermissionsM { +public class PermissionsManager { /** * Steffion's Engine - Made by Steffion. * @@ -69,7 +69,7 @@ public class PermissionsM { return true; } else { if (message) { - MessageM.sendFMessage(player, ConfigC.error_noPermission); + MessageManager.sendFMessage(player, ConfigC.error_noPermission); } } return false; @@ -125,7 +125,7 @@ public class PermissionsM { return true; } else { if (message) { - MessageM.sendFMessage(player, ConfigC.error_noPermission); + MessageManager.sendFMessage(player, ConfigC.error_noPermission); } } return false; diff --git a/src/nl/Steffion/BlockHunt/PermissionsC.java b/src/main/java/nl/Steffion/BlockHunt/PermissionsC.java similarity index 100% rename from src/nl/Steffion/BlockHunt/PermissionsC.java rename to src/main/java/nl/Steffion/BlockHunt/PermissionsC.java diff --git a/src/nl/Steffion/BlockHunt/PlayerArenaData.java b/src/main/java/nl/Steffion/BlockHunt/PlayerArenaData.java similarity index 100% rename from src/nl/Steffion/BlockHunt/PlayerArenaData.java rename to src/main/java/nl/Steffion/BlockHunt/PlayerArenaData.java diff --git a/src/nl/Steffion/BlockHunt/ScoreboardHandler.java b/src/main/java/nl/Steffion/BlockHunt/ScoreboardHandler.java similarity index 68% rename from src/nl/Steffion/BlockHunt/ScoreboardHandler.java rename to src/main/java/nl/Steffion/BlockHunt/ScoreboardHandler.java index 20f63b2..f34f65e 100644 --- a/src/nl/Steffion/BlockHunt/ScoreboardHandler.java +++ b/src/main/java/nl/Steffion/BlockHunt/ScoreboardHandler.java @@ -1,7 +1,7 @@ package nl.Steffion.BlockHunt; import nl.Steffion.BlockHunt.Arena.ArenaState; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -22,17 +22,17 @@ public class ScoreboardHandler { Objective object = board.registerNewObjective(BlockHunt.cutString(arena.arenaName, 32), "dummy"); object.setDisplaySlot(DisplaySlot.SIDEBAR); - object.setDisplayName(BlockHunt.cutString(MessageM.replaceAll((String) W.config.get(ConfigC.scoreboard_title)), 32)); + object.setDisplayName(BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_title)), 32)); - String temp = BlockHunt.cutString(MessageM.replaceAll((String) W.config.get(ConfigC.scoreboard_timeleft)), 32); + String temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_timeleft)), 32); Score timeleft = object.getScore(temp); timeleft.setScore(arena.timer); - temp = BlockHunt.cutString(MessageM.replaceAll((String) W.config.get(ConfigC.scoreboard_seekers)), 32); + temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_seekers)), 32); Score seekers = object.getScore(temp); seekers.setScore(arena.seekers.size()); - temp = BlockHunt.cutString(MessageM.replaceAll((String) W.config.get(ConfigC.scoreboard_hiders)), 32); + temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_hiders)), 32); Score hiders = object.getScore(temp); hiders.setScore(arena.playersInArena.size() - arena.seekers.size()); @@ -52,17 +52,17 @@ public class ScoreboardHandler { if ((Boolean) W.config.get(ConfigC.scoreboard_enabled)) { Scoreboard board = arena.scoreboard; Objective object = board.getObjective(DisplaySlot.SIDEBAR); - object.setDisplayName(BlockHunt.cutString(MessageM.replaceAll((String) W.config.get(ConfigC.scoreboard_title)), 32)); + object.setDisplayName(BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_title)), 32)); - String temp = BlockHunt.cutString(MessageM.replaceAll((String) W.config.get(ConfigC.scoreboard_timeleft)), 32); + String temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_timeleft)), 32); Score timeleft = object.getScore(temp); timeleft.setScore(arena.timer); - temp = BlockHunt.cutString(MessageM.replaceAll((String) W.config.get(ConfigC.scoreboard_seekers)), 32); + temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_seekers)), 32); Score seekers = object.getScore(temp); seekers.setScore(arena.seekers.size()); - temp = BlockHunt.cutString(MessageM.replaceAll((String) W.config.get(ConfigC.scoreboard_hiders)), 32); + temp = BlockHunt.cutString(MessageManager.replaceAll((String) W.config.get(ConfigC.scoreboard_hiders)), 32); Score hiders = object.getScore(temp); hiders.setScore(arena.playersInArena.size() - arena.seekers.size()); diff --git a/src/nl/Steffion/BlockHunt/Serializables/LocationSerializable.java b/src/main/java/nl/Steffion/BlockHunt/Serializables/LocationSerializable.java similarity index 60% rename from src/nl/Steffion/BlockHunt/Serializables/LocationSerializable.java rename to src/main/java/nl/Steffion/BlockHunt/Serializables/LocationSerializable.java index d577688..aa0ef98 100644 --- a/src/nl/Steffion/BlockHunt/Serializables/LocationSerializable.java +++ b/src/main/java/nl/Steffion/BlockHunt/Serializables/LocationSerializable.java @@ -1,57 +1,66 @@ -package nl.Steffion.BlockHunt.Serializables; - -import java.util.HashMap; -import java.util.Map; - -import nl.Steffion.BlockHunt.Managers.MessageM; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.configuration.serialization.ConfigurationSerializable; -import org.bukkit.configuration.serialization.SerializableAs; - -@SerializableAs("BlockHuntLocation") -public class LocationSerializable extends Location implements ConfigurationSerializable { - public LocationSerializable(World world, double x, double y, double z, float yaw, float pitch) { - super(world, x, y, z, yaw, pitch); - } - - public LocationSerializable(Location loc) { - super(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); - } - - @Override - public boolean equals(Object o) { - if (o instanceof LocationSerializable || o instanceof Location) { - Location loc = (Location) o; - return loc.getWorld().getName().equals(getWorld().getName()) && loc.getX() == getX() && loc.getY() == getY() && loc.getZ() == getZ() - && loc.getYaw() == getYaw() && loc.getPitch() == getPitch(); - } - return false; - } - - @Override - public Map serialize() { - Map map = new HashMap<>(); - map.put("w", getWorld().getName()); - map.put("x", getX()); - map.put("y", getY()); - map.put("z", getZ()); - if (getYaw() != 0D) - map.put("a", getYaw()); - if (getPitch() != 0D) - map.put("p", getPitch()); - return map; - } - - public static LocationSerializable deserialize(Map map) { - World w = Bukkit.getWorld((String) M.g(map, "w", "")); - if (w == null) { - MessageM.sendMessage(null, "%EError deserializing LocationSerializable - world not found! (%A%w%%E)", "w-" + w); - return null; - } - return new LocationSerializable(w, (Double) M.g(map, "x", 0D), (Double) M.g(map, "y", 0D), (Double) M.g(map, "z", 0D), ((Double) M.g(map, "a", 0D)).floatValue(), - ((Double) M.g(map, "p", 0D)).floatValue()); - } -} +package nl.Steffion.BlockHunt.Serializables; + +import java.util.HashMap; +import java.util.Map; + +import nl.Steffion.BlockHunt.Managers.MessageManager; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.configuration.serialization.ConfigurationSerializable; +import org.bukkit.configuration.serialization.SerializableAs; + +/** + * No longer required as a location is already serializable + */ + +@SerializableAs("BlockHuntLocation") +@Deprecated +public class LocationSerializable extends Location { + public LocationSerializable(World world, double x, double y, double z, float yaw, float pitch) { + super(world, x, y, z, yaw, pitch); + } + + public LocationSerializable(Location loc) { + super(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); + } + + @Override + public boolean equals(Object o) { + if (o instanceof LocationSerializable || o instanceof Location) { + Location loc = (Location) o; + return loc.getWorld().getName().equals(getWorld().getName()) && loc.getX() == getX() && loc.getY() == getY() && loc.getZ() == getZ() + && loc.getYaw() == getYaw() && loc.getPitch() == getPitch(); + } + return false; + } + + @Override + public Map serialize() { + Map map = new HashMap<>(); + map.put("world", getWorld().getName()); + map.put("x", getX()); + map.put("y", getY()); + map.put("z", getZ()); + if (getYaw() != 0D) + map.put("yaw", getYaw()); + if (getPitch() != 0D) + map.put("pitch", getPitch()); + return map; + } + + public static LocationSerializable deserialize(Map map) { + World w = Bukkit.getWorld((String)map.getOrDefault( "w", "")); + if (w == null) { + MessageManager.sendMessage(null, "%EError deserializing Location - world not found! (%A%w%%E)", "w-" + w); + return null; + } + return new LocationSerializable(w, (Double) map.getOrDefault( "x", 0D), (Double) map.getOrDefault( "y", 0D), (Double) map.getOrDefault( "z", 0D), ((Double) map.getOrDefault( "a", 0D)).floatValue(), + ((Double) map.getOrDefault( "p", 0D)).floatValue()); + } + + public static Location getLocation(LocationSerializable ser){ + return new Location(ser.getWorld(),ser.getX(),ser.getY(),ser.getZ(),ser.getYaw(),ser.getPitch()); + } +} diff --git a/src/nl/Steffion/BlockHunt/SignsHandler.java b/src/main/java/nl/Steffion/BlockHunt/SignsHandler.java similarity index 79% rename from src/nl/Steffion/BlockHunt/SignsHandler.java rename to src/main/java/nl/Steffion/BlockHunt/SignsHandler.java index 02a7796..509bbde 100644 --- a/src/nl/Steffion/BlockHunt/SignsHandler.java +++ b/src/main/java/nl/Steffion/BlockHunt/SignsHandler.java @@ -2,16 +2,16 @@ package nl.Steffion.BlockHunt; import java.util.ArrayList; import nl.Steffion.BlockHunt.Arena.ArenaState; -import nl.Steffion.BlockHunt.Managers.MessageM; -import nl.Steffion.BlockHunt.Serializables.LocationSerializable; +import nl.Steffion.BlockHunt.Managers.MessageManager; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Sign; import org.bukkit.event.block.SignChangeEvent; public class SignsHandler { - public static void createSign(SignChangeEvent event, String[] lines, LocationSerializable location) { + public static void createSign(SignChangeEvent event, String[] lines, Location location) { if (lines[1] != null) { if (lines[1].equalsIgnoreCase("leave")) { boolean saved = false; @@ -61,15 +61,15 @@ public class SignsHandler { } if (!saved) { - MessageM.sendFMessage(event.getPlayer(), ConfigC.error_noArena, "name-" + lines[1]); + MessageManager.sendFMessage(event.getPlayer(), ConfigC.error_noArena, "name-" + lines[1]); } } } } - public static void removeSign(LocationSerializable location) { + public static void removeSign(Location location) { for (String sign : W.signs.getFile().getKeys(false)) { - LocationSerializable loc = new LocationSerializable((LocationSerializable) W.signs.getFile().get(sign + ".location")); + Location loc = (Location) W.signs.getFile().get(sign + ".location"); if (loc.equals(location)) { W.signs.getFile().set(sign, null); W.signs.save(); @@ -77,9 +77,9 @@ public class SignsHandler { } } - public static boolean isSign(LocationSerializable location) { + public static boolean isSign(Location location) { for (String sign : W.signs.getFile().getKeys(false)) { - LocationSerializable loc = new LocationSerializable((LocationSerializable) W.signs.getFile().get(sign + ".location")); + Location loc = (Location) W.signs.getFile().get(sign + ".location"); if (loc.equals(location)) { return true; } @@ -91,7 +91,7 @@ public class SignsHandler { public static void updateSigns() { W.signs.load(); for (String sign : W.signs.getFile().getKeys(false)) { - LocationSerializable loc = new LocationSerializable((LocationSerializable) W.signs.getFile().get(sign + ".location")); + Location loc = (Location) W.signs.getFile().get(sign + ".location"); if (loc.getBlock().getType().equals(Material.SIGN_POST) || loc.getBlock().getType().equals(Material.WALL_SIGN)) { Sign signblock = (Sign) loc.getBlock().getState(); String[] lines = signblock.getLines(); @@ -101,7 +101,7 @@ public class SignsHandler { int linecount = 0; for (String line : signLines) { if (linecount <= 3) { - signblock.setLine(linecount, MessageM.replaceAll(line)); + signblock.setLine(linecount, MessageManager.replaceAll(line)); } linecount = linecount + 1; @@ -112,7 +112,7 @@ public class SignsHandler { int linecount = 0; for (String line : signLines) { if (linecount <= 3) { - signblock.setLine(linecount, MessageM.replaceAll(line)); + signblock.setLine(linecount, MessageManager.replaceAll(line)); } linecount = linecount + 1; @@ -129,7 +129,7 @@ public class SignsHandler { if (linecount <= 3) { signblock.setLine( linecount, - MessageM.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-" + MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-" + arena.maxPlayers, "timeleft-" + arena.timer)); } @@ -145,7 +145,7 @@ public class SignsHandler { if (linecount <= 3) { signblock.setLine( linecount, - MessageM.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-" + MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-" + arena.maxPlayers, "timeleft-" + arena.timer)); } @@ -161,7 +161,7 @@ public class SignsHandler { if (linecount <= 3) { signblock.setLine( linecount, - MessageM.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-" + MessageManager.replaceAll(line, "arenaname-" + arena.arenaName, "players-" + arena.playersInArena.size(), "maxplayers-" + arena.maxPlayers, "timeleft-" + arena.timer)); } diff --git a/src/nl/Steffion/BlockHunt/SolidBlockHandler.java b/src/main/java/nl/Steffion/BlockHunt/SolidBlockHandler.java similarity index 93% rename from src/nl/Steffion/BlockHunt/SolidBlockHandler.java rename to src/main/java/nl/Steffion/BlockHunt/SolidBlockHandler.java index 2a0f7b3..18be91f 100644 --- a/src/nl/Steffion/BlockHunt/SolidBlockHandler.java +++ b/src/main/java/nl/Steffion/BlockHunt/SolidBlockHandler.java @@ -3,7 +3,7 @@ package nl.Steffion.BlockHunt; import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.disguisetypes.DisguiseType; import me.libraryaddict.disguise.disguisetypes.MiscDisguise; -import nl.Steffion.BlockHunt.Managers.MessageM; +import nl.Steffion.BlockHunt.Managers.MessageManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -57,6 +57,6 @@ public class SolidBlockHandler { MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getTypeId(), block.getDurability()); DisguiseAPI.disguiseToAll(player, disguise); - MessageM.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid); + MessageManager.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid); } } diff --git a/src/nl/Steffion/BlockHunt/W.java b/src/main/java/nl/Steffion/BlockHunt/W.java similarity index 69% rename from src/nl/Steffion/BlockHunt/W.java rename to src/main/java/nl/Steffion/BlockHunt/W.java index 35d8d41..95ee879 100644 --- a/src/nl/Steffion/BlockHunt/W.java +++ b/src/main/java/nl/Steffion/BlockHunt/W.java @@ -16,9 +16,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Random; -import nl.Steffion.BlockHunt.Managers.CommandM; -import nl.Steffion.BlockHunt.Managers.ConfigM; -import nl.Steffion.BlockHunt.Serializables.LocationSerializable; +import nl.Steffion.BlockHunt.Managers.CommandManager; +import nl.Steffion.BlockHunt.Managers.ConfigManager; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -30,23 +29,23 @@ public class W { * Standard stuff. */ public static ArrayList newFiles = new ArrayList<>(); - public static ArrayList commands = new ArrayList<>(); + public static ArrayList commands = new ArrayList<>(); /* * If you want another file to be created. Copy and paste this line. */ - public static ConfigM config = new ConfigM("config"); - public static ConfigM messages = new ConfigM("messages"); - public static ConfigM arenas = new ConfigM("arenas"); - public static ConfigM signs = new ConfigM("signs"); - public static ConfigM shop = new ConfigM("shop"); + public static ConfigManager config = new ConfigManager("config"); + public static ConfigManager messages = new ConfigManager("messages"); + public static ConfigManager arenas = new ConfigManager("arenas"); + public static ConfigManager signs = new ConfigManager("signs"); + public static ConfigManager shop = new ConfigManager("shop"); /* * Add any variable you need in different classes here: */ - public static HashMap pos1 = new HashMap<>(); - public static HashMap pos2 = new HashMap<>(); + public static HashMap pos1 = new HashMap<>(); + public static HashMap pos2 = new HashMap<>(); public static ArrayList arenaList = new ArrayList<>(); public static Random random = new Random(); diff --git a/src/main/resources/lang/messages.properties b/src/main/resources/lang/messages.properties new file mode 100644 index 0000000..bc93181 --- /dev/null +++ b/src/main/resources/lang/messages.properties @@ -0,0 +1,90 @@ +log-enabledPlugin: '%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%autors%%N.' +log-disabledPlugin: '%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%autors%%N.' +info: '%NDisplays the plugin''s info.' +help: '%NShows a list of commands.' +reload: '%NReloads all configs.' +join: '%NJoins a BlockHunt game.' +leave: '%NLeave a BlockHunt game.' +list: '%NShows a list of available arenas.' +shop: '%NOpens the BlockHunt shop.' +start: '%NForces an arena to start.' +wand: '%NGives you the wand selection tool.' +create: '%NCreates an arena from your selection.' +set: '%NOpens a panel to set settings.' +setwarp: '%NSets warps for your arena.' +remove: '%NDeletes an Arena.' +tokens: '%NChange someones tokens.' +#buttons +button-add: '%NAdd %A%1%%N to %A%2%%N' +button-add2: Add +button-setting: '%NSetting %A%1%%N is now: %A%2%%N.' +button-remove: '%NRemove %A%1%%N from %A%2%%N' +button-remove2: Remove +#Normal +reloadedConfigs: '%TAG&aReloaded all configs!' +joinJoinedArena: '%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)' +leaveYouLeft: '%TAG%NYou left the arena! Thanks for playing!' +leaveLeftArena: '%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)' +startForced: '%TAG%NYou forced to start arena ''%A%arenaname%%N''!' +wandGaveWand: '%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)' +wandSetPosition: '%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N,%A%z%%N).' +createCreatedArena: '%TAG%NCreated an arena with the name ''%A%name%%N''.' +lobbyArenaIsStarting: '%TAG%NThe arena will start in %A%1%%N second(s)!' +lobbyArenaStarted: '%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!' +ingameSeekerChoosen: '%TAG%NPlayer %A%seeker%%N has been choosen as seeker!' +ingameBlock: '%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.' +ingameArenaEnd: '%TAG%NThe arena will end in %A%1%%N second(s)!' +ingameSeekerSpawned: '%TAG%A%playername%%N has spawned as a seeker!' +ingameGivenSword: '%TAG%NYou were given a sword!' +ingameHiderDied: '%TAG%NHider %A%playername%%N was killed by %A%killer%%N!' +ingameHidersLeft: '%NHider(s) left: %A%left%%N' +ingameSeekerDied: '%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!' +winSeekers: '%TAG%NThe %ASEEKERS%N have won!' +winHiders: '%TAG%NThe %AHIDERS%N have won!' +setwarpWarpSet: '%TAG%NSet warp ''%A%warp%%N'' to your location!' +addedToken: '%TAG%A%amount%%N tokens were added to your account!' +removeRemovedArena: '%TAG%NRemoved arena ''%A%name%%N''!' +tokensChanged: '%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.' +tokensChangedPerson: '%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% your tokens.' +ingameNowSolid: '%TAG%NYou''re now a solid ''%A%block%%N'' block!' +ingameNoMoreSolid: '%TAG%NYou''re no longer a solid block!' +shopBoughtItem: '%TAG%NYou''ve bought the ''%A%itemname%%N'' item!' +shopChoosenBlock: '%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!' +shopChoosenSeeker: '%TAG%NYou''ve choosen to be a %Aseeker%N!' +shopChoosenHiders: '%TAG%NYou''ve choosen to be a %Ahider%N!' +ingameBlocksLeft: '%TAG%NRemaining blocks: %A%1%%N' + +# Warnings +lobbyNeedAtleast: '%TAG%WYou need atleast %A%1%%W player(s) to start the game!' +ingameNEWSeekerChoosen: '%TAG%WThe last seeker left and a new seeker has been choosen!' +unableToCommand: '%TAG%WSorry but that command is disabled in the arena.' +ingameNoSolidPlace: '%TAG%WThat''s not a valid place to become solid!' +arenaStopped: '%TAG%WThe arena has been forced to stop!' + +error-noPermission: '%TAG%EYou don''t have the permissions to do that!' +error-notANumber: '%TAG%E''%A%1%%E'' is not a number!' +error-commandNotEnabled: '%TAG%EThis command has been disabled!' +error-commandNotFound: '%TAG%ECouldn''t find the command. Try %A/BlockHunt help %Efor more info.' +error-notEnoughArguments: '%TAG%EYou''re missing arguments, correct syntax: %A%syntax%' +error-libsDisguisesNotInstalled: '%TAG%EThe plugin ''%ALib''s Disguises%E'' is required to run this plugin! Intall it or it won''t work!' +error-protocolLibNotInstalled: '%TAG%EThe plugin ''%AProtocolLib%E'' is required to run this plugin! Intall it or it won''t work!' +error-noArena: '%TAG%ENo arena found with the name ''%A%name%%E''.' +error-onlyIngame: '%TAG%EThis is an only in-game command!' +error-joinAlreadyJoined: '%TAG%EYou''ve already joined an arena!' +error-joinNoBlocksSet: '%TAG%EThere are none blocks set for this arena. Notify the administrator.' +error-joinWarpsNotSet: '%TAG%EThere are no warps set for this arena. Notify the administrator.' +error-joinArenaIngame: '%TAG%EThis game has already started.' +error-joinFull: '%TAG%EUnable to join this arena. It''s full!' +error-joinInventoryNotEmpty: '%TAG%EYour inventory should be empty before joining!' +error-leaveNotInArena: '%TAG%EYou''re not in an arena!' +error-createSelectionFirst: '%TAG%EMake a selection first. Use the wand command: %A/BlockHunt %E.' +error-createNotSameWorld: '%TAG%EMake your selection points in the same world!' +error-setTooHighNumber: '%TAG%EThat amount is too high! Max amount is: %A%max%%E.' +error-setTooLowNumber: '%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.' +error-setNotABlock: '%TAG%EThat is not a block!' +error-setwarpWarpNotFound: '%TAG%EWarp ''%A%warp%%E'' is not valid!' +error-tokensPlayerNotOnline: '%TAG%ENo player found with the name ''%A%playername%%E''!' +error-tokensUnknownsetting: '%TAG%E''%A%option%%E'' is not a known option!' +error-shopNeedMoreTokens: '%TAG%EYou need more tokens before you can buy this item.' +error-shopMaxSeekersReached: '%TAG%ESorry, the maximum amount of seekers has been reached!' +error-shopMaxHidersReached: '%TAG%ESorry, the maximum amount of hiders has been reached!' \ No newline at end of file diff --git a/src/main/resources/lang/messages_en.properties b/src/main/resources/lang/messages_en.properties new file mode 100644 index 0000000..bc93181 --- /dev/null +++ b/src/main/resources/lang/messages_en.properties @@ -0,0 +1,90 @@ +log-enabledPlugin: '%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%autors%%N.' +log-disabledPlugin: '%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%autors%%N.' +info: '%NDisplays the plugin''s info.' +help: '%NShows a list of commands.' +reload: '%NReloads all configs.' +join: '%NJoins a BlockHunt game.' +leave: '%NLeave a BlockHunt game.' +list: '%NShows a list of available arenas.' +shop: '%NOpens the BlockHunt shop.' +start: '%NForces an arena to start.' +wand: '%NGives you the wand selection tool.' +create: '%NCreates an arena from your selection.' +set: '%NOpens a panel to set settings.' +setwarp: '%NSets warps for your arena.' +remove: '%NDeletes an Arena.' +tokens: '%NChange someones tokens.' +#buttons +button-add: '%NAdd %A%1%%N to %A%2%%N' +button-add2: Add +button-setting: '%NSetting %A%1%%N is now: %A%2%%N.' +button-remove: '%NRemove %A%1%%N from %A%2%%N' +button-remove2: Remove +#Normal +reloadedConfigs: '%TAG&aReloaded all configs!' +joinJoinedArena: '%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)' +leaveYouLeft: '%TAG%NYou left the arena! Thanks for playing!' +leaveLeftArena: '%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)' +startForced: '%TAG%NYou forced to start arena ''%A%arenaname%%N''!' +wandGaveWand: '%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)' +wandSetPosition: '%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N,%A%z%%N).' +createCreatedArena: '%TAG%NCreated an arena with the name ''%A%name%%N''.' +lobbyArenaIsStarting: '%TAG%NThe arena will start in %A%1%%N second(s)!' +lobbyArenaStarted: '%TAG%NThe arena has been started! The seeker is coming to find you in %A%secs%%N seconds!' +ingameSeekerChoosen: '%TAG%NPlayer %A%seeker%%N has been choosen as seeker!' +ingameBlock: '%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.' +ingameArenaEnd: '%TAG%NThe arena will end in %A%1%%N second(s)!' +ingameSeekerSpawned: '%TAG%A%playername%%N has spawned as a seeker!' +ingameGivenSword: '%TAG%NYou were given a sword!' +ingameHiderDied: '%TAG%NHider %A%playername%%N was killed by %A%killer%%N!' +ingameHidersLeft: '%NHider(s) left: %A%left%%N' +ingameSeekerDied: '%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N seconds!' +winSeekers: '%TAG%NThe %ASEEKERS%N have won!' +winHiders: '%TAG%NThe %AHIDERS%N have won!' +setwarpWarpSet: '%TAG%NSet warp ''%A%warp%%N'' to your location!' +addedToken: '%TAG%A%amount%%N tokens were added to your account!' +removeRemovedArena: '%TAG%NRemoved arena ''%A%name%%N''!' +tokensChanged: '%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.' +tokensChangedPerson: '%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% your tokens.' +ingameNowSolid: '%TAG%NYou''re now a solid ''%A%block%%N'' block!' +ingameNoMoreSolid: '%TAG%NYou''re no longer a solid block!' +shopBoughtItem: '%TAG%NYou''ve bought the ''%A%itemname%%N'' item!' +shopChoosenBlock: '%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!' +shopChoosenSeeker: '%TAG%NYou''ve choosen to be a %Aseeker%N!' +shopChoosenHiders: '%TAG%NYou''ve choosen to be a %Ahider%N!' +ingameBlocksLeft: '%TAG%NRemaining blocks: %A%1%%N' + +# Warnings +lobbyNeedAtleast: '%TAG%WYou need atleast %A%1%%W player(s) to start the game!' +ingameNEWSeekerChoosen: '%TAG%WThe last seeker left and a new seeker has been choosen!' +unableToCommand: '%TAG%WSorry but that command is disabled in the arena.' +ingameNoSolidPlace: '%TAG%WThat''s not a valid place to become solid!' +arenaStopped: '%TAG%WThe arena has been forced to stop!' + +error-noPermission: '%TAG%EYou don''t have the permissions to do that!' +error-notANumber: '%TAG%E''%A%1%%E'' is not a number!' +error-commandNotEnabled: '%TAG%EThis command has been disabled!' +error-commandNotFound: '%TAG%ECouldn''t find the command. Try %A/BlockHunt help %Efor more info.' +error-notEnoughArguments: '%TAG%EYou''re missing arguments, correct syntax: %A%syntax%' +error-libsDisguisesNotInstalled: '%TAG%EThe plugin ''%ALib''s Disguises%E'' is required to run this plugin! Intall it or it won''t work!' +error-protocolLibNotInstalled: '%TAG%EThe plugin ''%AProtocolLib%E'' is required to run this plugin! Intall it or it won''t work!' +error-noArena: '%TAG%ENo arena found with the name ''%A%name%%E''.' +error-onlyIngame: '%TAG%EThis is an only in-game command!' +error-joinAlreadyJoined: '%TAG%EYou''ve already joined an arena!' +error-joinNoBlocksSet: '%TAG%EThere are none blocks set for this arena. Notify the administrator.' +error-joinWarpsNotSet: '%TAG%EThere are no warps set for this arena. Notify the administrator.' +error-joinArenaIngame: '%TAG%EThis game has already started.' +error-joinFull: '%TAG%EUnable to join this arena. It''s full!' +error-joinInventoryNotEmpty: '%TAG%EYour inventory should be empty before joining!' +error-leaveNotInArena: '%TAG%EYou''re not in an arena!' +error-createSelectionFirst: '%TAG%EMake a selection first. Use the wand command: %A/BlockHunt %E.' +error-createNotSameWorld: '%TAG%EMake your selection points in the same world!' +error-setTooHighNumber: '%TAG%EThat amount is too high! Max amount is: %A%max%%E.' +error-setTooLowNumber: '%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.' +error-setNotABlock: '%TAG%EThat is not a block!' +error-setwarpWarpNotFound: '%TAG%EWarp ''%A%warp%%E'' is not valid!' +error-tokensPlayerNotOnline: '%TAG%ENo player found with the name ''%A%playername%%E''!' +error-tokensUnknownsetting: '%TAG%E''%A%option%%E'' is not a known option!' +error-shopNeedMoreTokens: '%TAG%EYou need more tokens before you can buy this item.' +error-shopMaxSeekersReached: '%TAG%ESorry, the maximum amount of seekers has been reached!' +error-shopMaxHidersReached: '%TAG%ESorry, the maximum amount of hiders has been reached!' \ No newline at end of file diff --git a/src/plugin.yml b/src/main/resources/plugin.yml similarity index 100% rename from src/plugin.yml rename to src/main/resources/plugin.yml diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDinfo.java b/src/nl/Steffion/BlockHunt/Commands/CMDinfo.java deleted file mode 100644 index a70d765..0000000 --- a/src/nl/Steffion/BlockHunt/Commands/CMDinfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package nl.Steffion.BlockHunt.Commands; -/** - * Steffion's Engine - Made by Steffion. - * - * You're allowed to use this engine for own usage, you're not allowed to - * republish the engine. Using this for your own plugin is allowed when a - * credit is placed somewhere in the plugin. - * - * Thanks for your cooperate! - * - * @author Steffion - */ -import nl.Steffion.BlockHunt.BlockHunt; -import nl.Steffion.BlockHunt.ConfigC; -import nl.Steffion.BlockHunt.Managers.MessageM; - -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class CMDinfo extends DefaultCMD { - - - @Override - public boolean exectue(Player player, Command cmd, String label, String[] args) { - MessageM.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName()); - MessageM.sendMessage(player, "%A%name%%N made by %A%autors%%N.", "name-" + BlockHunt.pdfFile.getName(), "autors-" + BlockHunt.pdfFile.getAuthors().get(0)); - MessageM.sendMessage(player, "%NVersion: %A%version%%N.", "version-" + BlockHunt.pdfFile.getVersion()); - MessageM.sendMessage(player, "%NType %A%helpusage% %Nfor help.", "helpusage-" + BlockHunt.CMDhelp.usage); - MessageM.sendMessage(player, "%NDev-Page: %Ahttp://dev.bukkit.org/bukkit-plugins/blockhunt/"); - MessageM.sendMessage(player, "%NDonations are welcome!"); - MessageM.sendMessage(player, "%NMade by help from some friends &c<3%N!"); - MessageM.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oInfo Page"); - return true; - } -} diff --git a/src/nl/Steffion/BlockHunt/Commands/CMDlist.java b/src/nl/Steffion/BlockHunt/Commands/CMDlist.java deleted file mode 100644 index e557b4f..0000000 --- a/src/nl/Steffion/BlockHunt/Commands/CMDlist.java +++ /dev/null @@ -1,29 +0,0 @@ -package nl.Steffion.BlockHunt.Commands; - -import nl.Steffion.BlockHunt.Arena; -import nl.Steffion.BlockHunt.BlockHunt; -import nl.Steffion.BlockHunt.ConfigC; -import nl.Steffion.BlockHunt.W; -import nl.Steffion.BlockHunt.Managers.MessageM; - -import org.bukkit.command.Command; -import org.bukkit.entity.Player; - -public class CMDlist extends DefaultCMD { - - @Override - public boolean exectue(Player player, Command cmd, String label, String[] args) { - MessageM.sendFMessage(player, ConfigC.chat_headerhigh, "header-" + BlockHunt.pdfFile.getName()); - if (W.arenaList.size() >= 1) { - MessageM.sendMessage(player, "&7Available arena(s):"); - for (Arena arena : W.arenaList) { - MessageM.sendMessage(player, "%A" + arena.arenaName); - } - } else { - MessageM.sendMessage(player, "&7&oNo arenas available..."); - MessageM.sendMessage(player, "&7&oCreate an arena first please."); - } - MessageM.sendFMessage(player, ConfigC.chat_headerhigh, "header-&oArenas list"); - return true; - } -} diff --git a/src/nl/Steffion/BlockHunt/Managers/EngineInfo.java b/src/nl/Steffion/BlockHunt/Managers/EngineInfo.java deleted file mode 100644 index 8f8cb0d..0000000 --- a/src/nl/Steffion/BlockHunt/Managers/EngineInfo.java +++ /dev/null @@ -1,18 +0,0 @@ -package nl.Steffion.BlockHunt.Managers; -/** - * Steffion's Engine - Made by Steffion. - * - * You're allowed to use this engine for own usage, you're not allowed to - * republish the engine. Using this for your own plugin is allowed when a - * credit is placed somewhere in the plugin. - * - * Thanks for your cooperate! - * - * @author Steffion - */ -public class EngineInfo { - - - public static String engineVersion = "3.0.2"; - public static String engineAuthors = "Steffion"; -} diff --git a/src/nl/Steffion/BlockHunt/Managers/FileM.java b/src/nl/Steffion/BlockHunt/Managers/FileM.java deleted file mode 100644 index 22244bc..0000000 --- a/src/nl/Steffion/BlockHunt/Managers/FileM.java +++ /dev/null @@ -1,71 +0,0 @@ -package nl.Steffion.BlockHunt.Managers; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -public class FileM { - /* - * Made by @author Steffion, 2013. - */ - - public static void copyFolder(File src, File dest) throws IOException { - if (src.isDirectory()) { - if (!dest.exists()) { - dest.mkdir(); - // Bukkit.broadcastMessage("Directory copied from " + src - // + " to " + dest); - } - String files[] = src.list(); - - for (String file : files) { - File srcFile = new File(src, file); - File destFile = new File(dest, file); - if (!srcFile.getName().equals("uid.dat")) { - copyFolder(srcFile, destFile); - } - } - - } else { - InputStream in = new FileInputStream(src); - OutputStream out = new FileOutputStream(dest); - - byte[] buffer = new byte[1024]; - - int length; - while ((length = in.read(buffer)) > 0) { - out.write(buffer, 0, length); - } - - in.close(); - out.close(); - // Bukkit.broadcastMessage("File copied from " + src + " to " + - // dest); - } - } - - public static void delete(File file) throws IOException { - if (file.isDirectory()) { - - if (file.list().length == 0) { - file.delete(); - } else { - String files[] = file.list(); - - for (String temp : files) { - File fileDelete = new File(file, temp); - delete(fileDelete); - } - - if (file.list().length == 0) { - file.delete(); - } - } - } else { - file.delete(); - } - } -} diff --git a/src/nl/Steffion/BlockHunt/Serializables/M.java b/src/nl/Steffion/BlockHunt/Serializables/M.java deleted file mode 100644 index 8651d0d..0000000 --- a/src/nl/Steffion/BlockHunt/Serializables/M.java +++ /dev/null @@ -1,9 +0,0 @@ -package nl.Steffion.BlockHunt.Serializables; - -import java.util.Map; - -public class M { - public static Object g(Map map, String key, Object def) { - return map.getOrDefault(key, def); - } -} \ No newline at end of file diff --git a/src/test/resources/arena.yml b/src/test/resources/arena.yml new file mode 100644 index 0000000..d4a388e --- /dev/null +++ b/src/test/resources/arena.yml @@ -0,0 +1,82 @@ +TestArena: + ==: BlockHuntArena + maxPlayers: 40 + hidersWinCommands: [] + timeInLobbyUntilStart: 30 + minPlayers: 5 + timeUntilHidersSword: 0 + spawnWarp: + ==: BlockHuntLocation + p: 4.200027 + a: 41.700073 + w: games + x: -178.5 + y: 33.0 + z: -130.5 + allowedCommands: [] + arenaName: TestArena + amountSeekersOnStart: 3 + pos1: + ==: BlockHuntLocation + w: games + x: 576.0 + y: 2.0 + z: 503.0 + pos2: + ==: BlockHuntLocation + w: games + x: 428.0 + y: 66.0 + z: 342.0 + waitingTimeSeeker: 20 + seekersTokenWin: 0 + lobbyWarp: + ==: BlockHuntLocation + p: 4.19999 + a: -182.09694 + w: games + x: 500.66289894368725 + y: 4.0 + z: 497.83982348350094 + seekersWinCommands: [] + killTokens: 0 + gameTime: 660 + disguiseBlocks: + - ==: org.bukkit.inventory.ItemStack + type: BOOKSHELF + - ==: org.bukkit.inventory.ItemStack + type: GLOWSTONE + meta: + ==: ItemMeta + meta-type: UNSPECIFIC + enchants: + DURABILITY: 10 + - ==: org.bukkit.inventory.ItemStack + type: EMERALD_BLOCK + - ==: org.bukkit.inventory.ItemStack + type: WOOL + damage: 5 + - ==: org.bukkit.inventory.ItemStack + type: ICE + - ==: org.bukkit.inventory.ItemStack + type: MYCEL + - ==: org.bukkit.inventory.ItemStack + type: SAND + hidersWarp: + ==: BlockHuntLocation + p: -1.9500121 + a: 179.85266 + w: games + x: 500.52591580497256 + y: 4.0 + z: 482.31326505008246 + blockAnnouncerTime: 45 + seekersWarp: + ==: BlockHuntLocation + p: 17.69996 + a: 90.15417 + w: games + x: 519.6272528902401 + y: 42.0 + z: 453.4140380016035 + hidersTokenWin: 0 \ No newline at end of file diff --git a/src/test/resources/config.yml b/src/test/resources/config.yml new file mode 100644 index 0000000..544a059 --- /dev/null +++ b/src/test/resources/config.yml @@ -0,0 +1,87 @@ +chat: + tag: '[BlockHunt] ' + normal: '&b' + warning: '&c' + error: '&c' + arg: '&e' + header: '&9' + headerhigh: '%H_______.[ %A%header%%H ]._______' +commandEnabled: + info: true + help: true + reload: true + join: true + leave: true + list: true + shop: true + start: true + wand: true + create: true + set: true + setwarp: true + remove: true + tokens: true +autoUpdateCheck: false +autoDownloadUpdate: false +wandIDname: STICK +wandName: '%A&lBlockHunt%N''s selection wand' +wandDescription: +- '%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 ' +shop: + title: '%H&lBlockHunt %NShop' + price: '%NPrice: %A%amount% %Ntokens.' + blockChooserv1Enabled: true + blockChooserv1IDname: BOOK + blockChooserv1Price: 3000 + blockChooserv1Name: '%H&lBlockHunt Chooser' + blockChooserv1Description: + - '%NUse this item before the arena starts.' + - '%ARight-Click%N in the lobby and choose' + - '%Nthe block you want to be!' + - '&6Unlimited uses.' + BlockHuntPassv2Enabled: true + BlockHuntPassv2IDName: NAME_TAG + BlockHuntPassv2Price: 150 + BlockHuntPassv2Name: '%H&lBlockHunt Pass' + BlockHuntPassv2Description: + - '%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.' +sign: + LEAVE: + - '%H[BlockHunt%H]' + - '&4LEAVE' + - '&8Right-Click' + - '&8To leave.' + SHOP: + - '%H[BlockHunt%H]' + - '&4SHOP' + - '&8Right-Click' + - '&8To shop.' + WAITING: + - '%H[BlockHunt%H]' + - '&5%arenaname%' + - '&5%players%&6/&5%maxplayers%' + - '&8Waiting...' + STARTING: + - '%H[BlockHunt%H]' + - '&5%arenaname%' + - '&5%players%&6/&5%maxplayers%' + - '&2Start: %A%timeleft%' + INGAME: + - '%H[BlockHunt%H]' + - '&5%arenaname%' + - '&5%players%&6/&5%maxplayers%' + - '%EIngame: %A%timeleft%' +scoreboard: + enabled: true + title: '%H[BlockHunt]' + timeleft: '%ATime left:' + seekers: '%NSeekers:' + hiders: '%NHiders:' +requireInventoryClearOnJoin: false diff --git a/src/test/resources/messages.yml b/src/test/resources/messages.yml new file mode 100644 index 0000000..089fe0c --- /dev/null +++ b/src/test/resources/messages.yml @@ -0,0 +1,99 @@ +log: + enabledPlugin: '%TAG%N%name%&a&k + %N%version% is now Enabled. Made by %A%autors%%N.' + disabledPlugin: '%TAG%N%name%&c&k - %N%version% is now Disabled. Made by %A%autors%%N.' +help: + info: '%NDisplays the plugin''s info.' + help: '%NShows a list of commands.' + reload: '%NReloads all configs.' + join: '%NJoins a BlockHunt game.' + leave: '%NLeave a BlockHunt game.' + list: '%NShows a list of available arenas.' + shop: '%NOpens the BlockHunt shop.' + start: '%NForces an arena to start.' + wand: '%NGives you the wand selection tool.' + create: '%NCreates an arena from your selection.' + set: '%NOpens a panel to set settings.' + setwarp: '%NSets warps for your arena.' + remove: '%NDeletes an Arena.' + tokens: '%NChange someones tokens.' +button: + add: '%NAdd %A%1%%N to %A%2%%N' + add2: Add + setting: '%NSetting %A%1%%N is now: %A%2%%N.' + remove: '%NRemove %A%1%%N from %A%2%%N' + remove2: Remove +normal: + reloadedConfigs: '%TAG&aReloaded all configs!' + joinJoinedArena: '%TAG%A%playername%%N joined your arena. (%A%1%%N/%A%2%%N)' + leaveYouLeft: '%TAG%NYou left the arena! Thanks for playing!' + leaveLeftArena: '%TAG%A%playername%%N left your arena. (%A%1%%N/%A%2%%N)' + startForced: '%TAG%NYou forced to start arena ''%A%arenaname%%N''!' + wandGaveWand: '%TAG%NHere you go! &o(Use the %A&o%type%%N&o!)' + wandSetPosition: '%TAG%NSet position %A#%number%%N to location: (%A%x%%N, %A%y%%N, + %A%z%%N).' + createCreatedArena: '%TAG%NCreated an arena with the name ''%A%name%%N''.' + lobbyArenaIsStarting: '%TAG%NThe arena will start in %A%1%%N second(s)!' + lobbyArenaStarted: '%TAG%NThe arena has been started! The seeker is coming to find + you in %A%secs%%N seconds!' + ingameSeekerChoosen: '%TAG%NPlayer %A%seeker%%N has been choosen as seeker!' + ingameBlock: '%TAG%NYou''re disguised as a(n) ''%A%block%%N'' block.' + ingameArenaEnd: '%TAG%NThe arena will end in %A%1%%N second(s)!' + ingameSeekerSpawned: '%TAG%A%playername%%N has spawned as a seeker!' + ingameGivenSword: '%TAG%NYou were given a sword!' + ingameHiderDied: '%TAG%NHider %A%playername%%N was killed by %A%killer%%N!' + ingameHidersLeft: '%NHider(s) left: %A%left%%N' + ingameSeekerDied: '%TAG%NSeeker %A%playername%%N died and will respawn in %A%secs%%N + seconds!' + winSeekers: '%TAG%NThe %ASEEKERS%N have won!' + winHiders: '%TAG%NThe %AHIDERS%N have won!' + setwarpWarpSet: '%TAG%NSet warp ''%A%warp%%N'' to your location!' + addedToken: '%TAG%A%amount%%N tokens were added to your account!' + removeRemovedArena: '%TAG%NRemoved arena ''%A%name%%N''!' + tokensChanged: '%TAG%N%option% %A%amount%%N tokens %option2% %A%playername%%N.' + tokensChangedPerson: '%TAG%NPlayer %A%playername%%N %N%option% %A%amount%%N %option2% + your tokens.' + ingameNowSolid: '%TAG%NYou''re now a solid ''%A%block%%N'' block!' + ingameNoMoreSolid: '%TAG%NYou''re no longer a solid block!' + shopBoughtItem: '%TAG%NYou''ve bought the ''%A%itemname%%N'' item!' + shopChoosenBlock: '%TAG%NYou''ve choosen to be a(n) ''%A%block%%N'' block!' + shopChoosenSeeker: '%TAG%NYou''ve choosen to be a %Aseeker%N!' + shopChoosenHiders: '%TAG%NYou''ve choosen to be a %Ahider%N!' + ingameBlocksLeft: '%TAG%NRemaining blocks: %A%1%%N' +warning: + lobbyNeedAtleast: '%TAG%WYou need atleast %A%1%%W player(s) to start the game!' + ingameNEWSeekerChoosen: '%TAG%WThe last seeker left and a new seeker has been choosen!' + unableToCommand: '%TAG%WSorry but that command is disabled in the arena.' + ingameNoSolidPlace: '%TAG%WThat''s not a valid place to become solid!' + arenaStopped: '%TAG%WThe arena has been forced to stop!' +error: + noPermission: '%TAG%EYou don''t have the permissions to do that!' + notANumber: '%TAG%E''%A%1%%E'' is not a number!' + commandNotEnabled: '%TAG%EThis command has been disabled!' + commandNotFound: '%TAG%ECouldn''t find the command. Try %A/BlockHunt help %Efor + more info.' + notEnoughArguments: '%TAG%EYou''re missing arguments, correct syntax: %A%syntax%' + libsDisguisesNotInstalled: '%TAG%EThe plugin ''%ALib''s Disguises%E'' is required + to run this plugin! Intall it or it won''t work!' + protocolLibNotInstalled: '%TAG%EThe plugin ''%AProtocolLib%E'' is required to run + this plugin! Intall it or it won''t work!' + noArena: '%TAG%ENo arena found with the name ''%A%name%%E''.' + onlyIngame: '%TAG%EThis is an only in-game command!' + joinAlreadyJoined: '%TAG%EYou''ve already joined an arena!' + joinNoBlocksSet: '%TAG%EThere are none blocks set for this arena. Notify the administrator.' + joinWarpsNotSet: '%TAG%EThere are no warps set for this arena. Notify the administrator.' + joinArenaIngame: '%TAG%EThis game has already started.' + joinFull: '%TAG%EUnable to join this arena. It''s full!' + joinInventoryNotEmpty: '%TAG%EYour inventory should be empty before joining!' + leaveNotInArena: '%TAG%EYou''re not in an arena!' + createSelectionFirst: '%TAG%EMake a selection first. Use the wand command: %A/BlockHunt + %E.' + createNotSameWorld: '%TAG%EMake your selection points in the same world!' + setTooHighNumber: '%TAG%EThat amount is too high! Max amount is: %A%max%%E.' + setTooLowNumber: '%TAG%EThat amount is too low! Minimal amount is: %A%min%%E.' + setNotABlock: '%TAG%EThat is not a block!' + setwarpWarpNotFound: '%TAG%EWarp ''%A%warp%%E'' is not valid!' + tokensPlayerNotOnline: '%TAG%ENo player found with the name ''%A%playername%%E''!' + tokensUnknownsetting: '%TAG%E''%A%option%%E'' is not a known option!' + shopNeedMoreTokens: '%TAG%EYou need more tokens before you can buy this item.' + shopMaxSeekersReached: '%TAG%ESorry, the maximum amount of seekers has been reached!' + shopMaxHidersReached: '%TAG%ESorry, the maximum amount of hiders has been reached!'