get ServerInfo from PluginMessageEvent?

Discussion in 'BungeeCord Plugin Help' started by AstetYne, May 12, 2019.

  1. Hello,

    I have comunication Spigot <=> BungeeCord. When message arrive on bungee side, I need to know, from which server does it come.

    In Event PluginMessageEvent, I can get only getSender() which returns ServerConnection. I need to get ServerInfo from that.
    How can I?
     
  2. You can cast the sender to a Server object and get the ServerInfo from that:
    Code (Java):
    public void onPluginMessage(PluginMessageEvent e) {
        Server server = (Server) e.getSender();
        ServerInfo info = server.getInfo();
    }
     
     
    • Like Like x 1
    • Agree Agree x 1
  3. Thank you! Works.