Add method isTickingWorlds to Bukkit (#8316)
Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Also, restores un/loading worlds mid tick. This will not be officially supported API contract that such a routine is safe, and these restrictions may be restored in the future.
This commit is contained in:
parent
6736f390a2
commit
4d52f1d247
17 changed files with 136 additions and 7 deletions
|
@ -0,0 +1,48 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Hensel <nickhensel25@icloud.com>
|
||||
Date: Sun, 28 Aug 2022 23:44:18 +0200
|
||||
Subject: [PATCH] Also load resources from LibraryLoader
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
index 345394132df70593800127d34a38f8f8a4dafe00..f7cfe6c0d9d52ed72d0d45baaaf856c15769c668 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -90,14 +90,35 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
|
||||
@Override
|
||||
public URL getResource(String name) {
|
||||
- return findResource(name);
|
||||
+ // Paper start
|
||||
+ URL resource = findResource(name);
|
||||
+ if (resource == null && libraryLoader != null) {
|
||||
+ return libraryLoader.getResource(name);
|
||||
+ }
|
||||
+ return resource;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<URL> getResources(String name) throws IOException {
|
||||
- return findResources(name);
|
||||
+ // Paper start
|
||||
+ java.util.ArrayList<URL> resources = new java.util.ArrayList<>();
|
||||
+ addEnumeration(resources, findResources(name));
|
||||
+ if (libraryLoader != null) {
|
||||
+ addEnumeration(resources, libraryLoader.getResources(name));
|
||||
+ }
|
||||
+ return Collections.enumeration(resources);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private <T> void addEnumeration(java.util.ArrayList<T> list, Enumeration<T> enumeration) {
|
||||
+ while (enumeration.hasMoreElements()) {
|
||||
+ list.add(enumeration.nextElement());
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
||||
return loadClass0(name, resolve, true, true);
|
Loading…
Add table
Add a link
Reference in a new issue