Kits now appear when there's map voting
This commit is contained in:
parent
c39995aa20
commit
34eeb208e2
@ -67,9 +67,6 @@ public enum Preference implements Permission
|
|||||||
|
|
||||||
COLOR_SUFFIXES(true, PreferenceCategory.USER, Material.WOOL, "Color Chat Suffixes", "Enabling this will color your", "chat suffixes like ¯\\_(ツ)_/¯", "based on your rank."),
|
COLOR_SUFFIXES(true, PreferenceCategory.USER, Material.WOOL, "Color Chat Suffixes", "Enabling this will color your", "chat suffixes like ¯\\_(ツ)_/¯", "based on your rank."),
|
||||||
|
|
||||||
PARTICLES_IN_GAME(true, PreferenceCategory.GAME_PLAY, Material.NETHER_STAR, "Display Particles", "Enabling this will show your selected", "particle aura in game.")
|
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private static final Map<Integer, Preference> PREFERENCE_MAP = Maps.newHashMap();
|
private static final Map<Integer, Preference> PREFERENCE_MAP = Maps.newHashMap();
|
||||||
|
@ -170,7 +170,6 @@ import nautilus.game.arcade.managers.chat.GameChatManager;
|
|||||||
import nautilus.game.arcade.managers.lobby.LobbyManager;
|
import nautilus.game.arcade.managers.lobby.LobbyManager;
|
||||||
import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager;
|
import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager;
|
||||||
import nautilus.game.arcade.managers.lobby.legacy.LegacyGameLobbyManager;
|
import nautilus.game.arcade.managers.lobby.legacy.LegacyGameLobbyManager;
|
||||||
import nautilus.game.arcade.managers.voting.event.VoteStartEvent;
|
|
||||||
|
|
||||||
public class ArcadeManager extends MiniPlugin implements IRelation
|
public class ArcadeManager extends MiniPlugin implements IRelation
|
||||||
{
|
{
|
||||||
@ -417,7 +416,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
@Override
|
@Override
|
||||||
public void handlePlayerJoin(String playerName)
|
public void handlePlayerJoin(String playerName)
|
||||||
{
|
{
|
||||||
if (GetGame() != null && GetGame().GetState() != GameState.Loading && GetGame().GetState() != GameState.Recruit && GetGame().UseCustomScoreboard)
|
if (GetGame() != null && !GetGame().inLobby() && GetGame().UseCustomScoreboard)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -518,9 +517,14 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
@Override
|
@Override
|
||||||
public void draw(MineplexScoreboard scoreboard)
|
public void draw(MineplexScoreboard scoreboard)
|
||||||
{
|
{
|
||||||
if (GetGame() != null)
|
if (_gameCreationManager.getVotingManager().isVoteInProgress())
|
||||||
|
{
|
||||||
|
scoreboard.setSidebarName(C.Bold + "Vote ends in " + C.cGreenB + _gameCreationManager.getVotingManager().getCurrentVote().getTimer());
|
||||||
|
}
|
||||||
|
else if (GetGame() != null)
|
||||||
{
|
{
|
||||||
int countdown = GetGame().GetCountdown();
|
int countdown = GetGame().GetCountdown();
|
||||||
|
GameState state = GetGame().GetState();
|
||||||
|
|
||||||
if (countdown > 0)
|
if (countdown > 0)
|
||||||
{
|
{
|
||||||
@ -530,19 +534,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
{
|
{
|
||||||
scoreboard.setSidebarName(C.cGreenB + "In Progress...");
|
scoreboard.setSidebarName(C.cGreenB + "In Progress...");
|
||||||
}
|
}
|
||||||
else if (GetGame().GetState() == GameState.Recruit)
|
else if (state == GameState.Recruit || state == GameState.PreLoad)
|
||||||
{
|
{
|
||||||
scoreboard.setSidebarName(C.cGreenB + "Waiting for players");
|
scoreboard.setSidebarName(C.cGreenB + "Waiting for players");
|
||||||
}
|
}
|
||||||
else if (GetGame().GetState() == GameState.Loading)
|
else if (state == GameState.Loading)
|
||||||
{
|
{
|
||||||
scoreboard.setSidebarName(C.cGreenB + "Loading...");
|
scoreboard.setSidebarName(C.cGreenB + "Loading...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_gameCreationManager.getVotingManager().isVoteInProgress())
|
|
||||||
{
|
|
||||||
scoreboard.setSidebarName(C.Bold + "Vote ends in " + C.cGreenB + _gameCreationManager.getVotingManager().getCurrentVote().getTimer());
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scoreboard.setSidebarName(C.cGreenB + "Waiting for players");
|
scoreboard.setSidebarName(C.cGreenB + "Waiting for players");
|
||||||
@ -974,7 +974,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
team.RemovePlayer(player);
|
team.RemovePlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_game != null && _game.GetState() != GameState.Recruit) //Game is NOT in lobby
|
else if (_game != null && !_game.inLobby()) //Game is NOT in lobby
|
||||||
{
|
{
|
||||||
addSpectator(player, true);
|
addSpectator(player, true);
|
||||||
_specList.add(player);
|
_specList.add(player);
|
||||||
@ -1628,14 +1628,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void cosmeticState(GameStateChangeEvent event)
|
public void cosmeticState(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
//Disable
|
GameState state = event.GetState();
|
||||||
if (event.GetState() == GameState.Recruit)
|
|
||||||
|
if (state == GameState.PreLoad || state == GameState.Dead)
|
||||||
{
|
{
|
||||||
getTitles().forceEnable();
|
getTitles().forceEnable();
|
||||||
getCosmeticManager().setActive(true);
|
getCosmeticManager().setActive(true);
|
||||||
getCosmeticManager().setHideParticles(false);
|
getCosmeticManager().setHideParticles(false);
|
||||||
}
|
}
|
||||||
else if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Loading || event.GetState() == GameState.Dead)
|
else if (state == GameState.Prepare)
|
||||||
{
|
{
|
||||||
Game game = event.GetGame();
|
Game game = event.GetGame();
|
||||||
|
|
||||||
@ -1648,31 +1649,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.AllowParticles)
|
if (!game.AllowParticles)
|
||||||
{
|
|
||||||
for (Player player : UtilServer.getPlayersCollection())
|
|
||||||
{
|
|
||||||
Gadget gadget = getCosmeticManager().getGadgetManager().getActive(player, GadgetType.PARTICLE);
|
|
||||||
|
|
||||||
if (gadget == null || isVanished(player))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getPreferences().get(player).isActive(Preference.PARTICLES_IN_GAME))
|
|
||||||
{
|
|
||||||
if (!gadget.isActive(player))
|
|
||||||
{
|
|
||||||
gadget.enable(player, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gadget.disable(player, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
getCosmeticManager().setHideParticles(true);
|
getCosmeticManager().setHideParticles(true);
|
||||||
}
|
}
|
||||||
@ -1684,14 +1661,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onVote(VoteStartEvent event)
|
|
||||||
{
|
|
||||||
getTitles().forceEnable();
|
|
||||||
getCosmeticManager().showInterface(true);
|
|
||||||
getCosmeticManager().setHideParticles(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void disableGadget(PlayerJoinEvent event)
|
public void disableGadget(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ public class StartCommand extends CommandBase<ArcadeManager>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Plugin.GetGame().GetState() != GameState.Recruit)
|
if (!Plugin.GetGame().inLobby())
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Game", "The game is already starting, it cannot be started again!"));
|
UtilPlayer.message(caller, F.main("Game", "The game is already starting, it cannot be started again!"));
|
||||||
return;
|
return;
|
||||||
|
@ -36,7 +36,7 @@ public class StopCommand extends CommandBase<ArcadeManager>
|
|||||||
UtilPlayer.message(caller, F.main("Game", "The game is already ending, it cannot be ended again"));
|
UtilPlayer.message(caller, F.main("Game", "The game is already ending, it cannot be ended again"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (Plugin.GetGame().GetState() == GameState.Recruit)
|
else if (Plugin.GetGame().inLobby())
|
||||||
{
|
{
|
||||||
Plugin.GetGame().SetState(GameState.Dead);
|
Plugin.GetGame().SetState(GameState.Dead);
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ import org.bukkit.event.HandlerList;
|
|||||||
public class GameStateChangeEvent extends Event
|
public class GameStateChangeEvent extends Event
|
||||||
{
|
{
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private Game _game;
|
private final Game _game;
|
||||||
private GameState _to;
|
private final GameState _to;
|
||||||
|
|
||||||
public GameStateChangeEvent(Game game, GameState to)
|
public GameStateChangeEvent(Game game, GameState to)
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
|
|
||||||
public enum GameState
|
public enum GameState
|
||||||
{
|
{
|
||||||
Loading, Recruit, Prepare, Live, End, Dead
|
PreLoad, Loading, Recruit, Prepare, Live, End, Dead
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArcadeManager Manager;
|
public ArcadeManager Manager;
|
||||||
@ -160,7 +160,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
private PhasedLifetime<GameState> _lifetime = new PhasedLifetime<>();
|
private PhasedLifetime<GameState> _lifetime = new PhasedLifetime<>();
|
||||||
|
|
||||||
// State
|
// State
|
||||||
private GameState _gameState = GameState.Loading;
|
private GameState _gameState = GameState.PreLoad;
|
||||||
private long _gameLiveTime;
|
private long _gameLiveTime;
|
||||||
private long _gameStateTime = System.currentTimeMillis();
|
private long _gameStateTime = System.currentTimeMillis();
|
||||||
|
|
||||||
@ -800,6 +800,11 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
return _gameStateTime;
|
return _gameStateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean inLobby()
|
||||||
|
{
|
||||||
|
return GetState() == GameState.PreLoad || GetState() == GameState.Loading || GetState() == GameState.Recruit;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean InProgress()
|
public boolean InProgress()
|
||||||
{
|
{
|
||||||
return GetState() == GameState.Prepare || GetState() == GameState.Live;
|
return GetState() == GameState.Prepare || GetState() == GameState.Live;
|
||||||
@ -1587,7 +1592,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void HelpUpdate(UpdateEvent event)
|
public void HelpUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (_help == null || _help.length == 0 || event.getType() != UpdateType.SLOWER || GetState() != GameState.Recruit)
|
if (_help == null || _help.length == 0 || event.getType() != UpdateType.SLOWER || !inLobby())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1791,17 +1796,17 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
|||||||
Manager.GetGameCreationManager().setNextGameType(gameType);
|
Manager.GetGameCreationManager().setNextGameType(gameType);
|
||||||
|
|
||||||
// End Current
|
// End Current
|
||||||
if (GetState() == GameState.Recruit)
|
if (InProgress())
|
||||||
{
|
{
|
||||||
SetState(GameState.Dead);
|
SetState(GameState.Dead);
|
||||||
|
|
||||||
if (inform)
|
if (inform)
|
||||||
Announce(C.cAqua + C.Bold + caller.getName() + " has changed game to " + gameType.getName() + ".");
|
Announce(C.cAquaB + caller.getName() + " has changed game to " + gameType.getName() + ".");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (inform)
|
if (inform)
|
||||||
Announce(C.cAqua + C.Bold + caller.getName() + " set next game to " + gameType.getName() + ".");
|
Announce(C.cAquaB + caller.getName() + " set next game to " + gameType.getName() + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1094,10 +1094,7 @@ public class Minestrike extends TeamGame
|
|||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void specToTeam(PlayerJoinEvent event)
|
public void specToTeam(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
if (GetState() == GameState.Recruit || GetState() == GameState.Loading)
|
if (inLobby() || Manager.isVanished(event.getPlayer()))
|
||||||
return;
|
|
||||||
|
|
||||||
if (Manager.isVanished(event.getPlayer()))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -78,9 +78,8 @@ public class CustomScoreboardModule extends Module
|
|||||||
public void playerJoin(PlayerJoinEvent event)
|
public void playerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
GameState state = getGame().GetState();
|
|
||||||
|
|
||||||
if (state == GameState.Loading || state == GameState.Recruit)
|
if (getGame().inLobby())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import mineplex.core.common.Pair;
|
|||||||
import mineplex.core.common.timing.TimingManager;
|
import mineplex.core.common.timing.TimingManager;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -28,6 +29,7 @@ import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
|
|||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
import nautilus.game.arcade.GameMode;
|
import nautilus.game.arcade.GameMode;
|
||||||
import nautilus.game.arcade.GameType;
|
import nautilus.game.arcade.GameType;
|
||||||
|
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import nautilus.game.arcade.game.Game.GameState;
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
import nautilus.game.arcade.managers.voting.Vote;
|
import nautilus.game.arcade.managers.voting.Vote;
|
||||||
@ -93,7 +95,7 @@ public class GameCreationManager implements Listener
|
|||||||
_ended.add(Manager.GetGame());
|
_ended.add(Manager.GetGame());
|
||||||
|
|
||||||
//Lobby Display
|
//Lobby Display
|
||||||
Manager.GetLobby().DisplayLast(Manager.GetGame());
|
Manager.GetLobby().displayLast(Manager.GetGame());
|
||||||
|
|
||||||
Manager.SetGame(null);
|
Manager.SetGame(null);
|
||||||
}
|
}
|
||||||
@ -285,11 +287,11 @@ public class GameCreationManager implements Listener
|
|||||||
|
|
||||||
ModePref = null;
|
ModePref = null;
|
||||||
|
|
||||||
|
// No map voting, load the maps now
|
||||||
|
boolean loadMapsNow = !Manager.GetServerConfig().MapVoting;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// No map voting, load the maps now
|
|
||||||
boolean loadMapsNow = !Manager.GetServerConfig().MapVoting;
|
|
||||||
|
|
||||||
if (loadMapsNow)
|
if (loadMapsNow)
|
||||||
{
|
{
|
||||||
loadMaps(gameType);
|
loadMaps(gameType);
|
||||||
@ -327,20 +329,25 @@ public class GameCreationManager implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimingManager.start("DisplayNext");
|
|
||||||
Manager.GetLobby().DisplayNext(Manager.GetGame());
|
|
||||||
TimingManager.stop("DisplayNext");
|
|
||||||
|
|
||||||
TimingManager.start("registerEvents");
|
TimingManager.start("registerEvents");
|
||||||
Manager.GetGame().getLifetime().start(GameState.Loading);
|
Manager.GetGame().getLifetime().start(GameState.PreLoad);
|
||||||
|
// Need to manually call the the event
|
||||||
|
UtilServer.CallEvent(new GameStateChangeEvent(Manager.GetGame(), GameState.PreLoad));
|
||||||
TimingManager.stop("registerEvents");
|
TimingManager.stop("registerEvents");
|
||||||
|
|
||||||
|
Manager.GetLobby().displayNext(Manager.GetGame());
|
||||||
|
|
||||||
|
if (loadMapsNow)
|
||||||
|
{
|
||||||
|
Manager.GetGame().SetState(GameState.Loading);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkMapVoting()
|
private void checkMapVoting()
|
||||||
{
|
{
|
||||||
Game game = Manager.GetGame();
|
Game game = Manager.GetGame();
|
||||||
|
|
||||||
if (game == null || MapPref != null || !Manager.GetServerConfig().MapVoting || Manager.GetServerConfig().GameVoting)
|
if (game == null || game.GetState() != GameState.PreLoad || MapPref != null || !Manager.GetServerConfig().MapVoting || Manager.GetServerConfig().GameVoting)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -349,6 +356,7 @@ public class GameCreationManager implements Listener
|
|||||||
{
|
{
|
||||||
MapPref = _votingManager.getFinishedVote().getWinner().getName();
|
MapPref = _votingManager.getFinishedVote().getWinner().getName();
|
||||||
_votingManager.deactivate();
|
_votingManager.deactivate();
|
||||||
|
game.SetState(GameState.Loading);
|
||||||
|
|
||||||
// Load maps for the running game
|
// Load maps for the running game
|
||||||
loadMaps(game.GetType());
|
loadMaps(game.GetType());
|
||||||
|
@ -917,7 +917,7 @@ public class GameFlagManager implements Listener
|
|||||||
//Not Playing
|
//Not Playing
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
if (game == null || game.GetState() == GameState.Recruit || (!game.IsAlive(player) && game.shouldHeal(player)))
|
if (game == null || game.inLobby() || (!game.IsAlive(player) && game.shouldHeal(player)))
|
||||||
{
|
{
|
||||||
player.setMaxHealth(20);
|
player.setMaxHealth(20);
|
||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
|
@ -461,8 +461,10 @@ public class GameManager implements Listener
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void restartServerCheck(RestartTriggerEvent event)
|
public void restartServerCheck(RestartTriggerEvent event)
|
||||||
{
|
{
|
||||||
if (Manager.GetGame() != null && Manager.GetGame().GetState() != GameState.Recruit && event.getReason() == RestartTriggerEvent.RestartReason.UPDATE)
|
if (Manager.GetGame() != null && !Manager.GetGame().inLobby() && event.getReason() == RestartTriggerEvent.RestartReason.UPDATE)
|
||||||
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -663,7 +665,7 @@ public class GameManager implements Listener
|
|||||||
Game game = Manager.GetGame();
|
Game game = Manager.GetGame();
|
||||||
if (game == null) return;
|
if (game == null) return;
|
||||||
|
|
||||||
if (game.GetCountdown() > 0 || game.GetState() != GameState.Recruit)
|
if (game.GetCountdown() > 0 || !game.inLobby())
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Carl", "You can't use my spinner at the moment!"));
|
UtilPlayer.message(event.getPlayer(), F.main("Carl", "You can't use my spinner at the moment!"));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -68,7 +68,7 @@ public class HubClockManager implements Listener
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void giveOnNextLobby(GameStateChangeEvent event)
|
public void giveOnNextLobby(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetState() != GameState.Recruit && event.GetState() != GameState.Dead || !canGiveClock())
|
if (!canGiveClock())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -141,6 +141,6 @@ public class HubClockManager implements Listener
|
|||||||
|
|
||||||
private boolean canGiveClock()
|
private boolean canGiveClock()
|
||||||
{
|
{
|
||||||
return _manager.GetGame() == null || _manager.GetGame().GetState() == GameState.Recruit || _manager.GetGame().GiveClock;
|
return _manager.GetGame() == null || _manager.GetGame().inLobby() || _manager.GetGame().GiveClock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ public class IdleManager implements Listener
|
|||||||
{
|
{
|
||||||
if (UtilTime.elapsed(_idle.get(player.getUniqueId()), _arcadeManager.GetGame().IsLive() ? 240000 : 120000))
|
if (UtilTime.elapsed(_idle.get(player.getUniqueId()), _arcadeManager.GetGame().IsLive() ? 240000 : 120000))
|
||||||
{
|
{
|
||||||
if (_arcadeManager.GetGame().GetState() != GameState.Recruit && !_arcadeManager.GetGame().IsAlive(player))
|
if (!_arcadeManager.GetGame().inLobby() && !_arcadeManager.GetGame().IsAlive(player))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (_arcadeManager.GetClients().Get(player).hasPermission(Perm.BYPASS_KICK))
|
if (_arcadeManager.GetClients().Get(player).hasPermission(Perm.BYPASS_KICK))
|
||||||
|
@ -113,7 +113,7 @@ public class ServerUptimeManager implements Listener
|
|||||||
if (Manager.GetGame() == null)
|
if (Manager.GetGame() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Manager.GetGame().GetState() != GameState.Recruit)
|
if (!Manager.GetGame().inLobby())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!UtilTime.elapsed(Manager.GetGame().GetStateTime(), SHUTDOWN_DELAY)
|
if (!UtilTime.elapsed(Manager.GetGame().GetStateTime(), SHUTDOWN_DELAY)
|
||||||
|
@ -326,7 +326,7 @@ public class GameChatManager implements Listener
|
|||||||
|
|
||||||
private JsonMessage buildJSON(Player player, String prefix, String rankStr, PermissionGroup group, String name, LinkedList<ChatStatData> hoverText, String message)
|
private JsonMessage buildJSON(Player player, String prefix, String rankStr, PermissionGroup group, String name, LinkedList<ChatStatData> hoverText, String message)
|
||||||
{
|
{
|
||||||
if (_manager.GetGame() == null || _manager.GetGame().GetState() == GameState.Recruit)
|
if (_manager.GetGame() == null || _manager.GetGame().inLobby())
|
||||||
{
|
{
|
||||||
if (group.getDisplay(false, false, false, false).isEmpty())
|
if (group.getDisplay(false, false, false, false).isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,7 @@ import com.google.common.collect.Maps;
|
|||||||
|
|
||||||
import mineplex.core.PlayerSelector;
|
import mineplex.core.PlayerSelector;
|
||||||
import mineplex.core.account.permissions.PermissionGroup;
|
import mineplex.core.account.permissions.PermissionGroup;
|
||||||
|
import mineplex.core.common.timing.TimingManager;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilBlockText;
|
import mineplex.core.common.util.UtilBlockText;
|
||||||
import mineplex.core.common.util.UtilBlockText.TextAlign;
|
import mineplex.core.common.util.UtilBlockText.TextAlign;
|
||||||
@ -191,17 +192,7 @@ public abstract class LobbyManager implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.GetGame().GetMode() == null)
|
writeGameLine(event.GetGame().WorldData.MapName, event.GetGame().GetMode() == null ? 1 : 2, 159, (byte) 4);
|
||||||
{
|
|
||||||
writeGameLine(event.GetGame().WorldData.MapName, 1, 159, (byte) 4);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
writeGameLine(event.GetGame().WorldData.MapName, 2, 159, (byte) 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
writeTeamLine("Select", 0, 159, (byte) 15);
|
|
||||||
writeTeamLine("Team", 1, 159, (byte) 4);
|
|
||||||
|
|
||||||
//Remove Old Ents
|
//Remove Old Ents
|
||||||
getTeams().keySet().forEach(Entity::remove);
|
getTeams().keySet().forEach(Entity::remove);
|
||||||
@ -211,15 +202,8 @@ public abstract class LobbyManager implements Listener
|
|||||||
getTeamBlocks().forEach(Block::setType);
|
getTeamBlocks().forEach(Block::setType);
|
||||||
getTeamBlocks().clear();
|
getTeamBlocks().clear();
|
||||||
|
|
||||||
//Smash
|
|
||||||
if (event.GetGame().HideTeamSheep)
|
if (event.GetGame().HideTeamSheep)
|
||||||
{
|
{
|
||||||
if (event.GetGame().ReplaceTeamsWithKits)
|
|
||||||
{
|
|
||||||
//Text
|
|
||||||
writeTeamLine("Select", 0, 159, (byte) 15);
|
|
||||||
writeTeamLine("Kit", 1, 159, (byte) 4);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +222,7 @@ public abstract class LobbyManager implements Listener
|
|||||||
UpdateFirework();
|
UpdateFirework();
|
||||||
// TODO TEMPORARY INCREASE 100 -> 200. ALLOW CUSTOM BORDERS WHEN IF REWRITTEN
|
// TODO TEMPORARY INCREASE 100 -> 200. ALLOW CUSTOM BORDERS WHEN IF REWRITTEN
|
||||||
PlayerSelector.selectPlayers(UtilLambda.and(PlayerSelector.inWorld(WORLD), UtilLambda.not(PlayerSelector.within(getSpawn(), 200))))
|
PlayerSelector.selectPlayers(UtilLambda.and(PlayerSelector.inWorld(WORLD), UtilLambda.not(PlayerSelector.within(getSpawn(), 200))))
|
||||||
.forEach(player -> player.teleport(getSpawn()));
|
.forEach(player -> player.teleport(getSpawn()));
|
||||||
}
|
}
|
||||||
else if (event.getType() == UpdateType.SLOW)
|
else if (event.getType() == UpdateType.SLOW)
|
||||||
{
|
{
|
||||||
@ -288,7 +272,7 @@ public abstract class LobbyManager implements Listener
|
|||||||
|
|
||||||
private void UpdateAdvertise()
|
private void UpdateAdvertise()
|
||||||
{
|
{
|
||||||
if (_manager.GetGame() == null || _manager.GetGame().GetState() != GameState.Recruit)
|
if (_manager.GetGame() == null || !_manager.GetGame().inLobby())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -369,7 +353,7 @@ public abstract class LobbyManager implements Listener
|
|||||||
UtilFirework.playFirework(getSpawn().clone().add(Math.random() * 160 - 80, 30 + Math.random() * 10, Math.random() * 160 - 80), Type.BALL_LARGE, _fireworkColor, false, false);
|
UtilFirework.playFirework(getSpawn().clone().add(Math.random() * 160 - 80, 30 + Math.random() * 10, Math.random() * 160 - 80), Type.BALL_LARGE, _fireworkColor, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayLast(Game game)
|
public void displayLast(Game game)
|
||||||
{
|
{
|
||||||
//Start Fireworks
|
//Start Fireworks
|
||||||
RegisterFireworks(game.WinnerTeam);
|
RegisterFireworks(game.WinnerTeam);
|
||||||
@ -389,57 +373,59 @@ public abstract class LobbyManager implements Listener
|
|||||||
getTeamBlocks().clear();
|
getTeamBlocks().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisplayNext(Game game)
|
public void displayNext(Game game)
|
||||||
|
{
|
||||||
|
TimingManager.start("displayNext");
|
||||||
|
|
||||||
|
displayGame(game);
|
||||||
|
displayWaiting(false);
|
||||||
|
displayKitTeamText(game);
|
||||||
|
|
||||||
|
UtilServer.getPlayersCollection().forEach(this::equipActiveKit);
|
||||||
|
createKits(game);
|
||||||
|
|
||||||
|
TimingManager.stop("displayNext");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void displayGame(Game game)
|
||||||
{
|
{
|
||||||
writeGameLine(game.GetType().GetLobbyName(), 0, 159, (byte) 14);
|
writeGameLine(game.GetType().GetLobbyName(), 0, 159, (byte) 14);
|
||||||
|
|
||||||
if (_manager.GetGame().GetMode() == null)
|
if (game.GetMode() == null)
|
||||||
{
|
{
|
||||||
writeGameLine("", 1, Material.AIR.getId(), (byte) 0);
|
writeGameLine("", 1, Material.AIR.getId(), (byte) 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writeGameLine(_manager.GetGame().GetMode(), 1, 159, (byte) 1);
|
writeGameLine(game.GetMode(), 1, 159, (byte) 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UtilServer.getPlayersCollection().forEach(this::equipActiveKit);
|
public void displayKitTeamText(Game game)
|
||||||
|
{
|
||||||
displayWaiting(false);
|
|
||||||
createKits(game);
|
|
||||||
|
|
||||||
writeTeamLine("Select", 0, 159, (byte) 15);
|
|
||||||
writeTeamLine("Team", 1, 159, (byte) 4);
|
|
||||||
|
|
||||||
writeKitLine("Select", 0, 159, (byte) 15);
|
writeKitLine("Select", 0, 159, (byte) 15);
|
||||||
writeKitLine("Kit", 1, 159, (byte) 4);
|
writeKitLine("Kit", 1, 159, (byte) 4);
|
||||||
|
|
||||||
//Smash
|
|
||||||
if (game.HideTeamSheep)
|
if (game.HideTeamSheep)
|
||||||
{
|
{
|
||||||
if (game.ReplaceTeamsWithKits)
|
if (game.ReplaceTeamsWithKits)
|
||||||
{
|
{
|
||||||
//Text
|
|
||||||
writeTeamLine("Select", 0, 159, (byte) 15);
|
writeTeamLine("Select", 0, 159, (byte) 15);
|
||||||
writeTeamLine("Kit", 1, 159, (byte) 4);
|
writeTeamLine("Kit", 1, 159, (byte) 4);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
createTeams(game);
|
{
|
||||||
|
writeTeamLine("Select", 0, 159, (byte) 15);
|
||||||
|
writeTeamLine("Team", 1, 159, (byte) 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayWaiting(boolean forVote)
|
public void displayWaiting(boolean forVote)
|
||||||
{
|
{
|
||||||
if (forVote)
|
if (forVote)
|
||||||
{
|
{
|
||||||
int i = 0;
|
for (int i = 1; i < 3; i++)
|
||||||
|
|
||||||
if (_manager.GetServerConfig().MapVoting)
|
|
||||||
{
|
|
||||||
writeGameLine(_manager.GetServerConfig().GameList.get(0).getName(), i++, Material.STAINED_CLAY.getId(), (byte) 14);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; i < 3; i++)
|
|
||||||
{
|
{
|
||||||
writeGameLine("", i, Material.AIR.getId(), (byte) 0);
|
writeGameLine("", i, Material.AIR.getId(), (byte) 0);
|
||||||
}
|
}
|
||||||
@ -470,15 +456,18 @@ public abstract class LobbyManager implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
Game game = _manager.GetGame();
|
Game game = _manager.GetGame();
|
||||||
if (game != null && game.GetState() != GameState.Loading && game.GetState() != GameState.Recruit)
|
|
||||||
|
if (game != null && !game.inLobby())
|
||||||
{
|
{
|
||||||
if (game.UseCustomScoreboard)
|
if (game.UseCustomScoreboard)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayersCollection())
|
||||||
|
{
|
||||||
player.setScoreboard(_manager.GetGame().GetScoreboard().getScoreboard()); //XXX
|
player.setScoreboard(_manager.GetGame().GetScoreboard().getScoreboard()); //XXX
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -570,7 +559,7 @@ public abstract class LobbyManager implements Listener
|
|||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
boolean rankIsUltra = group == PermissionGroup.PLAYER &&
|
boolean rankIsUltra = group == PermissionGroup.PLAYER &&
|
||||||
_manager.GetDonation().Get(player).ownsUnknownSalesPackage(_manager.GetServerConfig().ServerType + " ULTRA");
|
_manager.GetDonation().Get(player).ownsUnknownSalesPackage(_manager.GetServerConfig().ServerType + " ULTRA");
|
||||||
|
|
||||||
if (rankIsUltra)
|
if (rankIsUltra)
|
||||||
{
|
{
|
||||||
@ -601,12 +590,7 @@ public abstract class LobbyManager implements Listener
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void disallowInventoryClick(InventoryClickEvent event)
|
public void disallowInventoryClick(InventoryClickEvent event)
|
||||||
{
|
{
|
||||||
if (_manager.GetGame() == null)
|
if (_manager.GetGame() == null || !_manager.GetGame().inLobby())
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_manager.GetGame().GetState() != GameState.Recruit)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -628,7 +612,7 @@ public abstract class LobbyManager implements Listener
|
|||||||
|
|
||||||
Game game = _manager.GetGame();
|
Game game = _manager.GetGame();
|
||||||
|
|
||||||
if (game != null && game.GetState() != GameState.Recruit && game.GadgetsDisabled)
|
if (game != null && !game.inLobby() && game.GadgetsDisabled)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -749,7 +733,7 @@ public abstract class LobbyManager implements Listener
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInteractArmorStand(PlayerArmorStandManipulateEvent event)
|
public void onInteractArmorStand(PlayerArmorStandManipulateEvent event)
|
||||||
{
|
{
|
||||||
if (_manager.GetGame() == null || _manager.GetGame().GetState() == GameState.Recruit)
|
if (_manager.GetGame() == null || !_manager.GetGame().inLobby())
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -863,7 +847,7 @@ public abstract class LobbyManager implements Listener
|
|||||||
public boolean isNearSpawn(Location location, int distance)
|
public boolean isNearSpawn(Location location, int distance)
|
||||||
{
|
{
|
||||||
// offsetSquared should be compared to squared distance, obviously...
|
// offsetSquared should be compared to squared distance, obviously...
|
||||||
return UtilMath.offsetSquared(_spawn, location) < distance*distance;
|
return UtilMath.offsetSquared(_spawn, location) < distance * distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNearSpawn(Location location)
|
public boolean isNearSpawn(Location location)
|
||||||
|
@ -119,6 +119,9 @@ public class VotingManager extends ListenerComponent implements Lifetimed
|
|||||||
UtilPlayer.closeInventoryIfOpen(player);
|
UtilPlayer.closeInventoryIfOpen(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_manager.GetLobby().displayGame(_manager.GetGame());
|
||||||
|
_manager.GetLobby().displayWaiting(false);
|
||||||
|
|
||||||
_currentVote.onEnd();
|
_currentVote.onEnd();
|
||||||
|
|
||||||
_currentVote = null;
|
_currentVote = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user