notifier: Add username to tray notification title

This also removes the player's ingame name from notifications which are
referring to the active player in favor of the title.
This commit is contained in:
Jordan Atwood
2021-02-06 17:19:40 -08:00
committed by Adam
parent fadfc15cd0
commit 0fa078d8f1
7 changed files with 41 additions and 36 deletions

View File

@@ -109,13 +109,7 @@ public class GroundItemsPluginTest
return null;
}).when(executor).execute(any(Runnable.class));
when(client.getLocalPlayer()).then(a ->
{
Player player = mock(Player.class);
when(player.getName()).thenReturn("Adam");
return player;
});
when(client.getLocalPlayer()).thenReturn(mock(Player.class));
when(config.getHiddenItems()).thenReturn("");
}
@@ -149,6 +143,6 @@ public class GroundItemsPluginTest
groundItemsPlugin.onItemSpawned(new ItemSpawned(tile, tileItem));
verify(notifier).notify("[Adam] received a highlighted drop: Abyssal whip");
verify(notifier).notify("You received a highlighted drop: Abyssal whip");
}
}

View File

@@ -62,8 +62,6 @@ import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class IdleNotifierPluginTest
{
private static final String PLAYER_NAME = "Deathbeam";
@Mock
@Bind
private Client client;
@@ -116,7 +114,6 @@ public class IdleNotifierPluginTest
when(fishingSpot.getName()).thenReturn("Fishing spot");
// Mock player
when(player.getName()).thenReturn(PLAYER_NAME);
when(player.getAnimation()).thenReturn(AnimationID.IDLE);
when(client.getLocalPlayer()).thenReturn(player);
@@ -145,7 +142,7 @@ public class IdleNotifierPluginTest
when(player.getAnimation()).thenReturn(AnimationID.IDLE);
plugin.onAnimationChanged(animationChanged);
plugin.onGameTick(new GameTick());
verify(notifier).notify("[" + PLAYER_NAME + "] is now idle!");
verify(notifier).notify("You are now idle!");
}
@Test
@@ -201,7 +198,7 @@ public class IdleNotifierPluginTest
when(player.getInteracting()).thenReturn(null);
plugin.onInteractingChanged(new InteractingChanged(player, null));
plugin.onGameTick(new GameTick());
verify(notifier).notify("[" + PLAYER_NAME + "] is now out of combat!");
verify(notifier).notify("You are now out of combat!");
}
@Test
@@ -292,7 +289,7 @@ public class IdleNotifierPluginTest
plugin.onInteractingChanged(new InteractingChanged(player, null));
plugin.onGameTick(new GameTick());
verify(notifier).notify("[" + PLAYER_NAME + "] is now idle!");
verify(notifier).notify("You are now idle!");
}
@Test
@@ -306,7 +303,7 @@ public class IdleNotifierPluginTest
when(client.getVar(eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(500); // 50%
plugin.onGameTick(new GameTick());
verify(notifier).notify(eq("[" + PLAYER_NAME + "] has restored spec energy!"));
verify(notifier).notify(eq("You have restored spec energy!"));
}
@Test
@@ -321,6 +318,6 @@ public class IdleNotifierPluginTest
// No movement here
plugin.onGameTick(new GameTick());
verify(notifier).notify(eq("[" + PLAYER_NAME + "] has stopped moving!"));
verify(notifier).notify(eq("You have stopped moving!"));
}
}