Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-14 18:40:10 +01:00
Paper Plugins (#8108)
Dieser Commit ist enthalten in:
Ursprung
f9dc371fd8
Commit
841da90501
@ -39,7 +39,7 @@ subprojects {
|
||||
events(TestLogEvent.STANDARD_OUT)
|
||||
}
|
||||
minHeapSize = "2g"
|
||||
maxHeapSize = "2g"
|
||||
maxHeapSize = "4g"
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..756acf231b1b076b08046d86992ba7ce
|
||||
+
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 4ac3dd977e75cd8464163351d306e037ee32cb48..1a71bb8861150c1add6446aa2fad0f7035dd6873 100644
|
||||
index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c84891b8b0fd 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -40,7 +40,17 @@ public class AnnotationTest {
|
||||
@ -229,7 +229,19 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..1a71bb8861150c1add6446aa2fad0f70
|
||||
}
|
||||
|
||||
private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException {
|
||||
@@ -152,7 +193,7 @@ public class AnnotationTest {
|
||||
@@ -140,6 +181,11 @@ public class AnnotationTest {
|
||||
// Exceptions are excluded
|
||||
return false;
|
||||
}
|
||||
+ // Paper start
|
||||
+ if (isInternal(clazz.invisibleAnnotations)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
for (String excludedClass : EXCLUDED_CLASSES) {
|
||||
if (excludedClass.equals(clazz.name)) {
|
||||
@@ -152,7 +198,7 @@ public class AnnotationTest {
|
||||
|
||||
private static boolean isMethodIncluded(@NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull Map<String, ClassNode> allClasses) {
|
||||
// Exclude private, synthetic and deprecated methods
|
||||
@ -238,9 +250,32 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..1a71bb8861150c1add6446aa2fad0f70
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -174,7 +215,7 @@ public class AnnotationTest {
|
||||
@@ -170,11 +216,30 @@ public class AnnotationTest {
|
||||
if ("<init>".equals(method.name) && isAnonymous(clazz)) {
|
||||
return false;
|
||||
}
|
||||
+ // Paper start
|
||||
+ if (isInternal(method.invisibleAnnotations)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
return true;
|
||||
}
|
||||
+ // Paper start
|
||||
+ private static boolean isInternal(List<? extends AnnotationNode> annotations) {
|
||||
+ if (annotations == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (AnnotationNode node : annotations) {
|
||||
+ if (node.desc.equals("Lorg/jetbrains/annotations/ApiStatus$Internal;")) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
- private static boolean isWellAnnotated(@Nullable List<AnnotationNode> annotations) {
|
||||
+ private static boolean isWellAnnotated(@Nullable List<? extends AnnotationNode> annotations) { // Paper
|
||||
|
@ -1561,20 +1561,19 @@ index ab6b0ec328e94bf65a0dafd0403e5ee3b870296c..c8d37184d8e882a4084a1bfef85faa33
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
|
||||
index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d02168acb567e 100644
|
||||
index 80209bb88a0294d4eedc78509533a6257315d856..caa29be46e8541b69ec47c181eb3320d6515b544 100644
|
||||
--- a/src/main/java/org/bukkit/command/Command.java
|
||||
+++ b/src/main/java/org/bukkit/command/Command.java
|
||||
@@ -32,8 +32,7 @@ public abstract class Command {
|
||||
@@ -32,7 +32,7 @@ public abstract class Command {
|
||||
protected String description;
|
||||
protected String usageMessage;
|
||||
private String permission;
|
||||
- private String permissionMessage;
|
||||
- public org.spigotmc.CustomTimingsHandler timings; // Spigot
|
||||
+ private net.kyori.adventure.text.Component permissionMessage; // Paper
|
||||
public org.spigotmc.CustomTimingsHandler timings; // Spigot
|
||||
|
||||
protected Command(@NotNull String name) {
|
||||
this(name, "", "/" + name, new ArrayList<String>());
|
||||
@@ -186,10 +185,10 @@ public abstract class Command {
|
||||
@@ -186,10 +186,10 @@ public abstract class Command {
|
||||
|
||||
if (permissionMessage == null) {
|
||||
target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is a mistake.");
|
||||
@ -1589,7 +1588,7 @@ index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d0216
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -317,10 +316,12 @@ public abstract class Command {
|
||||
@@ -317,10 +317,12 @@ public abstract class Command {
|
||||
* command
|
||||
*
|
||||
* @return Permission check failed message
|
||||
@ -1603,7 +1602,7 @@ index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d0216
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -381,10 +382,12 @@ public abstract class Command {
|
||||
@@ -381,10 +383,12 @@ public abstract class Command {
|
||||
* @param permissionMessage new permission message, null to indicate
|
||||
* default message, or an empty string to indicate no message
|
||||
* @return this command object, for chaining
|
||||
@ -1617,7 +1616,7 @@ index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d0216
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -399,13 +402,47 @@ public abstract class Command {
|
||||
@@ -399,13 +403,47 @@ public abstract class Command {
|
||||
this.usageMessage = (usage == null) ? "" : usage;
|
||||
return this;
|
||||
}
|
||||
@ -1666,7 +1665,7 @@ index 80209bb88a0294d4eedc78509533a6257315d856..57ade3963faae3724d9a01eeeb6d0216
|
||||
|
||||
if (source instanceof BlockCommandSender) {
|
||||
BlockCommandSender blockCommandSender = (BlockCommandSender) source;
|
||||
@@ -424,7 +461,12 @@ public abstract class Command {
|
||||
@@ -424,7 +462,12 @@ public abstract class Command {
|
||||
}
|
||||
|
||||
Set<Permissible> users = Bukkit.getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE);
|
||||
@ -4677,7 +4676,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..47b10df619ad2520b9bb673e2220f363
|
||||
|
||||
/**
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 1a71bb8861150c1add6446aa2fad0f7035dd6873..8275a5d7e1de39a5171e254f449a42c6defd3445 100644
|
||||
index 8f35cda0d67ec66646c6096a5bf1c84891b8b0fd..9825db30d42701aad5d9970bbb989fbff0142fb1 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -26,6 +26,12 @@ import org.objectweb.asm.tree.ParameterNode;
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Use ASM for event executors.
|
||||
Uses method handles for private or static methods.
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index c9f9174a085174b96897c013e0ecb79738c2e9e3..9d650b937610d83748b30d724cee97afd715167f 100644
|
||||
index 558fa62d87af1103efa703ef9114481cb928cf8d..359e7bd7e3c76cec89d638f940006dc9c944f98b 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -39,6 +39,9 @@ dependencies {
|
||||
@ -368,30 +368,3 @@ index a850f0780de05463fc0d3f9e15ff7f19d88b2aed..9026e108ccd3a88aee1267ee275137be
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 5eb24f38f158d43fb42836b83c108f808c89512e..5d74fab03a15d7099e5dacb780eade4cdc185797 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -291,21 +291,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
}
|
||||
}
|
||||
|
||||
- EventExecutor executor = new co.aikar.timings.TimedEventExecutor(new EventExecutor() { // Paper
|
||||
- @Override
|
||||
- public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper
|
||||
- try {
|
||||
- if (!eventClass.isAssignableFrom(event.getClass())) {
|
||||
- return;
|
||||
- }
|
||||
- method.invoke(listener, event);
|
||||
- } catch (InvocationTargetException ex) {
|
||||
- throw new EventException(ex.getCause());
|
||||
- } catch (Throwable t) {
|
||||
- throw new EventException(t);
|
||||
- }
|
||||
- }
|
||||
- }, plugin, method, eventClass); // Paper
|
||||
+ EventExecutor executor = new co.aikar.timings.TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass); // Paper // Paper (Yes.) - Use factory method `EventExecutor.create()`
|
||||
if (false) { // Spigot - RL handles useTimings check now
|
||||
eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
|
||||
} else {
|
2494
patches/api/0008-Paper-Plugins.patch
Normale Datei
2494
patches/api/0008-Paper-Plugins.patch
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1,181 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Tue, 18 May 2021 14:42:26 -0700
|
||||
Subject: [PATCH] Add command line option to load extra plugin jars not in the
|
||||
plugins folder
|
||||
|
||||
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index e24589a4cb42b0163e4a1455b8b11d7130b5cd41..71a09ed2b9863d2d339967f41ab6373ec27429d3 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -76,6 +76,20 @@ public final class Bukkit {
|
||||
return server;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
|
||||
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
|
||||
+ *
|
||||
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
|
||||
+ * directory manually when determining the location in which to store their data and configuration files.</p>
|
||||
+ *
|
||||
+ * @return plugins directory
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static File getPluginsFolder() {
|
||||
+ return server.getPluginsFolder();
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Attempts to set the {@link Server} singleton.
|
||||
* <p>
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index ac087402c90dad4b3c499fcf8507e50e9099cea5..a4f8035b40eebff8afe01788781128b04247f28c 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -61,6 +61,18 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper
|
||||
|
||||
+ /**
|
||||
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
|
||||
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
|
||||
+ *
|
||||
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
|
||||
+ * directory manually when determining the location in which to store their data and configuration files.</p>
|
||||
+ *
|
||||
+ * @return plugins directory
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ File getPluginsFolder();
|
||||
+
|
||||
/**
|
||||
* Used for all administrative messages, such as an operator using a
|
||||
* command.
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 763b3e9ea24b14c54abf94048931f29228c76df5..1bfa9fcb1b803eecfe33156f81ee88d2922ca88a 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -111,6 +111,12 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
@NotNull
|
||||
public Plugin[] loadPlugins(@NotNull File directory) {
|
||||
+ // Paper start - extra jars
|
||||
+ return this.loadPlugins(directory, java.util.Collections.emptyList());
|
||||
+ }
|
||||
+ @NotNull
|
||||
+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List<File> extraPluginJars) {
|
||||
+ // Paper end
|
||||
Preconditions.checkArgument(directory != null, "Directory cannot be null");
|
||||
Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory");
|
||||
|
||||
@@ -128,7 +134,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
Map<String, Collection<String>> softDependencies = new HashMap<String, Collection<String>>();
|
||||
|
||||
// This is where it figures out all possible plugins
|
||||
- for (File file : directory.listFiles()) {
|
||||
+ // Paper start - extra jars
|
||||
+ final List<File> pluginJars = new ArrayList<>(java.util.Arrays.asList(directory.listFiles()));
|
||||
+ pluginJars.addAll(extraPluginJars);
|
||||
+ for (File file : pluginJars) {
|
||||
+ // Paper end
|
||||
PluginLoader loader = null;
|
||||
for (Pattern filter : filters) {
|
||||
Matcher match = filter.matcher(file.getName());
|
||||
@@ -144,14 +154,14 @@ public final class SimplePluginManager implements PluginManager {
|
||||
description = loader.getPluginDescription(file);
|
||||
String name = description.getName();
|
||||
if (name.equalsIgnoreCase("bukkit") || name.equalsIgnoreCase("minecraft") || name.equalsIgnoreCase("mojang")) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': Restricted Name");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': Restricted Name"); // Paper
|
||||
continue;
|
||||
} else if (description.rawName.indexOf(' ') != -1) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': uses the space-character (0x20) in its name");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': uses the space-character (0x20) in its name"); // Paper
|
||||
continue;
|
||||
}
|
||||
} catch (InvalidDescriptionException ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -162,7 +172,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
description.getName(),
|
||||
file.getPath(),
|
||||
replacedFile.getPath(),
|
||||
- directory.getPath()
|
||||
+ file.getParentFile().getPath() // Paper
|
||||
));
|
||||
}
|
||||
|
||||
@@ -183,7 +193,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
file.getPath(),
|
||||
provided,
|
||||
pluginFile.getPath(),
|
||||
- directory.getPath()
|
||||
+ file.getParentFile().getPath() // Paper
|
||||
));
|
||||
} else {
|
||||
String replacedPlugin = pluginsProvided.put(provided, description.getName());
|
||||
@@ -265,7 +275,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
server.getLogger().log(
|
||||
Level.SEVERE,
|
||||
- "Could not load '" + entry.getValue().getPath() + "' in folder '" + directory.getPath() + "'",
|
||||
+ "Could not load '" + entry.getValue().getPath() + "' in folder '" + entry.getValue().getParentFile().getPath() + "'", // Paper
|
||||
new UnknownDependencyException("Unknown dependency " + dependency + ". Please download and install " + dependency + " to run this plugin."));
|
||||
break;
|
||||
}
|
||||
@@ -304,11 +314,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
loadedPlugins.add(loadedPlugin.getName());
|
||||
loadedPlugins.addAll(loadedPlugin.getDescription().getProvides());
|
||||
} else {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'"); // Paper
|
||||
}
|
||||
continue;
|
||||
} catch (InvalidPluginException ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -335,11 +345,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
loadedPlugins.add(loadedPlugin.getName());
|
||||
loadedPlugins.addAll(loadedPlugin.getDescription().getProvides());
|
||||
} else {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'"); // Paper
|
||||
}
|
||||
break;
|
||||
} catch (InvalidPluginException ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'", ex);
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "'", ex); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -352,7 +362,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
while (failedPluginIterator.hasNext()) {
|
||||
File file = failedPluginIterator.next();
|
||||
failedPluginIterator.remove();
|
||||
- server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "': circular dependency detected");
|
||||
+ server.getLogger().log(Level.SEVERE, "Could not load '" + file.getPath() + "' in folder '" + file.getParentFile().getPath() + "': circular dependency detected"); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 5c1b8b05d8a5408bb4830942c74ebfe400ab5a32..333c47a1f7e9d7ddf91aad5ec15163427f7b8039 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -91,7 +91,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
throw new InvalidPluginException(ex);
|
||||
}
|
||||
|
||||
- final File parentFile = file.getParentFile();
|
||||
+ final File parentFile = this.server.getPluginsFolder(); // Paper
|
||||
final File dataFolder = new File(parentFile, description.getName());
|
||||
@SuppressWarnings("deprecation")
|
||||
final File oldDataFolder = new File(parentFile, description.getRawName());
|
@ -2834,7 +2834,7 @@ index 892e03189957b0072827be4fd485dd98352334e8..ac087402c90dad4b3c499fcf8507e50e
|
||||
* Sends the component to the player
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 876072a6c91bd02c9c7de53556419b8e1ac48f27..33c005a11e1ee241c1146e2cc291d523b1dd744e 100644
|
||||
index dc9a4f12d9f05a3ae7c9f1c7648123e4b3dfd115..daf3ac72cae4d19c0273058dc6a1e1afe9a47f77 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -33,6 +33,7 @@ public interface UnsafeValues {
|
||||
@ -2845,10 +2845,10 @@ index 876072a6c91bd02c9c7de53556419b8e1ac48f27..33c005a11e1ee241c1146e2cc291d523
|
||||
Material toLegacy(Material material);
|
||||
|
||||
Material fromLegacy(Material material);
|
||||
@@ -96,4 +97,12 @@ public interface UnsafeValues {
|
||||
String getTranslationKey(EntityType entityType);
|
||||
|
||||
String getTranslationKey(ItemStack itemStack);
|
||||
@@ -106,4 +107,12 @@ public interface UnsafeValues {
|
||||
return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
|
||||
}
|
||||
// Paper end
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
@ -2886,19 +2886,20 @@ index 0000000000000000000000000000000000000000..f9a00aecca5ec41b460bf41dfe1c6969
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
|
||||
index 57ade3963faae3724d9a01eeeb6d02168acb567e..6fd341482d5250ad814e870360e40b52427f799a 100644
|
||||
index caa29be46e8541b69ec47c181eb3320d6515b544..6fd341482d5250ad814e870360e40b52427f799a 100644
|
||||
--- a/src/main/java/org/bukkit/command/Command.java
|
||||
+++ b/src/main/java/org/bukkit/command/Command.java
|
||||
@@ -33,6 +33,8 @@ public abstract class Command {
|
||||
@@ -33,7 +33,8 @@ public abstract class Command {
|
||||
protected String usageMessage;
|
||||
private String permission;
|
||||
private net.kyori.adventure.text.Component permissionMessage; // Paper
|
||||
- public org.spigotmc.CustomTimingsHandler timings; // Spigot
|
||||
+ public co.aikar.timings.Timing timings; // Paper
|
||||
+ @NotNull public String getTimingName() {return getName();} // Paper
|
||||
|
||||
protected Command(@NotNull String name) {
|
||||
this(name, "", "/" + name, new ArrayList<String>());
|
||||
@@ -46,7 +48,6 @@ public abstract class Command {
|
||||
@@ -47,7 +48,6 @@ public abstract class Command {
|
||||
this.usageMessage = (usageMessage == null) ? "/" + name : usageMessage;
|
||||
this.aliases = aliases;
|
||||
this.activeAliases = new ArrayList<String>(aliases);
|
||||
@ -2906,7 +2907,7 @@ index 57ade3963faae3724d9a01eeeb6d02168acb567e..6fd341482d5250ad814e870360e40b52
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,7 +245,6 @@ public abstract class Command {
|
||||
@@ -245,7 +245,6 @@ public abstract class Command {
|
||||
}
|
||||
this.nextLabel = name;
|
||||
if (!isRegistered()) {
|
||||
@ -3079,7 +3080,7 @@ index 0000000000000000000000000000000000000000..9d263ab3afb938c215c0b64d9171345f
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index e195e74c48c69047aa825b75fad95419c505b41f..f99d71301ceaa3af07ff0525f7d657ac6253d0e6 100644
|
||||
index 53f28c9e6843991486a576d41b6641c170589807..4205649948a9e2a72f64c3f007112245abac6d50 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -15,7 +15,6 @@ import org.bukkit.command.defaults.BukkitCommand;
|
||||
@ -3093,7 +3094,7 @@ index e195e74c48c69047aa825b75fad95419c505b41f..f99d71301ceaa3af07ff0525f7d657ac
|
||||
@@ -35,7 +34,7 @@ public class SimpleCommandMap implements CommandMap {
|
||||
register("bukkit", new VersionCommand("version"));
|
||||
register("bukkit", new ReloadCommand("reload"));
|
||||
register("bukkit", new PluginsCommand("plugins"));
|
||||
//register("bukkit", new PluginsCommand("plugins")); // Paper
|
||||
- register("bukkit", new TimingsCommand("timings"));
|
||||
+ register("bukkit", new co.aikar.timings.TimingsCommand("timings")); // Paper
|
||||
}
|
||||
@ -3410,10 +3411,10 @@ index 4053c086a9ef9aa071402818672643bd800851d6..705644a2e0d209ef717470da07d34faf
|
||||
|
||||
@NotNull
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index a69c5d5cad6168aeaae41e8adc319dc8c976b1e2..763b3e9ea24b14c54abf94048931f29228c76df5 100644
|
||||
index f64a90241ce7f73e111e6b5ac6ff87cd93583c0e..f13dcbe448111b24b36105d25527ba87ccc9334e 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -358,7 +358,6 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -368,7 +368,6 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
@ -3421,7 +3422,7 @@ index a69c5d5cad6168aeaae41e8adc319dc8c976b1e2..763b3e9ea24b14c54abf94048931f292
|
||||
return result.toArray(new Plugin[result.size()]);
|
||||
}
|
||||
|
||||
@@ -397,9 +396,9 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -416,9 +415,9 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
if (result != null) {
|
||||
plugins.add(result);
|
||||
@ -3433,16 +3434,16 @@ index a69c5d5cad6168aeaae41e8adc319dc8c976b1e2..763b3e9ea24b14c54abf94048931f292
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +427,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
@@ -448,7 +447,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Nullable
|
||||
public synchronized Plugin getPlugin(@NotNull String name) {
|
||||
if (true) {return this.paperPluginManager.getPlugin(name);} // Paper
|
||||
- return lookupNames.get(name.replace(' ', '_'));
|
||||
+ return lookupNames.get(name.replace(' ', '_').toLowerCase(java.util.Locale.ENGLISH)); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -646,7 +645,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -676,7 +675,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled");
|
||||
}
|
||||
|
||||
@ -3452,28 +3453,29 @@ index a69c5d5cad6168aeaae41e8adc319dc8c976b1e2..763b3e9ea24b14c54abf94048931f292
|
||||
getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
|
||||
} else {
|
||||
getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
|
||||
@@ -866,7 +866,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
@@ -911,7 +911,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
public boolean useTimings() {
|
||||
if (true) {return this.paperPluginManager.useTimings();} // Paper
|
||||
- return useTimings;
|
||||
+ return co.aikar.timings.Timings.isTimingsEnabled(); // Spigot
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -875,6 +875,6 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -920,7 +920,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
* @param use True if per event timing code should be used
|
||||
*/
|
||||
public void useTimings(boolean use) {
|
||||
- useTimings = use;
|
||||
+ co.aikar.timings.Timings.setTimingsEnabled(use); // Paper
|
||||
}
|
||||
}
|
||||
|
||||
// Paper start
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 047c0304fd617cec990f80815b43916c6ef5a94c..5c1b8b05d8a5408bb4830942c74ebfe400ab5a32 100644
|
||||
index d0ad072c832b8fc8a1cfdcafdd42c724531a2e29..02062284dbc1a6c923ceffa5e4d6a3be8c7429d3 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -54,7 +54,6 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -55,7 +55,6 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")};
|
||||
private final List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>();
|
||||
private final LibraryLoader libraryLoader;
|
||||
@ -3481,7 +3483,7 @@ index 047c0304fd617cec990f80815b43916c6ef5a94c..5c1b8b05d8a5408bb4830942c74ebfe4
|
||||
|
||||
/**
|
||||
* This class was not meant to be constructed explicitly
|
||||
@@ -292,27 +291,21 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -294,27 +293,21 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
}
|
||||
}
|
||||
|
||||
@ -3513,15 +3515,13 @@ index 047c0304fd617cec990f80815b43916c6ef5a94c..5c1b8b05d8a5408bb4830942c74ebfe4
|
||||
eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
|
||||
} else {
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
index 2f74ec96ece706de23156ebabfe493211bc05391..6148b69af39344f758b05a28c7c572befa9b8f3f 100644
|
||||
index e721c58eafee2180d4ba1a73002cf850355a366e..39c9253d03bae99f8b5b19d22295f6172606d57b 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -29,7 +29,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* A ClassLoader for plugins, to allow shared classes across multiple plugins
|
||||
@@ -31,6 +31,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
-final class PluginClassLoader extends URLClassLoader {
|
||||
+public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
@org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
public final class PluginClassLoader extends URLClassLoader implements io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader { // Paper
|
||||
+ public JavaPlugin getPlugin() { return plugin; } // Spigot
|
||||
private final JavaPluginLoader loader;
|
||||
private final Map<String, Class<?>> classes = new ConcurrentHashMap<String, Class<?>>();
|
@ -0,0 +1,96 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Tue, 18 May 2021 14:42:26 -0700
|
||||
Subject: [PATCH] Add command line option to load extra plugin jars not in the
|
||||
plugins folder
|
||||
|
||||
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index e24589a4cb42b0163e4a1455b8b11d7130b5cd41..71a09ed2b9863d2d339967f41ab6373ec27429d3 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -76,6 +76,20 @@ public final class Bukkit {
|
||||
return server;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
|
||||
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
|
||||
+ *
|
||||
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
|
||||
+ * directory manually when determining the location in which to store their data and configuration files.</p>
|
||||
+ *
|
||||
+ * @return plugins directory
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static File getPluginsFolder() {
|
||||
+ return server.getPluginsFolder();
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Attempts to set the {@link Server} singleton.
|
||||
* <p>
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index ac087402c90dad4b3c499fcf8507e50e9099cea5..a4f8035b40eebff8afe01788781128b04247f28c 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -61,6 +61,18 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper
|
||||
|
||||
+ /**
|
||||
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
|
||||
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
|
||||
+ *
|
||||
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
|
||||
+ * directory manually when determining the location in which to store their data and configuration files.</p>
|
||||
+ *
|
||||
+ * @return plugins directory
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ File getPluginsFolder();
|
||||
+
|
||||
/**
|
||||
* Used for all administrative messages, such as an operator using a
|
||||
* command.
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index f13dcbe448111b24b36105d25527ba87ccc9334e..3fcb73a0fc2daaeb76dd4c6757afce52c5b3118b 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -116,9 +116,22 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
@NotNull
|
||||
public Plugin[] loadPlugins(@NotNull File directory) {
|
||||
+ // Paper start - extra jars
|
||||
+ return this.loadPlugins(directory, java.util.Collections.emptyList());
|
||||
+ }
|
||||
+ @NotNull
|
||||
+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List<File> extraPluginJars) {
|
||||
+ // Paper end
|
||||
if (true) {
|
||||
List<Plugin> pluginList = new ArrayList<>();
|
||||
java.util.Collections.addAll(pluginList, this.paperPluginManager.loadPlugins(directory));
|
||||
+ for (File file : extraPluginJars) {
|
||||
+ try {
|
||||
+ pluginList.add(this.paperPluginManager.loadPlugin(file));
|
||||
+ } catch (Exception e) {
|
||||
+ this.server.getLogger().log(Level.SEVERE, "Plugin loading error!", e);
|
||||
+ }
|
||||
+ }
|
||||
return pluginList.toArray(new Plugin[0]);
|
||||
}
|
||||
Preconditions.checkArgument(directory != null, "Directory cannot be null");
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 02062284dbc1a6c923ceffa5e4d6a3be8c7429d3..88d852c1a729ffd5951da803da424b31591c9f9a 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -93,7 +93,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
throw new InvalidPluginException(ex);
|
||||
}
|
||||
|
||||
- final File parentFile = file.getParentFile();
|
||||
+ final File parentFile = this.server.getPluginsFolder(); // Paper
|
||||
final File dataFolder = new File(parentFile, description.getName());
|
||||
@SuppressWarnings("deprecation")
|
||||
final File oldDataFolder = new File(parentFile, description.getRawName());
|
@ -56,10 +56,10 @@ index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c7
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 33c005a11e1ee241c1146e2cc291d523b1dd744e..5183d3b1893fdcad9a475b747cb34df5653774fd 100644
|
||||
index daf3ac72cae4d19c0273058dc6a1e1afe9a47f77..24fad8e59a3a5a174d24505cedda2a3fd52115b1 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -104,5 +104,12 @@ public interface UnsafeValues {
|
||||
@@ -114,5 +114,12 @@ public interface UnsafeValues {
|
||||
* @return name
|
||||
*/
|
||||
String getTimingsServerName();
|
@ -462,7 +462,7 @@ index 0000000000000000000000000000000000000000..5582999fe94c7a3dac655044ccc6d078
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index f99d71301ceaa3af07ff0525f7d657ac6253d0e6..2e23c124311b38aaea64dd274c33afcd52edcf43 100644
|
||||
index 4205649948a9e2a72f64c3f007112245abac6d50..b3b32ce429edbf1ed040354dbe28ab86f0d24201 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -155,11 +155,14 @@ public class SimpleCommandMap implements CommandMap {
|
||||
@ -493,10 +493,10 @@ index f99d71301ceaa3af07ff0525f7d657ac6253d0e6..2e23c124311b38aaea64dd274c33afcd
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 1bfa9fcb1b803eecfe33156f81ee88d2922ca88a..b535ab89b5a04371bac41720d28b4af8b18f1c20 100644
|
||||
index 5a25e44c6ddeec5ad5fdd8c4a1f30dba5546cbe6..d1d5bf23529434730df7be8ae463d2e32c9fcf5f 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -488,7 +488,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -515,7 +515,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
try {
|
||||
plugin.getPluginLoader().enablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
@ -506,7 +506,7 @@ index 1bfa9fcb1b803eecfe33156f81ee88d2922ca88a..b535ab89b5a04371bac41720d28b4af8
|
||||
}
|
||||
|
||||
HandlerList.bakeAll();
|
||||
@@ -509,32 +510,37 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -538,32 +539,37 @@ public final class SimplePluginManager implements PluginManager {
|
||||
try {
|
||||
plugin.getPluginLoader().disablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
@ -549,7 +549,7 @@ index 1bfa9fcb1b803eecfe33156f81ee88d2922ca88a..b535ab89b5a04371bac41720d28b4af8
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -547,6 +553,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -576,6 +582,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
@ -562,8 +562,8 @@ index 1bfa9fcb1b803eecfe33156f81ee88d2922ca88a..b535ab89b5a04371bac41720d28b4af8
|
||||
+
|
||||
@Override
|
||||
public void clearPlugins() {
|
||||
synchronized (this) {
|
||||
@@ -610,7 +623,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
if (true) {this.paperPluginManager.clearPlugins(); return;} // Paper
|
||||
@@ -641,7 +654,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
));
|
||||
}
|
||||
} catch (Throwable ex) {
|
@ -84,21 +84,3 @@ index 50cc311be7904cc8fc6070a21c8e4de3a489fd20..5fa9d648bc780e874f658597f1a24715
|
||||
+ return java.util.Collections.singletonList("permissions"); // Paper
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index b535ab89b5a04371bac41720d28b4af8b18f1c20..77caec9f974077ed6580d3cbbc20feb1199feb11 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -906,4 +906,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
public void useTimings(boolean use) {
|
||||
co.aikar.timings.Timings.setTimingsEnabled(use); // Paper
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public void clearPermissions() {
|
||||
+ permissions.clear();
|
||||
+ defaultPerms.get(true).clear();
|
||||
+ defaultPerms.get(false).clear();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ index bd2c7a6964722412148fae39e1b4951fc0002b9b..864c263bbd4dd6dd7c37a74b39b1a40a
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 2e23c124311b38aaea64dd274c33afcd52edcf43..950a2d0b3b583c6b9a703190874bbc4df2783ab7 100644
|
||||
index b3b32ce429edbf1ed040354dbe28ab86f0d24201..1424060c0a162020d4a680e0a592224561067b16 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -293,4 +293,11 @@ public class SimpleCommandMap implements CommandMap {
|
||||
|
@ -7,7 +7,7 @@ Provides counts without the ineffeciency of using .getEntities().size()
|
||||
which creates copy of the collections.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 75a87b221cc0f6334c5283130a7b2bfdf4eedd03..e6c9942f7820f2b8750c1bb0825c8bdbc6f4b99e 100644
|
||||
index 8a6a548314eef8d486be908e38e3a4562f26bdb4..749d3de7dad480965be536938733d72bdfc2995b 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -45,6 +45,33 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] LivingEntity#setKiller
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 069711e792f92c2afa9dc661a2b14c55ffa54114..3489c719089e5cc0cc4710e8a06417c02dd76767 100644
|
||||
index 9977bb3cb5a66c84db816f8e4597db1c053f77c8..ccd8f36c8450bab9f609bb220b5270394960580e 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -295,6 +295,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
@ -14,7 +14,7 @@ it without having to shade it in the plugin and going through
|
||||
several layers of logging abstraction.
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 9d650b937610d83748b30d724cee97afd715167f..3c4dd6ebc2289c44c2f5723e7920aadffdc51884 100644
|
||||
index f5f217a3a786bf4c95bea74c135289d12205cf7b..56333098150995cd36793de75a998b628e82881d 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -39,6 +39,8 @@ dependencies {
|
||||
@ -27,10 +27,10 @@ index 9d650b937610d83748b30d724cee97afd715167f..3c4dd6ebc2289c44c2f5723e7920aadf
|
||||
implementation("org.ow2.asm:asm:9.2")
|
||||
implementation("org.ow2.asm:asm-commons:9.2")
|
||||
diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java
|
||||
index b37938745f916b5f0111b07b1a1c97527f026e9d..08aef59d8443038771704d9587e31f299e587307 100644
|
||||
index 8c76716249e44ed8bf6be94c1f5c7b6d9bb35be2..4eb639fbb46a0848be207149ea433455550fae1c 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/Plugin.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/Plugin.java
|
||||
@@ -186,6 +186,22 @@ public interface Plugin extends TabExecutor {
|
||||
@@ -198,6 +198,22 @@ public interface Plugin extends TabExecutor {
|
||||
}
|
||||
// Paper end
|
||||
|
@ -17,10 +17,10 @@ The implementation should handle plugin prefixes by displaying
|
||||
logger names when appropriate.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
index 669a70faa95d0d6525a731d73499ed6fb0b48320..1ff0e0ef1aebec5bbb0a8a09af11d07b2a3220e8 100644
|
||||
index a5636b1f223dd37420a4acbccf28f7198a7eee98..accac9527b1c267b75774532b85f28c868b06c28 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
@@ -43,7 +43,7 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
@@ -44,7 +44,7 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
private boolean naggable = true;
|
||||
private FileConfiguration newConfig = null;
|
||||
private File configFile = null;
|
||||
@ -28,14 +28,14 @@ index 669a70faa95d0d6525a731d73499ed6fb0b48320..1ff0e0ef1aebec5bbb0a8a09af11d07b
|
||||
+ private Logger logger = null; // Paper - PluginLogger -> Logger
|
||||
|
||||
public JavaPlugin() {
|
||||
final ClassLoader classLoader = this.getClass().getClassLoader();
|
||||
@@ -277,7 +277,8 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
// Paper start
|
||||
@@ -297,8 +297,8 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
this.dataFolder = dataFolder;
|
||||
this.classLoader = classLoader;
|
||||
this.configFile = new File(dataFolder, "config.yml");
|
||||
- this.logger = new PluginLogger(this);
|
||||
+ // Paper - Handle plugin prefix in implementation
|
||||
+ this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName());
|
||||
this.pluginMeta = configuration; // Paper
|
||||
+ this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); // Paper - Handle plugin prefix in implementation
|
||||
}
|
||||
|
||||
/**
|
@ -14,12 +14,13 @@ parent of the plugin logger to avoid this.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..76f2cb9cd99cad2a9484eab2becd8c36f1dd91b3
|
||||
index 0000000000000000000000000000000000000000..087ee57fe5485bc760fadd45a176d4d90a18f9f8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/utils/PaperPluginLogger.java
|
||||
@@ -0,0 +1,41 @@
|
||||
@@ -0,0 +1,48 @@
|
||||
+package com.destroystokyo.paper.utils;
|
||||
+
|
||||
+import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||
+import org.bukkit.plugin.PluginDescriptionFile;
|
||||
+
|
||||
+import java.util.logging.Level;
|
||||
@ -32,20 +33,26 @@ index 0000000000000000000000000000000000000000..76f2cb9cd99cad2a9484eab2becd8c36
|
||||
+ */
|
||||
+public class PaperPluginLogger extends Logger {
|
||||
+
|
||||
+ @Deprecated(forRemoval = true)
|
||||
+ @NotNull
|
||||
+ public static Logger getLogger(@NotNull PluginDescriptionFile description) {
|
||||
+ Logger logger = new PaperPluginLogger(description);
|
||||
+ return getLogger((PluginMeta) description);
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static Logger getLogger(@NotNull PluginMeta meta) {
|
||||
+ Logger logger = new PaperPluginLogger(meta);
|
||||
+ if (!LogManager.getLogManager().addLogger(logger)) {
|
||||
+ // Disable this if it's going to happen across reloads anyways...
|
||||
+ //logger.log(Level.WARNING, "Could not insert plugin logger - one was already found: {}", LogManager.getLogManager().getLogger(this.getName()));
|
||||
+ logger = LogManager.getLogManager().getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName());
|
||||
+ logger = LogManager.getLogManager().getLogger(meta.getLoggerPrefix() != null ? meta.getLoggerPrefix() : meta.getName());
|
||||
+ }
|
||||
+
|
||||
+ return logger;
|
||||
+ }
|
||||
+
|
||||
+ private PaperPluginLogger(@NotNull PluginDescriptionFile description) {
|
||||
+ super(description.getPrefix() != null ? description.getPrefix() : description.getName(), null);
|
||||
+ private PaperPluginLogger(@NotNull PluginMeta meta) {
|
||||
+ super(meta.getLoggerPrefix() != null ? meta.getLoggerPrefix() : meta.getName(), null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -60,24 +67,23 @@ index 0000000000000000000000000000000000000000..76f2cb9cd99cad2a9484eab2becd8c36
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
index 1ff0e0ef1aebec5bbb0a8a09af11d07b2a3220e8..3bea5dd67ad0393160ccede4ac99a3c7baa1803b 100644
|
||||
index accac9527b1c267b75774532b85f28c868b06c28..a536c47fb5f05cad046c2f3374c69f4f83f7f32c 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
||||
@@ -43,7 +43,7 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
@@ -44,7 +44,7 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
private boolean naggable = true;
|
||||
private FileConfiguration newConfig = null;
|
||||
private File configFile = null;
|
||||
- private Logger logger = null; // Paper - PluginLogger -> Logger
|
||||
+ Logger logger = null; // Paper - PluginLogger -> Logger, package-private
|
||||
+ public Logger logger = null; // Paper - PluginLogger -> Logger, public
|
||||
|
||||
public JavaPlugin() {
|
||||
final ClassLoader classLoader = this.getClass().getClassLoader();
|
||||
@@ -277,8 +277,11 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
this.dataFolder = dataFolder;
|
||||
// Paper start
|
||||
@@ -298,7 +298,11 @@ public abstract class JavaPlugin extends PluginBase {
|
||||
this.classLoader = classLoader;
|
||||
this.configFile = new File(dataFolder, "config.yml");
|
||||
- // Paper - Handle plugin prefix in implementation
|
||||
- this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName());
|
||||
this.pluginMeta = configuration; // Paper
|
||||
- this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); // Paper - Handle plugin prefix in implementation
|
||||
+ // Paper start
|
||||
+ if (this.logger == null) {
|
||||
+ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(this.description);
|
||||
@ -87,31 +93,23 @@ index 1ff0e0ef1aebec5bbb0a8a09af11d07b2a3220e8..3bea5dd67ad0393160ccede4ac99a3c7
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
index 6148b69af39344f758b05a28c7c572befa9b8f3f..0db641f5d5e1293b236ad0d2e3a156802ffed839 100644
|
||||
index 39c9253d03bae99f8b5b19d22295f6172606d57b..a657654079c40a0fee6f70c7d72df24b3827b911 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -44,6 +44,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
private JavaPlugin pluginInit;
|
||||
private IllegalStateException pluginState;
|
||||
private final Set<String> seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
+ private java.util.logging.Logger logger; // Paper - add field
|
||||
|
||||
static {
|
||||
ClassLoader.registerAsParallelCapable();
|
||||
@@ -62,6 +63,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
@@ -66,7 +66,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
||||
this.url = file.toURI().toURL();
|
||||
this.libraryLoader = libraryLoader;
|
||||
|
||||
-
|
||||
+ this.logger = com.destroystokyo.paper.utils.PaperPluginLogger.getLogger(description); // Paper - Register logger early
|
||||
+
|
||||
try {
|
||||
Class<?> jarClass;
|
||||
try {
|
||||
@@ -229,6 +232,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
// Paper start
|
||||
this.classLoaderGroup = io.papermc.paper.plugin.provider.classloader.PaperClassLoaderStorage.instance().registerSpigotGroup(this); // Paper
|
||||
this.dependencyContext = dependencyContext;
|
||||
@@ -260,6 +260,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
||||
pluginState = new IllegalStateException("Initial initialization");
|
||||
this.pluginInit = javaPlugin;
|
||||
|
||||
+ javaPlugin.logger = this.logger; // Paper - set logger
|
||||
javaPlugin.init(loader, loader.server, description, dataFolder, file, this);
|
||||
javaPlugin.init(null, org.bukkit.Bukkit.getServer(), description, dataFolder, file, this); // Paper
|
||||
}
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ index 270e6d8ad4358baa256cee5f16cff281f063ce3b..4a3451af454295ac3e1b688e6665cad9
|
||||
|
||||
@Override
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 8275a5d7e1de39a5171e254f449a42c6defd3445..4bca64b2a44ae032730575ecba39f9737a5a1ec7 100644
|
||||
index 9825db30d42701aad5d9970bbb989fbff0142fb1..2cb81e6d253d70388da15c9d07b630277d486c70 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -48,6 +48,8 @@ public class AnnotationTest {
|
@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..7b2af1bd72dfbcf4e962a982940fc49b
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 50faa513411cdb611ae228f0c07a7dfe15807b85..1f29ed50c981fa262790a070722bbe9fecac5b02 100644
|
||||
index e15a9525b989abee62ca2d8ec924ee492118abb2..7efa33336a6f6309cf11677185fd11a7c0757bb3 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -41,7 +41,7 @@ import org.jetbrains.annotations.Nullable;
|
@ -16,7 +16,7 @@ See: https://github.com/PaperMC/Paper/issues/917
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3ad231aa3206c8cfd5ec995249584cebab5d11f3
|
||||
index 0000000000000000000000000000000000000000..02e421b0bb4ce3529ef1c4d34ec8a0c0345cce57
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreCreatureSpawnEvent.java
|
||||
@@ -0,0 +1,105 @@
|
@ -6,7 +6,7 @@ Subject: [PATCH] Additional world.getNearbyEntities API's
|
||||
Provides more methods to get nearby entities, and filter by types and predicates
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index e6c9942f7820f2b8750c1bb0825c8bdbc6f4b99e..3539e63993cc21f9eecda9046b759cebdfec80ff 100644
|
||||
index 749d3de7dad480965be536938733d72bdfc2995b..dad7de7246741d6f3f2a444cf0b88f396302a8af 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -1,6 +1,9 @@
|
@ -5,7 +5,7 @@ Subject: [PATCH] Make shield blocking delay configurable
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 3489c719089e5cc0cc4710e8a06417c02dd76767..81d89daf9691b5338b53bb7b0749ad802f5d026f 100644
|
||||
index ccd8f36c8450bab9f609bb220b5270394960580e..2bfeebe26f32d2e931dc483714d30430deeb9b04 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -731,5 +731,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
@ -106,7 +106,7 @@ index 6693e3d8dc2519facb12db981a6b6325faa095bf..5a6b33c6d9a68affdbd02c13fdb0854e
|
||||
* Returns a list of entities within a bounding box centered around a Location.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 8b48ce606523528f4322296b61a64bd12067387c..fd50f3a12863d1bc65d1880c939389f7b5d2c53c 100644
|
||||
index ae102dddda30ff0e15f70bdb17385c8d9d4b9a08..adf743334f4e69ebca8045df70800f67bcd7d98f 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -1424,6 +1424,88 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
@ -20,7 +20,7 @@ index 9715a9d36187e2eecfeab1a05087d27c28b8690e..12068d14af5731494a839b87b67ed3cc
|
||||
public ItemStack getItemInUse();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 81d89daf9691b5338b53bb7b0749ad802f5d026f..8241a89ac92845a2a8c2398dbeb76529abebd37c 100644
|
||||
index 2bfeebe26f32d2e931dc483714d30430deeb9b04..17e5d2e2acdae23d8ea3b3b1a89f62e8be7b81a8 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -745,5 +745,42 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add World.getEntity(UUID) API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index fd50f3a12863d1bc65d1880c939389f7b5d2c53c..c58c9c7791eff28ba8f847f5bc60e0db757ababd 100644
|
||||
index adf743334f4e69ebca8045df70800f67bcd7d98f..e0caac06b7f5459faefbbd5a6a3486dbb6bfa9ba 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -944,6 +944,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren