use of org.bukkit.event.player.PlayerJoinEvent in project AuthMeReloaded by AuthMe.
the class PlayerListenerTest method shouldRemoveJoinMessage.
@Test
public void shouldRemoveJoinMessage() {
// given
Player player = mock(Player.class);
String joinMsg = "The player joined";
PlayerJoinEvent event = new PlayerJoinEvent(player, joinMsg);
given(settings.getProperty(RegistrationSettings.REMOVE_JOIN_MESSAGE)).willReturn(true);
// when
listener.onJoinMessage(event);
// then
assertThat(event.getJoinMessage(), nullValue());
verifyZeroInteractions(joinMessageService);
}
use of org.bukkit.event.player.PlayerJoinEvent in project AuthMeReloaded by AuthMe.
the class PlayerListenerTest method shouldUseCustomMessage.
@Test
public void shouldUseCustomMessage() {
// given
Player player = mock(Player.class);
given(player.getName()).willReturn("doooew");
given(player.getDisplayName()).willReturn("Displ");
String joinMsg = "The player joined";
PlayerJoinEvent event = new PlayerJoinEvent(player, joinMsg);
given(settings.getProperty(RegistrationSettings.REMOVE_JOIN_MESSAGE)).willReturn(false);
given(settings.getProperty(RegistrationSettings.CUSTOM_JOIN_MESSAGE)).willReturn("Hello {PLAYERNAME} (aka {DISPLAYNAME})");
given(settings.getProperty(RegistrationSettings.DELAY_JOIN_MESSAGE)).willReturn(false);
// when
listener.onJoinMessage(event);
// then
assertThat(event.getJoinMessage(), equalTo("Hello doooew (aka Displ)"));
verifyZeroInteractions(joinMessageService);
}
use of org.bukkit.event.player.PlayerJoinEvent in project Essentials by drtshock.
the class FakeServer method addPlayer.
public void addPlayer(Player base1) {
players.add(base1);
pluginManager.callEvent(new PlayerJoinEvent(base1, null));
}
Aggregations