@@ -0,0 +1,2515 @@
+package com.github.games647.scoreboardstats.variables.defaults;%0A%0Aimport com.github.games647.scoreboardstats.BackwardsCompatibleUtil;%0Aimport com.github.games647.scoreboardstats.variables.ReplaceEvent;%0Aimport com.github.games647.scoreboardstats.variables.ReplaceManager;%0Aimport com.google.common.collect.Iterables;%0Aimport com.google.common.io.ByteArrayDataInput;%0Aimport com.google.common.io.ByteArrayDataOutput;%0Aimport com.google.common.io.ByteStreams;%0A%0Aimport org.bukkit.Bukkit;%0A%0Aimport org.bukkit.entity.Player;%0Aimport org.bukkit.plugin.Plugin;%0Aimport org.bukkit.plugin.messaging.PluginMessageListener;%0A%0Apublic class BungeeCordVariables extends DefaultReplaceAdapter%3CPlugin%3E implements PluginMessageListener, Runnable %7B%0A%0A    private static final int UPDATE_INTERVAL = 20 * 30;%0A    private static final String BUNGEE_CHANNEL = %22BungeeCord%22;%0A%0A    private final ReplaceManager replaceManager;%0A    private int playersCount;%0A%0A    public BungeeCordVariables(ReplaceManager replaceManager) %7B%0A        super(Bukkit.getPluginManager().getPlugin(%22ScoreboardStats%22), %22bungee-online%22);%0A%0A        this.replaceManager = replaceManager;%0A        Bukkit.getMessenger().registerOutgoingPluginChannel(getPlugin(), BUNGEE_CHANNEL);%0A        Bukkit.getMessenger().registerIncomingPluginChannel(getPlugin(), BUNGEE_CHANNEL, this);%0A%0A        Bukkit.getScheduler().runTaskTimer(getPlugin(), this, UPDATE_INTERVAL, UPDATE_INTERVAL);%0A    %7D%0A%0A    @Override%0A    public void onReplace(Player player, String variable, ReplaceEvent replaceEvent) %7B%0A        replaceEvent.setScoreOrText(playersCount);%0A    %7D%0A%0A    @Override%0A    public void onPluginMessageReceived(String channel, Player player, byte%5B%5D message) %7B%0A        if (!channel.equals(BUNGEE_CHANNEL)) %7B%0A            return;%0A        %7D%0A%0A        ByteArrayDataInput in = ByteStreams.newDataInput(message);%0A        String subchannel = in.readUTF();%0A        if (%22PlayerCount%22.equals(subchannel)) %7B%0A            String server = in.readUTF();%0A            //update variable for cache%0A            playersCount = in.readInt();%0A            replaceManager.updateScore(%22bungee-online%22, playersCount);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void run() %7B%0A        ByteArrayDataOutput out = ByteStreams.newDataOutput();%0A        out.writeUTF(%22PlayerCount%22);%0A        out.writeUTF(%22ALL%22);%0A%0A        Player sender = Iterables.getFirst(BackwardsCompatibleUtil.getOnlinePlayers(), null);%0A        if (sender != null) %7B%0A            sender.sendPluginMessage(getPlugin(), BUNGEE_CHANNEL, out.toByteArray());%0A        %7D%0A    %7D%0A%7D%0A

Add BungeeCord variable (Fixes #74)