mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-18 16:35:13 +01:00
Create separate module for configs
This commit is contained in:
parent
137d23b408
commit
ff5ca5dddb
37
Config/pom.xml
Normal file
37
Config/pom.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.gmail.filoghost.holographicdisplays</groupId>
|
||||
<artifactId>holographicdisplays-parent</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<name>HolographicDisplays Config</name>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>elmakers-repo</id>
|
||||
<url>http://maven.elmakers.com/repository/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-utils</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>${spigot-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.gmail.filoghost.holographicdisplays.bridge.bungeecord.serverpinger;
|
||||
package com.gmail.filoghost.holographicdisplays.disk;
|
||||
|
||||
public class ServerAddress {
|
||||
|
@ -42,6 +42,12 @@
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-nms-interfaces</artifactId>
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<String> lines = FileUtils.readLines(targetFile);
|
||||
hologram.clearLines();
|
||||
|
@ -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;
|
||||
|
||||
|
||||
@ -91,7 +90,4 @@ public class FileUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isConfigFile(File file) {
|
||||
return file.getName().toLowerCase().endsWith(".yml") && HolographicDisplays.getInstance().getResource(file.getName()) != null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user