Search in sources :

Example 1 with RankManager

use of com.alessiodp.parties.common.players.RankManager in project Parties by AlessioDP.

the class PartiesPlaceholderTest method testPlaceholderListRank.

@Test
public void testPlaceholderListRank() {
    RankManager mockRankManager = mock(RankManager.class);
    when(mockPlugin.getRankManager()).thenReturn(mockRankManager);
    when(mockRankManager.searchRankByHardName(any())).thenReturn(new PartyRankImpl("myrank", "myrank", "", 20, 0, null, Collections.emptyList(), true));
    when(mockMessageUtils.convertPlaceholders(any(), any(), any())).thenReturn("Dummy");
    PartiesPlaceholder placeholder = PartiesPlaceholder.getPlaceholder("list_rank_myrank");
    assertEquals(PartiesPlaceholder.LIST_RANK, placeholder);
    assertEquals(player1.getName(), placeholder.formatPlaceholder(null, party1, "list_rank_myrank"));
    placeholder = PartiesPlaceholder.getPlaceholder("list_rank_myrank_total");
    assertEquals(PartiesPlaceholder.LIST_RANK_TOTAL, placeholder);
    placeholder = PartiesPlaceholder.getPlaceholder("list_rank_myrank_1");
    assertEquals(PartiesPlaceholder.LIST_RANK_NUMBER, placeholder);
    placeholder = PartiesPlaceholder.getPlaceholder("list_rank_myrank_1_placeholder");
    assertEquals(PartiesPlaceholder.LIST_RANK_NUMBER_PLACEHOLDER, placeholder);
}
Also used : PartiesPlaceholder(com.alessiodp.parties.common.addons.internal.PartiesPlaceholder) PartyRankImpl(com.alessiodp.parties.common.players.objects.PartyRankImpl) RankManager(com.alessiodp.parties.common.players.RankManager) Test(org.junit.jupiter.api.Test)

Example 2 with RankManager

use of com.alessiodp.parties.common.players.RankManager in project Parties by AlessioDP.

the class RankManagerTest method setUp.

@BeforeAll
public static void setUp() {
    // Ranks
    rank1 = new PartyRankImpl("rank1", "rank1", "rank1", 1, 0, null, Lists.newArrayList(RankPermission.EDIT_COLOR.toString(), RankPermission.EDIT_DESC.toString()), true);
    rank2 = new PartyRankImpl("rank2", "rank2", "rank2", 2, 0, null, Lists.newArrayList("-" + RankPermission.EDIT_FOLLOW, "-" + RankPermission.EDIT_HOME, "*"), false);
    rank3 = new PartyRankImpl("rank3", "rank3", "rank3", 3, 0, null, Lists.newArrayList("-" + RankPermission.EDIT_HOME, "*"), false);
    // Configuration
    ConfigParties.RANK_LIST = Sets.newSet(rank1, rank2, rank3);
    rankManager = new RankManager(mockPlugin);
    rankManager.reload();
}
Also used : PartyRankImpl(com.alessiodp.parties.common.players.objects.PartyRankImpl) RankManager(com.alessiodp.parties.common.players.RankManager) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with RankManager

use of com.alessiodp.parties.common.players.RankManager in project Parties by AlessioDP.

the class PartiesPlugin method postHandle.

@Override
protected void postHandle() {
    api = new ApiHandler(this, initApiOptions());
    colorManager = new ColorManager();
    cooldownManager = new CooldownManager(this);
    expManager = new ExpManager(this);
    playerUtils = new PartiesPlayerUtils(this);
    rankManager = new RankManager(this);
    getPartyManager().reload();
    getPlayerManager().reload();
    getCommandManager().setup();
    getMessenger().reload();
    getExpManager().reload();
    registerListeners();
    reloadAdpUpdater();
    getAddonManager().loadAddons();
    Parties.setApi(api);
}
Also used : PartiesPlayerUtils(com.alessiodp.parties.common.utils.PartiesPlayerUtils) ExpManager(com.alessiodp.parties.common.parties.ExpManager) ApiHandler(com.alessiodp.parties.common.api.ApiHandler) CooldownManager(com.alessiodp.parties.common.parties.CooldownManager) ColorManager(com.alessiodp.parties.common.parties.ColorManager) RankManager(com.alessiodp.parties.common.players.RankManager)

Aggregations

RankManager (com.alessiodp.parties.common.players.RankManager)3 PartyRankImpl (com.alessiodp.parties.common.players.objects.PartyRankImpl)2 PartiesPlaceholder (com.alessiodp.parties.common.addons.internal.PartiesPlaceholder)1 ApiHandler (com.alessiodp.parties.common.api.ApiHandler)1 ColorManager (com.alessiodp.parties.common.parties.ColorManager)1 CooldownManager (com.alessiodp.parties.common.parties.CooldownManager)1 ExpManager (com.alessiodp.parties.common.parties.ExpManager)1 PartiesPlayerUtils (com.alessiodp.parties.common.utils.PartiesPlayerUtils)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1 Test (org.junit.jupiter.api.Test)1