HashMaps Help

Discussion in 'Plugin Development' started by bubblefat_, Jun 2, 2015.

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


    I am making a mute command. I need to know how to store a players username and the Reason in a HashMap
    Reason (open)

    String reason = "";
    for (int i = 1; i != args.length; i++)
    reason += args + " ";

    Then from a different class how to get the players name and the reason.
  2. Offline


    Make a HashMap that stores a UUID and String
    HashMap<UUID,String> mutes = new HashMap<UUID, String>();
  3. Offline


    So it should be:
    public Map<UUID, String> mutedPlayers = new HashMap<>();

    Anyway, in general, bubblefat_, it seems you don't really know the basics of Java, I'm not trying to offend you, but Map is a key Java feature, as well as the "public" modifier, along with for example, the "static" modifier.

    You should try learning about all of this before creating Bukkit plugins, otherwise the forums gets spammed with threads asking basic questions.

    Example of errors: "i != args.length"
    Use: i < args.length

    "String", use a StringBuilder, it's more efficient in loops.
    Last edited: Jun 3, 2015
Thread Status:
Not open for further replies.

Share This Page