Solved Naming object

Discussion in 'Plugin Help/Development/Requests' started by 0verFull, Apr 7, 2015.

Thread Status:
Not open for further replies.
  1. Offline


    Hi everyone,

    In my plugin, I want to create a new object (with a defined constructor in another class) but I want this object take the name of the first args of the command
    The probleme is with the "args[0]"

    code :

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){

    // Player p = (Player) sender;


    ChatGroupPluginGroup args[0] = new ChatGroupPluginGroup(ChatColor.valueOf(args[1]), new ArrayList<Player>(), args[2]);
    return true;
    return false;
  2. You can't set the variable name to a variable. Why do you even want to do this?
  3. Offline


    Dont know what you are trying to do but maybe you can use HahMap? or something like that...
  4. Offline


    What does that have to do with anything?
  5. Offline



    dont know what he is trying to do,I Just suggested it maybe it will help him maybe not. you dont have to jump every time u see something that you dont think its relevant/related...
  6. Offline


    If You want, I want to create a plugin that when a Player use the command /cgcreate , it created a chat group in game. I create the group with my constructor ChatGroupPluginGroup
  7. Offline



    So you want to store all the player the belong to a chat group by name? you can use config to store chat groups
    for example:
    ArrayList <String>  chatGroupList=new ArrayList<String>();
    //add your players by:
    getConfig().set("ChatGroupPluginGroup." +args[0],chatGroupList); //args[0]: your name i guess...
  8. Offline


Thread Status:
Not open for further replies.

Share This Page