{Help} Using arguments with words!

Discussion in 'Plugin Development' started by mactown21, Sep 14, 2013.

?

Is This Possible to make?

  1. Yes

    1 vote(s)
    100.0%
  2. No

    0 vote(s)
    0.0%
Thread Status:
Not open for further replies.
  1. Offline

    mactown21

    I want to add a arguments for a plugin that i need really bad, its for a plugin that im making and ik it sounds funny but i havnt made a plugin in a while,

    Example, if someone do a command that is like /areana create [name]
    and you dont want the play to have the name no longer than 10 characters how can you stop that?
    And get a command back that says "your arena name cannot be longer than 10 characters, please make it shorter

    And if someone would like to be a coding buddy with me because i make private plugins, add me on skype: mactown51
     
  2. Offline

    boss86741

    if (args[1].length() > 10) {
    sender.sendMessage("No more than 10 characters!")
    }
     
  3. Offline

    mactown21

    And what is that, since i have the arg, how to block it so they cant continue using it, like the have the command as /arena create {Name} and if they make the arena name to long then it wont create?

    if(args.length == 2){


    if(args[0].equalsIgnoreCase("create")){
    Arena arena = new Arena(args[1], this);
    getConfig().addDefault("Arenas." + arena.getName(), args[1]);
    getConfig().addDefault("Arenas." + arena.getName() + ".Counter", 0);
    getConfig().addDefault("Arenas." + arena.getName() + ".Signs.Counter", 0);
    actualConfig.addDefault(arena.getName() + ".MaxPlayers", 8);
    actualConfig.addDefault(arena.getName() + ".AutoStartPlayers", 3);
    actualConfig.addDefault(arena.getName() + ".Countdown", 30);
    actualConfig.addDefault(arena.getName() + ".KillsToEnd", 25);
    actualConfig.addDefault(arena.getName() + ".Type", "Kills");
    actualConfig.addDefault(arena.getName() + ".Lives", "5");

    m.saveYamls();
    if(getConfig().contains("Arenas.List")){
    List<String> list = getConfig().getStringList("Arenas.List");
    list.add(arena.getName());
    getConfig().set("Arenas.List", list);
     
  4. mactown21
    Add this
    Code:
    if (args[1].length() > 10) return true;
    under this
    Code:
    if(args[0].equalsIgnoreCase("create")){
     
  5. Offline

    mactown21

    but how do i stop them from using the command, even if i do add this it will say that the arena is created, and then says that the arena name cannot be longer than 9 characters!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
Thread Status:
Not open for further replies.

Share This Page