Fix issues that came up in testing

This commit is contained in:
Sam 2018-08-02 16:20:29 +01:00 committed by Alexander Meech
parent d766c7d1eb
commit 2b99495e7b
10 changed files with 51 additions and 32 deletions

View File

@ -17,7 +17,6 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.game.GameDisplay; import mineplex.core.game.GameDisplay;
import mineplex.serverdata.Region;
import mineplex.serverdata.redis.RedisDataRepository; import mineplex.serverdata.redis.RedisDataRepository;
public class GameRejoinManager implements Listener public class GameRejoinManager implements Listener
@ -33,7 +32,7 @@ public class GameRejoinManager implements Listener
{ {
_parent = parent; _parent = parent;
_clientManager = Managers.require(CoreClientManager.class); _clientManager = Managers.require(CoreClientManager.class);
_repository = new RedisDataRepository<>(Region.ALL, GameRejoinData.class, "gameRejoin"); _repository = new RedisDataRepository<>(UtilServer.getRegion(), GameRejoinData.class, "gameRejoin");
} }
public void searchToRejoin() public void searchToRejoin()

View File

@ -62,6 +62,7 @@ import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetSelectLocationEvent; import mineplex.core.gadget.event.GadgetSelectLocationEvent;
import mineplex.core.game.rejoin.GameRejoinManager;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.incognito.events.IncognitoHidePlayerEvent; import mineplex.core.incognito.events.IncognitoHidePlayerEvent;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
@ -244,6 +245,9 @@ public class HubManager extends MiniClientPlugin<HubClient> implements IChatMess
require(SecretAreas.class); require(SecretAreas.class);
// require(TreasureHuntManager.class); // require(TreasureHuntManager.class);
new GameRejoinManager(this)
.searchToRejoin();
_parkourManager = require(ParkourManager.class); _parkourManager = require(ParkourManager.class);
_jumpManager = new JumpManager(this); _jumpManager = new JumpManager(this);

View File

@ -33,6 +33,7 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.incognito.events.IncognitoStatusChangeEvent;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -323,10 +324,32 @@ public class CombatManager extends MiniClientPlugin<ClientCombat>
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void playerQuit(PlayerQuitEvent event) public void playerQuit(PlayerQuitEvent event)
{ {
Player player = event.getPlayer(); fakeDeath(event.getPlayer());
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void vanishStatus(IncognitoStatusChangeEvent event)
{
if (!event.getNewState())
{
return;
}
fakeDeath(event.getPlayer());
}
private void fakeDeath(Player player)
{
CombatLog log = _active.get(player.getUniqueId()); CombatLog log = _active.get(player.getUniqueId());
if (log == null || log.GetAttackers().isEmpty()) if (log == null)
{
return;
}
log.ExpireOld();
if (log.GetAttackers().isEmpty())
{ {
return; return;
} }
@ -360,7 +383,8 @@ public class CombatManager extends MiniClientPlugin<ClientCombat>
log.ExpireOld(); log.ExpireOld();
// Save Death // Save Death
Get(event.getEntity().getUniqueId()).GetDeaths().addFirst(log); ClientCombat client = Get(event.getEntity());
client.GetDeaths().addFirst(log);
// Add Kill/Assist // Add Kill/Assist
int assists = 0; int assists = 0;
@ -400,7 +424,7 @@ public class CombatManager extends MiniClientPlugin<ClientCombat>
log.SetAssists(assists); log.SetAssists(assists);
// Event // Event
CombatDeathEvent combatEvent = new CombatDeathEvent(event, Get(event.getEntity().getUniqueId()), log, "killed"); CombatDeathEvent combatEvent = new CombatDeathEvent(event, client, log, "killed");
UtilServer.CallEvent(combatEvent); UtilServer.CallEvent(combatEvent);
DeathMessageType messageType = combatEvent.GetBroadcastType(); DeathMessageType messageType = combatEvent.GetBroadcastType();

View File

@ -400,9 +400,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
Bukkit.getScheduler().runTaskLater(plugin, () -> Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName()), 80L); Bukkit.getScheduler().runTaskLater(plugin, () -> Portal.transferPlayer(GetHost(), _serverStatusManager.getCurrentServerName()), 80L);
} }
Region region = new File("eu.dat").exists() ? Region.EU : Region.US; _nextBestGameManager = new NextBestGameManager(serverConfig.ServerGroup, UtilServer.getRegion(), _partyManager);
_nextBestGameManager = new NextBestGameManager(serverConfig.ServerGroup, region, _partyManager);
addCommand(new GoToNextGameCommand(this)); addCommand(new GoToNextGameCommand(this));
addCommand(new CancelNextGameCommand(this)); addCommand(new CancelNextGameCommand(this));

View File

@ -1074,22 +1074,23 @@ public abstract class Game extends ListenerComponent implements Lifetimed
public void SetKit(Player player, Kit kit, boolean announce, boolean apply) public void SetKit(Player player, Kit kit, boolean announce, boolean apply)
{ {
GameTeam team = GetTeam(player); GameTeam team = GetTeam(player);
if (team != null)
if (team != null && !team.KitAllowed(kit))
{ {
if (!team.KitAllowed(kit)) if (announce)
{ {
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f);
UtilPlayer.message( player.sendMessage(F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") + "."));
player,
F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit")
+ "."));
return;
}
} }
if (_playerKit.get(player) != null) return;
}
Kit oldKit = GetKit(player);
if (oldKit != null)
{ {
_playerKit.get(player).Deselected(player); oldKit.Deselected(player);
} }
_playerKit.put(player, kit); _playerKit.put(player, kit);

View File

@ -146,7 +146,6 @@ public class CakeTeamModule extends CakeModule
@EventHandler @EventHandler
public void playerRejoin(PlayerRejoinGameEvent event) public void playerRejoin(PlayerRejoinGameEvent event)
{ {
Player player = event.getPlayer();
CakeTeam cakeTeam = getCakeTeam(event.getPlayerGameInfo().getTeam()); CakeTeam cakeTeam = getCakeTeam(event.getPlayerGameInfo().getTeam());
if (cakeTeam == null || !cakeTeam.canRespawn()) if (cakeTeam == null || !cakeTeam.canRespawn())

View File

@ -42,6 +42,7 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
@ -56,7 +57,6 @@ import nautilus.game.arcade.game.games.common.dominate_data.PlayerData;
import nautilus.game.arcade.game.games.common.dominate_data.Resupply; import nautilus.game.arcade.game.games.common.dominate_data.Resupply;
import nautilus.game.arcade.game.modules.SpawnRegenerationModule; import nautilus.game.arcade.game.modules.SpawnRegenerationModule;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.game.modules.rejoin.RejoinModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
public class CaptureTheFlag extends TeamGame public class CaptureTheFlag extends TeamGame
@ -107,9 +107,6 @@ public class CaptureTheFlag extends TeamGame
this.HungerSet = 20; this.HungerSet = 20;
this.WorldTimeSet = 2000; this.WorldTimeSet = 2000;
new RejoinModule(manager)
.register(this);
new CompassModule() new CompassModule()
.setGiveCompass(true) .setGiveCompass(true)
.setGiveCompassToSpecs(true) .setGiveCompassToSpecs(true)

View File

@ -45,7 +45,6 @@ import nautilus.game.arcade.game.games.common.dominate_data.PlayerData;
import nautilus.game.arcade.game.games.common.dominate_data.Resupply; import nautilus.game.arcade.game.games.common.dominate_data.Resupply;
import nautilus.game.arcade.game.modules.SpawnRegenerationModule; import nautilus.game.arcade.game.modules.SpawnRegenerationModule;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.game.modules.rejoin.RejoinModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
public class Domination extends TeamGame public class Domination extends TeamGame
@ -86,9 +85,6 @@ public class Domination extends TeamGame
this.DeathSpectateSecs = 10; this.DeathSpectateSecs = 10;
new RejoinModule(manager)
.register(this);
new CompassModule() new CompassModule()
.setGiveCompass(true) .setGiveCompass(true)
.setGiveCompassToSpecs(true) .setGiveCompassToSpecs(true)

View File

@ -18,7 +18,7 @@ import nautilus.game.arcade.kit.perks.data.MeteorShowerData;
public class SmashMagmacube extends SmashUltimate public class SmashMagmacube extends SmashUltimate
{ {
private List<MeteorShowerData> _meteors = new ArrayList<>(); private final List<MeteorShowerData> _meteors = new ArrayList<>();
public SmashMagmacube() public SmashMagmacube()
{ {
@ -28,6 +28,8 @@ public class SmashMagmacube extends SmashUltimate
@Override @Override
public void activate(Player player) public void activate(Player player)
{ {
super.activate(player);
_meteors.add(new MeteorShowerData(player, UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 128).getLocation(), getLength())); _meteors.add(new MeteorShowerData(player, UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 128).getLocation(), getLength()));
} }

View File

@ -33,8 +33,6 @@ public class RejoinModule extends Module
{ {
_manager = new GameRejoinManager(manager); _manager = new GameRejoinManager(manager);
_rejoinData = new HashMap<>(); _rejoinData = new HashMap<>();
_manager.searchToRejoin();
} }
@Override @Override
@ -118,7 +116,7 @@ public class RejoinModule extends Module
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerGameInfo info = _rejoinData.get(player.getUniqueId()); PlayerGameInfo info = _rejoinData.get(player.getUniqueId());
if (info == null) if (info == null || getGame().getArcadeManager().isVanished(player))
{ {
return; return;
} }
@ -149,7 +147,7 @@ public class RejoinModule extends Module
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerGameInfo info = _rejoinData.remove(player.getUniqueId()); PlayerGameInfo info = _rejoinData.remove(player.getUniqueId());
if (info == null || info.isCancelled()) if (info == null || info.isCancelled() || getGame().getArcadeManager().isVanished(player))
{ {
return; return;
} }
@ -157,6 +155,7 @@ public class RejoinModule extends Module
if (info.getKit() != null) if (info.getKit() != null)
{ {
getGame().SetKit(player, info.getKit(), false); getGame().SetKit(player, info.getKit(), false);
getGame().ValidateKit(player, info.getTeam());
} }
player.setHealth(Math.min(info.getHealth(), player.getHealth())); player.setHealth(Math.min(info.getHealth(), player.getHealth()));