Advertisement
Guest User

Untitled

a guest
Aug 24th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. protected Map<String, String> loadLang(String lang) {
  2. try {
  3. String content = Utils.readFile(getClass().getClassLoader().getResourceAsStream("lang/"+lang+".ini"));
  4. Map<String, String> d = new HashMap<>();
  5. for (String line : content.split("n")) {
  6. line = line.trim();
  7. if (line.equals("") || line.charAt(0) == '#') {
  8. continue;
  9. }
  10. String[] t = line.split("=");
  11. if (t.length < 2) {
  12. continue;
  13. }
  14. String key = t[0];
  15. String value = "";
  16. for (int i = 1; i < t.length - 1; i++) {
  17. value += t[i] + "=";
  18. }
  19. value += t[t.length - 1];
  20. if (value.equals("")) {
  21. continue;
  22. }
  23. d.put(key, value);
  24. }
  25. return d;
  26. } catch (IOException e) {
  27. Server.getInstance().getLogger().logException(e);
  28. return null;
  29. }
  30. }
  31. Далее this.languages().get(key); мне выведет value. В котором и нужно реализовать перенос строки
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement