use of au.com.mineauz.minigames.commands.JoinCommand in project Minigames by AddstarMC.
the class EventsTest method onPlayerDisconnect.
public void onPlayerDisconnect() {
PlayerMock mock = server.addPlayer();
mock.setLocation(server.getWorld("GAMES").getSpawnLocation());
PlayerJoinEvent event = new PlayerJoinEvent(mock, "Joined the Server");
server.getPluginManager().callEvent(event);
MinigamePlayer player = plugin.getPlayerManager().getMinigamePlayer(mock);
JoinCommand command = new JoinCommand();
String[] args = { game.getName(false) };
command.onCommand(mock, game, "", args);
assertTrue(player.isInMinigame());
PlayerQuitEvent event2 = new PlayerQuitEvent(mock, "has left the game");
server.getPluginManager().callEvent(event2);
assertFalse(player.isInMinigame());
assertFalse(plugin.getPlayerManager().hasMinigamePlayer(player.getUUID()));
}
Aggregations