Removed 'island.custom-ranks' from config

#432
This commit is contained in:
Florian CUNY 2019-01-03 16:17:01 +01:00
parent 369600e4d5
commit c549d969a4
3 changed files with 1 additions and 35 deletions

View File

@ -145,10 +145,6 @@ public class Settings implements DataObject {
@ConfigEntry(path = "island.paste-speed") @ConfigEntry(path = "island.paste-speed")
private int pasteSpeed = 1000; private int pasteSpeed = 1000;
// Ranks
@ConfigEntry(path = "island.custom-ranks", experimental = true)
private Map<String, Integer> customRanks = new HashMap<>();
//---------------------------------------------------------------------------------------/ //---------------------------------------------------------------------------------------/
@ConfigComment("These settings should not be edited") @ConfigComment("These settings should not be edited")
private String uniqueId = "config"; private String uniqueId = "config";
@ -378,14 +374,6 @@ public class Settings implements DataObject {
return this.pasteSpeed; return this.pasteSpeed;
} }
public Map<String, Integer> getCustomRanks() {
return customRanks;
}
public void setCustomRanks(Map<String, Integer> customRanks) {
this.customRanks = customRanks;
}
/** /**
* @return the uniqueId * @return the uniqueId
*/ */
@ -401,7 +389,4 @@ public class Settings implements DataObject {
public void setUniqueId(String uniqueId) { public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId; this.uniqueId = uniqueId;
} }
} }

View File

@ -50,18 +50,6 @@ public class RanksManager {
ranksPut(COOP_RANK_REF, COOP_RANK); ranksPut(COOP_RANK_REF, COOP_RANK);
ranksPut(VISITOR_RANK_REF, VISITOR_RANK); ranksPut(VISITOR_RANK_REF, VISITOR_RANK);
ranksPut(BANNED_RANK_REF, BANNED_RANK); ranksPut(BANNED_RANK_REF, BANNED_RANK);
loadCustomRanks();
}
/**
* Loads the custom ranks from the settings
*/
public void loadCustomRanks() {
for (Entry<String, Integer> en : plugin.getSettings().getCustomRanks().entrySet()) {
if (!addRank(en.getKey(),en.getValue())) {
plugin.logError("Error loading custom rank: " + en.getKey() + " " + en.getValue() + " skipping...");
}
}
} }
/** /**

View File

@ -32,14 +32,8 @@ public class RanksManagerTest {
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
BentoBox plugin = mock(BentoBox.class); BentoBox plugin = mock(BentoBox.class);
Settings settings = mock(Settings.class);
// Blank ranks for now
Map<String, Integer> customRanks = new HashMap<>();
when(plugin.getSettings()).thenReturn(settings);
when(settings.getCustomRanks()).thenReturn(customRanks);
ranksManager = new RanksManager(plugin); ranksManager = new RanksManager(plugin);
} }
/** /**
@ -118,5 +112,4 @@ public class RanksManagerTest {
assertEquals(RanksManager.OWNER_RANK_REF, ranksManager.getRank(RanksManager.OWNER_RANK)); assertEquals(RanksManager.OWNER_RANK_REF, ranksManager.getRank(RanksManager.OWNER_RANK));
assertEquals("", ranksManager.getRank(-999)); assertEquals("", ranksManager.getRank(-999));
} }
} }