diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/StartGameButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/StartGameButton.java new file mode 100644 index 000000000..754018e72 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/StartGameButton.java @@ -0,0 +1,33 @@ +package nautilus.game.arcade.gui.privateServer.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.common.util.C; +import mineplex.core.shop.item.IButton; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; + +public class StartGameButton implements IButton +{ + private ArcadeManager _arcadeManager; + + public StartGameButton(ArcadeManager arcadeManager) + { + _arcadeManager = arcadeManager; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + if (_arcadeManager.GetGame().GetState() != GameState.Recruit) + { + player.sendMessage("Game is already in progress..."); + return; + } + + _arcadeManager.GetGameManager().StateCountdown(_arcadeManager.GetGame(), 20, true); + + _arcadeManager.GetGame().Announce(C.cDGreen + C.Bold + player.getName() + " has started the game."); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/StopGameButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/StopGameButton.java new file mode 100644 index 000000000..bfe66e681 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/StopGameButton.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.gui.privateServer.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.common.util.C; +import mineplex.core.shop.item.IButton; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; + +public class StopGameButton implements IButton +{ + private ArcadeManager _arcadeManager; + + public StopGameButton(ArcadeManager arcadeManager) + { + _arcadeManager = arcadeManager; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + if (_arcadeManager.GetGame().GetState() == GameState.End || _arcadeManager.GetGame().GetState() == GameState.End) + { + player.sendMessage("Game is already ending..."); + return; + } + else if (_arcadeManager.GetGame().GetState() == GameState.Recruit) + { + _arcadeManager.GetGame().SetState(GameState.Dead); + } + else + { + _arcadeManager.GetGame().SetState(GameState.End); + } + + + _arcadeManager.GetGame().Announce(C.cDGreen + C.Bold + player.getName() + " has stopped the game."); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java index 5e5b723ae..c904e8c6d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/MenuPage.java @@ -13,6 +13,8 @@ import nautilus.game.arcade.gui.privateServer.button.EditRotationButton; import nautilus.game.arcade.gui.privateServer.button.GiveAdminButton; import nautilus.game.arcade.gui.privateServer.button.SetGameButton; import nautilus.game.arcade.gui.privateServer.button.OptionsButton; +import nautilus.game.arcade.gui.privateServer.button.StartGameButton; +import nautilus.game.arcade.gui.privateServer.button.StopGameButton; import nautilus.game.arcade.gui.privateServer.button.UnbanButton; public class MenuPage extends BasePage @@ -29,17 +31,23 @@ public class MenuPage extends BasePage ItemStack ownerHead = getOwnerHead(); setItem(4, ownerHead); + StartGameButton startGameButton = new StartGameButton(Plugin); + AddButton(1 + 9, new ShopItem(Material.EMERALD_BLOCK, "Start Game", new String[] {}, 1, false), startGameButton); + + StopGameButton stopGameButton = new StopGameButton(Plugin); + AddButton(1 + 18, new ShopItem(Material.REDSTONE_BLOCK, "Stop Game", new String[] {}, 1, false), stopGameButton); + SetGameButton setGameButton = new SetGameButton(Plugin, Shop); - AddButton(1 + 9, new ShopItem(Material.BOOK_AND_QUILL, "Set Game", new String[] {}, 1, false), setGameButton); + AddButton(3 + 9, new ShopItem(Material.BOOK_AND_QUILL, "Set Game", new String[] {}, 1, false), setGameButton); EditRotationButton editRotationButton = new EditRotationButton(Plugin, Shop); - AddButton(1 + 18, new ShopItem(Material.BOOK, "Edit Game Rotation", new String[]{}, 1, false), editRotationButton); + AddButton(3 + 18, new ShopItem(Material.BOOK, "Edit Game Rotation", new String[]{}, 1, false), editRotationButton); GiveAdminButton giveAdminButton = new GiveAdminButton(Plugin, Shop); - AddButton(3 + 9, new ShopItem(Material.DIAMOND_SWORD, "Give Admin", new String[] {}, 1, false), giveAdminButton); + AddButton(5 + 9, new ShopItem(Material.DIAMOND_SWORD, "Give Admin", new String[] {}, 1, false), giveAdminButton); OptionsButton optionsButton = new OptionsButton(Plugin, Shop); - AddButton(5 + 9, new ShopItem(Material.REDSTONE_COMPARATOR, "Game Options", new String[] {}, 1, false), optionsButton); + AddButton(5 + 18, new ShopItem(Material.REDSTONE_COMPARATOR, "Game Options", new String[] {}, 1, false), optionsButton); BanButton banButton = new BanButton(Plugin, Shop); AddButton(7 + 9, new ShopItem(Material.LAVA_BUCKET, "Ban Player", new String[] {}, 1, false), banButton); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java index c0b377012..a003202b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java @@ -61,15 +61,28 @@ public class GameChatManager implements Listener ownsUltra= Manager.GetDonation().Get(sender.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA"); //Level - String levelStr = Manager.GetAchievement().getMineplexLevel(sender, rank); + String levelStr = ""; + if (!Manager.GetGameHostManager().isPrivateServer()) + levelStr = Manager.GetAchievement().getMineplexLevel(sender, rank); - //Rank Prefix String rankStr = ""; - if (rank != Rank.ALL) - rankStr = rank.GetTag(true, true) + " "; + //Rank Prefix & MPS Host Prefix + if (Manager.GetGameHostManager().isHost(event.getPlayer())) + { + rankStr = C.cDGreen + "MPS HOST "; + } + else if (Manager.GetGameHostManager().isAdmin(event.getPlayer())) + { + rankStr = C.cDGreen + "MPS ADMIN "; + } + else + { + if (rank != Rank.ALL) + rankStr = rank.GetTag(true, true) + " "; - if (ownsUltra && !rank.Has(Rank.ULTRA)) - rankStr = Rank.ULTRA.GetTag(true, true) + " "; + if (ownsUltra && !rank.Has(Rank.ULTRA)) + rankStr = Rank.ULTRA.GetTag(true, true) + " "; + } //Base Format event.setFormat(dead + levelStr + rankStr + Manager.GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java index 11faa6369..510d02023 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.managers; import java.util.ArrayList; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import mineplex.core.common.Rank; @@ -9,6 +10,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; @@ -20,6 +22,7 @@ import nautilus.game.arcade.gui.privateServer.PrivateServerShop; import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; @@ -57,37 +60,60 @@ public class GameHostManager implements Listener _shop = new PrivateServerShop(manager, manager.GetClients(), manager.GetDonation()); Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); - //Ultra Games - ultraGames.add(GameType.Smash); - ultraGames.add(GameType.BaconBrawl); - ultraGames.add(GameType.DeathTag); - ultraGames.add(GameType.DragonEscape); - ultraGames.add(GameType.Dragons); - ultraGames.add(GameType.Micro); - ultraGames.add(GameType.Paintball); - ultraGames.add(GameType.Quiver); - ultraGames.add(GameType.Runner); - ultraGames.add(GameType.Sheep); - ultraGames.add(GameType.Snake); - ultraGames.add(GameType.SneakyAssassins); - ultraGames.add(GameType.TurfWars); - ultraGames.add(GameType.Spleef); + //Game Rotation + if (Manager.GetServerConfig().GameList.contains(GameType.ChampionsDominate) || + Manager.GetServerConfig().GameList.contains(GameType.ChampionsDominate)) + { + Iterator gameIterator = Manager.GetServerConfig().GameList.iterator(); + + //Remove Non-Champion Games + while (gameIterator.hasNext()) + { + GameType type = gameIterator.next(); + + if (type != GameType.ChampionsDominate && type != GameType.ChampionsDominate) + gameIterator.remove(); + } + + //Hero Games + heroGames.add(GameType.ChampionsDominate); + heroGames.add(GameType.ChampionsTDM); + } + else + { + //Ultra Games + ultraGames.add(GameType.Smash); + ultraGames.add(GameType.BaconBrawl); + ultraGames.add(GameType.DeathTag); + ultraGames.add(GameType.DragonEscape); + ultraGames.add(GameType.Dragons); + ultraGames.add(GameType.Micro); + ultraGames.add(GameType.Paintball); + ultraGames.add(GameType.Quiver); + ultraGames.add(GameType.Runner); + ultraGames.add(GameType.Sheep); + ultraGames.add(GameType.Snake); + ultraGames.add(GameType.SneakyAssassins); + ultraGames.add(GameType.TurfWars); + ultraGames.add(GameType.Spleef); - //Hero Games - heroGames.add(GameType.ChampionsDominate); - heroGames.add(GameType.ChampionsTDM); - heroGames.add(GameType.HideSeek); - heroGames.add(GameType.Draw); + //Hero Games + heroGames.add(GameType.HideSeek); + heroGames.add(GameType.Draw); - //Legend Games - legendGames.add(GameType.Bridge); - legendGames.add(GameType.SurvivalGames); - legendGames.add(GameType.CastleSiege); - legendGames.add(GameType.MineStrike); + //Legend Games + legendGames.add(GameType.Bridge); + legendGames.add(GameType.SurvivalGames); + legendGames.add(GameType.CastleSiege); + legendGames.add(GameType.MineStrike); + } + - _blacklist.add("Chiss"); - _blacklist.add("defek7"); - _blacklist.add("Ayreloc"); + Manager.GetServerConfig().HotbarInventory = false; + Manager.GetServerConfig().RewardAchievements = false; + Manager.GetServerConfig().RewardGems = false; + Manager.GetServerConfig().RewardItems = false; + Manager.GetServerConfig().RewardStats = false; } @EventHandler @@ -100,20 +126,16 @@ public class GameHostManager implements Listener if (Manager.GetHost() == null || Manager.GetHost().length() == 0) return; - //Host Update - if (_host != null) - { - giveAdminItem(_host); - - _lastOnline = System.currentTimeMillis(); - } - // Admins update - for (Player admin : _onlineAdmins) + for (Player player : UtilServer.getPlayers()) { - giveAdminItem(admin); - - _lastOnline = System.currentTimeMillis(); + if (player.equals(_host) || _adminList.contains(player.getName()) || Manager.GetClients().Get(player).GetRank().Has(Rank.SNR_MODERATOR)) + { + if (Manager.GetGame() == null || Manager.GetGame().GetState() == GameState.Recruit) + giveAdminItem(player); + + _lastOnline = System.currentTimeMillis(); + } } } @@ -169,7 +191,7 @@ public class GameHostManager implements Listener if (UtilGear.isMat(player.getInventory().getItem(5), Material.BOOK_AND_QUILL)) return; - player.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.BOOK, (byte)0, 1, C.cGreen + C.Bold + "/menu")); + player.getInventory().setItem(7, ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER, (byte)0, 1, C.cGreen + C.Bold + "/menu")); } public HashSet getWhitelist() @@ -205,7 +227,7 @@ public class GameHostManager implements Listener if (!isAdmin(event.getPlayer())) return; - if (!UtilGear.isMat(_host.getItemInHand(), Material.BOOK)) + if (!UtilGear.isMat(_host.getItemInHand(), Material.BLAZE_POWDER)) return; openMenu(event.getPlayer()); @@ -224,7 +246,7 @@ public class GameHostManager implements Listener public boolean isHost(Player player) { - return player.equals(Manager.GetHost()); + return player.getName().equals(Manager.GetHost()); } public boolean isPrivateServer() @@ -353,7 +375,11 @@ public class GameHostManager implements Listener public void ban(Player player) { _blacklist.add(player.getName()); - player.kickPlayer("You were removed by the game host."); + + UtilPlayer.message(player, C.cGold + C.Bold + "You were kicked from this Mineplex Private Server."); + + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); + Manager.GetPortal().SendPlayerToServer(player, "Lobby"); } public void giveAdmin(Player player)