Removed deprecated FlagsManager#getFlagByID(String)

This method was actually still used in some classes, so I had to fix them as well.
This commit is contained in:
Florian CUNY 2019-02-02 11:06:59 +01:00
parent 57d70c3d24
commit de69c9c571
4 changed files with 3 additions and 19 deletions

View File

@ -83,18 +83,6 @@ public class FlagsManager {
return flags;
}
/**
* Get flag by ID
* @param id unique id for this flag
* @return Flag or null if not known
* @deprecated As of 1.1, use {@link #getFlag(String)} instead.
*/
@Deprecated
@Nullable
public Flag getFlagByID(@NonNull String id) {
return getFlag(id).orElse(null);
}
/**
* Gets a Flag by providing an ID.
* @param id Unique ID for this Flag.

View File

@ -42,11 +42,7 @@ public class SettingsPanel {
// Get a list of flags of the correct type and sort by the translated names
List<Flag> flags = plugin.getFlagsManager().getFlags().stream().filter(f -> f.getType().equals(flagType))
.sorted(Comparator.comparing(Flag::getID, (s1, s2) -> {
String s1Translation = user.getTranslation(plugin.getFlagsManager().getFlagByID(s1).getNameReference());
String s2Translation = user.getTranslation(plugin.getFlagsManager().getFlagByID(s2).getNameReference());
return s1Translation.compareTo(s2Translation);
}))
.sorted(Comparator.comparing(flag -> user.getTranslation(flag.getNameReference())))
.collect(Collectors.toList());
// Use paging

View File

@ -101,7 +101,7 @@ public class InvincibleVisitorsListenerTest {
PanelItem item = mock(PanelItem.class);
when(item.getItem()).thenReturn(mock(ItemStack.class));
when(flag.toPanelItem(Mockito.any(), Mockito.eq(user))).thenReturn(item);
when(fm.getFlagByID(Mockito.anyString())).thenReturn(flag);
when(fm.getFlag(Mockito.anyString())).thenReturn(Optional.of(flag));
when(plugin.getFlagsManager()).thenReturn(fm);
// Island Manager

View File

@ -149,7 +149,7 @@ public class PVPListenerTest {
PanelItem item = mock(PanelItem.class);
when(item.getItem()).thenReturn(mock(ItemStack.class));
when(flag.toPanelItem(Mockito.any(), Mockito.any())).thenReturn(item);
when(fm.getFlagByID(Mockito.anyString())).thenReturn(flag);
when(fm.getFlag(Mockito.anyString())).thenReturn(Optional.of(flag));
when(plugin.getFlagsManager()).thenReturn(fm);
im = mock(IslandsManager.class);