org.bukkit.plugin.messaging.StandardMessenger Java Examples

The following examples show how to use org.bukkit.plugin.messaging.StandardMessenger. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CraftPlayer.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
    StandardMessenger.validatePluginMessage(server.getMessenger(), source, channel, message);
    if (getHandle().connection == null) return;

    if (channels.contains(channel) || SpigotConfig.bungee) {
        SPacketCustomPayload packet = new SPacketCustomPayload(channel, new PacketBuffer(Unpooled.wrappedBuffer(message)));
        getHandle().connection.sendPacket(packet);
    }
}
 
Example #2
Source File: CraftWorld.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
    StandardMessenger.validatePluginMessage(server.getMessenger(), source, channel, message);

    for (Player player : getPlayers()) {
        player.sendPluginMessage(source, channel, message);
    }
}
 
Example #3
Source File: CraftServer.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
    StandardMessenger.validatePluginMessage(getMessenger(), source, channel, message);

    for (Player player : getOnlinePlayers()) {
        player.sendPluginMessage(source, channel, message);
    }
}
 
Example #4
Source File: CraftPlayer.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
    StandardMessenger.validatePluginMessage(server.getMessenger(), source, channel, message);
    if (getHandle().playerNetServerHandler == null) return;

    if (channels.contains(channel)) {
        net.minecraft.network.play.server.S3FPacketCustomPayload packet = new net.minecraft.network.play.server.S3FPacketCustomPayload(channel, message);
        getHandle().playerNetServerHandler.sendPacket(packet);
    }
}
 
Example #5
Source File: CraftWorld.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
    StandardMessenger.validatePluginMessage(server.getMessenger(), source, channel, message);

    for (Player player : getPlayers()) {
        player.sendPluginMessage(source, channel, message);
    }
}
 
Example #6
Source File: CraftServer.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
    StandardMessenger.validatePluginMessage(getMessenger(), source, channel, message);

    for (Player player : getOnlinePlayers()) {
        player.sendPluginMessage(source, channel, message);
    }
}
 
Example #7
Source File: ReplaceManagerTest.java    From ScoreboardStats with MIT License 5 votes vote down vote up
@Test
public void testUnregister() throws Exception {
    PowerMockito.mockStatic(Bukkit.class);
    Mockito.when(Bukkit.getPluginManager()).thenReturn(PowerMockito.mock(SimplePluginManager.class));
    Mockito.when(Bukkit.getMessenger()).thenReturn(PowerMockito.mock(StandardMessenger.class));
    Mockito.when(Bukkit.getScheduler()).thenReturn(PowerMockito.mock(BukkitScheduler.class));

    Plugin plugin = PowerMockito.mock(Plugin.class);

    ReplaceManager replaceManager = new ReplaceManager(null, plugin, LoggerFactory.getLogger("test"));
    replaceManager.register(new Replacer(plugin, "test").scoreSupply(() -> 1));
}