menuentryswapper: Fix birdhouse swap

This commit is contained in:
Jordan Atwood
2020-06-23 21:49:16 -07:00
committed by Adam
parent 86ddd6ebd4
commit db917454e8
2 changed files with 32 additions and 1 deletions

View File

@@ -252,7 +252,7 @@ public class MenuEntrySwapperPlugin extends Plugin
swap("pick-up", "chase", config::swapChase);
swap("interact", "birdhouse", "empty", config::swapBirdhouseEmpty);
swap("interact", target -> target.endsWith("birdhouse"), "empty", config::swapBirdhouseEmpty);
swap("enter", "the gauntlet", "enter-corrupted", config::swapGauntlet);

View File

@@ -366,4 +366,35 @@ public class MenuEntrySwapperPluginTest
menu("Deposit-All", "Rune arrow", MenuAction.CC_OP, 8),
}, argumentCaptor.getValue());
}
@Test
public void testBirdhouse()
{
when(config.swapBirdhouseEmpty()).thenReturn(true);
entries = new MenuEntry[]{
menu("Cancel", "", MenuAction.CANCEL),
menu("Examine", "Redwood birdhouse", MenuAction.EXAMINE_OBJECT),
menu("Walk here", "", MenuAction.WALK),
menu("Empty", "Redwood birdhouse", MenuAction.GAME_OBJECT_THIRD_OPTION),
menu("Seeds", "Redwood birdhouse", MenuAction.GAME_OBJECT_SECOND_OPTION),
menu("Interact", "Redwood birdhouse", MenuAction.GAME_OBJECT_FIRST_OPTION),
};
menuEntrySwapperPlugin.onClientTick(new ClientTick());
ArgumentCaptor<MenuEntry[]> argumentCaptor = ArgumentCaptor.forClass(MenuEntry[].class);
verify(client).setMenuEntries(argumentCaptor.capture());
assertArrayEquals(new MenuEntry[]{
menu("Cancel", "", MenuAction.CANCEL),
menu("Examine", "Redwood birdhouse", MenuAction.EXAMINE_OBJECT),
menu("Walk here", "", MenuAction.WALK),
menu("Interact", "Redwood birdhouse", MenuAction.GAME_OBJECT_FIRST_OPTION),
menu("Seeds", "Redwood birdhouse", MenuAction.GAME_OBJECT_SECOND_OPTION),
menu("Empty", "Redwood birdhouse", MenuAction.GAME_OBJECT_THIRD_OPTION),
}, argumentCaptor.getValue());
}
}