1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Multiple args or command

Discussion in 'Java' started by Deku, Sep 6, 2020.

  1. Deku

    Deku Member

    Joined:
    Jul 12, 2020
    Messages:
    36
    Likes Received:
    0
    How can I make sure that in a command there is a command (/ roles) that by adding different args (doctor, soldier) gives me different answers?

    There is my code on command:

    Code (Text):
    1.         if(cmd.getName().equalsIgnoreCase("roles")) {
    2.             if (args.length == 1) {        
    3.                 if (args[0].contains("0")) {        
    4.                     sender.sendMessage(main.getInstance().getConfig().getString("ruolo.medico").replaceAll("&", "§"));    
    5.             }
    6.             }
    Main code:
    Code (Text):
    1. package comr;
    2.  
    3. import org.bukkit.plugin.java.JavaPlugin;
    4.  
    5. public class chunk extends JavaPlugin {
    6.  
    7.     public static chunk plugin;
    8.  
    9.        public void onEnable() {    
    10.            plugin = this;        
    11.            getCommand("roles").setExecutor(new comand ());                
    12.            this.saveDefaultConfig();        
    13.        }
    14.  
    15.        public void onDisable() {
    16.            System.out.println("§9a");
    17.        }
    18.          public static chunk getInstance() {
    19.             return plugin;
    20.     }
    21.          public void onReload() {    
    22.            reloadConfig();        
    23.            plugin.getServer().getPluginManager().disablePlugin(plugin);
    24.            plugin.getServer().getPluginManager().enablePlugin(plugin);              
    25.        }
    26. }
    27.  
     
  2. i_know_Brian

    i_know_Brian Member

    Joined:
    Aug 27, 2019
    Messages:
    4
    Likes Received:
    0
    did you mean rules?
     
  3. Blue

    Moderator Supporter ++

    Joined:
    Apr 15, 2018
    Messages:
    30
    Likes Received:
    5
    Use the String#equals and String#equalsIgnoreCase methods and the length of the argument array.
     
  4. Deku

    Deku Member

    Joined:
    Jul 12, 2020
    Messages:
    36
    Likes Received:
    0
    [QUOTE = "Blue, post: 53031, member: 6298"] Utilizza i metodi String # equals e String # equalsIgnoreCase e la lunghezza dell'array di argomenti. [/ QUOTE]
    thanks youu
     

Share This Page

Loading...