Filled a simple plugin to log player name from cmd needed w/ source

Discussion in 'Archived: Plugin Requests' started by Arrxzon, Feb 26, 2014.

  1. Offline

    Arrxzon

    Hi,
    i have this idea for my server and i am not the best with java,

    what i need is a plugin that would simply log a player name to a file upon entering command, complexity dose not matter once it does just that. I would just modify command/permissions and i would be set for the idea i have.

    thanks in advance,
     
  2. Online

    timtower Administrator Administrator Moderator

    Arrxzon Maybe tell the command? Or what you can do with it?
     
  3. Offline

    Arrxzon

    @timtowerdoes does not matter just anything, i can easily modify once i decide all that needs to be done is

    the player enters a certain command /command here
    if the player has permission (i can add perms if you want to save time)
    then the name will be logged to a file of your choice
     
  4. Online

    timtower Administrator Administrator Moderator

    Arrxzon It isn't that hard to be honest, get a list from the config, add the current player, save the list again.
     
  5. Offline

    Arrxzon

    timtower i wouldn't say it is that hard either, guess i will try over the weekend.
     
  6. Offline

    DrEinsteinium

    Arrxzon Do you mind explaining the main point of this plugin? Is it for administrative purposes? Or just purely to log who is using a command?

    I was thinking of doing a plugin similar to this but I haven't found the motivation yet.
     
  7. Offline

    killerman747

    Something like this?
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
    2. if(sender instanceof Player){
    3. Player player = (Player) sender;
    4. if(commandLabel.equalsIgnoreCase("addname")){
    5. if(args.length>=1){
    6. getConfig().set(player.getName(), args);
    7. this.saveDefaultConfig();
    8. saveConfig();
    9. player.sendMessage(ChatColor.GREEN + "You have added your name to the list!");
    10. }
    11. else{
    12. player.sendMessage(ChatColor.DARK_RED + "You must include your name!");
    13. }
     
  8. Offline

    Arrxzon

    killerman747
    that looks nice thanks,
    how would i check if the name already exists in the file ?
     
  9. Offline

    killerman747

    That would create a config file that looks like
    Code:
    Yourname: Yourname
    for each user. Are you looking to create a list of names like: Yourname, Yourname1, Yourname2?
     
  10. Offline

    Arrxzon

    killerman747
    nah this is perfect don't matter about checking if name already exists
    thanks for that
     

Share This Page