mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-27 12:35:12 +01:00
auto-register old plugins
This commit is contained in:
parent
147f43b38a
commit
9bf3239279
@ -28,6 +28,7 @@ import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.json.simple.JSONObject;
|
||||
@ -89,9 +90,75 @@ public class SongodaCore {
|
||||
Bukkit.getPluginManager().registerEvents(loginListener, javaPlugin);
|
||||
Bukkit.getPluginManager().registerEvents(shadingListener, javaPlugin);
|
||||
// we aggressevely want to own this command
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(javaPlugin, ()->{CommandManager.registerCommandDynamically(piggybackedPlugin, "songoda", commandManager, commandManager);}, 10 * 60 * 1);
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(javaPlugin, ()->{CommandManager.registerCommandDynamically(piggybackedPlugin, "songoda", commandManager, commandManager);}, 20 * 60 * 1);
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(javaPlugin, ()->{CommandManager.registerCommandDynamically(piggybackedPlugin, "songoda", commandManager, commandManager);}, 20 * 60 * 2);
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(javaPlugin, ()->{CommandManager.registerCommandDynamically(piggybackedPlugin, "songoda", commandManager, commandManager);}, 20 * 60 * 2);
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(javaPlugin, ()->registerAllPlugins(), 20 * 60 * 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register plugins that may not have been updated yet
|
||||
*/
|
||||
private void registerAllPlugins() {
|
||||
PluginManager pm = Bukkit.getPluginManager();
|
||||
String p;
|
||||
if (!isRegistered(p = "EpicAnchors") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 31, LegacyMaterials.END_PORTAL_FRAME.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicBosses") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 19, LegacyMaterials.ZOMBIE_SPAWN_EGG.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicEnchants") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 67, LegacyMaterials.DIAMOND_SWORD.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicFarming") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 21, LegacyMaterials.WHEAT.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicFurnaces") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 22, LegacyMaterials.FURNACE.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicHeads") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 26, LegacyMaterials.PLAYER_HEAD.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicHoppers") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 15, LegacyMaterials.HOPPER.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicLevels") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 44, LegacyMaterials.NETHER_STAR.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicSpawners") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 13, LegacyMaterials.SPAWNER.name());
|
||||
}
|
||||
if (!isRegistered(p = "EpicVouchers") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 25, LegacyMaterials.EMERALD.name());
|
||||
}
|
||||
if (!isRegistered(p = "FabledSkyBlock") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 17, LegacyMaterials.GRASS_BLOCK.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateCatcher") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 51, LegacyMaterials.EGG.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateClaims") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 65, LegacyMaterials.CHEST.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateFishing") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 59, LegacyMaterials.COD.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateKits") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 14, LegacyMaterials.BEACON.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateModeration") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 29, LegacyMaterials.DIAMOND_CHESTPLATE.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateRepairing") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 20, LegacyMaterials.ANVIL.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateStacker") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 16, LegacyMaterials.IRON_INGOT.name());
|
||||
}
|
||||
if (!isRegistered(p = "UltimateTimber") && pm.isPluginEnabled(p)) {
|
||||
register((JavaPlugin) pm.getPlugin(p), 18, LegacyMaterials.IRON_AXE.name());
|
||||
}
|
||||
}
|
||||
|
||||
private void register(JavaPlugin plugin, int pluginID, String icon) {
|
||||
@ -156,6 +223,10 @@ public class SongodaCore {
|
||||
return prefix + " ";
|
||||
}
|
||||
|
||||
public static boolean isRegistered(String plugin) {
|
||||
return registeredPlugins.stream().anyMatch(p -> p.getJavaPlugin().getName().equalsIgnoreCase(plugin));
|
||||
}
|
||||
|
||||
public static JavaPlugin getHijackedPlugin() {
|
||||
return INSTANCE == null ? null : INSTANCE.piggybackedPlugin;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.songoda.core.core;
|
||||
|
||||
import com.songoda.core.core.PluginInfoModule;
|
||||
import com.songoda.core.compatibility.LegacyMaterials;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.json.simple.JSONObject;
|
||||
@ -36,7 +35,7 @@ public final class PluginInfo {
|
||||
|
||||
public void setLatestVersion(String latestVersion) {
|
||||
this.latestVersion = latestVersion;
|
||||
hasUpdate = !javaPlugin.getDescription().getVersion().equalsIgnoreCase(latestVersion);
|
||||
hasUpdate = latestVersion != null && !latestVersion.isEmpty() && !javaPlugin.getDescription().getVersion().equalsIgnoreCase(latestVersion);
|
||||
}
|
||||
|
||||
public String getNotification() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.songoda.core.gui;
|
||||
|
||||
import com.songoda.core.compatibility.LegacyMaterials;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -37,12 +38,62 @@ public class GuiUtils {
|
||||
return item;
|
||||
}
|
||||
|
||||
public static List<String> getSafeLore(String ... lines) {
|
||||
return getSafeLore(Arrays.asList(lines));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a lore value that will display fine on clients using auto gui scaling
|
||||
*
|
||||
* @param lines lines to format
|
||||
* @return newline and length-corrected item lore
|
||||
*/
|
||||
public static List<String> getSafeLore(List<String> lines) {
|
||||
// fix newlines
|
||||
ArrayList<String> newLore = new ArrayList();
|
||||
for (String l : lines) {
|
||||
for (String l2 : l.split("\n")) {
|
||||
if (l2.length() < 58) {
|
||||
newLore.add(l2);
|
||||
} else {
|
||||
// try to shorten the string
|
||||
String shorterString = l2;
|
||||
ChatColor lastColor = null; // todo? probably should also track formatting codes..
|
||||
int line = 0;
|
||||
while (shorterString.length() > 50) {
|
||||
int breakingSpace = -1;
|
||||
for (int i = 0; i < 55; ++i) {
|
||||
if (shorterString.charAt(i) == ChatColor.COLOR_CHAR) {
|
||||
lastColor = ChatColor.getByChar(shorterString.charAt(++i));
|
||||
} else if (shorterString.charAt(i) == ' ' || shorterString.charAt(i) == '-') {
|
||||
breakingSpace = i;
|
||||
}
|
||||
}
|
||||
if (breakingSpace == -1) {
|
||||
breakingSpace = Math.max(55, shorterString.length());
|
||||
newLore.add((line != 0 && lastColor != null ? lastColor.toString() : "") + shorterString.substring(0, breakingSpace) + "-");
|
||||
shorterString = breakingSpace == shorterString.length() ? "" : shorterString.substring(breakingSpace + 1);
|
||||
} else {
|
||||
newLore.add((line != 0 && lastColor != null ? lastColor.toString() : "") + shorterString.substring(0, breakingSpace));
|
||||
shorterString = breakingSpace == shorterString.length() ? "" : shorterString.substring(breakingSpace + 1);
|
||||
}
|
||||
++line;
|
||||
}
|
||||
if (!shorterString.isEmpty()) {
|
||||
newLore.add((line != 0 && lastColor != null ? lastColor.toString() : "") + " " + shorterString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return newLore;
|
||||
}
|
||||
|
||||
public static ItemStack createButtonItem(LegacyMaterials mat, String title, String... lore) {
|
||||
ItemStack item = mat.getItem();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(title);
|
||||
if (lore != null) {
|
||||
meta.setLore(Arrays.asList(lore.length == 1 ? lore[0].split("\n") : lore));
|
||||
meta.setLore(getSafeLore(lore));
|
||||
} else {
|
||||
meta.setLore(Collections.EMPTY_LIST);
|
||||
}
|
||||
@ -55,7 +106,7 @@ public class GuiUtils {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(title);
|
||||
if (lore != null) {
|
||||
meta.setLore(Arrays.asList(lore.length == 1 ? lore[0].split("\n") : lore));
|
||||
meta.setLore(getSafeLore(lore));
|
||||
} else {
|
||||
meta.setLore(Collections.EMPTY_LIST);
|
||||
}
|
||||
@ -68,7 +119,7 @@ public class GuiUtils {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(title);
|
||||
if (lore != null) {
|
||||
meta.setLore(lore.size() == 1 ? Arrays.asList(lore.get(0).split("\n")) : lore);
|
||||
meta.setLore(getSafeLore(lore));
|
||||
} else {
|
||||
meta.setLore(Collections.EMPTY_LIST);
|
||||
}
|
||||
@ -81,7 +132,7 @@ public class GuiUtils {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(title);
|
||||
if (lore != null) {
|
||||
meta.setLore(lore.size() == 1 ? Arrays.asList(lore.get(0).split("\n")) : lore);
|
||||
meta.setLore(getSafeLore(lore));
|
||||
} else {
|
||||
meta.setLore(Collections.EMPTY_LIST);
|
||||
}
|
||||
@ -93,7 +144,7 @@ public class GuiUtils {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(title);
|
||||
if (lore != null) {
|
||||
meta.setLore(Arrays.asList(lore.length == 1 ? lore[0].split("\n") : lore));
|
||||
meta.setLore(getSafeLore(lore));
|
||||
} else {
|
||||
meta.setLore(Collections.EMPTY_LIST);
|
||||
}
|
||||
@ -108,7 +159,7 @@ public class GuiUtils {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(title);
|
||||
if (lore != null) {
|
||||
meta.setLore(Arrays.asList(lore.length == 1 ? lore[0].split("\n") : lore));
|
||||
meta.setLore(getSafeLore(lore));
|
||||
} else {
|
||||
meta.setLore(Collections.EMPTY_LIST);
|
||||
}
|
||||
@ -123,7 +174,7 @@ public class GuiUtils {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(title);
|
||||
if (lore != null) {
|
||||
meta.setLore(Arrays.asList(lore.length == 1 ? lore[0].split("\n") : lore));
|
||||
meta.setLore(getSafeLore(lore));
|
||||
} else {
|
||||
meta.setLore(Collections.EMPTY_LIST);
|
||||
}
|
||||
@ -135,7 +186,7 @@ public class GuiUtils {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(title);
|
||||
if (lore != null) {
|
||||
meta.setLore(lore.size() == 1 ? Arrays.asList(lore.get(0).split("\n")) : lore);
|
||||
meta.setLore(getSafeLore(lore));
|
||||
} else {
|
||||
meta.setLore(Collections.EMPTY_LIST);
|
||||
}
|
||||
@ -150,7 +201,7 @@ public class GuiUtils {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(title);
|
||||
if (lore != null) {
|
||||
meta.setLore(lore.size() == 1 ? Arrays.asList(lore.get(0).split("\n")) : lore);
|
||||
meta.setLore(getSafeLore(lore));
|
||||
} else {
|
||||
meta.setLore(Collections.EMPTY_LIST);
|
||||
}
|
||||
@ -165,7 +216,7 @@ public class GuiUtils {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(title);
|
||||
if (lore != null) {
|
||||
meta.setLore(lore.size() == 1 ? Arrays.asList(lore.get(0).split("\n")) : lore);
|
||||
meta.setLore(getSafeLore(lore));
|
||||
} else {
|
||||
meta.setLore(Collections.EMPTY_LIST);
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.songoda.core.settingsv2.adapters;
|
||||
package com.songoda.core.settingsv2;
|
||||
|
||||
import com.songoda.core.settingsv2.Config;
|
||||
import com.songoda.core.settingsv2.SongodaConfigurationSection;
|
||||
import java.util.List;
|
||||
import org.bukkit.configuration.MemoryConfigurationOptions;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -9,7 +7,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ConfigOptionsAdapter extends MemoryConfigurationOptions {
|
||||
|
||||
public ConfigOptionsAdapter(SongodaConfigurationSection root) {
|
||||
ConfigOptionsAdapter(SongodaConfigurationSection root) {
|
||||
super(root);
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.songoda.core.settingsv2;
|
||||
|
||||
import com.songoda.core.compatibility.LegacyMaterials;
|
||||
import com.songoda.core.settingsv2.adapters.ConfigDefaultsAdapter;
|
||||
import com.songoda.core.settingsv2.adapters.ConfigOptionsAdapter;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@ -56,7 +54,7 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
|
||||
SongodaConfigurationSection(SongodaConfigurationSection root, SongodaConfigurationSection parent, String path, boolean isDefault) {
|
||||
this.root = root;
|
||||
this.parent = parent;
|
||||
this.fullPath = parent.fullPath + path + root.pathChar;
|
||||
this.fullPath = path != null ? parent.fullPath + path + root.pathChar : parent.fullPath;
|
||||
this.isDefault = isDefault;
|
||||
configComments = defaultComments = null;
|
||||
defaults = null;
|
||||
@ -186,13 +184,13 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigDefaultsAdapter getDefaults() {
|
||||
return new ConfigDefaultsAdapter(root, this);
|
||||
public SongodaConfigurationSection getDefaults() {
|
||||
return new SongodaConfigurationSection(root, this, null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigDefaultsAdapter getDefaultSection() {
|
||||
return new ConfigDefaultsAdapter(root, this);
|
||||
public SongodaConfigurationSection getDefaultSection() {
|
||||
return new SongodaConfigurationSection(root, this, null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,361 +0,0 @@
|
||||
package com.songoda.core.settingsv2.adapters;
|
||||
|
||||
import com.songoda.core.settingsv2.SongodaConfigurationSection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.bukkit.configuration.ConfigurationOptions;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class ConfigDefaultsAdapter implements Configuration {
|
||||
|
||||
final SongodaConfigurationSection root;
|
||||
final SongodaConfigurationSection current;
|
||||
|
||||
public ConfigDefaultsAdapter(SongodaConfigurationSection config, SongodaConfigurationSection current) {
|
||||
this.root = config;
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDefault(String string, Object o) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDefaults(Map<String, Object> map) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDefaults(Configuration c) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaults(Configuration c) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration getDefaults() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationOptions options() {
|
||||
return new ConfigOptionsAdapter(root);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getKeys(boolean bln) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getValues(boolean bln) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String string, boolean bln) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSet(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentPath() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration getRoot() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection getParent() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(String string, Object o) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(String string, Object o) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection createSection(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection createSection(String string, Map<?, ?> map) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(String string, String string1) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isString(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(String string, int i) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInt(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBoolean(String string, boolean bln) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBoolean(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDouble(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDouble(String string, double d) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDouble(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLong(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLong(String string, long l) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLong(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> getList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> getList(String string, List<?> list) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getStringList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getIntegerList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Boolean> getBooleanList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Double> getDoubleList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Float> getFloatList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getLongList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Byte> getByteList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Character> getCharacterList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Short> getShortList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<?, ?>> getMapList(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getObject(String string, Class<T> type) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getObject(String string, Class<T> type, T t) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends ConfigurationSerializable> T getSerializable(String string, Class<T> type) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends ConfigurationSerializable> T getSerializable(String string, Class<T> type, T t) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getVector(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getVector(String string, Vector vector) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVector(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfflinePlayer getOfflinePlayer(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfflinePlayer getOfflinePlayer(String string, OfflinePlayer op) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOfflinePlayer(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(String string, ItemStack is) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemStack(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getColor(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getColor(String string, Color color) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isColor(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection getConfigurationSection(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConfigurationSection(String string) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationSection getDefaultSection() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.songoda.core.settingsv2.editor;
|
||||
|
||||
import com.songoda.core.gui.Gui;
|
||||
import com.songoda.core.settingsv2.Config;
|
||||
import com.songoda.core.settingsv2.SongodaConfigurationSection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigEditorGui extends Gui {
|
||||
final Config config;
|
||||
List<String> keys = new ArrayList();
|
||||
List<String> sections = new ArrayList();
|
||||
List<String> settings = new ArrayList();
|
||||
|
||||
public ConfigEditorGui(Config config, SongodaConfigurationSection node) {
|
||||
this.config = config;
|
||||
for(String key : node.getKeys(false)) {
|
||||
if(node.isConfigurationSection(key)) {
|
||||
sections.add(key);
|
||||
keys.add(key); // sections listed first
|
||||
} else {
|
||||
settings.add(key);
|
||||
}
|
||||
}
|
||||
keys.addAll(settings); // normal settings next
|
||||
|
||||
// next we need to display the config settings, with the ability to browse more pages
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user