Solved i can't find a way to do this need help

Discussion in 'Plugin Development' started by xxmobkiller, Jun 21, 2013.

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

    xxmobkiller

  2. Offline

    ProtoTempus

    xxmobkiller This should honestly be in Plugin Requests unless you've actually started an attempt at coding this.
     
  3. Offline

    xxmobkiller

    Code:
    package me.xxmobkiller.com;
     
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.event.block.SignChangeEvent;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin implements Listener {
        public void onDisable() {
            // TODO: Place any custom disable code here.
        }
     
        public void onEnable() {
            getServer().getPluginManager().registerEvents(this, this);
        }
     
          @EventHandler
          public void onSignChangeEvent1(SignChangeEvent sign) {
              String firstLine = sign.getLine(0);
              if (firstLine.equals("[online]") && firstLine.equalsIgnoreCase("Online") || firstLine.equalsIgnoreCase("online")) {
                  sign.setLine(0, ChatColor.BLACK + "[Online]" );
                  sign.setLine(1, ChatColor.BLACK + "[" + Bukkit.getOnlinePlayers().length + ChatColor.BLACK +"/" + Bukkit.getMaxPlayers() + ChatColor.BLACK + "]");
                  sign.setLine(2, ChatColor.DARK_GREEN  + " " + "Online");
                    for (Player player : Bukkit.getOnlinePlayers())
                      update(player);
                  }
              }
          private void update(Player player) {
         
         }
    }
     
Thread Status:
Not open for further replies.

Share This Page