jessefjxm

Untitled

Aug 8th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. // JsonFormatInfo.java
  2.  
  3. public class JsonFormatInfo {
  4. // Extented part
  5. private JsonFormat[] jfName;
  6. private JsonFormat[] jfPrefix;
  7. private JsonFormat[] jfSuffix;
  8.  
  9. public JsonFormatInfo(MineverseChat plugin) {
  10. int priority = 0;
  11.  
  12. ConfigurationSection cs;
  13. cs = plugin.getConfig().getConfigurationSection("jsonformatting_name");
  14. this.jfName = new JsonFormat[cs.getKeys(false).size()];
  15. int x = 0;
  16. for (String key : cs.getKeys(false)) {
  17. String name = key;
  18. priority = cs.getInt(key + ".priority", 0);
  19. List hoverText = cs.getStringList(key + ".hover_text");
  20. String clickType = cs.getString(key + ".click_type");
  21. String clickText = cs.getString(key + ".click_text");
  22. JsonFormat j = new JsonFormat(name, priority, hoverText, clickType, clickText, null, null, null, null, null, null);
  23. this.jfPrefix[(x++)] = j;
  24. }
  25.  
  26. cs = plugin.getConfig().getConfigurationSection("jsonformatting_prefix");
  27. this.jfPrefix = new JsonFormat[cs.getKeys(false).size()];
  28. x = 0;
  29. for (String key : cs.getKeys(false)) {
  30. String name = key;
  31. priority = cs.getInt(key + ".priority", 0);
  32. List hoverText = cs.getStringList(key + ".hover_text");
  33. String clickType = cs.getString(key + ".click_type");
  34. String clickText = cs.getString(key + ".click_text");
  35. JsonFormat j = new JsonFormat(name, priority, null, null, null, hoverText, clickType, clickText, null, null, null);
  36. this.jfPrefix[(x++)] = j;
  37. }
  38.  
  39. cs = plugin.getConfig().getConfigurationSection("jsonformatting_suffix");
  40. this.jfPrefix = new JsonFormat[cs.getKeys(false).size()];
  41. x = 0;
  42. for (String key : cs.getKeys(false)) {
  43. String name = key;
  44. priority = cs.getInt(key + ".priority", 0);
  45. List hoverText = cs.getStringList(key + ".hover_text");
  46. String clickType = cs.getString(key + ".click_type");
  47. String clickText = cs.getString(key + ".click_text");
  48. JsonFormat j = new JsonFormat(name, priority, null, null, null, null, null, null, clickType, clickText, hoverText);
  49. this.jfPrefix[(x++)] = j;
  50. }
  51. }
  52.  
  53. public JsonFormat[] getJsonFormatsName() {
  54. return this.jfName;
  55. }
  56.  
  57. public JsonFormat[] getJsonFormatsPrefix() {
  58. return this.jfPrefix;
  59. }
  60.  
  61. public JsonFormat[] getJsonFormatsSuffix() {
  62. return this.jfSuffix;
  63. }
  64.  
  65. public JsonFormat getJsonFormatName(String name) {
  66. for (JsonFormat j : this.jfName) {
  67. if (j.getName().equalsIgnoreCase(name))
  68. return j;
  69. }
  70. return getJsonFormatName("Default");
  71. }
  72.  
  73. public JsonFormat getJsonFormatPrefix(String name) {
  74. for (JsonFormat j : this.jfPrefix) {
  75. if (j.getName().equalsIgnoreCase(name))
  76. return j;
  77. }
  78. return getJsonFormatPrefix("Default");
  79. }
  80.  
  81. public JsonFormat getJsonFormatSuffix(String name) {
  82. for (JsonFormat j : this.jfSuffix) {
  83. if (j.getName().equalsIgnoreCase(name))
  84. return j;
  85. }
  86. return getJsonFormatSuffix("Default");
  87. }
  88. // Ended extented part
  89. }
Add Comment
Please, Sign In to add comment