diff --git a/Config/pom.xml b/Config/pom.xml new file mode 100644 index 00000000..49c30488 --- /dev/null +++ b/Config/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + + + com.gmail.filoghost.holographicdisplays + holographicdisplays-parent + 2.3.0-SNAPSHOT + + + holographicdisplays-config + HolographicDisplays Config + + + + elmakers-repo + http://maven.elmakers.com/repository/ + + + + + + ${project.groupId} + holographicdisplays-utils + 2.3.0-SNAPSHOT + + + + org.spigotmc + spigot-api + ${spigot-api.version} + provided + + + + diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/ConfigNode.java b/Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/ConfigNode.java similarity index 100% rename from Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/ConfigNode.java rename to Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/ConfigNode.java diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/Configuration.java b/Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/Configuration.java similarity index 98% rename from Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/Configuration.java rename to Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/Configuration.java index b6d34fe5..57497aca 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/Configuration.java +++ b/Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/Configuration.java @@ -14,7 +14,6 @@ import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.Plugin; -import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger.ServerAddress; import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger; import com.gmail.filoghost.holographicdisplays.util.Utils; diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/LocationSerializer.java b/Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/LocationSerializer.java similarity index 100% rename from Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/LocationSerializer.java rename to Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/LocationSerializer.java diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/ServerAddress.java b/Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/ServerAddress.java similarity index 80% rename from Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/ServerAddress.java rename to Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/ServerAddress.java index 52478d8a..eb951620 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/ServerAddress.java +++ b/Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/ServerAddress.java @@ -1,4 +1,4 @@ -package com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger; +package com.gmail.filoghost.holographicdisplays.disk; public class ServerAddress { diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/StringConverter.java b/Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/StringConverter.java similarity index 100% rename from Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/StringConverter.java rename to Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/StringConverter.java diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/UnicodeSymbols.java b/Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/UnicodeSymbols.java similarity index 100% rename from Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/disk/UnicodeSymbols.java rename to Config/src/main/java/com/gmail/filoghost/holographicdisplays/disk/UnicodeSymbols.java diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/exception/InvalidFormatException.java b/Config/src/main/java/com/gmail/filoghost/holographicdisplays/exception/InvalidFormatException.java similarity index 100% rename from Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/exception/InvalidFormatException.java rename to Config/src/main/java/com/gmail/filoghost/holographicdisplays/exception/InvalidFormatException.java diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/exception/WorldNotFoundException.java b/Config/src/main/java/com/gmail/filoghost/holographicdisplays/exception/WorldNotFoundException.java similarity index 100% rename from Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/exception/WorldNotFoundException.java rename to Config/src/main/java/com/gmail/filoghost/holographicdisplays/exception/WorldNotFoundException.java diff --git a/Plugin/pom.xml b/Plugin/pom.xml index b58cbb5d..542e8011 100644 --- a/Plugin/pom.xml +++ b/Plugin/pom.xml @@ -41,6 +41,12 @@ holographicdisplays-utils 2.3.0-SNAPSHOT + + + ${project.groupId} + holographicdisplays-config + 2.3.0-SNAPSHOT + ${project.groupId} diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/HolographicDisplays.java b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/HolographicDisplays.java index eccd605c..94a3be79 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/HolographicDisplays.java +++ b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/HolographicDisplays.java @@ -1,5 +1,6 @@ package com.gmail.filoghost.holographicdisplays; +import java.io.File; import java.util.Set; import java.util.logging.Level; import java.util.regex.Matcher; @@ -302,4 +303,9 @@ public class HolographicDisplays extends JavaPlugin { return protocolLibHook; } + + public static boolean isConfigFile(File file) { + return file.getName().toLowerCase().endsWith(".yml") && instance.getResource(file.getName()) != null; + } + } diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/BungeeServerTracker.java b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/BungeeServerTracker.java index 043c8103..bff9cf53 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/BungeeServerTracker.java +++ b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/BungeeServerTracker.java @@ -12,10 +12,10 @@ import org.bukkit.Bukkit; import org.bukkit.scheduler.BukkitRunnable; import com.gmail.filoghost.holographicdisplays.HolographicDisplays; -import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger.ServerAddress; -import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger.ServerPinger; import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger.PingResponse; +import com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger.ServerPinger; import com.gmail.filoghost.holographicdisplays.disk.Configuration; +import com.gmail.filoghost.holographicdisplays.disk.ServerAddress; import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger; public class BungeeServerTracker { diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/PingResponse.java b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/PingResponse.java index 4bd10d68..29976b87 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/PingResponse.java +++ b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/PingResponse.java @@ -6,6 +6,7 @@ import java.util.logging.Level; import org.json.simple.JSONObject; import org.json.simple.JSONValue; +import com.gmail.filoghost.holographicdisplays.disk.ServerAddress; import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger; public class PingResponse diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/ServerPinger.java b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/ServerPinger.java index f4a68c29..76058137 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/ServerPinger.java +++ b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/bridge/bungeecord/serverpinger/ServerPinger.java @@ -8,6 +8,8 @@ import java.net.Socket; import java.net.SocketTimeoutException; import java.net.UnknownHostException; +import com.gmail.filoghost.holographicdisplays.disk.ServerAddress; + public class ServerPinger { public static PingResponse fetchData(final ServerAddress serverAddress, int timeout) throws SocketTimeoutException, UnknownHostException, IOException, Exception { diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadimageCommand.java b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadimageCommand.java index 9711b78b..7891bd14 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadimageCommand.java +++ b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadimageCommand.java @@ -89,7 +89,7 @@ public class ReadimageCommand extends HologramSubCommand { File targetImage = new File(HolographicDisplays.getInstance().getDataFolder(), fileName); CommandValidator.isTrue(FileUtils.isParentFolder(HolographicDisplays.getInstance().getDataFolder(), targetImage), "The image must be inside HolographicDisplays' folder."); - CommandValidator.isTrue(!FileUtils.isConfigFile(targetImage), "Cannot read default configuration files."); + CommandValidator.isTrue(!HolographicDisplays.isConfigFile(targetImage), "Cannot read default configuration files."); image = FileUtils.readImage(targetImage); } diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadtextCommand.java b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadtextCommand.java index 626a6c03..93b4a071 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadtextCommand.java +++ b/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadtextCommand.java @@ -49,7 +49,7 @@ public class ReadtextCommand extends HologramSubCommand { String fileName = args[1]; File targetFile = new File(HolographicDisplays.getInstance().getDataFolder(), fileName); CommandValidator.isTrue(FileUtils.isParentFolder(HolographicDisplays.getInstance().getDataFolder(), targetFile), "The file must be inside HolographicDisplays' folder."); - CommandValidator.isTrue(!FileUtils.isConfigFile(targetFile), "Cannot read default configuration files."); + CommandValidator.isTrue(!HolographicDisplays.isConfigFile(targetFile), "Cannot read default configuration files."); List lines = FileUtils.readLines(targetFile); hologram.clearLines(); diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/exception/UnreadableImageException.java b/Utils/src/main/java/com/gmail/filoghost/holographicdisplays/exception/UnreadableImageException.java similarity index 100% rename from Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/exception/UnreadableImageException.java rename to Utils/src/main/java/com/gmail/filoghost/holographicdisplays/exception/UnreadableImageException.java diff --git a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/util/FileUtils.java b/Utils/src/main/java/com/gmail/filoghost/holographicdisplays/util/FileUtils.java similarity index 88% rename from Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/util/FileUtils.java rename to Utils/src/main/java/com/gmail/filoghost/holographicdisplays/util/FileUtils.java index dc8d86af..7e7eb475 100644 --- a/Plugin/src/main/java/com/gmail/filoghost/holographicdisplays/util/FileUtils.java +++ b/Utils/src/main/java/com/gmail/filoghost/holographicdisplays/util/FileUtils.java @@ -12,7 +12,6 @@ import java.util.List; import javax.imageio.ImageIO; -import com.gmail.filoghost.holographicdisplays.HolographicDisplays; import com.gmail.filoghost.holographicdisplays.exception.UnreadableImageException; @@ -90,8 +89,5 @@ public class FileUtils { return false; } - - public static boolean isConfigFile(File file) { - return file.getName().toLowerCase().endsWith(".yml") && HolographicDisplays.getInstance().getResource(file.getName()) != null; - } + } diff --git a/pom.xml b/pom.xml index dd3ca91f..69c81ce5 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,7 @@ API JavaCompat Utils + Config NMS/Interfaces NMS/v1_8_R1 NMS/v1_8_R2