Add info about service providers to debugpaste (#4226)

This commit is contained in:
Hannes Greule 2023-11-03 14:58:38 +01:00 committed by GitHub
parent e689337188
commit e3bfd9b8bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -135,6 +135,7 @@ import org.bukkit.generator.ChunkGenerator;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue; import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -1178,6 +1179,17 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
.append(" • Load Before: ").append(p.getDescription().getLoadBefore()).append("\n") .append(" • Load Before: ").append(p.getDescription().getLoadBefore()).append("\n")
.append(" • Dependencies: ").append(p.getDescription().getDepend()).append("\n") .append(" • Dependencies: ").append(p.getDescription().getDepend()).append("\n")
.append(" • Soft Dependencies: ").append(p.getDescription().getSoftDepend()).append("\n"); .append(" • Soft Dependencies: ").append(p.getDescription().getSoftDepend()).append("\n");
List<RegisteredServiceProvider<?>> providers = Bukkit.getServicesManager().getRegistrations(p);
if (!providers.isEmpty()) {
msg.append(" • Provided Services: \n");
for (RegisteredServiceProvider<?> provider : providers) {
msg.append("")
.append(provider.getService().getName()).append(" = ")
.append(provider.getProvider().getClass().getName())
.append(" (priority: ").append(provider.getPriority()).append(")")
.append("\n");
}
}
} }
return msg.toString(); return msg.toString();
} }