Search in sources :

Example 6 with PartiesPlaceholder

use of com.alessiodp.parties.common.addons.internal.PartiesPlaceholder in project Parties by AlessioDP.

the class PartiesPlaceholderTest method testMembers.

@Test
public void testMembers() {
    Messages.PARTIES_LIST_EMPTY = "empty";
    Messages.PARTIES_LIST_ONLINEFORMAT = "player";
    Messages.PARTIES_LIST_OFFLINEFORMAT = "offlineplayer";
    Messages.PARTIES_LIST_SEPARATOR = ",";
    when(mockMessageUtils.convertPlaceholders(any(), any(), any())).then(args -> args.getArgument(0));
    PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("members");
    assertEquals(PartiesPlaceholder.MEMBERS, placeholder);
    assertEquals(Messages.PARTIES_LIST_OFFLINEFORMAT + Messages.PARTIES_LIST_SEPARATOR + Messages.PARTIES_LIST_OFFLINEFORMAT, placeholder.formatPlaceholder(player1, party1, "members"));
}
Also used : PartiesPlaceholder(com.alessiodp.parties.common.addons.internal.PartiesPlaceholder) Test(org.junit.jupiter.api.Test)

Example 7 with PartiesPlaceholder

use of com.alessiodp.parties.common.addons.internal.PartiesPlaceholder in project Parties by AlessioDP.

the class PartiesPlaceholderTest method testPlaceholderLeaderUuid.

@Test
public void testPlaceholderLeaderUuid() {
    PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("leader_uuid");
    assertEquals(PartiesPlaceholder.LEADER_UUID, placeholder);
    assertEquals(player1.getPlayerUUID().toString(), placeholder.formatPlaceholder(player1, party1, "leader_uuid"));
}
Also used : PartiesPlaceholder(com.alessiodp.parties.common.addons.internal.PartiesPlaceholder) Test(org.junit.jupiter.api.Test)

Example 8 with PartiesPlaceholder

use of com.alessiodp.parties.common.addons.internal.PartiesPlaceholder in project Parties by AlessioDP.

the class PartiesPlaceholderTest method testMembersTotal.

@Test
public void testMembersTotal() {
    PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("members_total");
    assertEquals(PartiesPlaceholder.MEMBERS_TOTAL, placeholder);
    assertEquals("2", placeholder.formatPlaceholder(player1, party1, "members_total"));
    placeholder = PartiesPlaceholder.getPlaceholder("members_online_total");
    assertEquals(PartiesPlaceholder.MEMBERS_ONLINE_TOTAL, placeholder);
    assertEquals("0", placeholder.formatPlaceholder(player1, party1, "members_online_total"));
    placeholder = PartiesPlaceholder.getPlaceholder("members_offline_total");
    assertEquals(PartiesPlaceholder.MEMBERS_OFFLINE_TOTAL, placeholder);
    assertEquals("2", placeholder.formatPlaceholder(player1, party1, "members_offline_total"));
}
Also used : PartiesPlaceholder(com.alessiodp.parties.common.addons.internal.PartiesPlaceholder) Test(org.junit.jupiter.api.Test)

Example 9 with PartiesPlaceholder

use of com.alessiodp.parties.common.addons.internal.PartiesPlaceholder in project Parties by AlessioDP.

the class PartiesPlaceholderTest method testPlaceholderColorName.

@Test
public void testPlaceholderColorName() {
    PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("color_name");
    assertEquals(PartiesPlaceholder.COLOR_NAME, placeholder);
    assertEquals("", placeholder.formatPlaceholder(player1, party1, "color_name"));
    party1.setAccessible(true);
    party1.setColor(new PartyColorImpl("red", "123", "&c", 0, 0, 0));
    party1.setAccessible(false);
    assertEquals(party1.getColor().getName(), placeholder.formatPlaceholder(player1, party1, "color_name"));
}
Also used : PartiesPlaceholder(com.alessiodp.parties.common.addons.internal.PartiesPlaceholder) PartyColorImpl(com.alessiodp.parties.common.parties.objects.PartyColorImpl) Test(org.junit.jupiter.api.Test)

Example 10 with PartiesPlaceholder

use of com.alessiodp.parties.common.addons.internal.PartiesPlaceholder in project Parties by AlessioDP.

the class PartiesPlaceholderTest method testPlaceholderListPartiesTotal.

@Test
public void testPlaceholderListPartiesTotal() {
    when(mockDatabaseManager.getListPartiesNumber()).thenReturn(3);
    PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("list_parties_total");
    assertEquals(PartiesPlaceholder.LIST_PARTIES_TOTAL, placeholder);
    assertEquals("3", placeholder.formatPlaceholder(player1, party1, "list_parties_total"));
}
Also used : PartiesPlaceholder(com.alessiodp.parties.common.addons.internal.PartiesPlaceholder) Test(org.junit.jupiter.api.Test)

Aggregations

PartiesPlaceholder (com.alessiodp.parties.common.addons.internal.PartiesPlaceholder)24 Test (org.junit.jupiter.api.Test)21 PartyColorImpl (com.alessiodp.parties.common.parties.objects.PartyColorImpl)3 PartyImpl (com.alessiodp.parties.common.parties.objects.PartyImpl)2 PartyPlayerImpl (com.alessiodp.parties.common.players.objects.PartyPlayerImpl)2 Matcher (java.util.regex.Matcher)2 RankManager (com.alessiodp.parties.common.players.RankManager)1 PartyRankImpl (com.alessiodp.parties.common.players.objects.PartyRankImpl)1 EventHandler (org.bukkit.event.EventHandler)1