Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String AUTOMESSAGE_FILE = "AutoMessage.properties";
- private String FILE_PLUGIN = "plugins/" + main.getName() + "/";
- public LinkedList<String> getMessages() {
- LinkedList<String> messages = new LinkedList<>();
- Properties prop = new Properties();
- InputStream input = null;
- try {
- input = new FileInputStream(FILE_PLUGIN + AUTOMESSAGE_FILE);
- prop.load(input);
- for (int i = 0; i < 20; i++) {
- messages.add(getMessage(i));
- }
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- return messages;
- }
- public String getMessage(int i) {
- String s = "";
- Properties prop = new Properties();
- InputStream input = null;
- try {
- input = new FileInputStream(FILE_PLUGIN + AUTOMESSAGE_FILE);
- prop.load(input);
- s = prop.getProperty("Message" + i).replace("&", "ยง");
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement