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