calling a saved args

Discussion in 'Spigot Plugin Development' started by FletchBait, May 23, 2017.

  1. Hi, I'm new here and I need help
    I'm making a guild plugin, this is the command /guild create <guild name>, first it will be saved in a separate config file (<guild name>.yml) inside of /Guilds folder, then the problem is that because the guild name is not defined, I don't know how to call that argument.
    I have some sub-commands, one of them is /guild accept <guild name>...
    sorry if I can't explain it clearly, and I'm bad in english
    and I'm kind of new in spigot coding
     
  2. Can't you take the name of the .yml files? There's no need to save the guild name if the .yml file if the filename already matches the guild name.
     
  3. oh, ok sir, I'll try it
     
  4. I'd save both, just for the case of serializing/deserializing.

    Let's say you have an object

    Code (Java):
    public class Guild {

      // The name
      private String id;

      public String getName() {
        return this.id;
      }

    }
    I'd just use the name of the file as a way of identifying which file/data belongs to which guild.