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

View File

@ -33,8 +33,11 @@ public class ChooseMapButton implements IButton
@Override @Override
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
_arcadeManager.GetGameCreationManager().MapPref = _map;
_arcadeManager.GetGameCreationManager().MapSource = _gameType.GetName(); _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); _arcadeManager.GetGame().setGame(_gameType, player, true);
player.closeInventory(); player.closeInventory();
return; return;

View File

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

View File

@ -34,7 +34,13 @@ public class ChooseMapPage extends BasePage
addBackToSetGamePage(); addBackToSetGamePage();
int slot = 9; 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); 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); addButton(slot, new ShopItem(Material.PAPER, cur.split("_")[1], new String[]{"§7Click to select map."}, 1, false), btn);
slot++; slot++;

View File

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

View File

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

View File

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

View File

@ -167,6 +167,9 @@ public class GameCreationManager implements Listener
HashMap<String, ChatColor> pastTeams = null; 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 //Chosen Game
if (_nextGame != null) if (_nextGame != null)
{ {

View File

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