Merge branch 'MPS-Maps'

This commit is contained in:
Mini-Chiss 2015-07-29 15:27:11 +02:00
commit deba3f23fa
8 changed files with 103 additions and 28 deletions

View File

@ -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.WhitelistedPage;
/**
* 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.
* 29/07/15
*/
public class WhitelistButton implements IButton
{
private ArcadeManager _arcadeManager;
private PrivateServerShop _shop;
public WhitelistButton(ArcadeManager arcadeManager, PrivateServerShop shop)
{
_shop = shop;
_arcadeManager = arcadeManager;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_shop.openPageForPlayer(player, new WhitelistedPage(_arcadeManager, _shop, player));
}
}

View File

@ -76,12 +76,13 @@ public class EditRotationPage extends BasePage
allowedCats.add(GameCategory.SURVIVAL);
allowedCats.add(GameCategory.CHAMPIONS);
allowedCats.add(GameCategory.EXTRA);
allowedCats.add(GameCategory.TEAM_VARIANT);
int gameSlot = 9;
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
{
if (!allowedCats.contains(cat))
return;
continue;
for (GameType type : _manager.getGames(getPlayer()).get(cat))
{

View File

@ -54,12 +54,13 @@ public class GameVotingPage extends BasePage
allowedCats.add(GameCategory.SURVIVAL);
allowedCats.add(GameCategory.CHAMPIONS);
allowedCats.add(GameCategory.EXTRA);
allowedCats.add(GameCategory.TEAM_VARIANT);
int gameSlot = 9;
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())
{
if (!allowedCats.contains(cat))
return;
continue;
for (GameType type : _manager.getGames(getPlayer()).get(cat))
{

View File

@ -26,6 +26,7 @@ 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;
import nautilus.game.arcade.gui.privateServer.button.WhitelistButton;
public class MenuPage extends BasePage
{
@ -94,11 +95,14 @@ 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(4 + 27, new ShopItem(Material.TNT, "Kill Private Server",
addButton(8 + 18, 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);
addButton(3 + 27, new ShopItem(Material.BOOKSHELF, "Game Voting", new String[]{}, 1, false), votingButton);
WhitelistButton whitelistButton = new WhitelistButton(getPlugin(), getShop());
addButton(5 + 27, new ShopItem(Material.PAPER, "Whitelisted Players", new String[]{}, 1, false), whitelistButton);
}
OptionsButton optionsButton = new OptionsButton(getPlugin(), getShop());

View File

@ -117,6 +117,8 @@ public class OptionsPage extends BasePage
private void toggleWhitelist()
{
_config.PlayerServerWhitelist = !_config.PlayerServerWhitelist;
if (_config.PlayerServerWhitelist == true)
_config.PublicServer = false;
refresh();
}

View File

@ -72,6 +72,7 @@ public class SetGamePage extends BasePage
allowedCats.add(GameCategory.SURVIVAL);
allowedCats.add(GameCategory.CHAMPIONS);
allowedCats.add(GameCategory.EXTRA);
allowedCats.add(GameCategory.TEAM_VARIANT);
int gameSlot = 9;
for (GameCategory cat : _manager.getGames(getPlayer()).keySet())

View File

@ -0,0 +1,45 @@
package nautilus.game.arcade.gui.privateServer.page;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import nautilus.game.arcade.ArcadeManager;
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.
* 29/07/15
*/
public class WhitelistedPage extends PlayerPage
{
public WhitelistedPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
super(plugin, shop, "Whitelisted Players", player);
buildPage();
}
@Override
public boolean showPlayer(Player player)
{
if (getPlugin().GetGameHostManager().getWhitelist().contains(player.getName()))
return true;
return false;
}
@Override
public void clicked(int slot, Player player)
{
getPlugin().GetGameHostManager().getWhitelist().remove(player.getName());
getPlugin().GetPortal().sendToHub(player, "You are no longer whitelisted.");
getPlayer().sendMessage(F.main("Whitelist", "§e" + player.getName() + " §7is no longer whitelisted."));
}
@Override
public String getDisplayString(Player player)
{
return "Click to remove from whitelist";
}
}

View File

@ -109,10 +109,6 @@ public class GameHostManager implements Listener
legendGames.add(GameType.Build);
legendGames.add(GameType.UHC);
legendGames.add(GameType.MineStrike);
legendGames.add(GameType.SnowFight);
legendGames.add(GameType.Gravity);
legendGames.add(GameType.Barbarians);
legendGames.add(GameType.SmashDomination);
legendGames.add(GameType.Skywars);
// Team variants - Currently being remade.
/*
@ -128,6 +124,13 @@ public class GameHostManager implements Listener
legendGames.add(GameType.MilkCow);
legendGames.add(GameType.SearchAndDestroy);
legendGames.add(GameType.ZombieSurvival);
legendGames.add(GameType.SurvivalGamesTeams);
legendGames.add(GameType.SkywarsTeams);
legendGames.add(GameType.SmashTeams);
legendGames.add(GameType.SnowFight);
legendGames.add(GameType.Gravity);
legendGames.add(GameType.Barbarians);
legendGames.add(GameType.SmashDomination);
//Config Defaults
if (Manager.GetHost() != null && Manager.GetHost().length() > 0)
@ -187,31 +190,13 @@ public class GameHostManager implements Listener
if (_voteNotificationStage == 1)
{
UtilTextBottom.display("§e§l> §6§lUse §e§l/vote §6§lto vote for a game! §e§l<", UtilServer.getPlayers());
UtilTextBottom.display("§e§l> §e§lUse §6§l/vote §e§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());
UtilTextBottom.display("§6§l> §6§lUse §e§l/vote §6§lto vote for a game! §6§l<", UtilServer.getPlayers());
_voteNotificationStage = 1;
return;
}
@ -223,6 +208,8 @@ public class GameHostManager implements Listener
Player p = event.getPlayer();
if (Manager.GetServerConfig().PlayerServerWhitelist){
if (!getWhitelist().contains(p.getName())){
if (_host == p)
return;
Manager.GetPortal().sendToHub(p, "You aren't on the whitelist of this Mineplex Private Server.");
}
}