Background work for Minestrike

Admins no longer have OP in hubs. They have /gm command to gamemode.
This commit is contained in:
Chiss 2014-08-29 18:21:08 +10:00
parent 1f6b9374eb
commit 41daba98c4
11 changed files with 34 additions and 22 deletions

View File

@ -142,13 +142,13 @@ public enum Achievement
BLOCK_HUNT_HUNTER_OF_THE_YEAR("Hunter of the Year", 1200, BLOCK_HUNT_HUNTER_OF_THE_YEAR("Hunter of the Year", 1200,
new String[] {"Block Hunt.HunterOfTheYear"}, new String[] {"Block Hunt.HunterOfTheYear"},
new String[] {"Kill 7 Hiders in a single game"}, new String[] {"Kill 7 Hiders in a single game"},
new int[] {100}, new int[] {1},
AchievementCategory.BLOCK_HUNT), AchievementCategory.BLOCK_HUNT),
BLOCK_HUNT_BAD_HIDER("Bad Hider", 1000, BLOCK_HUNT_BAD_HIDER("Bad Hider", 1000,
new String[] {"Block Hunt.BadHider"}, new String[] {"Block Hunt.BadHider"},
new String[] {"Win as Hider without disguising"}, new String[] {"Win as Hider without disguising"},
new int[] {100}, new int[] {1},
AchievementCategory.BLOCK_HUNT), AchievementCategory.BLOCK_HUNT),
//Draw My Thing //Draw My Thing

View File

@ -73,6 +73,7 @@ import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.commands.ForcefieldRadius; import mineplex.hub.commands.ForcefieldRadius;
import mineplex.hub.commands.GameModeCommand;
import mineplex.hub.commands.NewsCommand; import mineplex.hub.commands.NewsCommand;
import mineplex.hub.modules.ForcefieldManager; import mineplex.hub.modules.ForcefieldManager;
import mineplex.hub.modules.JumpManager; import mineplex.hub.modules.JumpManager;
@ -309,6 +310,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
public void AddCommands() public void AddCommands()
{ {
AddCommand(new NewsCommand(this)); AddCommand(new NewsCommand(this));
AddCommand(new GameModeCommand(this));
} }
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
@ -463,7 +465,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void AdminOP(PlayerJoinEvent event) public void AdminOP(PlayerJoinEvent event)
{ {
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.ADMIN)) if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.OWNER))
event.getPlayer().setOp(true); event.getPlayer().setOp(true);
else else
event.getPlayer().setOp(false); event.getPlayer().setOp(false);

View File

@ -372,6 +372,11 @@ public abstract class Game implements Listener
System.out.println(GetName() + " state set to " + state.toString()); System.out.println(GetName() + " state set to " + state.toString());
} }
public void SetStateTime(long time)
{
_gameStateTime = time;
}
public long GetStateTime() public long GetStateTime()
{ {
return _gameStateTime; return _gameStateTime;
@ -446,7 +451,7 @@ public abstract class Game implements Listener
//Use this to parse in extra location data from maps //Use this to parse in extra location data from maps
} }
public void SetPlayerTeam(Player player, GameTeam team) public void SetPlayerTeam(Player player, GameTeam team, boolean in)
{ {
//Clean Old Team //Clean Old Team
GameTeam pastTeam = this.GetTeam(player); GameTeam pastTeam = this.GetTeam(player);
@ -455,7 +460,7 @@ public abstract class Game implements Listener
pastTeam.RemovePlayer(player); pastTeam.RemovePlayer(player);
} }
team.AddPlayer(player); team.AddPlayer(player, in);
//Ensure Valid Kit //Ensure Valid Kit
ValidateKit(player, team); ValidateKit(player, team);
@ -1017,13 +1022,13 @@ public abstract class Game implements Listener
return; return;
if (_helpColor == ChatColor.YELLOW) if (_helpColor == ChatColor.YELLOW)
_helpColor = ChatColor.GREEN; _helpColor = ChatColor.GOLD;
else else
_helpColor = ChatColor.YELLOW; _helpColor = ChatColor.YELLOW;
_helpTimer = System.currentTimeMillis(); _helpTimer = System.currentTimeMillis();
String msg = C.cWhite + C.Bold + "TIP " + ChatColor.RESET + _helpColor + _help[_helpIndex]; String msg = C.cWhite + C.Bold + "TIP> " + ChatColor.RESET + _helpColor + _help[_helpIndex];
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {

View File

@ -134,9 +134,9 @@ public class GameTeam
return _spawns.get(UtilMath.r(_spawns.size())); return _spawns.get(UtilMath.r(_spawns.size()));
} }
public void AddPlayer(Player player) public void AddPlayer(Player player, boolean in)
{ {
_players.put(player, PlayerState.IN); _players.put(player, in ? PlayerState.IN : PlayerState.OUT);
UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _name + " Team") + "."); UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _name + " Team") + ".");
@ -226,7 +226,12 @@ public class GameTeam
public void SpawnTeleport() public void SpawnTeleport()
{ {
for (Player player : GetPlayers(true)) SpawnTeleport(true);
}
public void SpawnTeleport(boolean aliveOnly)
{
for (Player player : GetPlayers(aliveOnly))
{ {
SpawnTeleport(player); SpawnTeleport(player);
} }

View File

@ -97,7 +97,7 @@ public abstract class TeamGame extends Game
GameTeam team = RejoinTeam.remove(event.getPlayer().getName()); GameTeam team = RejoinTeam.remove(event.getPlayer().getName());
if (team != null && _rejoinTime.remove(event.getPlayer().getName()) != null) if (team != null && _rejoinTime.remove(event.getPlayer().getName()) != null)
{ {
team.AddPlayer(event.getPlayer()); team.AddPlayer(event.getPlayer(), true);
Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false); Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false);

View File

@ -239,7 +239,7 @@ public class DeathTag extends SoloGame
if (GetTeam(player) != null) if (GetTeam(player) != null)
GetTeam(player).SetPlacement(player, PlayerState.OUT); GetTeam(player).SetPlacement(player, PlayerState.OUT);
SetPlayerTeam(player, _chasers); SetPlayerTeam(player, _chasers, true);
//Kit //Kit
Kit newKit = GetKits()[5]; //Normal Kit newKit = GetKits()[5]; //Normal

View File

@ -206,7 +206,7 @@ public class Draw extends SoloGame
for (Player player : _drawers.GetPlayers(false)) for (Player player : _drawers.GetPlayers(false))
{ {
_drawers.RemovePlayer(player); _drawers.RemovePlayer(player);
_guessers.AddPlayer(player); _guessers.AddPlayer(player, true);
UtilInv.Clear(player); UtilInv.Clear(player);
player.setAllowFlight(false); player.setAllowFlight(false);
@ -228,7 +228,7 @@ public class Draw extends SoloGame
//Select New Drawer //Select New Drawer
Player drawer = _roundPlayer.remove(0); Player drawer = _roundPlayer.remove(0);
_guessers.RemovePlayer(drawer); _guessers.RemovePlayer(drawer);
_drawers.AddPlayer(drawer); _drawers.AddPlayer(drawer, true);
//Get Word //Get Word
String word = _words[UtilMath.r(_words.length)]; String word = _words[UtilMath.r(_words.length)];

View File

@ -958,7 +958,7 @@ public class HideSeek extends TeamGame
public void SetSeeker(Player player, boolean forced) public void SetSeeker(Player player, boolean forced)
{ {
SetPlayerTeam(player, _seekers); SetPlayerTeam(player, _seekers, true);
Manager.GetDisguise().undisguise(player); Manager.GetDisguise().undisguise(player);

View File

@ -284,7 +284,7 @@ public class MilkCow extends SoloGame
if (GetTeam(player) != null) if (GetTeam(player) != null)
GetTeam(player).SetPlacement(player, PlayerState.OUT); GetTeam(player).SetPlacement(player, PlayerState.OUT);
SetPlayerTeam(player, _cows); SetPlayerTeam(player, _cows, true);
//Kit //Kit
Kit newKit = GetKits()[2]; Kit newKit = GetKits()[2];

View File

@ -148,7 +148,7 @@ public class ZombieSurvival extends SoloGame
GetTeam(player).SetPlacement(player, PlayerState.OUT); GetTeam(player).SetPlacement(player, PlayerState.OUT);
//Change to Undead //Change to Undead
SetPlayerTeam(player, _undead); SetPlayerTeam(player, _undead, true);
//Kit //Kit
Kit newKit = this.GetKits()[4]; Kit newKit = this.GetKits()[4];

View File

@ -389,7 +389,7 @@ public class GameManager implements Listener
} }
else else
{ {
game.SetPlayerTeam(player, team); game.SetPlayerTeam(player, team, true);
} }
} }
} }
@ -435,10 +435,10 @@ public class GameManager implements Listener
//Player Swap //Player Swap
queueIterator.remove(); queueIterator.remove();
game.SetPlayerTeam(player, team); game.SetPlayerTeam(player, team, true);
//Other Swap //Other Swap
game.SetPlayerTeam(other, currentTeam); game.SetPlayerTeam(other, currentTeam, true);
break; break;
} }
@ -523,7 +523,7 @@ public class GameManager implements Listener
if (team == null) if (team == null)
return false; return false;
game.SetPlayerTeam(player, team); game.SetPlayerTeam(player, team, true);
//Game Mode //Game Mode
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);