Getting Player Count And Name Of Server

Discussion in 'Plugin Development' started by toxiccoke, May 17, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    toxiccoke

    Hi
    I was making a MOTD for my network and i wanted to get the player count of the network and the name of the server the player has connected to using bungee.
    This is what i have but i am getting errors and i cannot work out why
    Code:
    package me.toxiccoke.core.Motd;
    
    import me.toxiccoke.core.Main;
    import me.toxiccoke.core.Chat.ChatUtils;
    import net.md_5.bungee.api.ProxyServer;
    import net.md_5.bungee.api.connection.ProxiedPlayer;
    
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.event.player.PlayerQuitEvent;
    
    public class MOTD implements Listener{
    
        Main plugin;
    
        @EventHandler
        public void onJoin(PlayerJoinEvent e){
            Player p = e.getPlayer();
            e.setJoinMessage(null);
    
            ChatUtils.sendMessage(p, ChatColor.YELLOW + "Welcome To " + ChatColor.RED + "Inferno Network");
            ChatUtils.sendMessage(p, ChatColor.YELLOW + "There are " + ChatColor.RED + p.getServer().getOnlinePlayers().length + ChatColor.YELLOW + " Player Online");
            ChatUtils.sendMessage(p, ChatColor.YELLOW + "Visit Our Website At " + ChatColor.RED + "");
            ChatUtils.sendMessage(p, ChatColor.YELLOW + "You Are Connected To " + "");
            ChatUtils.sendMessage(p, ChatColor.YELLOW + "Use " + ChatColor.RED + "/Server" + ChatColor.YELLOW + " To Switch Between Servers");
        }
    
        @EventHandler
        public void onQuit(PlayerQuitEvent e){
            e.setQuitMessage(null);
        }
    
    
    }
    
    If you would like anymore information then pls post below i will be happy to supply you with what i can to help me out
    this may not be the right place to post this but i am not having any luck on the spigot website sorry
    thanks toxiccoke
     
    Last edited: May 17, 2015
  2. Offline

    timtower Administrator Administrator Moderator

    Locked.
    Bungeecord is not supported on Bukkit.
     
Thread Status:
Not open for further replies.

Share This Page