debug msgs

This commit is contained in:
PiggyPiglet
2026-07-06 06:54:38 +08:00
parent 7d21d2f1d7
commit ccf520a1b0
2 changed files with 32 additions and 0 deletions
@@ -91,6 +91,8 @@ public final class CommandDump extends PlaceholderCommand {
@NotNull
private CompletableFuture<String> postDump(@NotNull final String dump) {
System.out.println("DUMP CREATE SUCCESS");
return CompletableFuture.supplyAsync(() -> {
try {
final HttpURLConnection connection = ((HttpURLConnection) new URL(URL + "documents")
@@ -110,6 +112,7 @@ public final class CommandDump extends PlaceholderCommand {
return gson.fromJson(json, JsonObject.class).get("key").getAsString();
}
} catch (final IOException ex) {
ex.printStackTrace();
throw new CompletionException(ex);
}
});
@@ -123,6 +126,8 @@ public final class CommandDump extends PlaceholderCommand {
.append(DATE_FORMAT.format(Instant.now()))
.append("\n\n");
System.out.println("DUMP1");
builder.append("PlaceholderAPI: ")
.append(plugin.getDescription().getVersion())
.append("\n\n");
@@ -130,6 +135,8 @@ public final class CommandDump extends PlaceholderCommand {
builder.append("Expansions Registered:")
.append('\n');
System.out.println("DUMP2");
final List<PlaceholderExpansion> expansions = plugin.getLocalExpansionManager()
.getExpansions()
.stream()
@@ -139,6 +146,8 @@ public final class CommandDump extends PlaceholderCommand {
)
.collect(Collectors.toList());
System.out.println("DUMP3");
int size = expansions.stream().map(e -> e.getIdentifier().length())
.max(Integer::compareTo)
.orElse(0);
@@ -163,6 +172,7 @@ public final class CommandDump extends PlaceholderCommand {
.getExpansionsFolder()
.list((dir, name) -> name.toLowerCase(Locale.ROOT).endsWith(".jar"));
System.out.println("DUMP4");
if (jars == null) {
builder.append(" ¨[Warning]: Could not load jar files from expansions folder.");
@@ -182,10 +192,14 @@ public final class CommandDump extends PlaceholderCommand {
.append(plugin.getServer().getVersion())
.append("\n");
System.out.println("DUMP5");
builder.append("Java Version: ")
.append(System.getProperty("java.version"))
.append("\n\n");
System.out.println("DUMP6");
builder.append("Plugin Info:")
.append('\n');
@@ -193,6 +207,8 @@ public final class CommandDump extends PlaceholderCommand {
.sorted(Comparator.comparing(Plugin::getName))
.collect(Collectors.toList());
System.out.println("DUMP7");
size = plugins.stream().map(pl -> pl.getName().length())
.max(Integer::compareTo)
.orElse(0);
@@ -208,6 +224,8 @@ public final class CommandDump extends PlaceholderCommand {
.append("\n");
}
System.out.println("DUMP8");
return builder.toString();
}
}
@@ -351,13 +351,19 @@ public final class LocalExpansionManager implements Listener {
Msg.info("Placeholder expansion registration initializing...");
Futures.onMainThread(plugin, findExpansionsOnDisk(), (classes, exception) -> {
System.out.println("LOAD1");
if (exception != null) {
Msg.severe("Failed to load class files of expansion.", exception);
exception.printStackTrace();
return;
}
System.out.println("LOAD2 - size: " + classes.size());
final List<PlaceholderExpansion> registered = classes.stream()
.filter(Objects::nonNull)
.peek(clazz -> System.out.println("Attempting register of - " + clazz))
.map(this::register)
.filter(Optional::isPresent)
.map(Optional::get)
@@ -386,6 +392,8 @@ public final class LocalExpansionManager implements Listener {
Msg.msg(sender, message.toString());
Bukkit.getPluginManager().callEvent(new ExpansionsLoadedEvent(registered));
System.out.println("LOAD3");
});
}
@@ -402,6 +410,10 @@ public final class LocalExpansionManager implements Listener {
@NotNull
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
File[] files = folder.listFiles((dir, name) -> name.endsWith(".jar"));
System.out.println(folder);
System.out.println("FIND FILES - " + Arrays.toString(files));
if (files == null) {
return CompletableFuture.completedFuture(Collections.emptyList());
}
@@ -414,6 +426,8 @@ public final class LocalExpansionManager implements Listener {
@NotNull
public CompletableFuture<@Nullable Class<? extends PlaceholderExpansion>> findExpansionInFile(
@NotNull final File file) {
System.out.println("FOUND FILE - " + file);
return CompletableFuture.supplyAsync(() -> {
try {
final Class<? extends PlaceholderExpansion> expansionClass = FileUtil.findClass(file, PlaceholderExpansion.class);