Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JsonFormatInfo.java
- public class JsonFormatInfo {
- // Extented part
- private JsonFormat[] jfName;
- private JsonFormat[] jfPrefix;
- private JsonFormat[] jfSuffix;
- public JsonFormatInfo(MineverseChat plugin) {
- int priority = 0;
- ConfigurationSection cs;
- cs = plugin.getConfig().getConfigurationSection("jsonformatting_name");
- this.jfName = new JsonFormat[cs.getKeys(false).size()];
- int x = 0;
- for (String key : cs.getKeys(false)) {
- String name = key;
- priority = cs.getInt(key + ".priority", 0);
- List hoverText = cs.getStringList(key + ".hover_text");
- String clickType = cs.getString(key + ".click_type");
- String clickText = cs.getString(key + ".click_text");
- JsonFormat j = new JsonFormat(name, priority, hoverText, clickType, clickText, null, null, null, null, null, null);
- this.jfPrefix[(x++)] = j;
- }
- cs = plugin.getConfig().getConfigurationSection("jsonformatting_prefix");
- this.jfPrefix = new JsonFormat[cs.getKeys(false).size()];
- x = 0;
- for (String key : cs.getKeys(false)) {
- String name = key;
- priority = cs.getInt(key + ".priority", 0);
- List hoverText = cs.getStringList(key + ".hover_text");
- String clickType = cs.getString(key + ".click_type");
- String clickText = cs.getString(key + ".click_text");
- JsonFormat j = new JsonFormat(name, priority, null, null, null, hoverText, clickType, clickText, null, null, null);
- this.jfPrefix[(x++)] = j;
- }
- cs = plugin.getConfig().getConfigurationSection("jsonformatting_suffix");
- this.jfPrefix = new JsonFormat[cs.getKeys(false).size()];
- x = 0;
- for (String key : cs.getKeys(false)) {
- String name = key;
- priority = cs.getInt(key + ".priority", 0);
- List hoverText = cs.getStringList(key + ".hover_text");
- String clickType = cs.getString(key + ".click_type");
- String clickText = cs.getString(key + ".click_text");
- JsonFormat j = new JsonFormat(name, priority, null, null, null, null, null, null, clickType, clickText, hoverText);
- this.jfPrefix[(x++)] = j;
- }
- }
- public JsonFormat[] getJsonFormatsName() {
- return this.jfName;
- }
- public JsonFormat[] getJsonFormatsPrefix() {
- return this.jfPrefix;
- }
- public JsonFormat[] getJsonFormatsSuffix() {
- return this.jfSuffix;
- }
- public JsonFormat getJsonFormatName(String name) {
- for (JsonFormat j : this.jfName) {
- if (j.getName().equalsIgnoreCase(name))
- return j;
- }
- return getJsonFormatName("Default");
- }
- public JsonFormat getJsonFormatPrefix(String name) {
- for (JsonFormat j : this.jfPrefix) {
- if (j.getName().equalsIgnoreCase(name))
- return j;
- }
- return getJsonFormatPrefix("Default");
- }
- public JsonFormat getJsonFormatSuffix(String name) {
- for (JsonFormat j : this.jfSuffix) {
- if (j.getName().equalsIgnoreCase(name))
- return j;
- }
- return getJsonFormatSuffix("Default");
- }
- // Ended extented part
- }
Add Comment
Please, Sign In to add comment