Get variable from another plugin

Discussion in 'Spigot Plugin Development' started by Switch, Jun 2, 2016.

  1. Hello,
    I use a Bungeecord network on a VPS, and i would like to get à variable in à plugin in the server À from a plugin in the server B.
    Can you help me ?
  2. Save the variable in a file/database. Then use the filepath or database connection to get that value.
  3. You could do 3 things that I know out if my head.

    You could save the data to a database.
    This might be a problem if you do it alot of times because it's slow.

    You could use sockets to connect the 2 servers. If you need to send the data a huge amount of times over what ever period, then it's a good way because it's fast. I would recommend to start up the sockets when the plugins load and keep the connection open. Else it'll get way slower.

    You could also use a bungee coord plugin as a database. You use the plugin messaging channel to set a value and then you can get the value also through bungee coord. This can be really useful and also pretty fast. The upside is that other servers on your instance can also access the info.
    One thing that you can't forget is that the bungee coord plugin needs to save the data on a server shutdown and load it up the the server boots up.