begin implementing new config system

This commit is contained in:
jascotty2 2019-08-31 12:28:11 -05:00
parent 4f669bb360
commit 7f3ac8f5a2
25 changed files with 630 additions and 155 deletions

View File

@ -1,7 +1,10 @@
package com.songoda.core;
import com.songoda.core.configuration.Config;
import com.songoda.core.configuration.ConfigFileConfigurationAdapter;
import com.songoda.core.locale.Locale;
import com.songoda.core.utils.Metrics;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -17,6 +20,7 @@ import org.bukkit.plugin.java.JavaPlugin;
public abstract class SongodaPlugin extends JavaPlugin {
protected Locale locale;
protected Config config = new Config(this);
protected ConsoleCommandSender console = Bukkit.getConsoleSender();
private boolean emergencyStop = false;
@ -27,8 +31,34 @@ public abstract class SongodaPlugin extends JavaPlugin {
public abstract void onPluginDisable();
/**
* Called after reloadConfig() is called
*/
public abstract void onConfigReload();
/**
* Any other plugin configuration files used by the plugin.
*
* @return a list of Configs that are used in addition to the main config.
*/
public abstract List<Config> getExtraConfig();
@Override
public ConfigFileConfigurationAdapter getConfig() {
return config.getConfig();
}
@Override
public void reloadConfig() {
config.load();
onConfigReload();
}
@Override
public void saveConfig() {
config.save();
}
@Override
public final void onLoad() {
try {
@ -54,9 +84,10 @@ public abstract class SongodaPlugin extends JavaPlugin {
try {
locale = Locale.loadDefaultLocale(this, "en_US");
// Starting Metrics
Metrics.start(this);
// plugin setup
onPluginEnable();
// Start Metrics
Metrics.start(this);
} catch (Throwable t) {
getLogger().log(Level.SEVERE, "Unexpected error while loading " + getDescription().getName() + ": Disabling plugin!", t);
emergencyStop = true;

View File

@ -736,14 +736,14 @@ public enum CompatibleSounds {
ENTITY_ZOMBIE_VILLAGER_HURT,
ENTITY_ZOMBIE_VILLAGER_STEP,
EVENT_RAID_HORN,
ITEM_ARMOR_EQUIP_CHAIN,
ITEM_ARMOR_EQUIP_DIAMOND,
ITEM_ARMOR_EQUIP_ELYTRA,
ITEM_ARMOR_EQUIP_GENERIC,
ITEM_ARMOR_EQUIP_GOLD,
ITEM_ARMOR_EQUIP_IRON,
ITEM_ARMOR_EQUIP_LEATHER,
ITEM_ARMOR_EQUIP_TURTLE,
ITEM_ARMOR_EQUIP_CHAIN(ServerVersion.V1_9, v("SUCCESSFUL_HIT", true)),
ITEM_ARMOR_EQUIP_DIAMOND(ServerVersion.V1_9, v("SUCCESSFUL_HIT", true)),
ITEM_ARMOR_EQUIP_ELYTRA(ServerVersion.V1_11, v(ServerVersion.V1_9, "ITEM_ARMOR_EQUIP_GENERIC", true), v("SUCCESSFUL_HIT", true)),
ITEM_ARMOR_EQUIP_GENERIC(ServerVersion.V1_9, v("SUCCESSFUL_HIT", true)),
ITEM_ARMOR_EQUIP_GOLD(ServerVersion.V1_9, v("SUCCESSFUL_HIT", true)),
ITEM_ARMOR_EQUIP_IRON(ServerVersion.V1_9, v("SUCCESSFUL_HIT", true)),
ITEM_ARMOR_EQUIP_LEATHER(ServerVersion.V1_9, v("SUCCESSFUL_HIT", true)),
ITEM_ARMOR_EQUIP_TURTLE(ServerVersion.V1_13, v(ServerVersion.V1_9, "ITEM_ARMOR_EQUIP_GENERIC", true), v("SUCCESSFUL_HIT", true)),
ITEM_AXE_STRIP,
ITEM_BOOK_PAGE_TURN,
ITEM_BOOK_PUT,

View File

@ -532,7 +532,7 @@ public enum LegacyMaterials {
LIGHT_GRAY_GLAZED_TERRACOTTA("SILVER_GLAZED_TERRACOTTA"),
LIGHT_GRAY_SHULKER_BOX(ServerVersion.V1_11, "SILVER_SHULKER_BOX"),
LIGHT_GRAY_STAINED_GLASS("STAINED_GLASS", (byte) 8),
LIGHT_GRAY_STAINED_GLASS_PANE("STAINED_GLASS_PANE", (byte) 8),
LIGHT_GRAY_STAINED_GLASS_PANE("STAINED_GLASS_PANE", (byte) 8), // this is nearly invisible in a chest, lol
LIGHT_GRAY_TERRACOTTA("STAINED_CLAY", (byte) 8),
LIGHT_GRAY_WALL_BANNER("WALL_BANNER", (byte) 7),
LIGHT_GRAY_WOOL("WOOL", (byte) 8),
@ -551,7 +551,7 @@ public enum LegacyMaterials {
LIME_STAINED_GLASS("STAINED_GLASS", (byte) 5),
LIME_STAINED_GLASS_PANE("STAINED_GLASS_PANE", (byte) 5),
LIME_TERRACOTTA("STAINED_CLAY", (byte) 5),
LIME_WALL_BANNER("WALL_BANNER", (byte) 0),
LIME_WALL_BANNER("WALL_BANNER", (byte) 10),
LIME_WOOL("WOOL", (byte) 5),
LINGERING_POTION,
LLAMA_SPAWN_EGG("MONSTER_EGG", (byte) 103),
@ -1837,9 +1837,109 @@ public enum LegacyMaterials {
}
return false;
}
/**
* Checks if this material is a food that can be cooked and is in its cooked state
* @return true if this material is valid as an item
*/
public boolean isValidItem() {
switch(this) {
case ACACIA_WALL_SIGN:
case AIR:
case ATTACHED_MELON_STEM:
case ATTACHED_PUMPKIN_STEM:
case BAMBOO_SAPLING:
case BEETROOTS:
case BIRCH_WALL_SIGN:
case BLACK_WALL_BANNER:
case BLUE_WALL_BANNER:
case BRAIN_CORAL_WALL_FAN:
case BROWN_WALL_BANNER:
case BUBBLE_COLUMN:
case BUBBLE_CORAL_WALL_FAN:
case CARROTS:
case CAVE_AIR:
case COCOA:
case CREEPER_WALL_HEAD:
case CYAN_WALL_BANNER:
case DARK_OAK_WALL_SIGN:
case DEAD_BRAIN_CORAL_WALL_FAN:
case DEAD_BUBBLE_CORAL_WALL_FAN:
case DEAD_FIRE_CORAL_WALL_FAN:
case DEAD_HORN_CORAL_WALL_FAN:
case DEAD_TUBE_CORAL_WALL_FAN:
case DRAGON_WALL_HEAD:
case END_GATEWAY:
case END_PORTAL:
case FIRE: // used to be able to in older versions
case FIRE_CORAL_WALL_FAN:
case FROSTED_ICE:
case GRAY_WALL_BANNER:
case GREEN_WALL_BANNER:
case HORN_CORAL_WALL_FAN:
case JUNGLE_WALL_SIGN:
case KELP_PLANT:
case LAVA:
case LIGHT_BLUE_WALL_BANNER:
case LIGHT_GRAY_WALL_BANNER:
case LIME_WALL_BANNER:
case MAGENTA_WALL_BANNER:
case MELON_STEM:
case MOVING_PISTON:
case NETHER_PORTAL:
case OAK_WALL_SIGN:
case ORANGE_WALL_BANNER:
case PINK_WALL_BANNER:
case PISTON_HEAD:
case PLAYER_WALL_HEAD:
case POTATOES:
case POTTED_ACACIA_SAPLING:
case POTTED_ALLIUM:
case POTTED_AZURE_BLUET:
case POTTED_BAMBOO:
case POTTED_BIRCH_SAPLING:
case POTTED_BLUE_ORCHID:
case POTTED_BROWN_MUSHROOM:
case POTTED_CACTUS:
case POTTED_CORNFLOWER:
case POTTED_DANDELION:
case POTTED_DARK_OAK_SAPLING:
case POTTED_DEAD_BUSH:
case POTTED_FERN:
case POTTED_JUNGLE_SAPLING:
case POTTED_LILY_OF_THE_VALLEY:
case POTTED_OAK_SAPLING:
case POTTED_ORANGE_TULIP:
case POTTED_OXEYE_DAISY:
case POTTED_PINK_TULIP:
case POTTED_POPPY:
case POTTED_RED_MUSHROOM:
case POTTED_RED_TULIP:
case POTTED_SPRUCE_SAPLING:
case POTTED_WHITE_TULIP:
case POTTED_WITHER_ROSE:
case PUMPKIN_STEM:
case PURPLE_WALL_BANNER:
case REDSTONE_WALL_TORCH:
case REDSTONE_WIRE:
case RED_TULIP:
case SKELETON_SPAWN_EGG:
case SPRUCE_WALL_SIGN:
case SWEET_BERRY_BUSH:
case TALL_SEAGRASS:
case TRIPWIRE:
case TUBE_CORAL_WALL_FAN:
case VOID_AIR:
case WALL_TORCH:
case WATER:
case WHITE_WALL_BANNER:
case WITHER_SKELETON_WALL_SKULL:
return false;
}
return true;
}
/**
* @return true if this material is a food that can be cooked and is in its cooked state
*/
public boolean isCooked() {
switch(this) {
@ -1858,7 +1958,7 @@ public enum LegacyMaterials {
}
/**
* Checks if this material is a food that can be cooked and is in its raw state
* @return true if this material is a food that can be cooked and is in its raw state
*/
public boolean isRaw() {
switch(this) {
@ -1875,4 +1975,118 @@ public enum LegacyMaterials {
}
return false;
}
public static LegacyMaterials getGlassPaneColor(int color) {
switch (color) {
case 0:
return WHITE_STAINED_GLASS_PANE;
case 1:
return ORANGE_STAINED_GLASS_PANE;
case 2:
return MAGENTA_STAINED_GLASS_PANE;
case 3:
return LIGHT_BLUE_STAINED_GLASS_PANE;
case 4:
return YELLOW_STAINED_GLASS_PANE;
case 5:
return LIME_STAINED_GLASS_PANE;
case 6:
return PINK_STAINED_GLASS_PANE;
case 7:
return GRAY_STAINED_GLASS_PANE;
case 8:
return LIGHT_GRAY_STAINED_GLASS_PANE;
case 9:
return CYAN_STAINED_GLASS_PANE;
case 10:
return PURPLE_STAINED_GLASS_PANE;
case 11:
return BLUE_STAINED_GLASS_PANE;
case 12:
return BROWN_STAINED_GLASS_PANE;
case 13:
return GREEN_STAINED_GLASS_PANE;
case 14:
return RED_STAINED_GLASS_PANE;
case 15:
return BLACK_STAINED_GLASS_PANE;
}
return WHITE_STAINED_GLASS_PANE;
}
public static LegacyMaterials getGlassColor(int color) {
switch (color) {
case 0:
return WHITE_STAINED_GLASS;
case 1:
return ORANGE_STAINED_GLASS;
case 2:
return MAGENTA_STAINED_GLASS;
case 3:
return LIGHT_BLUE_STAINED_GLASS;
case 4:
return YELLOW_STAINED_GLASS;
case 5:
return LIME_STAINED_GLASS;
case 6:
return PINK_STAINED_GLASS;
case 7:
return GRAY_STAINED_GLASS;
case 8:
return LIGHT_GRAY_STAINED_GLASS;
case 9:
return CYAN_STAINED_GLASS;
case 10:
return PURPLE_STAINED_GLASS;
case 11:
return BLUE_STAINED_GLASS;
case 12:
return BROWN_STAINED_GLASS;
case 13:
return GREEN_STAINED_GLASS;
case 14:
return RED_STAINED_GLASS;
case 15:
return BLACK_STAINED_GLASS;
}
return WHITE_STAINED_GLASS;
}
public static LegacyMaterials getDyeColor(int color) {
switch (color) {
case 0:
return BLACK_DYE;
case 1:
return RED_DYE;
case 2:
return GREEN_DYE;
case 3:
return BROWN_DYE;
case 4:
return BLUE_DYE;
case 5:
return PURPLE_DYE;
case 6:
return CYAN_DYE;
case 7:
return LIGHT_GRAY_DYE;
case 8:
return GRAY_DYE;
case 9:
return PINK_DYE;
case 10:
return LIME_DYE;
case 11:
return YELLOW_DYE;
case 12:
return LIGHT_BLUE_DYE;
case 13:
return MAGENTA_DYE;
case 14:
return ORANGE_DYE;
case 15:
return WHITE_DYE;
}
return WHITE_DYE;
}
}

View File

@ -1,6 +1,6 @@
package com.songoda.core.settingsv2;
package com.songoda.core.configuration;
import com.songoda.core.settingsv2.ConfigFormattingRules.CommentStyle;
import com.songoda.core.configuration.ConfigFormattingRules.CommentStyle;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package com.songoda.core.settingsv2;
package com.songoda.core.configuration;
import com.google.common.base.Charsets;
import java.io.BufferedReader;
@ -28,6 +28,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConstructor;
import org.bukkit.configuration.file.YamlRepresenter;
@ -45,7 +46,7 @@ import org.yaml.snakeyaml.representer.Representer;
* @since 2019-08-28
* @author jascotty2
*/
public class Config extends SongodaConfigurationSection {
public class Config extends ConfigSection {
/*
Serialization notes:
@ -61,6 +62,7 @@ public class Config extends SongodaConfigurationSection {
protected static final String BLANK_CONFIG = "{}\n";
protected File file;
protected final ConfigFileConfigurationAdapter config = new ConfigFileConfigurationAdapter(this);
final String dirName, fileName;
final Plugin plugin;
final DumperOptions yamlOptions = new DumperOptions();
@ -129,6 +131,10 @@ public class Config extends SongodaConfigurationSection {
fileName = file;
}
public ConfigFileConfigurationAdapter getConfig() {
return config;
}
public File getFile() {
if (file == null) {
if (dirName != null) {
@ -166,9 +172,11 @@ public class Config extends SongodaConfigurationSection {
* If the configuration is changed within this period, the timer is not reset.
*
* @param autosaveInterval time in seconds
* @return this class
*/
public void setAutosaveInterval(int autosaveInterval) {
public Config setAutosaveInterval(int autosaveInterval) {
this.autosaveInterval = autosaveInterval;
return this;
}
public boolean getAutoremove() {
@ -199,9 +207,12 @@ public class Config extends SongodaConfigurationSection {
/**
* Default comment applied to config nodes
*
* @return this config
*/
public void setDefaultNodeCommentFormat(ConfigFormattingRules.CommentStyle defaultNodeCommentFormat) {
public Config setDefaultNodeCommentFormat(ConfigFormattingRules.CommentStyle defaultNodeCommentFormat) {
this.defaultNodeCommentFormat = defaultNodeCommentFormat;
return this;
}
/**
@ -213,9 +224,12 @@ public class Config extends SongodaConfigurationSection {
/**
* Default comment applied to section nodes
*
* @return this config
*/
public void setDefaultSectionCommentFormat(ConfigFormattingRules.CommentStyle defaultSectionCommentFormat) {
public Config setDefaultSectionCommentFormat(ConfigFormattingRules.CommentStyle defaultSectionCommentFormat) {
this.defaultSectionCommentFormat = defaultSectionCommentFormat;
return this;
}
/**
@ -227,9 +241,12 @@ public class Config extends SongodaConfigurationSection {
/**
* Extra lines to put between root nodes
*
* @return this config
*/
public void setRootNodeSpacing(int rootNodeSpacing) {
public Config setRootNodeSpacing(int rootNodeSpacing) {
this.rootNodeSpacing = rootNodeSpacing;
return this;
}
/**
@ -243,9 +260,12 @@ public class Config extends SongodaConfigurationSection {
/**
* Extra lines to put in front of comments. <br>
* This is separate from rootNodeSpacing, if applicable.
*
* @return this config
*/
public void setCommentSpacing(int commentSpacing) {
public Config setCommentSpacing(int commentSpacing) {
this.commentSpacing = commentSpacing;
return this;
}
@NotNull
@ -297,15 +317,49 @@ public class Config extends SongodaConfigurationSection {
}
}
public void load() throws FileNotFoundException, IOException, InvalidConfigurationException {
FileInputStream stream = new FileInputStream(getFile());
this.load(new InputStreamReader((InputStream) stream, Charsets.UTF_16));
public boolean load() {
if (getFile().exists()) {
FileInputStream stream = null;
try {
stream = new FileInputStream(getFile());
this.load(new InputStreamReader((InputStream) stream, Charsets.UTF_16));
return true;
} catch (IOException | InvalidConfigurationException ex) {
(plugin != null ? plugin.getLogger() : Bukkit.getLogger()).log(Level.SEVERE, "Failed to load config file: " + file.getName(), ex);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException ex) {
}
}
}
return false;
}
return true;
}
public void load(@NotNull File file) throws FileNotFoundException, IOException, InvalidConfigurationException {
public boolean load(@NotNull File file) {
Validate.notNull(file, "File cannot be null");
FileInputStream stream = new FileInputStream(file);
this.load(new InputStreamReader((InputStream) stream, Charsets.UTF_8));
if (file.exists()) {
FileInputStream stream = null;
try {
stream = new FileInputStream(file);
this.load(new InputStreamReader((InputStream) stream, Charsets.UTF_16));
return true;
} catch (IOException | InvalidConfigurationException ex) {
(plugin != null ? plugin.getLogger() : Bukkit.getLogger()).log(Level.SEVERE, "Failed to load config file: " + file.getName(), ex);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException ex) {
}
}
}
return false;
}
return true;
}
public void load(@NotNull Reader reader) throws IOException, InvalidConfigurationException {
@ -336,7 +390,7 @@ public class Config extends SongodaConfigurationSection {
}
}
protected void convertMapsToSections(@NotNull Map<?, ?> input, @NotNull SongodaConfigurationSection section) {
protected void convertMapsToSections(@NotNull Map<?, ?> input, @NotNull ConfigSection section) {
for (Map.Entry<?, ?> entry : input.entrySet()) {
String key = entry.getKey().toString();
Object value = entry.getValue();

View File

@ -0,0 +1,39 @@
package com.songoda.core.configuration;
import java.util.stream.Collectors;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
public class ConfigFileConfigurationAdapter extends FileConfiguration {
final Config config;
public ConfigFileConfigurationAdapter(Config config) {
super(config);
this.config = config;
}
public Config getConfig() {
return config;
}
@Override
public String saveToString() {
return config.saveToString();
}
@Override
public void loadFromString(String string) throws InvalidConfigurationException {
config.loadFromString(string);
}
@Override
protected String buildHeader() {
return "#" + config.getHeader().stream().collect(Collectors.joining("\n#"));
}
@Override
public ConfigOptionsAdapter options() {
return new ConfigOptionsAdapter(config);
}
}

View File

@ -1,4 +1,4 @@
package com.songoda.core.settingsv2;
package com.songoda.core.configuration;
public class ConfigFormattingRules {

View File

@ -1,20 +1,27 @@
package com.songoda.core.settingsv2;
package com.songoda.core.configuration;
import java.util.List;
import org.bukkit.configuration.MemoryConfigurationOptions;
import org.bukkit.configuration.file.FileConfigurationOptions;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class ConfigOptionsAdapter extends MemoryConfigurationOptions {
public class ConfigOptionsAdapter extends FileConfigurationOptions {
ConfigOptionsAdapter(SongodaConfigurationSection root) {
super(root);
final ConfigSection config;
public ConfigOptionsAdapter(ConfigSection config) {
super(config);
this.config = config;
}
public Config getConfig() {
return (Config) config.root;
}
@NotNull
@Override
public Config configuration() {
return (Config) super.configuration();
public ConfigFileConfigurationAdapter configuration() {
return new ConfigFileConfigurationAdapter((Config) config.root);
}
@NotNull
@ -27,35 +34,37 @@ public class ConfigOptionsAdapter extends MemoryConfigurationOptions {
@NotNull
@Override
public ConfigOptionsAdapter pathSeparator(char value) {
((Config) super.configuration()).setPathSeparator(value);
((Config) config.root).setPathSeparator(value);
return this;
}
@NotNull
@Override
public ConfigOptionsAdapter header(@Nullable String value) {
if (value == null) {
((Config) super.configuration()).setHeader((List) null);
((Config) config.root).setHeader((List) null);
} else {
((Config) super.configuration()).setHeader(value.split("\n"));
((Config) config.root).setHeader(value.split("\n"));
}
return this;
}
@NotNull
@Override
public ConfigOptionsAdapter copyHeader(boolean value) {
if (!value) {
((Config) super.configuration()).setHeader((List) null);
((Config) config.root).setHeader((List) null);
}
return this;
}
public int indent() {
return ((Config) super.configuration()).getIndent();
return ((Config) config.root).getIndent();
}
@NotNull
public ConfigOptionsAdapter indent(int value) {
((Config) super.configuration()).setIndent(value);
((Config) config.root).setIndent(value);
return this;
}
}

View File

@ -1,7 +1,9 @@
package com.songoda.core.settingsv2;
package com.songoda.core.configuration;
import com.songoda.core.compatibility.LegacyMaterials;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@ -10,7 +12,6 @@ import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.bukkit.Material;
import org.bukkit.configuration.Configuration;
import org.bukkit.configuration.MemoryConfiguration;
import org.jetbrains.annotations.NotNull;
@ -22,11 +23,11 @@ import org.jetbrains.annotations.Nullable;
* @since 2019-08-28
* @author jascotty2
*/
public class SongodaConfigurationSection extends MemoryConfiguration {
public class ConfigSection extends MemoryConfiguration {
final String fullPath;
final SongodaConfigurationSection root;
final SongodaConfigurationSection parent;
final String fullPath, nodeKey;
final ConfigSection root;
final ConfigSection parent;
protected int indentation = 2; // between 2 and 9 (inclusive)
protected char pathChar = '.';
final HashMap<String, Comment> configComments;
@ -40,21 +41,22 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
final boolean isDefault;
final Object lock = new Object();
SongodaConfigurationSection() {
ConfigSection() {
this.root = this;
this.parent = null;
isDefault = false;
fullPath = "";
nodeKey = fullPath = "";
configComments = new HashMap();
defaultComments = new HashMap();
defaults = new LinkedHashMap();
values = new LinkedHashMap();
}
SongodaConfigurationSection(SongodaConfigurationSection root, SongodaConfigurationSection parent, String path, boolean isDefault) {
ConfigSection(ConfigSection root, ConfigSection parent, String nodeKey, boolean isDefault) {
this.root = root;
this.parent = parent;
this.fullPath = path != null ? parent.fullPath + path + root.pathChar : parent.fullPath;
this.nodeKey = nodeKey;
this.fullPath = nodeKey != null ? parent.fullPath + nodeKey + root.pathChar : parent.fullPath;
this.isDefault = isDefault;
configComments = defaultComments = null;
defaults = null;
@ -90,10 +92,24 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
public char getPathSeparator() {
return root.pathChar;
}
/**
* @return The full key for this section node
*/
public String getKey() {
return !fullPath.endsWith(String.valueOf(root.pathChar)) ? fullPath : fullPath.substring(0, fullPath.length() - 1);
}
/**
* @return The specific key that was used from the last node to get to this node
*/
public String getNodeKey() {
return nodeKey;
}
@NotNull
public SongodaConfigurationSection createDefaultSection(@NotNull String path) {
SongodaConfigurationSection section = new SongodaConfigurationSection(root, this, path, true);
public ConfigSection createDefaultSection(@NotNull String path) {
ConfigSection section = new ConfigSection(root, this, path, true);
synchronized (root.lock) {
root.defaults.put(fullPath + path, section);
}
@ -101,8 +117,8 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
}
@NotNull
public SongodaConfigurationSection createDefaultSection(@NotNull String path, String... comment) {
SongodaConfigurationSection section = new SongodaConfigurationSection(root, this, path, true);
public ConfigSection createDefaultSection(@NotNull String path, String... comment) {
ConfigSection section = new ConfigSection(root, this, path, true);
synchronized (root.lock) {
root.defaults.put(fullPath + path, section);
}
@ -110,12 +126,12 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
}
@NotNull
public SongodaConfigurationSection setComment(@NotNull String path, @Nullable ConfigFormattingRules.CommentStyle commentStyle, String... lines) {
public ConfigSection setComment(@NotNull String path, @Nullable ConfigFormattingRules.CommentStyle commentStyle, String... lines) {
return setComment(path, commentStyle, lines.length == 0 ? (List) null : Arrays.asList(lines));
}
@NotNull
public SongodaConfigurationSection setComment(@NotNull String path, @Nullable ConfigFormattingRules.CommentStyle commentStyle, @Nullable List<String> lines) {
public ConfigSection setComment(@NotNull String path, @Nullable ConfigFormattingRules.CommentStyle commentStyle, @Nullable List<String> lines) {
synchronized (root.lock) {
if (isDefault) {
root.defaultComments.put(fullPath + path, lines != null ? new Comment(commentStyle, lines) : null);
@ -127,12 +143,12 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
}
@NotNull
public SongodaConfigurationSection setDefaultComment(@NotNull String path, String... lines) {
public ConfigSection setDefaultComment(@NotNull String path, String... lines) {
return setDefaultComment(path, lines.length == 0 ? (List) null : Arrays.asList(lines));
}
@NotNull
public SongodaConfigurationSection setDefaultComment(@NotNull String path, @Nullable List<String> lines) {
public ConfigSection setDefaultComment(@NotNull String path, @Nullable List<String> lines) {
synchronized (root.lock) {
root.defaultComments.put(fullPath + path, new Comment(lines));
}
@ -140,12 +156,12 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
}
@NotNull
public SongodaConfigurationSection setDefaultComment(@NotNull String path, ConfigFormattingRules.CommentStyle commentStyle, String... lines) {
public ConfigSection setDefaultComment(@NotNull String path, ConfigFormattingRules.CommentStyle commentStyle, String... lines) {
return setDefaultComment(path, commentStyle, lines.length == 0 ? (List) null : Arrays.asList(lines));
}
@NotNull
public SongodaConfigurationSection setDefaultComment(@NotNull String path, ConfigFormattingRules.CommentStyle commentStyle, @Nullable List<String> lines) {
public ConfigSection setDefaultComment(@NotNull String path, ConfigFormattingRules.CommentStyle commentStyle, @Nullable List<String> lines) {
synchronized (root.lock) {
root.defaultComments.put(fullPath + path, new Comment(commentStyle, lines));
}
@ -184,13 +200,13 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
}
@Override
public SongodaConfigurationSection getDefaults() {
return new SongodaConfigurationSection(root, this, null, true);
public ConfigSection getDefaults() {
return new ConfigSection(root, this, null, true);
}
@Override
public SongodaConfigurationSection getDefaultSection() {
return new SongodaConfigurationSection(root, this, null, true);
public ConfigSection getDefaultSection() {
return new ConfigSection(root, this, null, true);
}
@Override
@ -264,6 +280,20 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
return result;
}
@NotNull
public List<ConfigSection> getSections(String path) {
ConfigSection rootSection = getConfigurationSection(path);
if (rootSection == null) {
return Collections.EMPTY_LIST;
}
ArrayList<ConfigSection> result = new ArrayList();
rootSection.getKeys(false).stream()
.map(key -> rootSection.get(key))
.filter(object -> object != null && object instanceof ConfigSection)
.forEachOrdered(object -> result.add((ConfigSection) object));
return result;
}
@Override
public boolean contains(@NotNull String path) {
return root.defaults.containsKey(fullPath + path) || root.values.containsKey(fullPath + path);
@ -293,12 +323,12 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
}
@Override
public SongodaConfigurationSection getRoot() {
public ConfigSection getRoot() {
return root;
}
@Override
public SongodaConfigurationSection getParent() {
public ConfigSection getParent() {
return parent;
}
@ -336,63 +366,63 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
}
@NotNull
public SongodaConfigurationSection set(@NotNull String path, @Nullable Object value, String ... comment) {
public ConfigSection set(@NotNull String path, @Nullable Object value, String ... comment) {
set(path, value);
return setComment(path, null, comment);
}
@NotNull
public SongodaConfigurationSection set(@NotNull String path, @Nullable Object value, List<String> comment) {
public ConfigSection set(@NotNull String path, @Nullable Object value, List<String> comment) {
set(path, value);
return setComment(path, null, comment);
}
@NotNull
public SongodaConfigurationSection set(@NotNull String path, @Nullable Object value, @Nullable ConfigFormattingRules.CommentStyle commentStyle, String ... comment) {
public ConfigSection set(@NotNull String path, @Nullable Object value, @Nullable ConfigFormattingRules.CommentStyle commentStyle, String ... comment) {
set(path, value);
return setComment(path, commentStyle, comment);
}
@NotNull
public SongodaConfigurationSection set(@NotNull String path, @Nullable Object value, @Nullable ConfigFormattingRules.CommentStyle commentStyle, List<String> comment) {
public ConfigSection set(@NotNull String path, @Nullable Object value, @Nullable ConfigFormattingRules.CommentStyle commentStyle, List<String> comment) {
set(path, value);
return setComment(path, commentStyle, comment);
}
@NotNull
public SongodaConfigurationSection setDefault(@NotNull String path, @Nullable Object value) {
public ConfigSection setDefault(@NotNull String path, @Nullable Object value) {
addDefault(path, value);
return this;
}
@NotNull
public SongodaConfigurationSection setDefault(@NotNull String path, @Nullable Object value, String ... comment) {
public ConfigSection setDefault(@NotNull String path, @Nullable Object value, String ... comment) {
addDefault(path, value);
return setDefaultComment(path, comment);
}
@NotNull
public SongodaConfigurationSection setDefault(@NotNull String path, @Nullable Object value, List<String> comment) {
public ConfigSection setDefault(@NotNull String path, @Nullable Object value, List<String> comment) {
addDefault(path, value);
return setDefaultComment(path, comment);
}
@NotNull
public SongodaConfigurationSection setDefault(@NotNull String path, @Nullable Object value, ConfigFormattingRules.CommentStyle commentStyle, String ... comment) {
public ConfigSection setDefault(@NotNull String path, @Nullable Object value, ConfigFormattingRules.CommentStyle commentStyle, String ... comment) {
addDefault(path, value);
return setDefaultComment(path, commentStyle, comment);
}
@NotNull
public SongodaConfigurationSection setDefault(@NotNull String path, @Nullable Object value, ConfigFormattingRules.CommentStyle commentStyle, List<String> comment) {
public ConfigSection setDefault(@NotNull String path, @Nullable Object value, ConfigFormattingRules.CommentStyle commentStyle, List<String> comment) {
addDefault(path, value);
return setDefaultComment(path, commentStyle, comment);
}
@NotNull
@Override
public SongodaConfigurationSection createSection(@NotNull String path) {
SongodaConfigurationSection section = new SongodaConfigurationSection(root, this, path, false);
public ConfigSection createSection(@NotNull String path) {
ConfigSection section = new ConfigSection(root, this, path, false);
synchronized(root.lock) {
root.values.put(fullPath + path, section);
}
@ -402,23 +432,23 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
}
@NotNull
public SongodaConfigurationSection createSection(@NotNull String path, String... comment) {
public ConfigSection createSection(@NotNull String path, String... comment) {
return createSection(path, null, comment.length == 0 ? (List) null : Arrays.asList(comment));
}
@NotNull
public SongodaConfigurationSection createSection(@NotNull String path, @Nullable List<String> comment) {
public ConfigSection createSection(@NotNull String path, @Nullable List<String> comment) {
return createSection(path, null, comment);
}
@NotNull
public SongodaConfigurationSection createSection(@NotNull String path, @Nullable ConfigFormattingRules.CommentStyle commentStyle, String... comment) {
public ConfigSection createSection(@NotNull String path, @Nullable ConfigFormattingRules.CommentStyle commentStyle, String... comment) {
return createSection(path, commentStyle, comment.length == 0 ? (List) null : Arrays.asList(comment));
}
@NotNull
public SongodaConfigurationSection createSection(@NotNull String path, @Nullable ConfigFormattingRules.CommentStyle commentStyle, @Nullable List<String> comment) {
SongodaConfigurationSection section = new SongodaConfigurationSection(root, this, path, false);
public ConfigSection createSection(@NotNull String path, @Nullable ConfigFormattingRules.CommentStyle commentStyle, @Nullable List<String> comment) {
ConfigSection section = new ConfigSection(root, this, path, false);
synchronized (root.lock) {
root.values.put(fullPath + path, section);
}
@ -430,8 +460,8 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
@NotNull
@Override
public SongodaConfigurationSection createSection(@NotNull String path, Map<?, ?> map) {
SongodaConfigurationSection section = new SongodaConfigurationSection(root, this, path, false);
public ConfigSection createSection(@NotNull String path, Map<?, ?> map) {
ConfigSection section = new ConfigSection(root, this, path, false);
synchronized (root.lock) {
root.values.put(fullPath + path, section);
}
@ -534,17 +564,17 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
}
@Nullable
public Material getMaterial(@NotNull String path) {
public LegacyMaterials getMaterial(@NotNull String path) {
String val = getString(path);
LegacyMaterials mat = val != null ? LegacyMaterials.getMaterial(val) : null;
return mat != null ? mat.getMaterial() : null;
return mat;
}
@Nullable
public Material getMaterial(@NotNull String path, @Nullable LegacyMaterials def) {
public LegacyMaterials getMaterial(@NotNull String path, @Nullable LegacyMaterials def) {
String val = getString(path);
LegacyMaterials mat = val != null ? LegacyMaterials.getMaterial(val) : null;
return mat != null ? mat.getMaterial() : (def != null ? def.getMaterial() : null);
return mat != null ? mat : def;
}
@Nullable
@ -562,13 +592,13 @@ public class SongodaConfigurationSection extends MemoryConfiguration {
}
@Override
public SongodaConfigurationSection getConfigurationSection(@NotNull String path) {
public ConfigSection getConfigurationSection(@NotNull String path) {
Object result = get(path);
return result instanceof SongodaConfigurationSection ? (SongodaConfigurationSection) result : null;
return result instanceof ConfigSection ? (ConfigSection) result : null;
}
public SongodaConfigurationSection getOrCreateConfigurationSection(@NotNull String path) {
public ConfigSection getOrCreateConfigurationSection(@NotNull String path) {
Object result = get(path);
return result instanceof SongodaConfigurationSection ? (SongodaConfigurationSection) result : createSection(path);
return result instanceof ConfigSection ? (ConfigSection) result : createSection(path);
}
}

View File

@ -1,8 +1,7 @@
package com.songoda.core.settingsv2;
package com.songoda.core.configuration;
import com.songoda.core.compatibility.LegacyMaterials;
import java.util.List;
import org.bukkit.Material;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -106,13 +105,13 @@ public class ConfigSetting {
}
@NotNull
public Material getMaterial() {
Material m = getMaterial(null);
return m != null ? m : Material.STONE;
public LegacyMaterials getMaterial() {
LegacyMaterials m = getMaterial(null);
return m != null ? m : LegacyMaterials.STONE;
}
@Nullable
public Material getMaterial(@Nullable LegacyMaterials def) {
public LegacyMaterials getMaterial(@Nullable LegacyMaterials def) {
//return config.getMaterial(key, def);
String val = config.getString(key);
LegacyMaterials mat = val != null ? LegacyMaterials.getMaterial(val) : null;
@ -121,7 +120,7 @@ public class ConfigSetting {
System.out.println(String.format("Config value \"%s\" has an invalid material name: \"%s\"", key, val));
}
return mat != null ? mat.getMaterial() : (def != null ? def.getMaterial() : null);
return mat != null ? mat : def;
}
}

View File

@ -1,21 +1,25 @@
package com.songoda.core.settingsv2.editor;
package com.songoda.core.configuration.editor;
import com.songoda.core.gui.Gui;
import com.songoda.core.settingsv2.Config;
import com.songoda.core.settingsv2.SongodaConfigurationSection;
import com.songoda.core.gui.SimplePagedGui;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.configuration.MemoryConfiguration;
public class ConfigEditorGui extends Gui {
final Config config;
public class ConfigEditorGui extends SimplePagedGui {
final MemoryConfiguration config;
List<String> keys = new ArrayList();
List<String> sections = new ArrayList();
List<String> settings = new ArrayList();
public ConfigEditorGui(Config config, SongodaConfigurationSection node) {
public ConfigEditorGui(String file, MemoryConfiguration config) {
this(file, config, config);
}
public ConfigEditorGui(String file, MemoryConfiguration config, MemoryConfiguration node) {
this.config = config;
for(String key : node.getKeys(false)) {
if(node.isConfigurationSection(key)) {
for (String key : node.getKeys(false)) {
if (node.isConfigurationSection(key)) {
sections.add(key);
keys.add(key); // sections listed first
} else {
@ -23,7 +27,7 @@ public class ConfigEditorGui extends Gui {
}
}
keys.addAll(settings); // normal settings next
// next we need to display the config settings, with the ability to browse more pages
}
}

View File

@ -0,0 +1,98 @@
package com.songoda.core.configuration.editor;
import com.songoda.core.SongodaPlugin;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.configuration.Config;
import com.songoda.core.gui.Gui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.gui.SimplePagedGui;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.ChatColor;
import org.bukkit.configuration.MemoryConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
/**
* Edit all configuration files for a specific plugin
*
* @since 2019-08-31
* @author jascotty2
*/
public class PluginConfigGui extends SimplePagedGui {
final Plugin plugin;
LinkedHashMap<String, MemoryConfiguration> configs = new LinkedHashMap();
public PluginConfigGui(SongodaPlugin plugin) {
this(plugin, null);
}
public PluginConfigGui(SongodaPlugin plugin, Gui parent) {
super(parent);
this.plugin = plugin;
// collect list of plugins
configs.put(plugin.getConfig().getConfig().getFile().getName(), plugin.getConfig().getConfig());
List<Config> more = plugin.getExtraConfig();
if (more != null && !more.isEmpty()) {
for (Config cfg : more) {
configs.put(cfg.getFile().getName(), cfg);
}
}
init();
}
public PluginConfigGui(Plugin plugin) {
this(plugin, null);
}
public PluginConfigGui(Plugin plugin, Gui parent) {
super(parent);
this.plugin = plugin;
// collect list of plugins
configs.put("config.yml", plugin.getConfig());
try {
// can we also grab extra config from this mysterious plugin?
Object more = plugin.getClass().getDeclaredMethod("getExtraConfig").invoke(plugin);
if (more instanceof List && !((List) more).isEmpty()) {
try {
// if we have the getExtraConfig function, we should also be able to get the file
Method method_Config_getFile = ((List) more).get(0).getClass().getDeclaredMethod("getFile");
for (Object cfg : ((List) more)) {
configs.put(((File) method_Config_getFile.invoke(cfg)).getName(), (MemoryConfiguration) cfg);
}
} catch (Exception ex) {
// include a failsafe, I guess
((List) more).forEach(cfg -> configs.put("(File " + configs.size() + ")", (MemoryConfiguration) cfg));
}
}
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
// I guess not!
}
init();
}
private void init() {
// decorate header
this.setTitle(ChatColor.DARK_BLUE + plugin.getName() + " Plugin Config");
this.setUseHeader(true);
headerBackItem = footerBackItem = GuiUtils.getBorderItem(LegacyMaterials.GRAY_STAINED_GLASS_PANE.getItem());
this.setButton(8, GuiUtils.createButtonItem(LegacyMaterials.OAK_DOOR, "Exit"), (event) -> event.player.closeInventory());
// List out all config files that this plugin has
int i = 9;
for (Map.Entry<String, MemoryConfiguration> config : configs.entrySet()) {
this.setButton(i++, GuiUtils.createButtonItem(LegacyMaterials.BOOK, ChatColor.YELLOW + config.getKey(), "Click to edit this config"),
(event) -> event.manager.showGUI(event.player, new ConfigEditorGui(config.getKey(), config.getValue())));
}
}
}

View File

@ -4,6 +4,7 @@ import com.songoda.core.SongodaCore;
import com.songoda.core.commands.AbstractCommand;
import com.songoda.core.compatibility.ServerProject;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.utils.NMSUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
@ -15,27 +16,23 @@ import java.util.List;
public class SongodaCoreDiagCommand extends AbstractCommand {
final SongodaCore instance;
private final String name = Bukkit.getServer().getClass().getPackage().getName();
private final String version = name.substring(name.lastIndexOf('.') + 1);
private final DecimalFormat format = new DecimalFormat("##.##");
private Object serverInstance;
private Field tpsField;
public SongodaCoreDiagCommand(SongodaCore instance) {
super(false, "diag");
this.instance = instance;
try {
serverInstance = getNMSClass("MinecraftServer").getMethod("getServer").invoke(null);
serverInstance = NMSUtils.getNMSClass("MinecraftServer").getMethod("getServer").invoke(null);
tpsField = serverInstance.getClass().getField("recentTps");
} catch (NoSuchFieldException | SecurityException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException e) {
e.printStackTrace();
}
}
@Override
@ -55,13 +52,15 @@ public class SongodaCoreDiagCommand extends AbstractCommand {
sender.sendMessage("Operating System: " + System.getProperty("os.name"));
sender.sendMessage("Allocated Memory: " + format.format(Runtime.getRuntime().maxMemory() / (1024 * 1024)) + "Mb");
sender.sendMessage("Online Players: " + Bukkit.getOnlinePlayers().size());
try {
double[] tps = ((double[]) tpsField.get(serverInstance));
if(tpsField != null) {
try {
double[] tps = ((double[]) tpsField.get(serverInstance));
sender.sendMessage("TPS from last 1m, 5m, 15m: " + format.format(tps[0]) + ", "
+ format.format(tps[1]) + ", " + format.format(tps[2]));
} catch (IllegalAccessException e) {
e.printStackTrace();
sender.sendMessage("TPS from last 1m, 5m, 15m: " + format.format(tps[0]) + ", "
+ format.format(tps[1]) + ", " + format.format(tps[2]));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
return ReturnType.SUCCESS;
@ -86,12 +85,4 @@ public class SongodaCoreDiagCommand extends AbstractCommand {
public String getDescription() {
return "Display diagnostics information.";
}
private Class<?> getNMSClass(String className) {
try {
return Class.forName("net.minecraft.server." + version + "." + className);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
}

View File

@ -2,6 +2,7 @@ package com.songoda.core.core;
import com.songoda.core.SongodaCore;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.configuration.editor.PluginConfigGui;
import com.songoda.core.gui.Gui;
import com.songoda.core.gui.GuiUtils;
import java.util.List;
@ -23,7 +24,7 @@ final class SongodaCoreOverviewGUI extends Gui {
// TODO: this could use some decorating
for (int i = 0; i < plugins.size(); i++) {
PluginInfo plugin = plugins.get(i);
final PluginInfo plugin = plugins.get(i);
if (plugin.hasUpdate()) {
setButton(i, GuiUtils.createButtonItem(plugin.icon != null ? plugin.icon : LegacyMaterials.STONE,
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
@ -33,18 +34,22 @@ final class SongodaCoreOverviewGUI extends Gui {
"Change log:",
plugin.getChangeLog(),
"",
ChatColor.GOLD + "Click for the marketplace page link."
ChatColor.GOLD + "Click for the marketplace page link.",
ChatColor.GOLD + "Right Click to edit plugin settings."
),
ClickType.LEFT, (event) -> event.player.sendMessage(plugin.getMarketplaceLink()));
setAction(i, ClickType.RIGHT, (event) -> event.manager.showGUI(event.player, new PluginConfigGui(plugin.getJavaPlugin(), event.gui)));
highlightItem(i);
} else {
setButton(i, GuiUtils.createButtonItem(plugin.icon != null ? plugin.icon : LegacyMaterials.STONE,
ChatColor.GOLD + plugin.getJavaPlugin().getName(),
ChatColor.GRAY + "Installed Version: " + plugin.getJavaPlugin().getDescription().getVersion(),
"",
ChatColor.GOLD + "Click for the marketplace page link."
ChatColor.GOLD + "Click for the marketplace page link.",
ChatColor.GOLD + "Right Click to edit plugin settings."
),
ClickType.LEFT, (event) -> event.player.sendMessage(plugin.getMarketplaceLink()));
setAction(i, ClickType.RIGHT, (event) -> event.manager.showGUI(event.player, new PluginConfigGui(plugin.getJavaPlugin(), event.gui)));
}
}
}

View File

@ -1,4 +1,4 @@
package com.songoda.core.settings;
package com.songoda.core.settingsv1;
import java.util.*;

View File

@ -1,4 +1,4 @@
package com.songoda.core.settings;
package com.songoda.core.settingsv1;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.MemorySection;
@ -12,6 +12,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Deprecated
public class Config {
private final Plugin plugin;

View File

@ -1,4 +1,4 @@
package com.songoda.core.settings;
package com.songoda.core.settingsv1;
import org.bukkit.configuration.file.FileConfiguration;

View File

@ -1,4 +1,4 @@
package com.songoda.core.settings;
package com.songoda.core.settingsv1;
import java.util.*;

View File

@ -1,4 +1,4 @@
package com.songoda.core.settings;
package com.songoda.core.settingsv1;
public class Section {

View File

@ -1,4 +1,4 @@
package com.songoda.core.settings;
package com.songoda.core.settingsv1;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;

View File

@ -1,4 +1,4 @@
package com.songoda.core.settings;
package com.songoda.core.settingsv1;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.utils.TextUtils;

View File

@ -1,8 +1,8 @@
package com.songoda.core.settings.editor;
package com.songoda.core.settingsv1.editor;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.settings.Category;
import com.songoda.core.settings.Config;
import com.songoda.core.settingsv1.Category;
import com.songoda.core.settingsv1.Config;
import com.songoda.core.utils.gui.AbstractGUI;
import org.bukkit.Material;
import org.bukkit.entity.Player;

View File

@ -1,10 +1,10 @@
package com.songoda.core.settings.editor;
package com.songoda.core.settingsv1.editor;
import com.songoda.core.input.ChatPrompt;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.settings.FoundSetting;
import com.songoda.core.settings.Narrow;
import com.songoda.core.settings.Setting;
import com.songoda.core.settingsv1.FoundSetting;
import com.songoda.core.settingsv1.Narrow;
import com.songoda.core.settingsv1.Setting;
import com.songoda.core.utils.gui.AbstractGUI;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;

View File

@ -1,8 +1,8 @@
package com.songoda.core.settings.editor;
package com.songoda.core.settingsv1.editor;
import com.songoda.core.input.ChatPrompt;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.settings.Setting;
import com.songoda.core.settingsv1.Setting;
import com.songoda.core.utils.gui.AbstractGUI;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

View File

@ -1,7 +1,7 @@
package com.songoda.core.settings.editor;
package com.songoda.core.settingsv1.editor;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.settings.Config;
import com.songoda.core.settingsv1.Config;
import com.songoda.core.utils.gui.AbstractGUI;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;