Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.google.common.io.ByteArrayDataInput;
- import com.google.common.io.ByteArrayDataOutput;
- import com.google.common.io.ByteStreams;
- import net.md_5.bungee.BungeeCord;
- import net.md_5.bungee.api.connection.ProxiedPlayer;
- import net.md_5.bungee.api.event.PluginMessageEvent;
- import net.md_5.bungee.api.plugin.Listener;
- import net.md_5.bungee.event.EventHandler;
- /**
- * Created by Vinetos on 17/01/2016.
- */
- public class PluginListener implements Listener {
- @EventHandler
- public void onPluginReceivedEvent(PluginMessageEvent e){
- if(!e.getTag().equalsIgnoreCase("VChannel"))return;
- ByteArrayDataInput in = ByteStreams.newDataInput(e.getData());
- String subChannel = in.readUTF();
- ProxiedPlayer p = BungeeCord.getInstance().getPlayer(e.getReceiver().toString());
- if(subChannel.equalsIgnoreCase("Message")){
- ByteArrayDataOutput out = ByteStreams.newDataOutput();
- out.writeUTF("Message");
- out.writeUTF("§aUn coucou de §cBungeecord §a!");
- p.getServer().getInfo().sendData("VChannel", out.toByteArray());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment