Merge branch 'MPS-Maps'

Conflicts:
	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java
This commit is contained in:
Mini-Chiss 2015-08-04 17:37:32 +02:00
commit 88fe5b3ec6
10 changed files with 78 additions and 44 deletions

View File

@ -294,6 +294,8 @@ public abstract class Game implements Listener
}
if (Manager.GetGameCreationManager().MapPref != null)
{
System.out.println("Map Preference: " + Manager.GetGameCreationManager().MapPref);
HashMap<GameType, ArrayList<String>> matches = new HashMap<GameType, ArrayList<String>>();
for (GameType game : _files.keySet())
{
@ -302,7 +304,7 @@ public abstract class Game implements Listener
{
if (cur.toLowerCase().contains(Manager.GetGameCreationManager().MapPref.toLowerCase()))
{
if(game.toString().toLowerCase().contains(Manager.GetGameCreationManager().MapSource.toLowerCase()))
if(game.GetName().toLowerCase().contains(Manager.GetGameCreationManager().MapSource.toLowerCase()))
{
list.add(cur);
System.out.print("Map Preference: " + cur);
@ -318,6 +320,10 @@ public abstract class Game implements Listener
Manager.GetGameCreationManager().MapPref = null;
Manager.GetGameCreationManager().MapSource = null;
}
else
{
System.out.println("Map Preference: None");
}
WorldData = new WorldData(this);
//Stat Trackers

View File

@ -33,8 +33,11 @@ public class ChooseMapButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
_arcadeManager.GetGameCreationManager().MapPref = _map;
_arcadeManager.GetGameCreationManager().MapSource = _gameType.GetName();
if(_gameType.getMapSource() != null)
_arcadeManager.GetGameCreationManager().MapSource = _gameType.getMapSource()[0].GetName();
_arcadeManager.GetGameCreationManager().MapPref = _map;
_arcadeManager.GetGame().setGame(_gameType, player, true);
player.closeInventory();
return;

View File

@ -32,11 +32,6 @@ public class WhitelistButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
List<String> strings = new ArrayList<>();
for (String s : _arcadeManager.GetGameHostManager().getWhitelist())
{
strings.add(s);
}
_shop.openPageForPlayer(player, new WhitelistedPage(_arcadeManager, _shop, player, strings));
_shop.openPageForPlayer(player, new WhitelistedPage(_arcadeManager, _shop, player));
}
}

View File

@ -34,7 +34,13 @@ public class ChooseMapPage extends BasePage
addBackToSetGamePage();
int slot = 9;
for (String cur : getPlugin().LoadFiles(_gameType.GetName())){
String loadMaps = _gameType.GetName();
if(_gameType.getMapSource() != null)
{
loadMaps = _gameType.getMapSource()[0].GetName();
}
for(String cur : getPlugin().LoadFiles(loadMaps))
{
ChooseMapButton btn = new ChooseMapButton(getPlugin(), getShop(), _gameType, cur);
addButton(slot, new ShopItem(Material.PAPER, cur.split("_")[1], new String[]{"§7Click to select map."}, 1, false), btn);
slot++;

View File

@ -124,6 +124,11 @@ public class OptionsPage extends BasePage
private void togglePublic()
{
if (_config.PlayerServerWhitelist==true)
{
_config.PublicServer = false;
return;
}
_config.PublicServer = !_config.PublicServer;
refresh();
}

View File

@ -38,7 +38,7 @@ public abstract class PlayerPage extends BasePage
{
addBackButton(4);
List<Player> players = null;
List<Player> players = new ArrayList<>();
if (useOtherList)
{
players = new ArrayList<>();

View File

@ -2,9 +2,14 @@ package nautilus.game.arcade.gui.privateServer.page;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
@ -15,33 +20,38 @@ import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
* consent of William Burns. 2015.
* 29/07/15
*/
public class WhitelistedPage extends PlayerPage
public class WhitelistedPage extends BasePage
{
public WhitelistedPage(ArcadeManager plugin, PrivateServerShop shop, Player player, List<String> players)
public WhitelistedPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
super(plugin, shop, "Whitelisted Players", player, players);
super(plugin, shop, "Whitelisted Players", player);
buildPage();
}
@Override
public boolean showPlayer(Player player)
protected void buildPage()
{
if (getPlugin().GetGameHostManager().getWhitelist().contains(player.getName()))
return true;
return false;
}
addBackButton(4);
@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."));
}
int slot = 9;
for (final String s : getPlugin().GetGameHostManager().getWhitelist())
{
ItemStack head = getPlayerHead(s, C.cGreen + C.Bold + s, new String[]{C.cGray + "Click to un-whitelist player"});
final int i = slot;
addButton(slot, head, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
getPlugin().GetGameHostManager().getWhitelist().remove(s);
removeButton(i);
getPlayer().sendMessage(F.main("Whitelist", "§e" + s + " §7is no longer whitelisted."));
if (Bukkit.getPlayer(s)!=null)
getPlugin().GetPortal().sendToHub(Bukkit.getPlayer(s), "You are no longer whitelisted.");
}
});
@Override
public String getDisplayString(Player player)
{
return "Click to remove from whitelist";
slot++;
}
}
}

View File

@ -167,6 +167,9 @@ public class GameCreationManager implements Listener
HashMap<String, ChatColor> pastTeams = null;
System.out.println(_nextGame == null ? "Next Game = null" : "Next Game = " + _nextGame.GetName());
System.out.println(MapPref == null ? "Map Pref = null" : "Map Pref = " + MapPref);
//Chosen Game
if (_nextGame != null)
{

View File

@ -48,6 +48,7 @@ public class GameHostManager implements Listener
ArcadeManager Manager;
private Player _host;
private String _hostName;
private Rank _hostRank;
private long _serverStartTime = System.currentTimeMillis();
private long _serverExpireTime = 21600000;
@ -208,8 +209,10 @@ public class GameHostManager implements Listener
Player p = event.getPlayer();
if (Manager.GetServerConfig().PlayerServerWhitelist){
if (!getWhitelist().contains(p.getName())){
if (_host == p)
if ((Manager.GetHost() != null) && (Manager.GetHost().equalsIgnoreCase(p.getName())))
{
return;
}
event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "This MPS is whitelisted.");
}
}
@ -368,6 +371,9 @@ public class GameHostManager implements Listener
event.setCancelled(true);
if (!isPrivateServer())
return;
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true))
return;