Rewrite of how /vanish is handled in game servers (PC-Bug-413)
Fixes all /vanish based issues where players would be not correctly handled while toggling /vanish in game servers.
This commit is contained in:
parent
ee10751e23
commit
1ff06adf18
@ -82,6 +82,7 @@ import nautilus.game.arcade.command.WriteCommand;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.GameServerConfig;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.event.EventModule;
|
||||
@ -626,60 +627,58 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
@EventHandler
|
||||
public void StaffIncognito(IncognitoStatusChangeEvent event)
|
||||
{
|
||||
if (event.getNewState() && _game != null && _game.IsPlaying(event.getPlayer()) && _game.IsLive())
|
||||
{
|
||||
addSpectator(event.getPlayer(), true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getNewState())
|
||||
{
|
||||
if(event.getNewState()) //Is going into incognito
|
||||
{
|
||||
UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName()));
|
||||
|
||||
if(_game.GetCountdown() > 0) //Lobby is counting down
|
||||
{
|
||||
// Clean
|
||||
if (_game != null)
|
||||
{
|
||||
// Remove Data
|
||||
_game.RemoveTeamPreference(event.getPlayer());
|
||||
_game.GetPlayerKits().remove(event.getPlayer());
|
||||
_game.GetPlayerGems().remove(event.getPlayer());
|
||||
|
||||
if (_game == null || _game.GetState() != GameState.Live)
|
||||
// Leave Team
|
||||
GameTeam team = _game.GetTeam(event.getPlayer());
|
||||
|
||||
if (team != null)
|
||||
{
|
||||
team.RemovePlayer(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(_game.GetState() != GameState.Recruit) //Game is NOT in lobby
|
||||
{
|
||||
addSpectator(event.getPlayer(), true);
|
||||
_specList.add(event.getPlayer());
|
||||
if(_game.GetTeam(event.getPlayer()) != null)
|
||||
_game.GetTeam(event.getPlayer()).SetPlayerState(event.getPlayer(), PlayerState.OUT);
|
||||
}
|
||||
else //Game is in lobby
|
||||
{
|
||||
_specList.add(event.getPlayer());
|
||||
}
|
||||
}
|
||||
else
|
||||
else //Is coming out of incognito
|
||||
{
|
||||
UtilServer.broadcast(F.sys("Join", event.getPlayer().getName()));
|
||||
|
||||
if(!_game.IsLive())
|
||||
{
|
||||
_specList.remove(event.getPlayer());
|
||||
if(_game.GetTeam(event.getPlayer()) != null)
|
||||
_game.GetTeam(event.getPlayer()).SetPlayerState(event.getPlayer(), PlayerState.IN);
|
||||
}
|
||||
|
||||
if (_game != null && isSpectator(event.getPlayer()))
|
||||
{
|
||||
if (_game.GetState() != GameState.Live)
|
||||
{
|
||||
_specList.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
event.show(false);
|
||||
}
|
||||
}
|
||||
if (_game.GetCountdown() > 0 && event.getNewState())
|
||||
{
|
||||
// Clean
|
||||
if (_game != null)
|
||||
{
|
||||
// Remove Data
|
||||
_game.RemoveTeamPreference(event.getPlayer());
|
||||
_game.GetPlayerKits().remove(event.getPlayer());
|
||||
_game.GetPlayerGems().remove(event.getPlayer());
|
||||
|
||||
// Leave Team
|
||||
GameTeam team = _game.GetTeam(event.getPlayer());
|
||||
|
||||
if (team != null)
|
||||
{
|
||||
team.RemovePlayer(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(_game.IsLive() && event.getNewState()))
|
||||
{
|
||||
_specList.remove(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
Loading…
Reference in New Issue
Block a user