Merge branch 'EventGameUpdates'

This commit is contained in:
Mini-Chiss 2015-08-11 13:01:33 +02:00
commit b348c62a3f
3 changed files with 67 additions and 49 deletions

View File

@ -849,8 +849,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{
// Give developers operator on their servers
boolean testServer = _plugin.getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER) || (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV)))
boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1");
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER)
|| (testServer && (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER) || _clientManager.Get(event.getPlayer()).GetRank() == Rank.JNR_DEV))
|| eventTestServer && _clientManager.Get(event.getPlayer()).GetRank().Has(Rank.JNR_DEV))
event.getPlayer().setOp(true);
else
event.getPlayer().setOp(false);

View File

@ -82,7 +82,11 @@ public class EventModule extends MiniPlugin
if (!event.getMessage().toLowerCase().startsWith("/sethost "))
return;
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true))
boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1");
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.JNR_DEV, true)
&& !event.getPlayer().isOp() &&
(!eventTestServer && !Manager.GetClients().Get(event.getPlayer()).GetRank().Has(event.getPlayer(), Rank.SNR_MODERATOR, true)))
return;
Manager.GetServerConfig().HostName = event.getMessage().split(" ")[1];
@ -177,7 +181,9 @@ public class EventModule extends MiniPlugin
if (!event.getMessage().toLowerCase().startsWith("/e "))
return;
if(!Manager.GetGameHostManager().isEventServer())
boolean eventTestServer = _plugin.getConfig().getString("serverstatus.name").equalsIgnoreCase("SMTestServer-1");
if(!Manager.GetGameHostManager().isEventServer() && !eventTestServer)
return;
event.setCancelled(true);

View File

@ -374,7 +374,7 @@ public class GameHostManager implements Listener
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) && !event.getPlayer().isOp())
return;
giveAdmin(event.getPlayer());
@ -713,57 +713,66 @@ public class GameHostManager implements Listener
if (!event.getMessage().toLowerCase().startsWith("/e set ") && !event.getMessage().toLowerCase().equals("/e set"))
return;
Player caller = event.getPlayer();
String[] args = event.getMessage().split(" ");
//Parse Game
if (args.length >= 3)
{
ArrayList<GameType> matches = new ArrayList<GameType>();
for (GameType type : GameType.values())
{
if (type.toString().toLowerCase().equals(args[2]))
{
matches.clear();
matches.add(type);
break;
}
if (type.toString().toLowerCase().contains(args[2]))
{
matches.add(type);
}
}
if (matches.size() == 0)
{
event.getPlayer().sendMessage("No results for: " + args[2]);
return;
}
if (matches.size() > 1)
{
event.getPlayer().sendMessage("Matched multiple games;");
for (GameType cur : matches)
event.getPlayer().sendMessage(cur.toString());
return;
}
GameType type = matches.get(0);
Manager.GetGame().setGame(type, event.getPlayer(), true);
}
else
{
Manager.GetGame().setGame(GameType.Event, event.getPlayer(), true);
}
String game = args[2].toLowerCase();
//Map Pref
if (args.length >= 4)
{
Manager.GetGameCreationManager().MapPref = args[3];
UtilPlayer.message(event.getPlayer(), C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + args[2]);
String map = "";
String source = "";
if(args.length == 5)
{
Manager.GetGameCreationManager().MapSource = args[3];
Manager.GetGameCreationManager().MapPref = args[4];
source = args[3];
map = args[4];
}
else
{
Manager.GetGameCreationManager().MapSource = args[2];
Manager.GetGameCreationManager().MapPref = args[3];
source = args[2];
map = args[3];
}
UtilPlayer.message(caller, C.cAqua + C.Bold + "Map Preference: " + ChatColor.RESET + source + ":" + map);
}
//Parse Game
ArrayList<GameType> matches = new ArrayList<>();
for (GameType type : GameType.values())
{
if (type.toString().toLowerCase().equals(game))
{
matches.clear();
matches.add(type);
break;
}
if (type.toString().toLowerCase().contains(game))
{
matches.add(type);
}
}
if (matches.size() == 0)
{
caller.sendMessage("No results for: " + game);
return;
}
if (matches.size() > 1)
{
caller.sendMessage("Matched multiple games;");
for (GameType cur : matches)
caller.sendMessage(cur.toString());
return;
}
GameType type = matches.get(0);
Manager.GetGame().setGame(type, event.getPlayer(), true);
event.setCancelled(true);
}