Search in sources :

Example 1 with JoinCommand

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()));
}
Also used : PlayerMock(be.seeseemelk.mockbukkit.entity.PlayerMock) MinigamePlayer(au.com.mineauz.minigames.objects.MinigamePlayer) JoinCommand(au.com.mineauz.minigames.commands.JoinCommand)

Aggregations

JoinCommand (au.com.mineauz.minigames.commands.JoinCommand)1 MinigamePlayer (au.com.mineauz.minigames.objects.MinigamePlayer)1 PlayerMock (be.seeseemelk.mockbukkit.entity.PlayerMock)1