Need some help with bungeecord data.

Discussion in 'BungeeCord Plugin Development' started by avighnash, May 27, 2016.

  1. This is the first time I have ever worked with Bungeecord. So here is the class I have:

    Code (Text):
    package net.hypixel.coins;

    import java.util.HashMap;
    import java.util.UUID;

    import net.md_5.bungee.api.connection.ProxiedPlayer;
    import net.md_5.bungee.api.plugin.Plugin;

    public class CoinsAPI extends Plugin {
        public void onEnable() {


        private static HashMap<UUID, Integer> coins = new HashMap<>();

        public static void addCoins(ProxiedPlayer p, int amount) {
            coins.put(p.getUniqueId(), amount);

        public static void removeCoins(ProxiedPlayer p, int amount) {
            coins.put(p.getUniqueId(), coins.get(p.getUniqueId()) - amount);

        public static int getCoins(ProxiedPlayer p) {
            if (!coins.containsKey(p.getUniqueId())) {
                return 0;
            } else {
                return coins.get(p.getUniqueId());


    (lol the package name is weird.. whateves :p decided to be an imposter)
    Now I have a couple of questions regarding this class that I made. If I get the coins, would it get the coins that the player has earned in every server in the proxy?
    And can I use this data in a scoreboard in a spigot plugin?
  2. Can I get some feedback?
  3. The way you have this set up, you can only access the coins from the same bungee cord plugin. If you want to be able to add coins and get coins from spigot plugin. You would have to look at the plugin messaging thing that allows you to send and receive data from and to spigot or bungee coord.
    Just Google around. There are enough threads that should help you. But you might need to search quite a bit
  4. Do you know something about MySQL and Plugin Messages?
  5. I have never used MySQL. I really want to learn how to though.
  6. I would watch our with storing data on mysql. Its really slow. I would recommend to have the bungee coord plugin have the coins saved to a file and use the plugin messaging channel or sockets to sync the coins.
    Like the bungee coord sends the player coins to the server when he joins that server and when he leaves that server the server sends bungee coord the new amount of coins.
    This is way faster and you try to only have a minimal amount of sending data.
    I had done this for a network when I was a developer there and it made it way faster.