Advertisement
Guest User

Untitled

a guest
Aug 8th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. private String AUTOMESSAGE_FILE = "AutoMessage.properties";
  2. private String FILE_PLUGIN = "plugins/" + main.getName() + "/";
  3.  
  4. public LinkedList<String> getMessages() {
  5. LinkedList<String> messages = new LinkedList<>();
  6. Properties prop = new Properties();
  7. InputStream input = null;
  8. try {
  9. input = new FileInputStream(FILE_PLUGIN + AUTOMESSAGE_FILE);
  10. prop.load(input);
  11. for (int i = 0; i < 20; i++) {
  12. messages.add(getMessage(i));
  13. }
  14. } catch (IOException e) {
  15. e.printStackTrace();
  16. } finally {
  17. if (input != null) {
  18. try {
  19. input.close();
  20. } catch (IOException e) {
  21. e.printStackTrace();
  22. }
  23. }
  24. }
  25. return messages;
  26. }
  27.  
  28. public String getMessage(int i) {
  29. String s = "";
  30. Properties prop = new Properties();
  31. InputStream input = null;
  32. try {
  33. input = new FileInputStream(FILE_PLUGIN + AUTOMESSAGE_FILE);
  34. prop.load(input);
  35. s = prop.getProperty("Message" + i).replace("&", "ยง");
  36. } catch (IOException e) {
  37. e.printStackTrace();
  38. } finally {
  39. if (input != null) {
  40. try {
  41. input.close();
  42. } catch (IOException e) {
  43. e.printStackTrace();
  44. }
  45. }
  46. }
  47. return s;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement