ChatColor argument?

Discussion in 'Spigot Plugin Help' started by JustEnrique_, Jul 27, 2018.

  1. Hi.

    So I wanted to make something that uses a command called /color. Which can have 1 argument, I wanted to make it so that the chat shows you what color you typed in that specific color. So for example you used the command /color red and then you get sent a message with "The color you picked was " + ChatColor from the argument + "args[0]". Something like that.

    >Uploaded the code I have currently in this post.


    Attached Files:

    • Code.png
      File size:
      43.6 KB
  2. Hey

    Make a map and put the the player as key and the color as value.
    In the chat event get the color from the map via player.

    Small example, written by hand.
    Code (Java):
    //In main or an other class
    Map<Player,ChatColor> colorforplayer = new LinkedList();

    //In the command
    //player: is the command sender.
    //color: translate from args[0] to chat color.

    //In chat event
    ChatColor color = colorforplayer.get(player);
    // translate the chat message
    Best regards