[REQ] [FORMATTED] CompassList

Discussion in 'Archived: Plugin Requests' started by njb_said, Jun 24, 2012.

  1. Offline

    njb_said

    Plugin category: INFORMATIONAL

    Suggested name: CompassList

    What I want: CompassList Plugin:

    Name and Colour of this line configurable in config
    &3--------=[ &9CompassCraft &3]=--------

    &3There are &6(&eX/X&6) &3players online.
    &5Online staff: &d<Staff from groups in config>
    &2Online Donators: &a<Donators from groups in config>

    Name and Colour of this line configurable in config
    &3--------=[ &9CompassJail &3]=--------

    Names without prefix all in the same colour.
    Suggested config.yml

    Staff Ranks:
    - <Rank 1>
    - <Rank 2>
    - <Rank 3>
    (As many ranks as we add)

    Donator Ranks:
    - <Rank 1>
    - <Rank 2>
    - <Rank 3>
    (As many ranks as we add)

    Hope this makes sense!


    Ideas for commands: /list /who /players /online
    - Overriding the essentials /list (Unless /elist is used)

    Ideas for permissions: None really unless the config idea is hard/impossible
    If it is hard then permissions:
    compasslist.staff (Adds them to the stafff)
    compasslist.donator (Adds them to donors)
    Everyone on the server (even if they are staff)
    will be in the 'There are (X/X) players online' section
    [Think i made it confusing sorry skype for explanation]

    When I'd like it by: Whenever is possible (Maximum Time: 2 Weeks)

    If this doesnt make sense feel free to add me on skype :D (sea_gfx)
     
  2. Offline

    McLuke500

    Wth Is this even a plugin?
     
  3. Offline

    njb_said

    Yeh sorry i clicked create thread whilst I was typing xD
     
  4. Offline

    McLuke500

    It would have to use vault for the groups but you could make it so its like permissions are
    Compasscraft.staff
    and Compasscraft.donator so if you /who it says 5 staff online and 2 donators and could list them or just say the number
     
  5. Offline

    njb_said

    Yeh lol I just edited when you said that hahaha
    xD
    Do you think you can make it?? :)

    We have vault
     
  6. Offline

    McLuke500

    I could make it I just really dont have the time but someone could make this very easily!

    I'll make it have command /cwho as in compasscraft or should it not?
    I will make it!

    Finished!
    Config is

    CompassCraft:
    cwho:
    - '&3--------=[ &9CompassCraft &3]=--------'
    - '&3There are &6(&e%allplayers%&6) &3players online.'
    - '&5Online staff: &d%staff%'
    - '&2Online Donators: &a%donators%'


    The %allplayers% is all players
    %staff% is number of staff
    %donators% is all donators


    Permissions are compasscraft.cwho to use the command /cwho

    compasscraft.reload to use /cwho reload


    then compasscraft.staff
    and compasscraft.donator

    Colorcodes work

    Download https://dl.dropbox.com/u/20849260/Compasscraft.jar




    And if anyones interested source code

    Code:
    package me.mcluke300.compasscraft;
     
     
    import java.util.ArrayList;
    import java.util.List;
     
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class main extends JavaPlugin implements Listener{
       
        public static main plugin;
     
        @Override
        public void onEnable() {
            LoadConfiguration();
            plugin = this;
            System.out.println(this+" has been Enabled");
            Bukkit.getServer().getPluginManager().registerEvents(this, this);
        }
        @Override
        public void onDisable() {
            System.out.println(this+" has been Disabled");
        }
     
       
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
            if(commandLabel.equalsIgnoreCase("cwho")) {
               
                //Main Command
                if(args.length == 0 && sender.hasPermission("compasscraft.cwho")) {
                    List<String> words = plugin.getConfig().getStringList("CompassCraft.cwho");
                    String allplayers = "" + Bukkit.getOnlinePlayers().length + "/" + Bukkit.getMaxPlayers();
                    int staffp = 0;
                    int donatorp = 0;
                    Player[] players = Bukkit.getOnlinePlayers();
                    for (Player playerP : players) {
                        if (playerP.hasPermission("compasscraft.staff")) {
                            staffp++;
                        }
                        if (playerP.hasPermission("compasscraft.donator")) {
                            donatorp++;
                        }
                    }
                    String staffpp = "" + staffp;
                    String donatorpp = "" + donatorp;
                    for (String m : words) {
                        m = m.replaceAll("%allplayers%", allplayers);
                        m = m.replaceAll("%staff%", staffpp);
                        m = m.replaceAll("%donators%", donatorpp);
                        m = m.replaceAll("&([0-9a-fA-F])", "ยง$1");
                        sender.sendMessage(m);
                    }
     
                   
                   
                }else if (args.length == 1){
                   
                    //Reload
                    if (args[0].equalsIgnoreCase("reload") && sender.hasPermission("compasscraft.reload")) {
                        getConfig();
                        reloadConfig();
                        getServer().getPluginManager().disablePlugin(plugin);
                        getServer().getPluginManager().enablePlugin(plugin);
                        sender.sendMessage(ChatColor.GREEN+"Compasscraft Config Reloaded");
                    }
                } else if (args.length < 2) {
                    return false;
                }
            }
            return false;
        }
       
        public void LoadConfiguration() {
            List<String> words = new ArrayList<String>();
            String path = "CompassCraft.cwho";
            words.add("&3--------=[ &9CompassCraft &3]=--------");
            words.add("&3There are &6(&e%allplayers%&6) &3players online.");
            words.add("&5Online staff: &d%staff%");
            words.add("&2Online Donators: &a%donators%");
            getConfig().addDefault(path, words);
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
     
    }
    

    njb_said

    [​IMG]

    Example

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  7. Offline

    njb_said

    Thank you!!!! Also could you make it list the player names of people who are staff and donors (Would be nice :))
     
  8. Offline

    njb_said

    Theres a small issue with the plugin :(

    1st:
    Could you make a toggleable option in config:
    Code:
    CompassCraft:
      cwho:
      - '&3--------=[ &9CompassCraft &3]=--------'
      - '&3There are &6(&e%allplayers%&6) &3players online.'
      - '&5Online staff: &d%staff%'
      - '&2Online Donators: &a%donators%'
     
    # This option toggles if player names are shown or not in the donator and staff lines.
    # False - it will show a number ||| True - It will list players online in those ranks.
    # If true and there are no staff or donators online it will show 'none' in the color selected in the line ^^.
    playernames: false
    
    2nd:
    Because admins and OP have '*' node they are classed as Staff and Donators
    Is there a way of changing it so players can only have EITHER compasscraft.staff or compasscraft.donator


    Hope that makes sense :p
    Apart from those issues its an amazing plugin :p
    Thank you :)
     
  9. Offline

    McLuke500

    Just give the staff group -compasscraft.donator
    and the donator group -compasscraft.staff
    to negate the nodes :D Hope this helps :D
     
  10. Offline

    njb_said

    tried that .. didnt work :(
     
  11. Offline

    izak12345678910

    playerz does this
     
  12. Offline

    McLuke500

  13. Offline

    izak12345678910

    It works well too simple to use and has the features he wanted i would have posted this earlier except i just saw the thread
     
  14. Offline

    McLuke500

    Its ok as you can see from the source it was a 5 minute plugin!
     
  15. Offline

    njb_said

    k :p thanks :D
     

Share This Page