use of at.pcgamingfreaks.Bungee.Message.Message in project Bukkit_Bungee_PluginLib by GeorgH93.
the class ActionBarSenderTest method testBroadcast.
@Test
public void testBroadcast() throws NoSuchFieldException, IllegalAccessException {
TestObjects.initProxyServer();
int sendCalls = 0;
int playerCount = TestObjects.getPlayers().size();
ActionBarSender actionBarSender = new ActionBarSender();
actionBarSender.doBroadcast("");
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
actionBarSender.doBroadcast("", 1);
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
ActionBarSender.broadcast(new Message(""));
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
}
use of at.pcgamingfreaks.Bungee.Message.Message in project Bukkit_Bungee_PluginLib by GeorgH93.
the class ActionBarSenderTest method testSend.
@Test
public void testSend() {
List<ProxiedPlayer> players = new ArrayList<>();
players.add(TestObjects.getPlayer());
players.add(TestObjects.getPlayer());
int sendCalls = 0;
int playerCount = players.size();
ActionBarSender actionBarSender = new ActionBarSender();
actionBarSender.doSend(TestObjects.getPlayer(), "");
verify(TestObjects.getPlayer().unsafe(), times(++sendCalls)).sendPacket(any(Chat.class));
actionBarSender.doSend(TestObjects.getPlayer(), "", 1);
verify(TestObjects.getPlayer().unsafe(), times(++sendCalls)).sendPacket(any(Chat.class));
ActionBarSender.send(TestObjects.getPlayer(), new Message(""));
verify(TestObjects.getPlayer().unsafe(), times(++sendCalls)).sendPacket(any(Chat.class));
actionBarSender.doSend(players, "");
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
actionBarSender.doSend(players, "", 1);
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
ActionBarSender.send(players, new Message(""));
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
}
use of at.pcgamingfreaks.Bungee.Message.Message in project Bukkit_Bungee_PluginLib by GeorgH93.
the class BossBarSenderTest method testSend.
@Test
public void testSend() {
List<ProxiedPlayer> players = new ArrayList<>();
players.add(TestObjects.getPlayer());
players.add(TestObjects.getPlayer());
int sendCalls = 0;
BossBarSender bossBarSender = new BossBarSender();
bossBarSender.doSend(TestObjects.getPlayer(), "");
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
bossBarSender.doSend(TestObjects.getPlayer(), "", 1);
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
BossBarSender.send(TestObjects.getPlayer(), new Message(""));
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
bossBarSender.doSend(players, "");
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
bossBarSender.doSend(players, "", 1);
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
}
use of at.pcgamingfreaks.Bungee.Message.Message in project Bukkit_Bungee_PluginLib by GeorgH93.
the class TitleSenderTest method testSend.
@Test
public void testSend() {
List<ProxiedPlayer> players = new ArrayList<>();
players.add(TestObjects.getPlayer());
players.add(TestObjects.getPlayer());
int sendCalls = 0;
int playerCount = players.size();
TitleSender titleSender = new TitleSender();
titleSender.doSend(TestObjects.getPlayer(), "");
sendCalls += 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
titleSender.doSend(TestObjects.getPlayer(), "", 1);
sendCalls += 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
titleSender.doSend(TestObjects.getPlayer(), "", new TitleMetadata());
sendCalls += 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
TitleSender.send(TestObjects.getPlayer(), new Message(""));
sendCalls += 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
TitleSender.send(TestObjects.getPlayer(), new Message(""), new TitleMetadata(10, 10, 20));
sendCalls += 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
titleSender.doSend(players, "");
sendCalls += playerCount * 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
titleSender.doSend(players, "", 1);
sendCalls += playerCount * 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
titleSender.doSend(players, "", new TitleMetadata());
sendCalls += playerCount * 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
TitleSender.send(players, new Message(""));
sendCalls += playerCount * 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
TitleSender.send(players, new Message(""), new TitleMetadata(true));
sendCalls += playerCount * 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
}
use of at.pcgamingfreaks.Bungee.Message.Message in project Bukkit_Bungee_PluginLib by GeorgH93.
the class TitleSenderTest method testBroadcast.
@Test
public void testBroadcast() throws NoSuchFieldException, IllegalAccessException {
TestObjects.initProxyServer();
int sendCalls = 0;
int playerCount = TestObjects.getPlayers().size();
TitleSender titleSender = new TitleSender();
titleSender.doBroadcast("");
sendCalls += playerCount * 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
titleSender.doBroadcast("", 1);
sendCalls += playerCount * 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
titleSender.doBroadcast("", new TitleMetadata());
sendCalls += playerCount * 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
TitleSender.broadcast(new Message(""));
sendCalls += playerCount * 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
TitleSender.broadcast(new Message(""), TitleMetadata.fromJson("[{\"fadeIn\": 10, \"fadeOut\": 20, \"stay\": 30, \"subtitle\": false}]"));
sendCalls += playerCount * 2;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
}
Aggregations