Don't add rejoin data if the player moves to the hub

This commit is contained in:
Sam 2018-08-05 21:40:49 +01:00 committed by Alexander Meech
parent f93d873ad5
commit 6ae95648c7

View File

@ -18,6 +18,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilServer;
import mineplex.core.game.rejoin.GameRejoinManager;
import mineplex.core.portal.events.ServerTransferEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.GameTeam;
@ -64,6 +65,7 @@ public class RejoinModule extends Module
{
getGame().QuitOut = true;
_rejoinData.clear();
_manager.searchToRejoin();
}
@EventHandler
@ -77,6 +79,17 @@ public class RejoinModule extends Module
_disallow.add(event.getPlayer());
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void playerTransfer(ServerTransferEvent event)
{
if (!isEnabled())
{
return;
}
_disallow.add(event.getPlayer());
}
@EventHandler(priority = EventPriority.LOW)
public void playerQuit(PlayerQuitEvent event)
{
@ -86,9 +99,15 @@ public class RejoinModule extends Module
}
Player player = event.getPlayer();
if (_disallow.remove(player) || player.isDead() || !player.getWorld().equals(getGame().WorldData.World))
{
return;
}
GameTeam team = getGame().GetTeam(player);
if (team == null || !team.IsAlive(player) || getGame().QuitOut || player.isDead() || _disallow.remove(player) || !player.getWorld().equals(getGame().WorldData.World))
if (team == null || !team.IsAlive(player))
{
return;
}
@ -181,7 +200,7 @@ public class RejoinModule extends Module
private boolean isEnabled()
{
return !getGame().getArcadeManager().GetGameHostManager().isPrivateServer() && getGame().InProgress();
return !getGame().getArcadeManager().GetGameHostManager().isPrivateServer() && getGame().InProgress() && !getGame().QuitOut;
}
public class PlayerGameInfo