Skip to content

Instantly share code, notes, and snippets.

@JustBru00
Created September 11, 2016 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JustBru00/ccfd04cc602dc9dde8f56996481546e1 to your computer and use it in GitHub Desktop.
Save JustBru00/ccfd04cc602dc9dde8f56996481546e1 to your computer and use it in GitHub Desktop.
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
exampleMap.put("uuidhere1", 36);
exampleMap.put("uuidhere2", 36);
exampleMap.put("uuidhere3", 2);
exampleMap.put("uuidhere4", 36);
exampleMap.put("uuidhere5", 3);
exampleMap.put("uuidhere6", 36);
exampleMap.put("uuidhere7", 5);
exampleMap.put("uuidhere8", 36);
main.getConfig().set("revenger-data", exampleMap);
main.saveConfig();
sender.sendMessage("Saved map to config.");
@SuppressWarnings("unchecked")
HashMap<String, Integer> getStuff = (HashMap<String, Integer>) main.getConfig().get("revenger-data");
if (getStuff == null) {
sender.sendMessage("NULL GETSTUFF");
return true;
}
for(Entry<String, Integer> entry : getStuff.entrySet()) {
String key = entry.getKey();
int value = entry.getValue();
sender.sendMessage("Key: " + key + " Data: " + value);
}
//getStuff.forEach((k, v) -> sender.sendMessage("key: " + k + " Value: " + v)); // JAVA 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment