mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
Removed FlagsManager#getFlagByIcon() as it is useless
This commit is contained in:
parent
e598fa7c93
commit
c6c7e0b4ee
@ -70,14 +70,4 @@ public class FlagsManager {
|
|||||||
public Flag getFlagByID(String id) {
|
public Flag getFlagByID(String id) {
|
||||||
return flags.stream().filter(flag -> flag.getID().equals(id)).findFirst().orElse(null);
|
return flags.stream().filter(flag -> flag.getID().equals(id)).findFirst().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get flag by icon
|
|
||||||
* @param icon material
|
|
||||||
* @return flag or null if it does not exist
|
|
||||||
*/
|
|
||||||
public Flag getFlagByIcon(Material icon) {
|
|
||||||
return flags.stream().filter(flag -> flag.getIcon().equals(icon)).findFirst().orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -520,7 +520,6 @@ public class TestBSkyBlock {
|
|||||||
// Add it to the Flag Manager
|
// Add it to the Flag Manager
|
||||||
flagsManager.registerFlag(customFlag);
|
flagsManager.registerFlag(customFlag);
|
||||||
assertEquals(customFlag, flagsManager.getFlagByID("CUSTOM_FLAG"));
|
assertEquals(customFlag, flagsManager.getFlagByID("CUSTOM_FLAG"));
|
||||||
assertEquals(customFlag, flagsManager.getFlagByIcon(customFlag.getIcon()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,14 +104,4 @@ public class FlagsManagerTest {
|
|||||||
Flags.values().stream().sorted(Comparator.reverseOrder()).forEach(flag -> assertEquals(flag, fm.getFlagByID(flag.getID())));
|
Flags.values().stream().sorted(Comparator.reverseOrder()).forEach(flag -> assertEquals(flag, fm.getFlagByID(flag.getID())));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetFlagByIcon() {
|
|
||||||
BSkyBlock plugin = mock(BSkyBlock.class);
|
|
||||||
FlagsManager fm = new FlagsManager(plugin);
|
|
||||||
// Test in forward and reverse order so that any duplicates are caught
|
|
||||||
Flags.values().stream().sorted().forEach(flag -> assertEquals(flag, fm.getFlagByIcon(flag.getIcon())));
|
|
||||||
Flags.values().stream().sorted(Comparator.reverseOrder()).forEach(flag -> assertEquals(flag, fm.getFlagByIcon(flag.getIcon())));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user