mirror of
https://github.com/plexusorg/Module-HTTPD.git
synced 2025-07-01 07:56:43 +00:00
Use config.yml + you can now hit enter to search
This commit is contained in:
@ -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
|
||||
|
@ -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 """
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<div style="text-align: center;">
|
||||
<h2 style="font-family:Helvetica">Enter the UUID or username of the player you want to check</h2>
|
||||
<input id="test" type="text" autofocus>
|
||||
<button type="button" onclick="redirect()">Submit</button>
|
||||
|
||||
<script>
|
||||
function redirect() {
|
||||
var url = document.getElementById('test').value
|
||||
window.location = "punishments/" + url
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>""";
|
||||
return contentBuilder.toString();
|
||||
}
|
||||
UUID pathUUID;
|
||||
String pathPlexPlayer;
|
||||
|
25
src/main/resources/httpd/punishments.html
Normal file
25
src/main/resources/httpd/punishments.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<div style="text-align: center;">
|
||||
<h2 style="font-family:Helvetica,serif">Enter the UUID or username of the player you want to lookup</h2>
|
||||
<input type="text"
|
||||
id="uuid"
|
||||
autofocus
|
||||
onkeydown="if (event.keyCode === 13)
|
||||
document.getElementById('submit').click()"/>
|
||||
|
||||
|
||||
<input type="button"
|
||||
id="submit"
|
||||
value="Submit"
|
||||
onclick="redirect();"/>
|
||||
|
||||
<script>
|
||||
function redirect() {
|
||||
const url = document.getElementById('uuid').value;
|
||||
window.location = "punishments/" + url
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<div style="text-align: center;">
|
||||
<h2 style="font-family:Helvetica">Enter the UUID or username of the player you want to check</h2>
|
||||
<input id="test" type="text" autofocus>
|
||||
<button type="button" onclick="redirect()">Submit</button>
|
||||
|
||||
<script>
|
||||
function redirect() {
|
||||
var url = document.getElementById('test').value
|
||||
window.location = "punishments/" + url
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user