From cb2dd508bd78b953e8ba622c76ab68e390213abf Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 30 May 2016 23:21:20 +0100 Subject: [PATCH] PC-413 (Fixed) Fixed some aggressive auto-formatting --- .../nautilus/game/arcade/ArcadeManager.java | 225 +++++++++--------- 1 file changed, 116 insertions(+), 109 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 0bd6d5bb0..7d4f4390d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -157,7 +157,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation private Portal _portal; private ArcadeShop _arcadeShop; - // Champions Modules + //Champions Modules private boolean _enabled = true; private ClassManager _classManager; private SkillFactory _skillFactory; @@ -207,21 +207,22 @@ public class ArcadeManager extends MiniPlugin implements IRelation // Games private Game _game; - // Youtuber Kits + //Youtuber Kits private HashSet _youtube = new HashSet(); - // Server Property + //Server Property private Rank _requiredRank; - // Game commands + //Game commands public static final String GAME_CMD_MODE_FILE = "GAME_CMD_MODE.dat"; private boolean _gameCommandMode; - public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, - DamageManager damageManager, StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, - Teleport teleport, Blood blood, Chat chat, Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, CosmeticManager cosmeticManager, - ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, NpcManager npcManager, - CustomDataManager customDataManager, Punish punish, EloManager eloManager) + public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, + CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, + StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, + Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, + CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, + NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager) { super("Game Manager", plugin); @@ -242,17 +243,17 @@ public class ArcadeManager extends MiniPlugin implements IRelation _brandingManager = new BrandingManager(plugin); - // Dont see a reason to ever just use the normal one - // if (serverConfig.GameList.contains(GameType.ChampionsDominate) - // || serverConfig.GameList.contains(GameType.ChampionsTDM) - // || serverConfig.GameList.contains(GameType.ChampionsCTF)) - // { - // _conditionManager = new SkillConditionManager(plugin); - // } - // else - // { - // _conditionManager = new ConditionManager(plugin); - // } + //Dont see a reason to ever just use the normal one + // if (serverConfig.GameList.contains(GameType.ChampionsDominate) + // || serverConfig.GameList.contains(GameType.ChampionsTDM) + // || serverConfig.GameList.contains(GameType.ChampionsCTF)) + // { + // _conditionManager = new SkillConditionManager(plugin); + // } + // else + // { + // _conditionManager = new ConditionManager(plugin); + // } _clientManager = clientManager; _serverStatusManager = serverStatusManager; @@ -303,8 +304,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _gameTournamentManager = new GameTournamentManager(this); new GameStatManager(this); FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager); - _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager, npcManager, hologramManager, statsManager, _inventoryManager, petManager, - facebookManager, _cosmeticManager.getGadgetManager()); + _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _cosmeticManager.getGadgetManager()); new GameLootManager(this, petManager, _bonusManager.getRewardManager()); new GameSpectatorManager(this); _gameWorldManager = new GameWorldManager(this); @@ -312,7 +312,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _hologramManager = hologramManager; _idleManager = new IdleManager(this); TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); - // new HolidayManager(this, titanGiveaway); + // new HolidayManager(this, titanGiveaway); new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); new PlayerDisguiseManager(plugin, _clientManager); @@ -322,15 +322,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation new SoupAddon(plugin, this); new TeamArmorAddon(plugin, this); - // Champions Modules + //Champions Modules _energy = new Energy(plugin); - _itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, _energy, _fire, _projectileManager, webAddress); + _itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, _energy, + _fire, _projectileManager, webAddress); - _skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(), _conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement( - plugin), teleport, _energy, webAddress); + _skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(), + _conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport, + _energy, webAddress); - _classManager = new ClassManager(plugin, clientManager, donationManager, _cosmeticManager.getGadgetManager(), _skillFactory, _itemFactory, webAddress); + _classManager = new ClassManager(plugin, clientManager, donationManager, _cosmeticManager.getGadgetManager(), _skillFactory, _itemFactory, + webAddress); _classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, _itemFactory, _achievementManager, clientManager); @@ -556,10 +559,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation return _serverStatusManager; } - public CustomDataManager getCustomDataManager() - { - return _customDataManager; - } + public CustomDataManager getCustomDataManager() { return _customDataManager; } public ChatColor GetColor(Player player) { @@ -687,7 +687,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation { event.setMaxPlayers(_serverConfig.MaxPlayers); - // MPS + //MPS if (_gameHostManager != null && _gameHostManager.isPrivateServer()) { if (_gameHostManager.isHostExpired()) @@ -703,23 +703,23 @@ public class ArcadeManager extends MiniPlugin implements IRelation } } - String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName()) + "|" - + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName); + String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName()) + + "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName); if (_gameHostManager.isPrivateServer() && _gameHostManager.hasRank(Rank.TWITCH)) extrainformation += "|HostRank." + _gameHostManager.getHostRank().toString(); - // Always Joinable - // if (_game != null && _game.JoinInProgress) - // { - // event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation); - // } - // UHC Timed + //Always Joinable + // if (_game != null && _game.JoinInProgress) + // { + // event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation); + // } + //UHC Timed if (_game != null && _game.GetType() == GameType.UHC) { event.setMotd(((UHC) _game).getMotdStatus() + extrainformation); } - // Recruiting + //Recruiting else if (_game == null || _game.GetState() == GameState.Recruit) { if (_game != null && _game.GetCountdown() != -1) @@ -731,7 +731,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation); } } - // In Progress + //In Progress else { event.setMotd(ChatColor.YELLOW + "In Progress" + extrainformation); @@ -810,15 +810,17 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (_game != null && !_game.GiveClock) return; - if (player.getOpenInventory().getType() != InventoryType.CRAFTING && player.getOpenInventory().getType() != InventoryType.CREATIVE) + if (player.getOpenInventory().getType() != InventoryType.CRAFTING && + player.getOpenInventory().getType() != InventoryType.CREATIVE) return; if (!UtilGear.isMat(player.getInventory().getItem(8), Material.WATCH) && !UtilGear.isMat(player.getInventory().getItem(8), Material.SPECKLED_MELON)) { player.getInventory().setItem( 8, - ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte) 0, 1, (short) 0, C.cGreen + "Return to Hub", new String[] { "", ChatColor.RESET + "Click while holding this", - ChatColor.RESET + "to return to the Hub." })); + ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte) 0, 1, (short) 0, C.cGreen + + "Return to Hub", new String[]{"", ChatColor.RESET + "Click while holding this", + ChatColor.RESET + "to return to the Hub."})); UtilInv.Update(player); } @@ -829,7 +831,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation { if (Bukkit.getServer().hasWhitelist()) { - if (_requiredRank != null) + if(_requiredRank != null) { if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), _requiredRank, false)) { @@ -857,8 +859,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation return; } } - if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.MODERATOR, false) || _clientManager.Get(event.getPlayer().getName()).GetRank() == Rank.MAPDEV - || _clientManager.Get(event.getPlayer().getName()).GetRank() == Rank.MAPLEAD) + if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.MODERATOR, false) || + _clientManager.Get(event.getPlayer().getName()).GetRank() == Rank.MAPDEV || + _clientManager.Get(event.getPlayer().getName()).GetRank() == Rank.MAPLEAD) { event.allow(); event.setResult(PlayerLoginEvent.Result.ALLOWED); @@ -951,11 +954,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation } /** - * Checks if a player is participating in/has been participating in the - * current game - * - * @param player - * The player to check + * Checks if a player is participating in/has been participating in the current game + * @param player The player to check * @return Whether they are/have been playing */ public boolean hasBeenPlaying(Player player) @@ -1019,7 +1019,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation // Arrows go bye bye. ((CraftPlayer) player).getHandle().o(0); - // Remove all conditions + //Remove all conditions GetCondition().EndCondition(player, null, null); for (PotionEffect potion : player.getActivePotionEffects()) player.removePotionEffect(potion.getType()); @@ -1037,8 +1037,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation { TimingManager.start("ArcadeManager LoadFiles"); - File folder = new File(".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar + "maps" + File.separatorChar + gameName); - System.out.println(folder.getAbsolutePath() + " -=-=-=-=-="); + File folder = new File(".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar + + "maps" + File.separatorChar + gameName); + System.out.println(folder.getAbsolutePath()+" -=-=-=-=-=" ); if (!folder.exists()) folder.mkdirs(); @@ -1345,7 +1346,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation @EventHandler(priority = EventPriority.LOWEST) public void cosmeticState(GameStateChangeEvent event) { - // Disable + //Disable if (event.GetState() == GameState.Recruit) { getCosmeticManager().setActive(true); @@ -1386,44 +1387,53 @@ public class ArcadeManager extends MiniPlugin implements IRelation getCosmeticManager().getGadgetManager().setGadgetEnabled(playerCount <= 40); } - /* - * public void saveBasicStats(final Game game) { if (!IsTournamentServer()) - * return; - * - * final Map data = new HashMap<>(); - * - * for (Player loser : game.getLosers()) data.put(loser.getUniqueId(), - * false); - * - * for (Player winner : game.getWinners()) data.put(winner.getUniqueId(), - * true); - * - * Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() { - * - * @Override public void run() { - * getArcadeRepository().saveBasicStats(game.GetType(), - * IsTournamentServer(), (int) (System.currentTimeMillis() - - * game.getGameLiveTime()), data); } }); } - */ + /*public void saveBasicStats(final Game game) + { + if (!IsTournamentServer()) + return; - /* - * public void saveLeaderboardStats(Game game) { final TournamentType type = - * TournamentType.getTournamentType(game.GetType()); - * - * if (type != null) { final Map data = new HashMap<>(); - * - * for (Player loser : game.getLosers()) data.put(loser.getUniqueId(), - * false); - * - * for (Player winner : game.getWinners()) data.put(winner.getUniqueId(), - * true); - * - * Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() { - * - * @Override public void run() { - * getArcadeRepository().saveLeaderboardStats(0, type.ordinal(), data); } - * }); } } - */ + final Map data = new HashMap<>(); + + for (Player loser : game.getLosers()) + data.put(loser.getUniqueId(), false); + + for (Player winner : game.getWinners()) + data.put(winner.getUniqueId(), true); + + Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() + { + @Override + public void run() + { + getArcadeRepository().saveBasicStats(game.GetType(), IsTournamentServer(), (int) (System.currentTimeMillis() - game.getGameLiveTime()), data); + } + }); + }*/ + + /*public void saveLeaderboardStats(Game game) + { + final TournamentType type = TournamentType.getTournamentType(game.GetType()); + + if (type != null) + { + final Map data = new HashMap<>(); + + for (Player loser : game.getLosers()) + data.put(loser.getUniqueId(), false); + + for (Player winner : game.getWinners()) + data.put(winner.getUniqueId(), true); + + Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() + { + @Override + public void run() + { + getArcadeRepository().saveLeaderboardStats(0, type.ordinal(), data); + } + }); + } + }*/ public boolean isGameInProgress() { @@ -1494,7 +1504,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _energy.registerSelf(); _eloManager.registerSelf(); - // Class Shop + //Class Shop _plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin); } else @@ -1506,7 +1516,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _energy.deregisterSelf(); _eloManager.deregisterSelf(); - // Class Shop + //Class Shop HandlerList.unregisterAll(_classShop); } } @@ -1526,8 +1536,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation if (teleport) player.teleport(GetGame().GetSpectatorLocation()); - // Set Spec State - UtilAction.velocity(player, new Vector(0, 1, 0)); + //Set Spec State + UtilAction.velocity(player, new Vector(0,1,0)); player.setAllowFlight(true); player.setFlying(true); player.setFlySpeed(0.1f); @@ -1537,7 +1547,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true); - // Game Team + //Game Team GetGame().GetScoreboard().SetPlayerTeam(player, "SPEC"); } @@ -1552,9 +1562,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation { _requiredRank = null; - for (File file : new File(".").listFiles()) + for(File file : new File(".").listFiles()) { - if (!file.getName().startsWith("RequiredRank")) + if(!file.getName().startsWith("RequiredRank")) continue; try @@ -1582,7 +1592,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _requiredRank = rank; } - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler(priority=EventPriority.LOWEST) public void explosionCancel(EntityExplodeEvent event) { if (GetGame() == null || !GetGame().InProgress()) @@ -1627,8 +1637,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation } /** - * Returns whether this server has a file, stating that it allows game - * commands. + * Returns whether this server has a file, stating that it allows game commands. * * @return Whether this server is in game command mode. */ @@ -1648,8 +1657,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation /** * Sets this server's game command mode state. * - * @param state - * Whether to enable or disable game commands. + * @param state Whether to enable or disable game commands. */ public void setGameCommandMode(boolean state) { @@ -1661,8 +1669,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation *

* Sends a denial alert if they can't. * - * @param player - * The player attempting to use the command. + * @param player The player attempting to use the command. * @return Whether or not the player can successfully use the command. */ public boolean canPlayerUseGameCmd(Player player)