diff --git a/build.gradle.kts b/build.gradle.kts index ad1367e..5de5d44 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -32,12 +32,12 @@ dependencies { implementation("org.projectlombok:lombok:1.18.22") annotationProcessor("org.projectlombok:lombok:1.18.22") implementation("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT") - implementation("dev.plex:Plex:1.0") + implementation("dev.plex:Plex:1.0.2-SNAPSHOT") implementation("org.json:json:20220320") implementation("org.reflections:reflections:0.10.2") - implementation("org.eclipse.jetty:jetty-server:11.0.8") - implementation("org.eclipse.jetty:jetty-servlet:11.0.8") - implementation("org.eclipse.jetty:jetty-proxy:11.0.8") + implementation("org.eclipse.jetty:jetty-server:11.0.9") + implementation("org.eclipse.jetty:jetty-servlet:11.0.9") + implementation("org.eclipse.jetty:jetty-proxy:11.0.9") implementation("com.github.MilkBowl:VaultAPI:1.7") } @@ -68,28 +68,6 @@ publishing { } tasks.getByName("jar") { -// duplicatesStrategy = DuplicatesStrategy.EXCLUDE archiveBaseName.set("Plex-HTTPD") archiveVersion.set("") -// from("src/main/resources") { -// include("**/**") -// } -// from("src/main/java") { -// include("**/**") -// } -} - -sourceSets { - main { - resources { - srcDirs("src/main/java", "src/main/resources") - include("**/**") - exclude("**/**.java") - } - } -} - -tasks.getByName("processResources") { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE -} - +} \ No newline at end of file diff --git a/src/main/java/dev/plex/HTTPDModule.java b/src/main/java/dev/plex/HTTPDModule.java index dcae2d8..e50f3cb 100644 --- a/src/main/java/dev/plex/HTTPDModule.java +++ b/src/main/java/dev/plex/HTTPDModule.java @@ -7,8 +7,6 @@ import dev.plex.request.impl.IndefBansEndpoint; import dev.plex.request.impl.ListEndpoint; import dev.plex.request.impl.PunishmentsEndpoint; import dev.plex.util.PlexLog; -import java.io.File; -import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; import lombok.Getter; import net.milkbowl.vault.permission.Permission; @@ -37,7 +35,8 @@ public class HTTPDModule extends PlexModule @Override public void load() { - moduleConfig = new ModuleConfig(this, "settings.yml"); + // Move it from /httpd/config.yml to /plugins/Plex/modules/Plex-HTTPD/config.yml + moduleConfig = new ModuleConfig(this, "httpd/config.yml", "config.yml"); } @Override diff --git a/src/main/java/dev/plex/request/impl/PunishmentsEndpoint.java b/src/main/java/dev/plex/request/impl/PunishmentsEndpoint.java index 8f50b63..8903a1e 100644 --- a/src/main/java/dev/plex/request/impl/PunishmentsEndpoint.java +++ b/src/main/java/dev/plex/request/impl/PunishmentsEndpoint.java @@ -12,14 +12,14 @@ import dev.plex.util.PlexLog; import dev.plex.util.adapter.LocalDateTimeSerializer; import jakarta.servlet.http.HttpServletRequest; import java.io.BufferedReader; -import java.io.FileReader; import java.io.IOException; +import java.io.InputStreamReader; +import java.time.LocalDateTime; +import java.util.Objects; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; -import java.time.LocalDateTime; -import java.util.UUID; - public class PunishmentsEndpoint extends AbstractServlet { @GetMapping(endpoint = "/api/punishments/") @@ -32,11 +32,10 @@ public class PunishmentsEndpoint extends AbstractServlet } if (request.getPathInfo() == null) { - /*StringBuilder contentBuilder = new StringBuilder(); - PlexLog.log(this.getClass().getClassLoader().getResource("punishments.html").getPath()); + StringBuilder contentBuilder = new StringBuilder(); try { - BufferedReader in = new BufferedReader(new FileReader(this.getClass().getClassLoader().getResource("punishments.html").getFile().replace("!", ""))); + BufferedReader in = new BufferedReader(new InputStreamReader(Objects.requireNonNull(this.getClass().getResourceAsStream("/httpd/punishments.html")))); String str; while ((str = in.readLine()) != null) { @@ -47,24 +46,7 @@ public class PunishmentsEndpoint extends AbstractServlet catch (IOException ignored) { } - return contentBuilder.toString();*/ - return """ - - -
-

Enter the UUID or username of the player you want to check

- - - - -
- - """; + return contentBuilder.toString(); } UUID pathUUID; String pathPlexPlayer; diff --git a/src/main/resources/settings.yml b/src/main/resources/httpd/config.yml similarity index 100% rename from src/main/resources/settings.yml rename to src/main/resources/httpd/config.yml diff --git a/src/main/resources/httpd/punishments.html b/src/main/resources/httpd/punishments.html new file mode 100644 index 0000000..bf88386 --- /dev/null +++ b/src/main/resources/httpd/punishments.html @@ -0,0 +1,25 @@ + + +
+

Enter the UUID or username of the player you want to lookup

+ + + + + + +
+ + \ No newline at end of file diff --git a/src/main/resources/punishments.html b/src/main/resources/punishments.html deleted file mode 100644 index 73309ae..0000000 --- a/src/main/resources/punishments.html +++ /dev/null @@ -1,16 +0,0 @@ - - -
-

Enter the UUID or username of the player you want to check

- - - - -
- - \ No newline at end of file