Fixes an issue where if a user did /spec pre-game they would not be
given a Spell-Book in game.
This commit is contained in:
Sam 2016-05-31 20:04:03 +01:00
parent d98afaf829
commit 6b70292837

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.wizards;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
@ -74,14 +75,24 @@ public class WizardSpellMenu extends MiniPlugin
}
@EventHandler
public void onJoin(GameStateChangeEvent event)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Recruit)
{
for (Player player : Bukkit.getOnlinePlayers())
for (Player player : UtilServer.GetPlayers())
{
player.getInventory().setItem(0, _wizardSpells);
}
}
else if(event.GetState() == GameState.Prepare)
{
for(Player player : UtilServer.GetPlayers())
{
if (!_wizards.IsAlive(player))
{
player.getInventory().setItem(0, _wizardSpells);
}
}
}
}