Woo a push

This commit is contained in:
William Burns 2015-07-29 14:22:49 +01:00
parent f6e64d25a2
commit 3bc66f16b6
9 changed files with 71 additions and 11 deletions

View File

@ -47,7 +47,7 @@ public class TeamSuperSmash extends SuperSmash
this.PlayersPerTeam = 2;
this.FillTeamsInOrderToCount = 2;
this.SpawnNearAlliesz = true;
this.SpawnNearAllies = true;
this.DamageTeamSelf = false;
}

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,6 +76,7 @@ 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())

View File

@ -54,6 +54,7 @@ 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())

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

@ -2,6 +2,7 @@ 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;
@ -12,7 +13,7 @@ import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
* consent of William Burns. 2015.
* 29/07/15
*/
public class WhitelistedPage extends BasePage
public class WhitelistedPage extends PlayerPage
{
public WhitelistedPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
@ -21,13 +22,24 @@ public class WhitelistedPage extends BasePage
}
@Override
protected void buildPage()
public boolean showPlayer(Player player)
{
if (getPlugin().GetGameHostManager().getWhitelist().contains(player.getName()))
return true;
return false;
}
private void addPlayerButton(Player p)
@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)
@ -223,6 +226,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.");
}
}