diff --git a/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml b/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml
index 3f5cae6e4..2fb39df09 100644
--- a/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml
+++ b/Plugins/.idea/artifacts/Nautilus_Game_Arcade_jar.xml
@@ -18,6 +18,8 @@
+
+
\ No newline at end of file
diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml
index 2e4d3e99b..b2c160566 100644
--- a/Plugins/.idea/compiler.xml
+++ b/Plugins/.idea/compiler.xml
@@ -21,8 +21,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
diff --git a/Plugins/.idea/encodings.xml b/Plugins/.idea/encodings.xml
index e206d70d8..d4f862411 100644
--- a/Plugins/.idea/encodings.xml
+++ b/Plugins/.idea/encodings.xml
@@ -1,5 +1,9 @@
-
-
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Plugins/.idea/misc.xml b/Plugins/.idea/misc.xml
index 76fba6e9f..5a73d09c7 100644
--- a/Plugins/.idea/misc.xml
+++ b/Plugins/.idea/misc.xml
@@ -7,6 +7,13 @@
+
+
+
diff --git a/Plugins/.idea/modules.xml b/Plugins/.idea/modules.xml
index bf0ac4bae..1b0feef52 100644
--- a/Plugins/.idea/modules.xml
+++ b/Plugins/.idea/modules.xml
@@ -18,6 +18,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java
index 3ea703536..0e1e2ac03 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java
@@ -36,6 +36,8 @@ public class GameServerConfig
public boolean PlayerKickIdle = true;
public boolean PublicServer = true;
+
+ public boolean PlayerServerWhitelist = false;
public boolean IsValid()
{
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java
new file mode 100644
index 000000000..1dbc380a9
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/ChooseMapButton.java
@@ -0,0 +1,41 @@
+package nautilus.game.arcade.gui.privateServer.button;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
+
+import mineplex.core.shop.item.IButton;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
+
+/**
+ * Created by WilliamTiger.
+ * All the code and any API's associated with it
+ * are not to be used anywhere else without written
+ * consent of William Burns. 2015.
+ * 08/07/2015
+ */
+public class ChooseMapButton implements IButton
+{
+ private ArcadeManager _arcadeManager;
+ private PrivateServerShop _privateServerShop;
+ private GameType _gameType;
+ private String _map;
+
+ public ChooseMapButton(ArcadeManager arcadeManager, PrivateServerShop privateServerShop, GameType gameType, String map)
+ {
+ _arcadeManager = arcadeManager;
+ _privateServerShop = privateServerShop;
+ _gameType = gameType;
+ _map = map;
+ }
+
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ _arcadeManager.GetGameCreationManager().MapPref = _map;
+ _arcadeManager.GetGame().setGame(_gameType, player, true);
+ player.closeInventory();
+ return;
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/GameVotingButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/GameVotingButton.java
new file mode 100644
index 000000000..a3193d8f1
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/button/GameVotingButton.java
@@ -0,0 +1,34 @@
+package nautilus.game.arcade.gui.privateServer.button;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
+
+import mineplex.core.shop.item.IButton;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
+import nautilus.game.arcade.gui.privateServer.page.GameVotingPage;
+
+/**
+ * Created by WilliamTiger.
+ * All the code and any API's associated with it
+ * are not to be used anywhere else without written
+ * consent of William Burns. 2015.
+ * 24/07/15
+ */
+public class GameVotingButton implements IButton
+{
+ private ArcadeManager _arcadeManager;
+ private PrivateServerShop _shop;
+
+ public GameVotingButton(ArcadeManager arcadeManager, PrivateServerShop shop)
+ {
+ _shop = shop;
+ _arcadeManager = arcadeManager;
+ }
+
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ _shop.openPageForPlayer(player, new GameVotingPage(_arcadeManager, _shop, player));
+ }
+}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/BasePage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/BasePage.java
index f0bdac9d9..fe3555ce8 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/BasePage.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/BasePage.java
@@ -44,6 +44,18 @@ public abstract class BasePage extends ShopPageBase enabledGames = getPlugin().GetServerConfig().GameList;
+ //Old code I'm not removing in-case the old style is wanted. - William
+ /*
int arcadeSlot = 9;
int classicSlot = 13;
int survivalSlot = 15;
@@ -64,13 +68,39 @@ public class EditRotationPage extends BasePage
addGameButton(slot, type, enabledGames.contains(type));
}
+ */
+
+ ArrayList allowedCats = new ArrayList();
+ allowedCats.add(GameCategory.ARCADE);
+ allowedCats.add(GameCategory.CLASSICS);
+ allowedCats.add(GameCategory.SURVIVAL);
+ allowedCats.add(GameCategory.CHAMPIONS);
+ allowedCats.add(GameCategory.EXTRA);
+
+ int gameSlot = 9;
+ for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
+ {
+ if (!allowedCats.contains(cat))
+ return;
+
+ for (GameType type : _manager.getGames(getPlayer()).get(cat))
+ {
+ addGameButton(gameSlot, type, enabledGames.contains(type));
+ gameSlot++;
+ }
+ }
}
private void addGameButton(int slot, final GameType type, boolean enabled)
{
- String titleString = ChatColor.RESET + (enabled ? C.cGreen : C.cRed) + ChatColor.BOLD + type.GetLobbyName();
+ String titleString = ChatColor.RESET + (enabled ? C.cGreen : C.cRed) + ChatColor.BOLD + type.GetName();
String infoString = ChatColor.RESET + C.cGray + (enabled ? "Click to Disable" : "Click to Enable");
- ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), titleString, new String[]{infoString}, 1, false, false);
+ String[] lore = new String[]{infoString};
+ if (_manager.hasWarning().contains(type))
+ {
+ lore = new String[]{infoString, "§1", "§c§lWARNING: §fThis game was rejected!"};
+ }
+ ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), titleString, lore, 1, false, false);
int itemCount = enabled ? 1 : 0;
addButtonFakeCount(slot, shopItem, new IButton()
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GameVotingPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GameVotingPage.java
new file mode 100644
index 000000000..dea63c263
--- /dev/null
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/GameVotingPage.java
@@ -0,0 +1,173 @@
+package nautilus.game.arcade.gui.privateServer.page;
+
+import java.util.ArrayList;
+
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.ClickType;
+
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.common.util.UtilServer;
+import mineplex.core.game.GameCategory;
+import mineplex.core.shop.item.IButton;
+import mineplex.core.shop.item.ShopItem;
+import nautilus.game.arcade.ArcadeManager;
+import nautilus.game.arcade.GameType;
+import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
+
+/**
+ * Created by WilliamTiger.
+ * All the code and any API's associated with it
+ * are not to be used anywhere else without written
+ * consent of William Burns. 2015.
+ * 24/07/15
+ */
+public class GameVotingPage extends BasePage
+{
+ public GameVotingPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
+ {
+ super(plugin, shop, "Game Voting Menu", player, 54);
+ buildPage();
+ }
+
+ @Override
+ protected void buildPage()
+ {
+ boolean host = getPlugin().GetGameHostManager().isHost(getPlayer());
+
+ if (host)
+ {
+ addBackButton(4);
+ addStartVoteButton(0);
+ addEndVoteButton(8);
+ }
+ else
+ {
+ addCloseButton(4);
+ }
+
+ ArrayList allowedCats = new ArrayList();
+ allowedCats.add(GameCategory.ARCADE);
+ allowedCats.add(GameCategory.CLASSICS);
+ allowedCats.add(GameCategory.SURVIVAL);
+ allowedCats.add(GameCategory.CHAMPIONS);
+ allowedCats.add(GameCategory.EXTRA);
+
+ int gameSlot = 9;
+ for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
+ {
+ if (!allowedCats.contains(cat))
+ return;
+
+ for (GameType type : _manager.getGames(getPlayer()).get(cat))
+ {
+ addGameButton(gameSlot, type);
+ gameSlot++;
+ }
+ }
+ }
+
+ private void addCloseButton(int slot)
+ {
+ ShopItem item = new ShopItem(Material.BED, (byte)0, "§cClose Menu", new String[]{}, 1, false, false);
+ addButton(slot, item, new IButton()
+ {
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ player.closeInventory();
+ }
+ });
+ }
+
+ private void addEndVoteButton(int slot)
+ {
+ ShopItem item = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, "§c§lEnd Vote", new String[]{}, 1, false, false);
+ addButton(slot, item, new IButton()
+ {
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ if (!_manager.isHost(player)) //Double Check...
+ return;
+
+ getPlugin().GetGameHostManager().setVoteInProgress(false);
+ for (Player p : UtilServer.getPlayers())
+ {
+ UtilPlayer.message(p, F.main("Vote", "The vote has ended!"));
+ }
+ refresh();
+ }
+ });
+ }
+
+ private void addStartVoteButton(int slot)
+ {
+ String warning = "§c§lWARNING: §fThis will reset current votes!";
+ ShopItem item = new ShopItem(Material.EMERALD_BLOCK, (byte)0, "Start Vote", new String[]{warning}, 1, false, false);
+ addButton(slot, item, new IButton()
+ {
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ if (!_manager.isHost(player)) //Double Check...
+ return;
+
+ getPlugin().GetGameHostManager().setVoteInProgress(true);
+ getPlugin().GetGameHostManager().getVotes().clear();
+ for (Player p : UtilServer.getPlayers())
+ {
+ UtilPlayer.message(p, F.main("Vote", "A vote has started! Use " + F.skill("/vote") + " to vote."));
+ p.playSound(p.getLocation(), Sound.NOTE_BASS, 1F, 1F);
+ }
+ refresh();
+ }
+ });
+ }
+
+ private void addGameButton(int slot, final GameType type)
+ {
+ String click = "§7Click to vote for this Game Type";
+ int votes = 0;
+ for (GameType cur : getPlugin().GetGameHostManager().getVotes().values())
+ {
+ if (cur.equals(type))
+ votes++;
+ }
+ String curVotes = "§7Votes: §e" + votes;
+ String[] lore = new String[]{click, curVotes};
+ if (_manager.hasWarning().contains(type))
+ {
+ lore = new String[]{click, curVotes, "§1", "§c§lWARNING: §fThis game was rejected!"};
+ }
+ ShopItem item = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), new String[]{click, curVotes}, 1, false, false);
+ if (votes >= 1)
+ {
+ addButton(slot, item, new IButton()
+ {
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ getPlugin().GetGameHostManager().getVotes().put(player.getName(), type);
+ refresh();
+ }
+ });
+ return;
+ }
+ else
+ {
+ addButtonFakeCount(slot, item, new IButton()
+ {
+ @Override
+ public void onClick(Player player, ClickType clickType)
+ {
+ getPlugin().GetGameHostManager().getVotes().put(player.getName(), type);
+ refresh();
+ }
+ }, votes);
+ return;
+ }
+ }
+}
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 5afc072b6..615d8552b 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
@@ -16,6 +16,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.button.BanButton;
import nautilus.game.arcade.gui.privateServer.button.EditRotationButton;
+import nautilus.game.arcade.gui.privateServer.button.GameVotingButton;
import nautilus.game.arcade.gui.privateServer.button.GiveAdminButton;
import nautilus.game.arcade.gui.privateServer.button.KillButton;
import nautilus.game.arcade.gui.privateServer.button.PlayerHeadButton;
@@ -30,7 +31,7 @@ public class MenuPage extends BasePage
{
public MenuPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
- super(plugin, shop, "Private Server Menu", player, 9*3);
+ super(plugin, shop, "Private Server Menu", player, 9*4);
buildPage();
}
@@ -93,8 +94,11 @@ public class MenuPage extends BasePage
addButton(4 + 18, new ShopItem(Material.GOLD_SWORD, "Remove Admin", new String[]{}, 1, false), removeAdminButton);
KillButton killButton = new KillButton(getPlugin());
- addButton(8 + 18, new ShopItem(Material.TNT, "Kill Private Server",
+ addButton(4 + 27, new ShopItem(Material.TNT, "Kill Private Server",
new String[]{ChatColor.RESET + C.cGray + "Shift-Right Click to Kill Private Server"}, 1, false), killButton);
+
+ GameVotingButton votingButton = new GameVotingButton(getPlugin(), getShop());
+ addButton(8 + 18, new ShopItem(Material.BOOKSHELF, "Game Voting", new String[]{}, 1, false), votingButton);
}
OptionsButton optionsButton = new OptionsButton(getPlugin(), getShop());
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java
index 9247d2831..8b7c5b0e0 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/OptionsPage.java
@@ -43,7 +43,7 @@ public class OptionsPage extends BasePage
}
});
- buildPreference(13, Material.PAPER, "Enforce Whitelist (Coming Soon)", false, new IButton()
+ buildPreference(13, Material.PAPER, "Enforce Whitelist", _config.PlayerServerWhitelist, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
@@ -116,7 +116,7 @@ public class OptionsPage extends BasePage
private void toggleWhitelist()
{
- // TODO CHISSPIE
+ _config.PlayerServerWhitelist = !_config.PlayerServerWhitelist;
refresh();
}
@@ -138,6 +138,14 @@ public class OptionsPage extends BasePage
ChatColor.RED + " ",
ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable") };
+ if (name.equalsIgnoreCase("Enforce Whitelist"))
+ {
+ description = new String[] {
+ "" + (preference ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"),
+ ChatColor.RED + " ",
+ ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable"), "", "§7Use §a/whitelist §e" };
+ }
+
addButton(index, new ShopItem(material, data, (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
addButton(index + 9, new ShopItem(Material.INK_SACK, (preference ? (byte) 10 : (byte) 8), (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java
index b8ca9a28e..dd176e97f 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/privateServer/page/SetGamePage.java
@@ -1,10 +1,14 @@
package nautilus.game.arcade.gui.privateServer.page;
+import java.util.ArrayList;
+import java.util.List;
+
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.util.C;
+import mineplex.core.game.GameCategory;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import nautilus.game.arcade.ArcadeManager;
@@ -24,6 +28,8 @@ public class SetGamePage extends BasePage
{
addBackButton(4);
+ //Old code I'm not removing in-case you want the old style - William.
+ /*
int arcadeSlot = 9;
int classicSlot = 13;
int survivalSlot = 15;
@@ -58,19 +64,58 @@ public class SetGamePage extends BasePage
addGameButton(slot, type);
}
+ */
+
+ ArrayList allowedCats = new ArrayList();
+ allowedCats.add(GameCategory.ARCADE);
+ allowedCats.add(GameCategory.CLASSICS);
+ allowedCats.add(GameCategory.SURVIVAL);
+ allowedCats.add(GameCategory.CHAMPIONS);
+ allowedCats.add(GameCategory.EXTRA);
+
+ int gameSlot = 9;
+ for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
+ {
+ if (!allowedCats.contains(cat))
+ return;
+
+ for (GameType type : _manager.getGames(getPlayer()).get(cat))
+ {
+ addGameButton(gameSlot, type);
+ gameSlot++;
+ }
+ }
}
private void addGameButton(int slot, final GameType type)
{
- String infoString = ChatColor.RESET + C.cGray + "Click to make this next Game Type";
- ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetLobbyName(), new String[]{infoString}, 1, false, false);
+ String infoString = ChatColor.RESET + C.cGray + "Make this next Game Type";
+ String space = "§1";
+ String left = ChatColor.YELLOW + "Left-Click " + C.cGray + "for a §fRandom Map§7.";
+ String right = ChatColor.YELLOW + "Right-Click " + C.cGray + "to §fChoose Map§7.";
+ String[] normLore = new String[]{infoString, space, left, right};
+ if (_manager.hasWarning().contains(type))
+ {
+ normLore = new String[]{infoString, space, left, right, "§2", "§c§lWARNING: §fThis game was rejected!"};
+ }
+ ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetName(), normLore, 1, false, false);
addButton(slot, shopItem, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
- getPlugin().GetGame().setGame(type, player, true);
- player.closeInventory();
+ if (clickType == ClickType.LEFT)
+ {
+ getPlugin().GetGame().setGame(type, player, true);
+ player.closeInventory();
+ return;
+ }
+ else if (clickType == ClickType.RIGHT)
+ {
+ getShop().openPageForPlayer(player, new ChooseMapPage(getPlugin(), getShop(), player, type));
+ return;
+ }
+
}
});
}
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 cfd640b0c..6c8bb6276 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
@@ -10,7 +10,9 @@ 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.UtilTextBottom;
import mineplex.core.common.util.UtilTime;
+import mineplex.core.game.GameCategory;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@@ -18,6 +20,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
+import nautilus.game.arcade.gui.privateServer.page.GameVotingPage;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -32,6 +35,7 @@ import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
@@ -61,6 +65,10 @@ public class GameHostManager implements Listener
private boolean _isEventServer = false;
private HashMap _permissionMap = new HashMap();
+
+ private boolean _voteInProgress = false;
+ private HashMap _votes = new HashMap();
+ private int _voteNotificationStage = 1;
public GameHostManager(ArcadeManager manager)
{
@@ -104,16 +112,22 @@ public class GameHostManager implements Listener
legendGames.add(GameType.SnowFight);
legendGames.add(GameType.Gravity);
legendGames.add(GameType.Barbarians);
- legendGames.add(GameType.OldMineWare);
legendGames.add(GameType.SmashDomination);
legendGames.add(GameType.Skywars);
- // Team variants
+ // Team variants - Currently being remade.
+ /*
legendGames.add(GameType.DragonEscapeTeams);
legendGames.add(GameType.DragonsTeams);
legendGames.add(GameType.QuiverTeams);
legendGames.add(GameType.SmashTeams);
legendGames.add(GameType.SpleefTeams);
legendGames.add(GameType.SurvivalGamesTeams);
+ */
+ //Rejected / Other
+ legendGames.add(GameType.Evolution);
+ legendGames.add(GameType.MilkCow);
+ legendGames.add(GameType.SearchAndDestroy);
+ legendGames.add(GameType.ZombieSurvival);
//Config Defaults
if (Manager.GetHost() != null && Manager.GetHost().length() > 0)
@@ -122,6 +136,16 @@ public class GameHostManager implements Listener
}
}
+ public ArrayList hasWarning()
+ {
+ ArrayList games = new ArrayList<>();
+ games.add(GameType.Evolution);
+ games.add(GameType.MilkCow);
+ games.add(GameType.SearchAndDestroy);
+ games.add(GameType.ZombieSurvival);
+ return games;
+ }
+
@EventHandler
public void updateHost(UpdateEvent event)
{
@@ -152,6 +176,58 @@ public class GameHostManager implements Listener
}
}
+ @EventHandler
+ public void voteNotification(UpdateEvent e)
+ {
+ if (e.getType() != UpdateType.FASTER)
+ return;
+
+ if (!_voteInProgress)
+ return;
+
+ if (_voteNotificationStage == 1)
+ {
+ UtilTextBottom.display("§e§l> §6§lUse §e§l/vote §6§lto vote for a game! §e§l<", UtilServer.getPlayers());
+ _voteNotificationStage++;
+ return;
+ }
+ else if (_voteNotificationStage == 2)
+ {
+ UtilTextBottom.display("§a§l> §2§lUse §a§l/vote §2§lto vote for a game! §a§l<", UtilServer.getPlayers());
+ _voteNotificationStage++;
+ return;
+ }
+ else if (_voteNotificationStage == 3)
+ {
+ UtilTextBottom.display("§c§l> §4§lUse §c§l/vote §4§lto vote for a game! §c§l<", UtilServer.getPlayers());
+ _voteNotificationStage++;
+ return;
+ }
+ else if (_voteNotificationStage == 4)
+ {
+ UtilTextBottom.display("§b§l> §3§lUse §b§l/vote §3§lto vote for a game! §b§l<", UtilServer.getPlayers());
+ _voteNotificationStage++;
+ return;
+ }
+ else if (_voteNotificationStage == 5)
+ {
+ UtilTextBottom.display("§d§l> §5§lUse §d§l/vote §5§lto vote for a game! §d§l<", UtilServer.getPlayers());
+ _voteNotificationStage = 1;
+ return;
+ }
+ }
+
+ @EventHandler
+ public void whitelistJoin(PlayerLoginEvent event)
+ {
+ Player p = event.getPlayer();
+ if (Manager.GetServerConfig().PlayerServerWhitelist){
+ if (!getWhitelist().contains(p.getName())){
+ Manager.GetPortal().sendToHub(p, "You aren't on the whitelist of this Mineplex Private Server.");
+ }
+ }
+ }
+
@EventHandler
public void adminJoin(PlayerJoinEvent event)
{
@@ -296,19 +372,78 @@ public class GameHostManager implements Listener
{
return _adminList;
}
+
+ @EventHandler
+ public void broadcastCommand(PlayerCommandPreprocessEvent event)
+ {
+ if (!event.getMessage().toLowerCase().startsWith("/bc"))
+ return;
+
+ if (!isPrivateServer())
+ return;
+
+ if (!isAdmin(event.getPlayer(), true))
+ {
+ event.getPlayer().sendMessage(F.main("Broadcast", "Only MPS admins can use this command."));
+ event.setCancelled(true);
+ return;
+ }
+
+ event.setCancelled(true);
+
+ if (event.getMessage().split(" ").length < 2)
+ {
+ event.getPlayer().sendMessage(F.main("Broadcast", "/bc "));
+ return;
+ }
+
+ String msg = "";
+ for (int i = 1; i < event.getMessage().split(" ").length; i++)
+ {
+ msg += event.getMessage().split(" ")[i] + " ";
+ }
+ msg = msg.trim();
+
+ Bukkit.broadcastMessage("§6§l" + event.getPlayer().getName() + " §e" + msg);
+ }
+
+ @EventHandler
+ public void voteCommand(PlayerCommandPreprocessEvent event)
+ {
+ if (!event.getMessage().toLowerCase().startsWith("/vote"))
+ return;
+
+ if (!isPrivateServer())
+ {
+ UtilPlayer.message(event.getPlayer(), F.main("Vote", "This command is only available on private servers."));
+ event.setCancelled(true);
+ return;
+ }
+
+ if (!_voteInProgress)
+ {
+ UtilPlayer.message(event.getPlayer(), F.main("Vote", "There is no vote in progress."));
+ event.setCancelled(true);
+ return;
+ }
+
+ event.setCancelled(true);
+ _shop.openPageForPlayer(event.getPlayer(), new GameVotingPage(Manager, _shop, event.getPlayer()));
+ return;
+ }
@EventHandler
public void menuCommand(PlayerCommandPreprocessEvent event)
{
+ if (!event.getMessage().toLowerCase().startsWith("/menu"))
+ return;
+
if (!isPrivateServer())
return;
if (!isAdmin(event.getPlayer(), true))
return;
- if (!event.getMessage().toLowerCase().startsWith("/menu"))
- return;
-
event.setCancelled(true);
openMenu(event.getPlayer());
}
@@ -355,8 +490,13 @@ public class GameHostManager implements Listener
if (_host == null || !event.getPlayer().equals(_host))
return;
- if (!event.getMessage().toLowerCase().startsWith("/whitelist "))
+ if (!event.getMessage().toLowerCase().startsWith("/whitelist"))
return;
+
+ if (!isPrivateServer())
+ return;
+
+ event.setCancelled(true);
String[] args = event.getMessage().split(" ");
@@ -366,7 +506,7 @@ public class GameHostManager implements Listener
if (_whitelist.add(name))
{
- UtilPlayer.message(event.getPlayer(), F.main("Host", "Added " + F.elem(name) + " to the whitelist."));
+ UtilPlayer.message(event.getPlayer(), F.main("Host", "Added " + F.elem(args[i]) + " to the whitelist."));
}
}
}
@@ -451,6 +591,24 @@ public class GameHostManager implements Listener
return games;
}
+ public HashMap> getGames(Player p)
+ {
+ HashMap> games = new HashMap>();
+ for (GameCategory cat : GameCategory.values())
+ {
+ ArrayList types = new ArrayList<>();
+ for (GameType type : getAvailableGames(p))
+ {
+ if (type.getGameCategory().equals(cat))
+ {
+ types.add(type);
+ }
+ }
+ games.put(cat, types);
+ }
+ return games;
+ }
+
public void ban(Player player)
{
_blacklist.add(player.getName());
@@ -650,4 +808,19 @@ public class GameHostManager implements Listener
{
_isEventServer = var;
}
+
+ public HashMap getVotes()
+ {
+ return _votes;
+ }
+
+ public void setVoteInProgress(boolean voteInProgress)
+ {
+ _voteInProgress = voteInProgress;
+ }
+
+ public boolean isVoteInProgress()
+ {
+ return _voteInProgress;
+ }
}
diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java
index 119179fb8..cfed7e11b 100644
--- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java
+++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java
@@ -226,7 +226,10 @@ public class GameManager implements Listener
{
if (game instanceof UHC && !((UHC)game).isMapLoaded())
return;
-
+
+ if (Manager.GetGameHostManager().isPrivateServer() && Manager.GetGameHostManager().isVoteInProgress())
+ return;
+
//Disabling Cosmetics
if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled)
{