Archiviert
13
0
Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-23 21:23:27 +02:00
Ursprung 380c4d2313
Commit 7cdf804392
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
23 geänderte Dateien mit 199 neuen und 502 gelöschten Zeilen

Datei anzeigen

@ -1584,7 +1584,7 @@ index ae3e68562c29992fab627428db3ff0006d8216f9..47153dee66782a00b980ecf15e8774ab
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4333f8608 100644 index 34830d2815d331a1b611f22eca08f53d815ea08a..fb4cb36391e69fd997300b952b64fbd73ae9d675 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -43,6 +43,8 @@ import org.jetbrains.annotations.Nullable; @@ -43,6 +43,8 @@ import org.jetbrains.annotations.Nullable;
@ -1626,7 +1626,15 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
Preconditions.checkArgument(directory != null, "Directory cannot be null"); Preconditions.checkArgument(directory != null, "Directory cannot be null");
Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory"); Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory");
@@ -389,6 +399,15 @@ public final class SimplePluginManager implements PluginManager { @@ -129,6 +139,7 @@ public final class SimplePluginManager implements PluginManager {
*/
@NotNull
public Plugin[] loadPlugins(@NotNull File[] files) {
+ // TODO Replace with Paper plugin loader
Preconditions.checkArgument(files != null, "File list cannot be null");
List<Plugin> result = new ArrayList<Plugin>();
@@ -389,6 +400,15 @@ public final class SimplePluginManager implements PluginManager {
@Nullable @Nullable
public synchronized Plugin loadPlugin(@NotNull File file) throws InvalidPluginException, UnknownDependencyException { public synchronized Plugin loadPlugin(@NotNull File file) throws InvalidPluginException, UnknownDependencyException {
Preconditions.checkArgument(file != null, "File cannot be null"); Preconditions.checkArgument(file != null, "File cannot be null");
@ -1642,7 +1650,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
checkUpdate(file); checkUpdate(file);
@@ -439,12 +458,14 @@ public final class SimplePluginManager implements PluginManager { @@ -439,12 +459,14 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
@Nullable @Nullable
public synchronized Plugin getPlugin(@NotNull String name) { public synchronized Plugin getPlugin(@NotNull String name) {
@ -1657,7 +1665,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
return plugins.toArray(new Plugin[plugins.size()]); return plugins.toArray(new Plugin[plugins.size()]);
} }
@@ -458,6 +479,7 @@ public final class SimplePluginManager implements PluginManager { @@ -458,6 +480,7 @@ public final class SimplePluginManager implements PluginManager {
*/ */
@Override @Override
public boolean isPluginEnabled(@NotNull String name) { public boolean isPluginEnabled(@NotNull String name) {
@ -1665,7 +1673,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
Plugin plugin = getPlugin(name); Plugin plugin = getPlugin(name);
return isPluginEnabled(plugin); return isPluginEnabled(plugin);
@@ -471,6 +493,7 @@ public final class SimplePluginManager implements PluginManager { @@ -471,6 +494,7 @@ public final class SimplePluginManager implements PluginManager {
*/ */
@Override @Override
public boolean isPluginEnabled(@Nullable Plugin plugin) { public boolean isPluginEnabled(@Nullable Plugin plugin) {
@ -1673,7 +1681,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
if ((plugin != null) && (plugins.contains(plugin))) { if ((plugin != null) && (plugins.contains(plugin))) {
return plugin.isEnabled(); return plugin.isEnabled();
} else { } else {
@@ -480,6 +503,7 @@ public final class SimplePluginManager implements PluginManager { @@ -480,6 +504,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public void enablePlugin(@NotNull final Plugin plugin) { public void enablePlugin(@NotNull final Plugin plugin) {
@ -1681,7 +1689,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
if (!plugin.isEnabled()) { if (!plugin.isEnabled()) {
List<Command> pluginCommands = PluginCommandYamlParser.parse(plugin); List<Command> pluginCommands = PluginCommandYamlParser.parse(plugin);
@@ -499,6 +523,7 @@ public final class SimplePluginManager implements PluginManager { @@ -499,6 +524,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public void disablePlugins() { public void disablePlugins() {
@ -1689,7 +1697,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
Plugin[] plugins = getPlugins(); Plugin[] plugins = getPlugins();
for (int i = plugins.length - 1; i >= 0; i--) { for (int i = plugins.length - 1; i >= 0; i--) {
disablePlugin(plugins[i]); disablePlugin(plugins[i]);
@@ -507,6 +532,7 @@ public final class SimplePluginManager implements PluginManager { @@ -507,6 +533,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public void disablePlugin(@NotNull final Plugin plugin) { public void disablePlugin(@NotNull final Plugin plugin) {
@ -1697,7 +1705,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
if (plugin.isEnabled()) { if (plugin.isEnabled()) {
try { try {
plugin.getPluginLoader().disablePlugin(plugin); plugin.getPluginLoader().disablePlugin(plugin);
@@ -551,6 +577,7 @@ public final class SimplePluginManager implements PluginManager { @@ -551,6 +578,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public void clearPlugins() { public void clearPlugins() {
@ -1705,7 +1713,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
synchronized (this) { synchronized (this) {
disablePlugins(); disablePlugins();
plugins.clear(); plugins.clear();
@@ -571,6 +598,7 @@ public final class SimplePluginManager implements PluginManager { @@ -571,6 +599,7 @@ public final class SimplePluginManager implements PluginManager {
*/ */
@Override @Override
public void callEvent(@NotNull Event event) { public void callEvent(@NotNull Event event) {
@ -1713,7 +1721,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
if (event.isAsynchronous()) { if (event.isAsynchronous()) {
if (Thread.holdsLock(this)) { if (Thread.holdsLock(this)) {
throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from inside synchronized code."); throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from inside synchronized code.");
@@ -619,6 +647,7 @@ public final class SimplePluginManager implements PluginManager { @@ -619,6 +648,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public void registerEvents(@NotNull Listener listener, @NotNull Plugin plugin) { public void registerEvents(@NotNull Listener listener, @NotNull Plugin plugin) {
@ -1721,7 +1729,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
if (!plugin.isEnabled()) { if (!plugin.isEnabled()) {
throw new IllegalPluginAccessException("Plugin attempted to register " + listener + " while not enabled"); throw new IllegalPluginAccessException("Plugin attempted to register " + listener + " while not enabled");
} }
@@ -652,6 +681,7 @@ public final class SimplePluginManager implements PluginManager { @@ -652,6 +682,7 @@ public final class SimplePluginManager implements PluginManager {
Preconditions.checkArgument(priority != null, "Priority cannot be null"); Preconditions.checkArgument(priority != null, "Priority cannot be null");
Preconditions.checkArgument(executor != null, "Executor cannot be null"); Preconditions.checkArgument(executor != null, "Executor cannot be null");
Preconditions.checkArgument(plugin != null, "Plugin cannot be null"); Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
@ -1729,7 +1737,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
if (!plugin.isEnabled()) { if (!plugin.isEnabled()) {
throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled");
@@ -699,16 +729,19 @@ public final class SimplePluginManager implements PluginManager { @@ -699,16 +730,19 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
@Nullable @Nullable
public Permission getPermission(@NotNull String name) { public Permission getPermission(@NotNull String name) {
@ -1749,7 +1757,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH); String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH);
if (permissions.containsKey(name)) { if (permissions.containsKey(name)) {
@@ -722,21 +755,25 @@ public final class SimplePluginManager implements PluginManager { @@ -722,21 +756,25 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
@NotNull @NotNull
public Set<Permission> getDefaultPermissions(boolean op) { public Set<Permission> getDefaultPermissions(boolean op) {
@ -1775,7 +1783,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
if (perm != null && permissions.containsKey(perm.getName().toLowerCase(java.util.Locale.ENGLISH))) { if (perm != null && permissions.containsKey(perm.getName().toLowerCase(java.util.Locale.ENGLISH))) {
defaultPerms.get(true).remove(perm); defaultPerms.get(true).remove(perm);
defaultPerms.get(false).remove(perm); defaultPerms.get(false).remove(perm);
@@ -776,6 +813,7 @@ public final class SimplePluginManager implements PluginManager { @@ -776,6 +814,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public void subscribeToPermission(@NotNull String permission, @NotNull Permissible permissible) { public void subscribeToPermission(@NotNull String permission, @NotNull Permissible permissible) {
@ -1783,7 +1791,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
String name = permission.toLowerCase(java.util.Locale.ENGLISH); String name = permission.toLowerCase(java.util.Locale.ENGLISH);
Map<Permissible, Boolean> map = permSubs.get(name); Map<Permissible, Boolean> map = permSubs.get(name);
@@ -789,6 +827,7 @@ public final class SimplePluginManager implements PluginManager { @@ -789,6 +828,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public void unsubscribeFromPermission(@NotNull String permission, @NotNull Permissible permissible) { public void unsubscribeFromPermission(@NotNull String permission, @NotNull Permissible permissible) {
@ -1791,7 +1799,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
String name = permission.toLowerCase(java.util.Locale.ENGLISH); String name = permission.toLowerCase(java.util.Locale.ENGLISH);
Map<Permissible, Boolean> map = permSubs.get(name); Map<Permissible, Boolean> map = permSubs.get(name);
@@ -804,6 +843,7 @@ public final class SimplePluginManager implements PluginManager { @@ -804,6 +844,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
@NotNull @NotNull
public Set<Permissible> getPermissionSubscriptions(@NotNull String permission) { public Set<Permissible> getPermissionSubscriptions(@NotNull String permission) {
@ -1799,7 +1807,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
String name = permission.toLowerCase(java.util.Locale.ENGLISH); String name = permission.toLowerCase(java.util.Locale.ENGLISH);
Map<Permissible, Boolean> map = permSubs.get(name); Map<Permissible, Boolean> map = permSubs.get(name);
@@ -816,6 +856,7 @@ public final class SimplePluginManager implements PluginManager { @@ -816,6 +857,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public void subscribeToDefaultPerms(boolean op, @NotNull Permissible permissible) { public void subscribeToDefaultPerms(boolean op, @NotNull Permissible permissible) {
@ -1807,7 +1815,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
Map<Permissible, Boolean> map = defSubs.get(op); Map<Permissible, Boolean> map = defSubs.get(op);
if (map == null) { if (map == null) {
@@ -828,6 +869,7 @@ public final class SimplePluginManager implements PluginManager { @@ -828,6 +870,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public void unsubscribeFromDefaultPerms(boolean op, @NotNull Permissible permissible) { public void unsubscribeFromDefaultPerms(boolean op, @NotNull Permissible permissible) {
@ -1815,7 +1823,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
Map<Permissible, Boolean> map = defSubs.get(op); Map<Permissible, Boolean> map = defSubs.get(op);
if (map != null) { if (map != null) {
@@ -842,6 +884,7 @@ public final class SimplePluginManager implements PluginManager { @@ -842,6 +885,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
@NotNull @NotNull
public Set<Permissible> getDefaultPermSubscriptions(boolean op) { public Set<Permissible> getDefaultPermSubscriptions(boolean op) {
@ -1823,7 +1831,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
Map<Permissible, Boolean> map = defSubs.get(op); Map<Permissible, Boolean> map = defSubs.get(op);
if (map == null) { if (map == null) {
@@ -854,6 +897,7 @@ public final class SimplePluginManager implements PluginManager { @@ -854,6 +898,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
@NotNull @NotNull
public Set<Permission> getPermissions() { public Set<Permission> getPermissions() {
@ -1831,7 +1839,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
return new HashSet<Permission>(permissions.values()); return new HashSet<Permission>(permissions.values());
} }
@@ -877,6 +921,7 @@ public final class SimplePluginManager implements PluginManager { @@ -877,6 +922,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public boolean useTimings() { public boolean useTimings() {
@ -1839,7 +1847,7 @@ index 34830d2815d331a1b611f22eca08f53d815ea08a..40794a8f60f7ba139e69c38e4fcbb7f4
return useTimings; return useTimings;
} }
@@ -888,4 +933,28 @@ public final class SimplePluginManager implements PluginManager { @@ -888,4 +934,28 @@ public final class SimplePluginManager implements PluginManager {
public void useTimings(boolean use) { public void useTimings(boolean use) {
useTimings = use; useTimings = use;
} }

Datei anzeigen

@ -3479,10 +3479,10 @@ index 4e9ba039669c7059180f5776ee2f7188f2dd01b5..5b526d602057ab70b4a058142e01a019
@NotNull @NotNull
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 40794a8f60f7ba139e69c38e4fcbb7f4333f8608..c75fd7ce01ca11535563ad7ebe1944eb61e65600 100644 index fb4cb36391e69fd997300b952b64fbd73ae9d675..3465bd660999caa53582e9d56a4e93ec7701a1de 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -379,7 +379,6 @@ public final class SimplePluginManager implements PluginManager { @@ -380,7 +380,6 @@ public final class SimplePluginManager implements PluginManager {
} }
} }
@ -3490,7 +3490,7 @@ index 40794a8f60f7ba139e69c38e4fcbb7f4333f8608..c75fd7ce01ca11535563ad7ebe1944eb
return result.toArray(new Plugin[result.size()]); return result.toArray(new Plugin[result.size()]);
} }
@@ -427,9 +426,9 @@ public final class SimplePluginManager implements PluginManager { @@ -428,9 +427,9 @@ public final class SimplePluginManager implements PluginManager {
if (result != null) { if (result != null) {
plugins.add(result); plugins.add(result);
@ -3502,7 +3502,7 @@ index 40794a8f60f7ba139e69c38e4fcbb7f4333f8608..c75fd7ce01ca11535563ad7ebe1944eb
} }
} }
@@ -459,7 +458,7 @@ public final class SimplePluginManager implements PluginManager { @@ -460,7 +459,7 @@ public final class SimplePluginManager implements PluginManager {
@Nullable @Nullable
public synchronized Plugin getPlugin(@NotNull String name) { public synchronized Plugin getPlugin(@NotNull String name) {
if (true) {return this.paperPluginManager.getPlugin(name);} // Paper if (true) {return this.paperPluginManager.getPlugin(name);} // Paper
@ -3511,7 +3511,7 @@ index 40794a8f60f7ba139e69c38e4fcbb7f4333f8608..c75fd7ce01ca11535563ad7ebe1944eb
} }
@Override @Override
@@ -687,7 +686,8 @@ public final class SimplePluginManager implements PluginManager { @@ -688,7 +687,8 @@ public final class SimplePluginManager implements PluginManager {
throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled"); throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled");
} }
@ -3521,7 +3521,7 @@ index 40794a8f60f7ba139e69c38e4fcbb7f4333f8608..c75fd7ce01ca11535563ad7ebe1944eb
getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
} else { } else {
getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled)); getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
@@ -922,7 +922,7 @@ public final class SimplePluginManager implements PluginManager { @@ -923,7 +923,7 @@ public final class SimplePluginManager implements PluginManager {
@Override @Override
public boolean useTimings() { public boolean useTimings() {
if (true) {return this.paperPluginManager.useTimings();} // Paper if (true) {return this.paperPluginManager.useTimings();} // Paper
@ -3530,7 +3530,7 @@ index 40794a8f60f7ba139e69c38e4fcbb7f4333f8608..c75fd7ce01ca11535563ad7ebe1944eb
} }
/** /**
@@ -931,7 +931,7 @@ public final class SimplePluginManager implements PluginManager { @@ -932,7 +932,7 @@ public final class SimplePluginManager implements PluginManager {
* @param use True if per event timing code should be used * @param use True if per event timing code should be used
*/ */
public void useTimings(boolean use) { public void useTimings(boolean use) {

Datei anzeigen

@ -55,7 +55,7 @@ index 77f8b0889cd7039bf041fc052fba33b60aa77e17..09012ce27344c60730b9c5fcde85712a
* Used for all administrative messages, such as an operator using a * Used for all administrative messages, such as an operator using a
* command. * command.
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index c75fd7ce01ca11535563ad7ebe1944eb61e65600..f896cfb30b967b9c21ee94893534201123e6ec72 100644 index 3465bd660999caa53582e9d56a4e93ec7701a1de..ca539930905531a4ce079529c4d456bcb6fc9e8c 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/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 { @@ -116,9 +116,22 @@ public final class SimplePluginManager implements PluginManager {

Datei anzeigen

@ -496,10 +496,10 @@ index 4205649948a9e2a72f64c3f007112245abac6d50..b3b32ce429edbf1ed040354dbe28ab86
} }
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index f896cfb30b967b9c21ee94893534201123e6ec72..2ff417f91492a441085ac1b7ddd248726f05de0a 100644 index ca539930905531a4ce079529c4d456bcb6fc9e8c..07a9c9e254188c251165ca84c8e961fccda01175 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -526,7 +526,8 @@ public final class SimplePluginManager implements PluginManager { @@ -527,7 +527,8 @@ public final class SimplePluginManager implements PluginManager {
try { try {
plugin.getPluginLoader().enablePlugin(plugin); plugin.getPluginLoader().enablePlugin(plugin);
} catch (Throwable ex) { } catch (Throwable ex) {
@ -509,7 +509,7 @@ index f896cfb30b967b9c21ee94893534201123e6ec72..2ff417f91492a441085ac1b7ddd24872
} }
HandlerList.bakeAll(); HandlerList.bakeAll();
@@ -549,32 +550,37 @@ public final class SimplePluginManager implements PluginManager { @@ -550,32 +551,37 @@ public final class SimplePluginManager implements PluginManager {
try { try {
plugin.getPluginLoader().disablePlugin(plugin); plugin.getPluginLoader().disablePlugin(plugin);
} catch (Throwable ex) { } catch (Throwable ex) {
@ -552,7 +552,7 @@ index f896cfb30b967b9c21ee94893534201123e6ec72..2ff417f91492a441085ac1b7ddd24872
} }
try { try {
@@ -587,6 +593,13 @@ public final class SimplePluginManager implements PluginManager { @@ -588,6 +594,13 @@ public final class SimplePluginManager implements PluginManager {
} }
} }
@ -566,7 +566,7 @@ index f896cfb30b967b9c21ee94893534201123e6ec72..2ff417f91492a441085ac1b7ddd24872
@Override @Override
public void clearPlugins() { public void clearPlugins() {
if (true) {this.paperPluginManager.clearPlugins(); return;} // Paper if (true) {this.paperPluginManager.clearPlugins(); return;} // Paper
@@ -652,7 +665,13 @@ public final class SimplePluginManager implements PluginManager { @@ -653,7 +666,13 @@ public final class SimplePluginManager implements PluginManager {
)); ));
} }
} catch (Throwable ex) { } catch (Throwable ex) {

Datei anzeigen

@ -28,10 +28,10 @@ index 37dab9e868dbfb019c271a547d975a48ad1cb571..3811c0d849a3eb028ed1a6b7a2d4747f
+/.factorypath +/.factorypath
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..8116ef8a1d098f0fe4fab661f913132ce3ec4ae9 index 0000000000000000000000000000000000000000..4ceb1ff4349ce60b418a2cb1140f2612139ccb5d
--- /dev/null --- /dev/null
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -0,0 +1,141 @@ @@ -0,0 +1,124 @@
+import io.papermc.paperweight.util.* +import io.papermc.paperweight.util.*
+ +
+plugins { +plugins {
@ -87,28 +87,11 @@ index 0000000000000000000000000000000000000000..8116ef8a1d098f0fe4fab661f913132c
+ +
+publishing { +publishing {
+ publications.create<MavenPublication>("maven") { + publications.create<MavenPublication>("maven") {
+ artifact(tasks.shadowJar)
+ }
+}
+
+relocation {
+ // Order matters here - e.g. craftbukkit proper must be relocated before any of the libs are relocated into the cb package
+ relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$craftbukkitPackageVersion") {
+ exclude("org.bukkit.craftbukkit.Main*")
+ } + }
+} +}
+ +
+tasks.shadowJar { +tasks.shadowJar {
+ configurations = listOf(project.configurations.vanillaServer.get()) + configurations = listOf(project.configurations.vanillaServer.get())
+ archiveClassifier.set("mojang-mapped")
+
+ for (relocation in relocation.relocations.get()) {
+ relocate(relocation.fromPackage, relocation.toPackage) {
+ for (exclude in relocation.excludes) {
+ exclude(exclude)
+ }
+ }
+ }
+} +}
+ +
+tasks.test { +tasks.test {

Datei anzeigen

@ -9,7 +9,7 @@ public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 8116ef8a1d098f0fe4fab661f913132ce3ec4ae9..2905c7273ed4d62a7f1bc7eab9ae919ee6c012de 100644 index 4ceb1ff4349ce60b418a2cb1140f2612139ccb5d..6dc799cc5cad69e37988b175e9768fa696ad7814 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -9,9 +9,7 @@ plugins { @@ -9,9 +9,7 @@ plugins {
@ -41,8 +41,8 @@ index 8116ef8a1d098f0fe4fab661f913132ce3ec4ae9..2905c7273ed4d62a7f1bc7eab9ae919e
) )
for (tld in setOf("net", "com", "org")) { for (tld in setOf("net", "com", "org")) {
attributes("$tld/bukkit", "Sealed" to true) attributes("$tld/bukkit", "Sealed" to true)
@@ -77,6 +79,17 @@ tasks.shadowJar { @@ -60,6 +62,17 @@ tasks.shadowJar {
} configurations = listOf(project.configurations.vanillaServer.get())
} }
+// Paper start +// Paper start
@ -59,7 +59,7 @@ index 8116ef8a1d098f0fe4fab661f913132ce3ec4ae9..2905c7273ed4d62a7f1bc7eab9ae919e
tasks.test { tasks.test {
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class") exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
useJUnitPlatform() useJUnitPlatform()
@@ -138,4 +151,5 @@ tasks.registerRunTask("runReobf") { @@ -121,4 +134,5 @@ tasks.registerRunTask("runReobf") {
tasks.registerRunTask("runDev") { tasks.registerRunTask("runDev") {
description = "Spin up a non-relocated Mojang-mapped test server" description = "Spin up a non-relocated Mojang-mapped test server"
classpath(sourceSets.main.map { it.runtimeClasspath }) classpath(sourceSets.main.map { it.runtimeClasspath })

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Test changes
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 2905c7273ed4d62a7f1bc7eab9ae919ee6c012de..e5f1c91937af872109e478b99a6037332994e717 100644 index 6dc799cc5cad69e37988b175e9768fa696ad7814..cba10082ca1da974cf3f8353b673f0565afa70ff 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -23,6 +23,7 @@ dependencies { @@ -23,6 +23,7 @@ dependencies {
@ -28,7 +28,7 @@ index 2905c7273ed4d62a7f1bc7eab9ae919ee6c012de..e5f1c91937af872109e478b99a603733
+ +
publishing { publishing {
publications.create<MavenPublication>("maven") { publications.create<MavenPublication>("maven") {
artifact(tasks.shadowJar) }
diff --git a/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java diff --git a/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java b/src/test/java/io/papermc/paper/registry/RegistryKeyTest.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..e070aa1bb69859224493d958621389ee757f8752 index 0000000000000000000000000000000000000000..e070aa1bb69859224493d958621389ee757f8752

Datei anzeigen

@ -15,7 +15,7 @@ public net.minecraft.server.dedicated.DedicatedServerProperties reload(Lnet/mine
public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES public net.minecraft.world.level.NaturalSpawner SPAWNING_CATEGORIES
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index e5f1c91937af872109e478b99a6037332994e717..2fb082175529e52604d7e2f4a272fc58d0ec2eb1 100644 index cba10082ca1da974cf3f8353b673f0565afa70ff..62c2aef1c2cce98f4f805bdd96792654af6f5935 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -11,6 +11,7 @@ dependencies { @@ -11,6 +11,7 @@ dependencies {

Datei anzeigen

@ -25,7 +25,7 @@ Other changes:
Co-Authored-By: Emilia Kond <emilia@rymiel.space> Co-Authored-By: Emilia Kond <emilia@rymiel.space>
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 8332781de54d73cb5803828e98882a731daed81f..cadb6a2cae98a8df97c392bfbd5a1440bccd16f4 100644 index 62c2aef1c2cce98f4f805bdd96792654af6f5935..bc4af2e667603d31dfbefc12e42e2300e389b65f 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -6,9 +6,30 @@ plugins { @@ -6,9 +6,30 @@ plugins {
@ -57,18 +57,18 @@ index 8332781de54d73cb5803828e98882a731daed81f..cadb6a2cae98a8df97c392bfbd5a1440
+ runtimeOnly(log4jPlugins.output) + runtimeOnly(log4jPlugins.output)
+ alsoShade(log4jPlugins.output) + alsoShade(log4jPlugins.output)
+ // Paper end + // Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
implementation("org.ow2.asm:asm-commons:9.7") implementation("org.ow2.asm:asm-commons:9.7")
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
@@ -75,7 +96,7 @@ relocation { @@ -67,7 +88,7 @@ publishing {
} }
tasks.shadowJar { tasks.shadowJar {
- configurations = listOf(project.configurations.vanillaServer.get()) - configurations = listOf(project.configurations.vanillaServer.get())
+ configurations = listOf(project.configurations.vanillaServer.get(), alsoShade) + configurations = listOf(project.configurations.vanillaServer.get(), alsoShade) // Paper
archiveClassifier.set("mojang-mapped") }
for (relocation in relocation.relocations.get()) { // Paper start
diff --git a/src/log4jPlugins/java/io/papermc/paper/console/StripANSIConverter.java b/src/log4jPlugins/java/io/papermc/paper/console/StripANSIConverter.java diff --git a/src/log4jPlugins/java/io/papermc/paper/console/StripANSIConverter.java b/src/log4jPlugins/java/io/papermc/paper/console/StripANSIConverter.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..91547f6e6fe90006713beb2818da634304bdd236 index 0000000000000000000000000000000000000000..91547f6e6fe90006713beb2818da634304bdd236
@ -250,10 +250,10 @@ index 8323f135d6bf2e1f12525e05094ffa3f2420e7e1..a143ea1e58464a3122fbd8ccafe417bd
} }
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fa1a6c2f1c11506243cfc61b519bef578e5627fc..7e4fd9fa173b24261b88fb5e898c905721e69dca 100644 index 555dc35fcc0e24b93eb310f11cd924a43d48b21a..7b5d3fac1b5f4d22340a620a5edd5a8fba6be584 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -155,7 +155,7 @@ import org.slf4j.Logger; @@ -148,7 +148,7 @@ import org.slf4j.Logger;
import com.mojang.serialization.Dynamic; import com.mojang.serialization.Dynamic;
import com.mojang.serialization.Lifecycle; import com.mojang.serialization.Lifecycle;
import java.util.Random; import java.util.Random;
@ -262,15 +262,15 @@ index fa1a6c2f1c11506243cfc61b519bef578e5627fc..7e4fd9fa173b24261b88fb5e898c9057
import joptsimple.OptionSet; import joptsimple.OptionSet;
import net.minecraft.nbt.NbtException; import net.minecraft.nbt.NbtException;
import net.minecraft.nbt.ReportedNbtException; import net.minecraft.nbt.ReportedNbtException;
@@ -284,7 +284,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -289,7 +289,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public org.bukkit.craftbukkit.CraftServer server; public org.bukkit.craftbukkit.CraftServer server;
public OptionSet options; public OptionSet options;
public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.ConsoleCommandSender console;
- public ConsoleReader reader; - public ConsoleReader reader;
public static int currentTick; // Paper - improve tick loop public static int currentTick = (int) (System.currentTimeMillis() / 50);
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod; public int autosavePeriod;
@@ -371,7 +370,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -377,7 +376,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.options = options; this.options = options;
this.worldLoader = worldLoader; this.worldLoader = worldLoader;
this.vanillaCommandDispatcher = worldstem.dataPackResources().commands; // CraftBukkit this.vanillaCommandDispatcher = worldstem.dataPackResources().commands; // CraftBukkit
@ -280,7 +280,7 @@ index fa1a6c2f1c11506243cfc61b519bef578e5627fc..7e4fd9fa173b24261b88fb5e898c9057
if (System.console() == null && System.getProperty("jline.terminal") == null) { if (System.console() == null && System.getProperty("jline.terminal") == null) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal"); System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
Main.useJline = false; Main.useJline = false;
@@ -392,6 +393,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -398,6 +399,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.warn((String) null, ex); MinecraftServer.LOGGER.warn((String) null, ex);
} }
} }
@ -289,7 +289,7 @@ index fa1a6c2f1c11506243cfc61b519bef578e5627fc..7e4fd9fa173b24261b88fb5e898c9057
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end // CraftBukkit end
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
@@ -1187,7 +1190,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1113,7 +1116,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.spigotmc.WatchdogThread.doStop(); // Spigot org.spigotmc.WatchdogThread.doStop(); // Spigot
// CraftBukkit start - Restore terminal to original settings // CraftBukkit start - Restore terminal to original settings
try { try {
@ -298,7 +298,7 @@ index fa1a6c2f1c11506243cfc61b519bef578e5627fc..7e4fd9fa173b24261b88fb5e898c9057
} catch (Exception ignored) { } catch (Exception ignored) {
} }
// CraftBukkit end // CraftBukkit end
@@ -1685,7 +1688,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1636,7 +1639,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override @Override
public void sendSystemMessage(Component message) { public void sendSystemMessage(Component message) {
@ -308,10 +308,10 @@ index fa1a6c2f1c11506243cfc61b519bef578e5627fc..7e4fd9fa173b24261b88fb5e898c9057
public KeyPair getKeyPair() { public KeyPair getKeyPair() {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index c8163a8645248765c0fa6c15bc8c37facdc70dc7..8edf2f049aa077792bfb507384f4cf5bb716cb64 100644 index 1b5e2e07a7723f61d4c4d4e3141c60b2f63e2b69..9249122da7282929f87613f41984b8085d7b53ec 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -98,6 +98,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -108,6 +108,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
if (!org.bukkit.craftbukkit.Main.useConsole) { if (!org.bukkit.craftbukkit.Main.useConsole) {
return; return;
} }
@ -321,7 +321,7 @@ index c8163a8645248765c0fa6c15bc8c37facdc70dc7..8edf2f049aa077792bfb507384f4cf5b
jline.console.ConsoleReader bufferedreader = DedicatedServer.this.reader; jline.console.ConsoleReader bufferedreader = DedicatedServer.this.reader;
// MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return // MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return
@@ -129,7 +132,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -139,7 +142,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
continue; continue;
} }
if (s.trim().length() > 0) { // Trim to filter lines which are just spaces if (s.trim().length() > 0) { // Trim to filter lines which are just spaces
@ -330,7 +330,7 @@ index c8163a8645248765c0fa6c15bc8c37facdc70dc7..8edf2f049aa077792bfb507384f4cf5b
} }
// CraftBukkit end // CraftBukkit end
} }
@@ -137,6 +140,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -147,6 +150,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.error("Exception handling console input", ioexception); DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
} }
@ -339,7 +339,7 @@ index c8163a8645248765c0fa6c15bc8c37facdc70dc7..8edf2f049aa077792bfb507384f4cf5b
} }
}; };
@@ -148,6 +153,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -158,6 +163,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
} }
global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler());
@ -349,17 +349,17 @@ index c8163a8645248765c0fa6c15bc8c37facdc70dc7..8edf2f049aa077792bfb507384f4cf5b
final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger());
for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) { for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) {
if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) { if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) {
@@ -156,6 +164,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -168,6 +176,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
} TerminalConsoleWriterThread writerThread = new TerminalConsoleWriterThread(System.out, this.reader);
this.reader.setCompletionHandler(new TerminalCompletionHandler(writerThread, this.reader.getCompletionHandler()));
new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader).start(); writerThread.start();
+ */ + */
+ // Paper end + // Paper end - Not needed with TerminalConsoleAppender
System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream()); System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream());
System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream()); System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream());
diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
index 75083eeb9b413e6dd5375007360dce6857a08fff..d292fdb165436f0b9b46b32110f5e09ad0e517a1 100644 index 3d92c61f7781221cfdc0324d11bd0088954e4a68..84a2c6c397604279ba821286f5c3c855e6041400 100644
--- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java --- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java +++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
@@ -166,7 +166,7 @@ public class MinecraftServerGui extends JComponent { @@ -166,7 +166,7 @@ public class MinecraftServerGui extends JComponent {
@ -372,7 +372,7 @@ index 75083eeb9b413e6dd5375007360dce6857a08fff..d292fdb165436f0b9b46b32110f5e09a
if (!SwingUtilities.isEventDispatchThread()) { if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 1c313dbfc501ce5782fb2d7500b9af35f0855c46..e35e202d49f01c0c97b8c3e41a14254cbd4f2c49 100644 index 126445b30f013e361473aa32583b35a5338c7083..dbb5b333930ce401d36f7d18880d103c9ef2f98e 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -161,8 +161,7 @@ public abstract class PlayerList { @@ -161,8 +161,7 @@ public abstract class PlayerList {
@ -386,7 +386,7 @@ index 1c313dbfc501ce5782fb2d7500b9af35f0855c46..e35e202d49f01c0c97b8c3e41a14254c
this.bans = new UserBanList(PlayerList.USERBANLIST_FILE); this.bans = new UserBanList(PlayerList.USERBANLIST_FILE);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 827579f59d34b61912a67b40624f0f41524185fd..f7d937c6a11e24afe767411428210f3c042a6f78 100644 index 9e34d3f009184981e4f4cd34b0c0c75be9f541f3..7ed0aca2d6eeb03fd9888db2853488cd4e6e2a64 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -42,7 +42,7 @@ import java.util.logging.Level; @@ -42,7 +42,7 @@ import java.util.logging.Level;
@ -398,7 +398,7 @@ index 827579f59d34b61912a67b40624f0f41524185fd..f7d937c6a11e24afe767411428210f3c
import net.minecraft.advancements.AdvancementHolder; import net.minecraft.advancements.AdvancementHolder;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
@@ -1341,9 +1341,13 @@ public final class CraftServer implements Server { @@ -1319,9 +1319,13 @@ public final class CraftServer implements Server {
return this.logger; return this.logger;
} }
@ -413,7 +413,7 @@ index 827579f59d34b61912a67b40624f0f41524185fd..f7d937c6a11e24afe767411428210f3c
@Override @Override
public PluginCommand getPluginCommand(String name) { public PluginCommand getPluginCommand(String name) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index db36453ff46afded45268b3701488e23305aa2eb..e5df5469f20ccffcbe9cd227df6f5c60e82206bf 100644 index 985b77911d03bc60a0210b796e901f31e2676268..9de87edb75947382fda114df883fb4b31c1a7141 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -13,7 +13,6 @@ import java.util.logging.Logger; @@ -13,7 +13,6 @@ import java.util.logging.Logger;
@ -424,7 +424,7 @@ index db36453ff46afded45268b3701488e23305aa2eb..e5df5469f20ccffcbe9cd227df6f5c60
public class Main { public class Main {
public static boolean useJline = true; public static boolean useJline = true;
@@ -220,6 +219,8 @@ public class Main { @@ -207,6 +206,8 @@ public class Main {
} }
try { try {
@ -433,7 +433,7 @@ index db36453ff46afded45268b3701488e23305aa2eb..e5df5469f20ccffcbe9cd227df6f5c60
// This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals // This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals
String jline_UnsupportedTerminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', 'T', 'e', 'r', 'm', 'i', 'n', 'a', 'l'}); String jline_UnsupportedTerminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', 'T', 'e', 'r', 'm', 'i', 'n', 'a', 'l'});
String jline_terminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 't', 'e', 'r', 'm', 'i', 'n', 'a', 'l'}); String jline_terminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 't', 'e', 'r', 'm', 'i', 'n', 'a', 'l'});
@@ -237,9 +238,18 @@ public class Main { @@ -224,9 +225,18 @@ public class Main {
// This ensures the terminal literal will always match the jline implementation // This ensures the terminal literal will always match the jline implementation
System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName()); System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName());
} }
@ -452,9 +452,9 @@ index db36453ff46afded45268b3701488e23305aa2eb..e5df5469f20ccffcbe9cd227df6f5c60
} }
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
@@ -268,6 +278,7 @@ public class Main { @@ -242,6 +252,7 @@ public class Main {
}
} }
// Paper end - Log Java and OS versioning to help with debugging plugin issues
+ System.setProperty("library.jansi.version", "Paper"); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows + System.setProperty("library.jansi.version", "Paper"); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows
System.out.println("Loading libraries, please wait..."); System.out.println("Loading libraries, please wait...");
@ -593,32 +593,29 @@ index 8390f5b5b957b5435efece26507a89756d0a7b3c..c6e8441e299f477ddb22c1ce26187107
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
index 1d8b279f3cbe6fde6bb1bfc4985c4133b0d4a95d..cdc52bbe5c6ae4688615a7732b10071f7f51718e 100644 index 2e5101fca081548bb616bc5eaa0134698719b63a..6e4d50a4863d43a2d6a2d574350c74d0819df402 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java --- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java +++ b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
@@ -5,12 +5,12 @@ import java.io.IOException; @@ -7,13 +7,9 @@ import java.util.Locale;
import java.io.OutputStream; import java.util.ResourceBundle;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
-import jline.console.ConsoleReader; -import jline.console.ConsoleReader;
+//import jline.console.ConsoleReader; -import jline.console.completer.CandidateListCompletionHandler;
import org.bukkit.craftbukkit.Main; import org.bukkit.craftbukkit.Main;
-import org.fusesource.jansi.Ansi; -import org.fusesource.jansi.Ansi;
-import org.fusesource.jansi.Ansi.Erase; -import org.fusesource.jansi.Ansi.Erase;
+//import org.fusesource.jansi.Ansi;
+//import org.fusesource.jansi.Ansi.Erase;
-public class TerminalConsoleWriterThread extends Thread { -public class TerminalConsoleWriterThread extends Thread {
+public class TerminalConsoleWriterThread /*extends Thread*/ {/* // Paper - disable +public class TerminalConsoleWriterThread /*extends Thread*/ {/* // Paper - Comment out entire class
private final ResourceBundle bundle = ResourceBundle.getBundle(CandidateListCompletionHandler.class.getName(), Locale.getDefault());
private final ConsoleReader reader; private final ConsoleReader reader;
private final OutputStream output; private final OutputStream output;
@@ -70,4 +66,5 @@ public class TerminalConsoleWriterThread extends Thread {
@@ -54,5 +54,5 @@ public class TerminalConsoleWriterThread extends Thread { void setCompletion(int completion) {
Logger.getLogger(TerminalConsoleWriterThread.class.getName()).log(Level.SEVERE, null, ex); this.completion = completion;
} }
} +*/ // Paper - Comment out entire class
- }
+ }*/
} }
diff --git a/src/main/resources/log4j2.component.properties b/src/main/resources/log4j2.component.properties diff --git a/src/main/resources/log4j2.component.properties b/src/main/resources/log4j2.component.properties
new file mode 100644 new file mode 100644
@ -628,27 +625,27 @@ index 0000000000000000000000000000000000000000..0694b21465fb9e4164e71862ff24b622
@@ -0,0 +1 @@ @@ -0,0 +1 @@
+log4j.skipJansi=true +log4j.skipJansi=true
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 722ca84968cbbbdeffd09939abff0cccd0a84010..a994ec0f8621b1f267b40049306f63479c050e2f 100644 index 0ff3f750fb7f684c12080894cd8660f0455c658b..301874c1fe16c52ffa6228d79e6617d746e9a035 100644
--- a/src/main/resources/log4j2.xml --- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml
@@ -1,17 +1,14 @@ @@ -1,17 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="com.mojang.util"> <Configuration status="WARN">
<Appenders> <Appenders>
- <Console name="SysOut" target="SYSTEM_OUT"> - <Console name="SysOut" target="SYSTEM_OUT">
- <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" /> - <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
- </Console> - </Console>
<Queue name="ServerGuiConsole"> <Queue name="ServerGuiConsole">
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" /> <PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg{nolookups}%n" />
</Queue> </Queue>
- <Queue name="TerminalConsole"> - <Queue name="TerminalConsole">
- <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" /> - <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
- </Queue> - </Queue>
+ <TerminalConsole name="TerminalConsole"> + <TerminalConsole name="TerminalConsole">
+ <PatternLayout pattern="%highlightError{[%d{HH:mm:ss} %level]: %msg%n%xEx}" /> + <PatternLayout pattern="%highlightError{[%d{HH:mm:ss} %level]: %msg%n%xEx}" />
+ </TerminalConsole> + </TerminalConsole>
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz"> <RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
- <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" /> - <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg{nolookups}%n" />
+ <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %stripAnsi{%msg}%n" /> + <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %stripAnsi{%msg}%n" />
<Policies> <Policies>
<TimeBasedTriggeringPolicy /> <TimeBasedTriggeringPolicy />

Datei anzeigen

@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing
the plugin logger. the plugin logger.
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index cadb6a2cae98a8df97c392bfbd5a1440bccd16f4..ca6e0c77acbcf3b32eb8b5c0f86701f52dfeea0c 100644 index bc4af2e667603d31dfbefc12e42e2300e389b65f..d7850a6bcfd910eb073280856dd34707118f8aae 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -25,7 +25,7 @@ dependencies { @@ -25,7 +25,7 @@ dependencies {
@ -28,10 +28,10 @@ index cadb6a2cae98a8df97c392bfbd5a1440bccd16f4..ca6e0c77acbcf3b32eb8b5c0f86701f5
runtimeOnly(log4jPlugins.output) runtimeOnly(log4jPlugins.output)
alsoShade(log4jPlugins.output) alsoShade(log4jPlugins.output)
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index bd4c744c597201267418b07b9bcb522805c485eb..0f391af1274926ef6316bd06458767a27640f54a 100644 index 60e354fe1d32cd315ed42cea4484c83c4b5e7e25..899e85ea70edfb6553dc27462690da8caa793f77 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -290,7 +290,7 @@ public class SpigotConfig @@ -288,7 +288,7 @@ public class SpigotConfig
private static void playerSample() private static void playerSample()
{ {
SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 ); SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 );
@ -41,11 +41,11 @@ index bd4c744c597201267418b07b9bcb522805c485eb..0f391af1274926ef6316bd06458767a2
public static int playerShuffle; public static int playerShuffle;
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index a994ec0f8621b1f267b40049306f63479c050e2f..bba2de3f3feb5e6a876f9df1eee6da0c7d93e271 100644 index 301874c1fe16c52ffa6228d79e6617d746e9a035..e073707a46397f62bedf1d413f9e5764e77dda6a 100644
--- a/src/main/resources/log4j2.xml --- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml
@@ -5,10 +5,22 @@ @@ -5,10 +5,22 @@
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" /> <PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg{nolookups}%n" />
</Queue> </Queue>
<TerminalConsole name="TerminalConsole"> <TerminalConsole name="TerminalConsole">
- <PatternLayout pattern="%highlightError{[%d{HH:mm:ss} %level]: %msg%n%xEx}" /> - <PatternLayout pattern="%highlightError{[%d{HH:mm:ss} %level]: %msg%n%xEx}" />

Datei anzeigen

@ -14,7 +14,7 @@ log. Disable the logger prefix for these plugins so the messages
show up correctly. show up correctly.
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index bba2de3f3feb5e6a876f9df1eee6da0c7d93e271..88957220d5574e5590e8a545605d76c0c7b0a10e 100644 index e073707a46397f62bedf1d413f9e5764e77dda6a..ab1caec640128aa90f246e4bbecf5ca275e7982e 100644
--- a/src/main/resources/log4j2.xml --- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml
@@ -6,19 +6,21 @@ @@ -6,19 +6,21 @@

Datei anzeigen

@ -5,19 +5,21 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index ca6e0c77acbcf3b32eb8b5c0f86701f52dfeea0c..470c55412e7a4f09235947adc72944b903d6543d 100644 index d7850a6bcfd910eb073280856dd34707118f8aae..4eec2a9aace7bca8383c893eedf0c27e06ba71c6 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -36,6 +36,7 @@ dependencies { @@ -34,8 +34,7 @@ dependencies {
implementation("org.ow2.asm:asm-commons:9.7")
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
implementation("commons-lang:commons-lang:2.6") implementation("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1") - runtimeOnly("org.xerial:sqlite-jdbc:3.45.3.0")
runtimeOnly("com.mysql:mysql-connector-j:8.2.0") - runtimeOnly("com.mysql:mysql-connector-j:8.3.0")
+ runtimeOnly("com.lmax:disruptor:3.4.4") // Paper + runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6") runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 88957220d5574e5590e8a545605d76c0c7b0a10e..ea4e2161c0bd43884055cc6b8d70b2139f70e720 100644 index ab1caec640128aa90f246e4bbecf5ca275e7982e..18e961a37b2830da6e5dab7aa35116b2f5215898 100644
--- a/src/main/resources/log4j2.xml --- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml
@@ -29,15 +29,18 @@ @@ -29,15 +29,18 @@

Datei anzeigen

@ -6,36 +6,17 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 9cd80bc7f2b47e1044eef2592274e38d1988ff5d..2b3da4b69e89a6b98ec98820e55044fefdafc061 100644 index 4eec2a9aace7bca8383c893eedf0c27e06ba71c6..4e24a9dcad6c8b3f52c3039f2ba80dfedb911e03 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -35,6 +35,7 @@ dependencies { @@ -34,6 +34,7 @@ dependencies {
implementation("org.ow2.asm:asm-commons:9.7") implementation("org.ow2.asm:asm-commons:9.7")
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
implementation("commons-lang:commons-lang:2.6") implementation("commons-lang:commons-lang:2.6")
+ implementation("net.fabricmc:mapping-io:0.5.0") // Paper - needed to read mappings for stacktrace deobfuscation + implementation("net.fabricmc:mapping-io:0.5.0") // Paper - needed to read mappings for stacktrace deobfuscation
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1")
runtimeOnly("com.mysql:mysql-connector-j:8.2.0")
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
@@ -121,6 +122,18 @@ tasks.check {
}
// Paper end
+// Paper start - include reobf mappings in jar for stacktrace deobfuscation runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
+val includeMappings = tasks.register<io.papermc.paperweight.tasks.IncludeMappings>("includeMappings") {
+ inputJar.set(tasks.fixJarForReobf.flatMap { it.outputJar })
+ mappings.set(tasks.reobfJar.flatMap { it.mappingsFile })
+ mappingsDest.set("META-INF/mappings/reobf.tiny")
+}
+
+tasks.reobfJar {
+ inputJar.set(includeMappings.flatMap { it.outputJar })
+}
+// Paper end - include reobf mappings in jar for stacktrace deobfuscation
+
tasks.test {
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
useJUnitPlatform()
diff --git a/src/log4jPlugins/java/io/papermc/paper/logging/StacktraceDeobfuscatingRewritePolicy.java b/src/log4jPlugins/java/io/papermc/paper/logging/StacktraceDeobfuscatingRewritePolicy.java diff --git a/src/log4jPlugins/java/io/papermc/paper/logging/StacktraceDeobfuscatingRewritePolicy.java b/src/log4jPlugins/java/io/papermc/paper/logging/StacktraceDeobfuscatingRewritePolicy.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..66b6011ee3684695b2ab9292961c80bf2a420ee9 index 0000000000000000000000000000000000000000..66b6011ee3684695b2ab9292961c80bf2a420ee9
@ -108,19 +89,6 @@ index 0000000000000000000000000000000000000000..66b6011ee3684695b2ab9292961c80bf
+ return new StacktraceDeobfuscatingRewritePolicy(); + return new StacktraceDeobfuscatingRewritePolicy();
+ } + }
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
index 404a8fd128043527d23f22ee26f7c8c739f09089..9f24003fffee14592e5ef22e75ec9826428438e6 100644
--- a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
@@ -91,7 +91,7 @@ public class SyncLoadFinder {
final JsonArray traces = new JsonArray();
- for (StackTraceElement element : pair.getFirst().stacktrace) {
+ for (StackTraceElement element : io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateStacktrace(pair.getFirst().stacktrace)) {
traces.add(String.valueOf(element));
}
diff --git a/src/main/java/io/papermc/paper/util/ObfHelper.java b/src/main/java/io/papermc/paper/util/ObfHelper.java diff --git a/src/main/java/io/papermc/paper/util/ObfHelper.java b/src/main/java/io/papermc/paper/util/ObfHelper.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..e8ff684d8bd994c64ff34f20e1e0601b678244c1 index 0000000000000000000000000000000000000000..e8ff684d8bd994c64ff34f20e1e0601b678244c1
@ -443,35 +411,8 @@ index 0000000000000000000000000000000000000000..eb910d4abf91488fa7cf1f5d47e0ee91
+ return lineMap; + return lineMap;
+ } + }
+} +}
diff --git a/src/main/java/io/papermc/paper/util/TraceUtil.java b/src/main/java/io/papermc/paper/util/TraceUtil.java
index 2d5494d2813b773e60ddba6790b750a9a08f21f8..0b210bdf7c1f5962afbd44195af6f84f625635e3 100644
--- a/src/main/java/io/papermc/paper/util/TraceUtil.java
+++ b/src/main/java/io/papermc/paper/util/TraceUtil.java
@@ -6,13 +6,20 @@ public final class TraceUtil {
public static void dumpTraceForThread(Thread thread, String reason) {
Bukkit.getLogger().warning(thread.getName() + ": " + reason);
- StackTraceElement[] trace = thread.getStackTrace();
+ StackTraceElement[] trace = StacktraceDeobfuscator.INSTANCE.deobfuscateStacktrace(thread.getStackTrace());
for (StackTraceElement traceElement : trace) {
Bukkit.getLogger().warning("\tat " + traceElement);
}
}
public static void dumpTraceForThread(String reason) {
- new Throwable(reason).printStackTrace();
+ final Throwable throwable = new Throwable(reason);
+ StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(throwable);
+ throwable.printStackTrace();
+ }
+
+ public static void printStackTrace(Throwable thr) {
+ StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
+ thr.printStackTrace();
}
}
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index a9a0248b1bd1ac454064e977b61f9b7d80962ff8..6f2452de76e8f5fcc1367066e0e753740764eb98 100644 index a23407fa1b906743890cff74f5051ad55d59c85e..06c514b2d0674cd7df6692981f020437ea0f2f91 100644
--- a/src/main/java/net/minecraft/CrashReport.java --- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java +++ b/src/main/java/net/minecraft/CrashReport.java
@@ -34,6 +34,7 @@ public class CrashReport { @@ -34,6 +34,7 @@ public class CrashReport {
@ -495,12 +436,12 @@ index f367ba058018074bfe6e4fe88bcc875ea9794d9e..2176171954609fd88f97f93408e14e01
} }
} }
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 7648b889bc488197f32545e8c3671a54102c01ec..44e62675a2d612a8d727d9ce6db5fb85d1a0bcc8 100644 index 256a983c7345902600d52d7b7e3056162275f4c7..0ccfdceea8e211c595be2dad2392876109b4eeef 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -75,13 +75,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -82,13 +82,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
public static final AttributeKey<ConnectionProtocol.CodecData<?>> ATTRIBUTE_SERVERBOUND_PROTOCOL = AttributeKey.valueOf("serverbound_protocol"); marker.add(Connection.PACKET_MARKER);
public static final AttributeKey<ConnectionProtocol.CodecData<?>> ATTRIBUTE_CLIENTBOUND_PROTOCOL = AttributeKey.valueOf("clientbound_protocol"); });
public static final Supplier<NioEventLoopGroup> NETWORK_WORKER_GROUP = Suppliers.memoize(() -> { public static final Supplier<NioEventLoopGroup> NETWORK_WORKER_GROUP = Suppliers.memoize(() -> {
- return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).build()); - return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).build());
+ return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper + return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper
@ -513,9 +454,9 @@ index 7648b889bc488197f32545e8c3671a54102c01ec..44e62675a2d612a8d727d9ce6db5fb85
- return new DefaultEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Client IO #%d").setDaemon(true).build()); - return new DefaultEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Client IO #%d").setDaemon(true).build());
+ return new DefaultEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Client IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper + return new DefaultEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Client IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper
}); });
private static final ProtocolInfo<ServerHandshakePacketListener> INITIAL_PROTOCOL = HandshakeProtocols.SERVERBOUND;
private final PacketFlow receiving; private final PacketFlow receiving;
private final Queue<Consumer<Connection>> pendingActions = Queues.newConcurrentLinkedQueue(); @@ -189,7 +189,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -207,7 +207,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} }
} }
@ -524,31 +465,11 @@ index 7648b889bc488197f32545e8c3671a54102c01ec..44e62675a2d612a8d727d9ce6db5fb85
} }
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) { protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) {
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
index 061eada043325142d33a0cec02e9e484d14a7fca..96d5448019d53ac3575e209c1c5c223a62a2638d 100644
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -47,7 +47,14 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k);
} catch (Throwable var13) {
- LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var13); // Paper - Give proper error message
+ // Paper start - Give proper error message
+ String packetName = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(packet.getClass().getName());
+ if (packetName.contains(".")) {
+ packetName = packetName.substring(packetName.lastIndexOf(".") + 1);
+ }
+
+ LOGGER.error("Packet encoding of packet {} (ID: {}) threw (skippable? {})", packetName, i, packet.isSkippable(), var13);
+ // Paper end
if (packet.isSkippable()) {
throw new SkipPacketException(var13);
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 28fe088d97bd5fbfcc29dcc7d2a657d54578b2be..c41c53ee3b1a8b5c2c41fc9846f557eeb4d10f9b 100644 index 9249122da7282929f87613f41984b8085d7b53ec..21b8f1913ff54d2b1553826269355da8bdb7f702 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -194,6 +194,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -206,6 +206,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings")); org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings"));
org.spigotmc.SpigotConfig.registerCommands(); org.spigotmc.SpigotConfig.registerCommands();
// Spigot end // Spigot end
@ -556,21 +477,8 @@ index 28fe088d97bd5fbfcc29dcc7d2a657d54578b2be..c41c53ee3b1a8b5c2c41fc9846f557ee
// Paper start - initialize global and world-defaults configuration // Paper start - initialize global and world-defaults configuration
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
diff --git a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
index e2537760becdd5b3f3561f7159ed7fc2755e6260..87c5690774363edc1b7ebff10b041e48c0a6d56d 100644
--- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
@@ -137,7 +137,7 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
ServerConfigurationPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
// Paper start - Debugging
if (MinecraftServer.getServer().isDebugging()) {
- exception.printStackTrace();
+ io.papermc.paper.util.TraceUtil.printStackTrace(exception);
}
// Paper end - Debugging
this.connection.send(new ClientboundDisconnectPacket(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA));
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 187b2cf175ba5cea94158d29b53993dc5a7c5b94..3b6bafb242d2623c15f26acdacd036478c7dc214 100644 index 987360a266a5a870f06929b00c9f451901188fd6..2cf3e79ec5e8706b71d27ebad4668773f0b91195 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -52,10 +52,10 @@ public class ServerConnectionListener { @@ -52,10 +52,10 @@ public class ServerConnectionListener {
@ -587,70 +495,32 @@ index 187b2cf175ba5cea94158d29b53993dc5a7c5b94..3b6bafb242d2623c15f26acdacd03647
final MinecraftServer server; final MinecraftServer server;
public volatile boolean running; public volatile boolean running;
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
index 86c88e81e275d52576122a5083b419e64cb011fc..45d4638d568ea2aee805aa1b0542533019e5870d 100644 index 8d06e8d286da2573e40794adab695ff77e5afd86..68551947f5b7d3471f15bd74ccd86519ab34c1c1 100644
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java --- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java +++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
@@ -357,7 +357,7 @@ public class OldUsersConverter { @@ -356,7 +356,7 @@ public class OldUsersConverter {
try { try {
root = NbtIo.readCompressed(new java.io.FileInputStream(file5), NbtAccounter.unlimitedHeap()); root = NbtIo.readCompressed(new java.io.FileInputStream(file5), NbtAccounter.unlimitedHeap());
} catch (Exception exception) { } catch (Exception exception) {
- exception.printStackTrace(); - exception.printStackTrace();
+ io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper + io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper
com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
} }
@@ -371,7 +371,7 @@ public class OldUsersConverter { if (root != null) {
@@ -369,7 +369,7 @@ public class OldUsersConverter {
try { try {
NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2)); NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2));
} catch (Exception exception) { } catch (Exception exception) {
- exception.printStackTrace(); - exception.printStackTrace();
+ io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper + io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper
com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java // CraftBukkit end
index 5403fc4fa2ed2526d2e67c230a46dd2a75e017be..af757309cb46af6df07872f7596b66df6d6f18d7 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -592,7 +592,7 @@ public class LevelChunk extends ChunkAccess {
+ " (" + getBlockState(blockposition) + ") where there was no entity tile!\n" +
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16) +
"\nWorld: " + level.getLevel().dimension().location());
- e.printStackTrace();
+ io.papermc.paper.util.TraceUtil.printStackTrace(e);
ServerInternalException.reportInternalException(e);
// Paper end - ServerExceptionEvent
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
index 3c1992e212a6d6f1db4d5b807b38d71913619fc0..9c1aff17aabd062640e3f451a2ef8c50a7c62f10 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
@@ -40,9 +40,9 @@ public class CraftAsyncScheduler extends CraftScheduler {
private final ThreadPoolExecutor executor = new ThreadPoolExecutor(
4, Integer.MAX_VALUE,30L, TimeUnit.SECONDS, new SynchronousQueue<>(),
- new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").build());
+ new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build()); // Paper
private final Executor management = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder()
- .setNameFormat("Craft Async Scheduler Management Thread").build());
+ .setNameFormat("Craft Async Scheduler Management Thread").setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build()); // Paper
private final List<CraftTask> temp = new ArrayList<>();
CraftAsyncScheduler() {
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 017c2eadbc5dfec155c21b5d8a80f0b1e380398e..b1ac7338fa632611ea8332044b09070f78f8f5f1 100644 index c4bf7053d83d207caca0e13e19f5c1afa7062de3..f697d45e0ac4e9cdc8a46121510a04c0f294d91f 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java --- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -102,7 +102,7 @@ public class WatchdogThread extends Thread @@ -130,7 +130,7 @@ public class WatchdogThread extends Thread
log.log(Level.SEVERE, "During the run of the server, a plugin set an excessive velocity on an entity");
log.log(Level.SEVERE, "This may be the cause of the issue, or it may be entirely unrelated");
log.log(Level.SEVERE, org.bukkit.craftbukkit.CraftServer.excessiveVelEx.getMessage());
- for (StackTraceElement stack : org.bukkit.craftbukkit.CraftServer.excessiveVelEx.getStackTrace()) {
+ for (StackTraceElement stack : io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateStacktrace(org.bukkit.craftbukkit.CraftServer.excessiveVelEx.getStackTrace())) { // Paper
log.log( Level.SEVERE, "\t\t" + stack );
}
}
@@ -172,7 +172,7 @@ public class WatchdogThread extends Thread
} }
log.log( Level.SEVERE, "\tStack:" ); log.log( Level.SEVERE, "\tStack:" );
// //
@ -660,7 +530,7 @@ index 017c2eadbc5dfec155c21b5d8a80f0b1e380398e..b1ac7338fa632611ea8332044b09070f
log.log( Level.SEVERE, "\t\t" + stack ); log.log( Level.SEVERE, "\t\t" + stack );
} }
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index ea4e2161c0bd43884055cc6b8d70b2139f70e720..4e2ca9162450c1f54b7ab95a63c1bad8efe81a06 100644 index 18e961a37b2830da6e5dab7aa35116b2f5215898..128fa1376f22d3429a23d79a2772abf2e7fec2bc 100644
--- a/src/main/resources/log4j2.xml --- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml
@@ -30,10 +30,14 @@ @@ -30,10 +30,14 @@

Datei anzeigen

@ -230,7 +230,7 @@ index 0000000000000000000000000000000000000000..34734bb969a1a74c7a4f9c17d40ebf00
+ } + }
+} +}
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 4e2ca9162450c1f54b7ab95a63c1bad8efe81a06..32e64b3866bdd1489a90339bda2268adafbb15de 100644 index 128fa1376f22d3429a23d79a2772abf2e7fec2bc..637d64da9938e51a97338b9253b43889585c67bb 100644
--- a/src/main/resources/log4j2.xml --- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml
@@ -34,6 +34,10 @@ @@ -34,6 +34,10 @@

Datei anzeigen

@ -605,10 +605,10 @@ index 0000000000000000000000000000000000000000..ae60bd96b5284d54676d8e7e4dd5d170
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 8ddfd4a148c95d0d9e93edf03ddac46332936d9a..8499eb5128d3269925ffb2c61d8532e9da47be4a 100644 index 21b8f1913ff54d2b1553826269355da8bdb7f702..b9c22f725f5aeaee469fe5b7d8c3a57ddb1d5bdd 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -187,6 +187,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -211,6 +211,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
// Paper end - initialize global and world-defaults configuration // Paper end - initialize global and world-defaults configuration
@ -617,7 +617,7 @@ index 8ddfd4a148c95d0d9e93edf03ddac46332936d9a..8499eb5128d3269925ffb2c61d8532e9
this.setPvpAllowed(dedicatedserverproperties.pvp); this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight); this.setFlightAllowed(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8441cbe4ebd676d1aacff223abdabeb32b5658e0..45ba78ae029f59efd16534a2d6453af50a7aa74a 100644 index 7ed0aca2d6eeb03fd9888db2853488cd4e6e2a64..3a0f3992e28c3057d598daf78c0b70b1437ae0b0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -951,6 +951,7 @@ public final class CraftServer implements Server { @@ -951,6 +951,7 @@ public final class CraftServer implements Server {
@ -628,7 +628,7 @@ index 8441cbe4ebd676d1aacff223abdabeb32b5658e0..45ba78ae029f59efd16534a2d6453af5
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -2649,6 +2650,34 @@ public final class CraftServer implements Server { @@ -2671,6 +2672,34 @@ public final class CraftServer implements Server {
// Paper end // Paper end
// Paper start // Paper start

Datei anzeigen

@ -698,10 +698,10 @@ index 0000000000000000000000000000000000000000..6aaed8e8bf8c721fc834da5c76ac72a4
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 8499eb5128d3269925ffb2c61d8532e9da47be4a..4917aa64505870a0521bc09ce4d4d3e37c03eaae 100644 index b9c22f725f5aeaee469fe5b7d8c3a57ddb1d5bdd..0d6688e9da81453e64daacfb81e4a13cc37b3e66 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -188,6 +188,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -212,6 +212,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
// Paper end - initialize global and world-defaults configuration // Paper end - initialize global and world-defaults configuration
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
@ -710,7 +710,7 @@ index 8499eb5128d3269925ffb2c61d8532e9da47be4a..4917aa64505870a0521bc09ce4d4d3e3
this.setPvpAllowed(dedicatedserverproperties.pvp); this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight); this.setFlightAllowed(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index e6e070db9a6ee78e65dbff6f18cb5c8784202b9f..bd4c744c597201267418b07b9bcb522805c485eb 100644 index 899e85ea70edfb6553dc27462690da8caa793f77..27b01f7ed930baab466a5e4f9608e9e1a4da0978 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -83,6 +83,7 @@ public class SpigotConfig @@ -83,6 +83,7 @@ public class SpigotConfig

Datei anzeigen

@ -7117,10 +7117,10 @@ index f7114d5b8f2f93f62883e24da29afaf9f74ee1a6..8bf0630c0e06950cd99b7ae9898137f7
return foundFrame.orElse(null); return foundFrame.orElse(null);
diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
index e8afaa3c1fab0435acb068426091bdf776263112..94da73ef6c77308a8bc21db4c0bca22a79376b58 100644 index bc91370654f5da33cbfe7d42431568915c1159d6..b43af53960978ac04bccde08544a562841492791 100644
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java --- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java +++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
@@ -312,7 +312,13 @@ public class BuiltInRegistries { @@ -304,7 +304,13 @@ public class BuiltInRegistries {
} }
public static void bootStrap() { public static void bootStrap() {
@ -7135,10 +7135,10 @@ index e8afaa3c1fab0435acb068426091bdf776263112..94da73ef6c77308a8bc21db4c0bca22a
validate(REGISTRY); validate(REGISTRY);
} }
diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java
index 1eabd8b5a99850298838b11ba97e3d220f444378..8ff786c366332588a2df053438f23cc9fb7e2b84 100644 index 15ee2f2a83bfef2f6891d9bfb2d3a8c14b24ffb1..d0d95d729853fc296c4931a2f73a3fc5f94302c9 100644
--- a/src/main/java/net/minecraft/server/Bootstrap.java --- a/src/main/java/net/minecraft/server/Bootstrap.java
+++ b/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java
@@ -76,7 +76,11 @@ public class Bootstrap { @@ -74,7 +74,11 @@ public class Bootstrap {
EntitySelectorOptions.bootStrap(); EntitySelectorOptions.bootStrap();
DispenseItemBehavior.bootStrap(); DispenseItemBehavior.bootStrap();
CauldronInteraction.bootStrap(); CauldronInteraction.bootStrap();
@ -7152,10 +7152,10 @@ index 1eabd8b5a99850298838b11ba97e3d220f444378..8ff786c366332588a2df053438f23cc9
Bootstrap.wrapStreams(); Bootstrap.wrapStreams();
Bootstrap.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis()); Bootstrap.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 66550ce5cc83534af8dcac338db5cd4cfb1c46c4..a40755f2e4d36a3ef34e187727065da4b918a5e8 100644 index 5b4ac7b4fd0077e900e9f788963f1613bbc9a5d0..6afede80c10503a261d0f735c351d943597be9ff 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -117,6 +117,7 @@ public class Main { @@ -119,6 +119,7 @@ public class Main {
JvmProfiler.INSTANCE.start(Environment.SERVER); JvmProfiler.INSTANCE.start(Environment.SERVER);
} }
@ -7164,10 +7164,10 @@ index 66550ce5cc83534af8dcac338db5cd4cfb1c46c4..a40755f2e4d36a3ef34e187727065da4
Bootstrap.validate(); Bootstrap.validate();
Util.startTimerHackThread(); Util.startTimerHackThread();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 45ba78ae029f59efd16534a2d6453af50a7aa74a..7bd9abe9166df3d120fe6580407a04f68279c55f 100644 index 3a0f3992e28c3057d598daf78c0b70b1437ae0b0..45160b93a24dc74f6368441e2a4fe659ceaf5bf5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -272,7 +272,8 @@ public final class CraftServer implements Server { @@ -274,7 +274,8 @@ public final class CraftServer implements Server {
private final CraftCommandMap commandMap = new CraftCommandMap(this); private final CraftCommandMap commandMap = new CraftCommandMap(this);
private final SimpleHelpMap helpMap = new SimpleHelpMap(this); private final SimpleHelpMap helpMap = new SimpleHelpMap(this);
private final StandardMessenger messenger = new StandardMessenger(); private final StandardMessenger messenger = new StandardMessenger();
@ -7253,10 +7253,10 @@ index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7
@Override @Override
public FileConfiguration getConfig() { public FileConfiguration getConfig() {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 203225cc5d0edc0de7e3dcf7ee4af15004cc1187..ea994c34e1ca725eae4d05223fc09fc1308b0730 100644 index da97b4e91b7952f1459e59c74447a659842990bc..adf28b8e77d42267ce41713e031ee316366202e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -426,6 +426,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -421,6 +421,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack); net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
return nmsItemStack.getItem().getDescriptionId(nmsItemStack); return nmsItemStack.getItem().getDescriptionId(nmsItemStack);
} }
@ -8063,10 +8063,10 @@ index 0000000000000000000000000000000000000000..ba271c35eb2804f94cfc893bf94affb9
+ } + }
+} +}
diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java diff --git a/src/test/java/org/bukkit/support/DummyServer.java b/src/test/java/org/bukkit/support/DummyServer.java
index f3017525b0c2397fdc7ce0778add2e7b38e9e2ba..3b3e44c5ed24f653f7dc1e5d3d4f0ff76084f277 100644 index 02a8e6b45bf304b6e0f88043a25188aa16b3d6bf..7a4681155f740a98ecafa0b992eae1fb5524551f 100644
--- a/src/test/java/org/bukkit/support/DummyServer.java --- a/src/test/java/org/bukkit/support/DummyServer.java
+++ b/src/test/java/org/bukkit/support/DummyServer.java +++ b/src/test/java/org/bukkit/support/DummyServer.java
@@ -52,7 +52,7 @@ public final class DummyServer { @@ -54,7 +54,7 @@ public final class DummyServer {
final Thread currentThread = Thread.currentThread(); final Thread currentThread = Thread.currentThread();
when(instance.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread)); when(instance.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Plugin remapping
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..69f6e6aa7f71c155651826400c6d41f075eb9ea3 100644 index 4e24a9dcad6c8b3f52c3039f2ba80dfedb911e03..ddd9bf846c7e918a1a36a6035b220db201c42440 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -56,9 +56,14 @@ dependencies { @@ -46,9 +46,14 @@ dependencies {
testImplementation("org.mockito:mockito-core:5.11.0") testImplementation("org.mockito:mockito-core:5.11.0")
testImplementation("org.ow2.asm:asm-tree:9.7") testImplementation("org.ow2.asm:asm-tree:9.7")
testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
@ -18,14 +18,14 @@ index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..69f6e6aa7f71c155651826400c6d41f0
+} +}
+ +
+paperweight { +paperweight {
+ craftBukkitPackageVersion.set("v1_20_R3") // also needs to be updated in MappingEnvironment + craftBukkitPackageVersion.set("v1_20_R4") // also needs to be updated in MappingEnvironment
} }
-val craftbukkitPackageVersion = "1_20_R3" // Paper -val craftbukkitPackageVersion = "1_20_R4" // Paper
tasks.jar { tasks.jar {
archiveClassifier.set("dev") archiveClassifier.set("dev")
@@ -78,7 +83,7 @@ tasks.jar { @@ -68,7 +73,7 @@ tasks.jar {
"Specification-Vendor" to "Bukkit Team", "Specification-Vendor" to "Bukkit Team",
"Git-Branch" to gitBranch, // Paper "Git-Branch" to gitBranch, // Paper
"Git-Commit" to gitHash, // Paper "Git-Commit" to gitHash, // Paper
@ -34,55 +34,7 @@ index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..69f6e6aa7f71c155651826400c6d41f0
) )
for (tld in setOf("net", "com", "org")) { for (tld in setOf("net", "com", "org")) {
attributes("$tld/bukkit", "Sealed" to true) attributes("$tld/bukkit", "Sealed" to true)
@@ -94,28 +99,11 @@ tasks.compileTestJava { @@ -148,20 +153,41 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM
publishing {
publications.create<MavenPublication>("maven") {
- artifact(tasks.shadowJar)
- }
-}
-
-relocation {
- // Order matters here - e.g. craftbukkit proper must be relocated before any of the libs are relocated into the cb package
- relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$craftbukkitPackageVersion") {
- exclude("org.bukkit.craftbukkit.Main*")
}
}
tasks.shadowJar {
configurations = listOf(project.configurations.vanillaServer.get(), alsoShade)
- archiveClassifier.set("mojang-mapped")
-
- for (relocation in relocation.relocations.get()) {
- relocate(relocation.fromPackage, relocation.toPackage) {
- for (exclude in relocation.excludes) {
- exclude(exclude)
- }
- }
- }
}
// Paper start
@@ -129,18 +117,6 @@ tasks.check {
}
// Paper end
-// Paper start - include reobf mappings in jar for stacktrace deobfuscation
-val includeMappings = tasks.register<io.papermc.paperweight.tasks.IncludeMappings>("includeMappings") {
- inputJar.set(tasks.fixJarForReobf.flatMap { it.outputJar })
- mappings.set(tasks.reobfJar.flatMap { it.mappingsFile })
- mappingsDest.set("META-INF/mappings/reobf.tiny")
-}
-
-tasks.reobfJar {
- inputJar.set(includeMappings.flatMap { it.outputJar })
-}
-// Paper end - include reobf mappings in jar for stacktrace deobfuscation
-
tasks.test {
exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
useJUnitPlatform()
@@ -187,20 +163,41 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM
runtime.filterNot { it.asFile.absolutePath == vanilla } runtime.filterNot { it.asFile.absolutePath == vanilla }
} }
@ -1521,10 +1473,10 @@ index 0000000000000000000000000000000000000000..badff5d6ae6dd8d209c82bc7e8afe370
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 27db614d46dffc2d10f18d79cc5a084f3421d86b..58234db42c54ce32f1a8e0cd755ca350e87f3696 100644 index 7b5d3fac1b5f4d22340a620a5edd5a8fba6be584..e021ac312127e0544606ab466cab781915e027d2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -670,6 +670,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -637,6 +637,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD); this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP)); this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
@ -1532,8 +1484,8 @@ index 27db614d46dffc2d10f18d79cc5a084f3421d86b..58234db42c54ce32f1a8e0cd755ca350
this.connection.acceptConnections(); this.connection.acceptConnections();
} }
@@ -975,6 +976,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -909,6 +910,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.waitForAsyncTasksShutdown(); // Paper - Wait for Async Tasks during shutdown this.server.disablePlugins();
} }
// CraftBukkit end // CraftBukkit end
+ if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.shutdown(); // Paper - Plugin remapping + if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.shutdown(); // Paper - Plugin remapping
@ -1541,10 +1493,10 @@ index 27db614d46dffc2d10f18d79cc5a084f3421d86b..58234db42c54ce32f1a8e0cd755ca350
this.isSaving = true; this.isSaving = true;
if (this.playerList != null) { if (this.playerList != null) {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 68d268b6fff126e8645b6deec3fb549ea2286b77..dd24112604d2dc99809d78f2dbc70eebd90aabc0 100644 index 0d6688e9da81453e64daacfb81e4a13cc37b3e66..98cba55466d6798e5de33d8dcbf03e205e5199d8 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -343,6 +343,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -315,6 +315,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
} }
} }
@ -1872,31 +1824,22 @@ index 0000000000000000000000000000000000000000..73b20a92f330311e3fef8f03b51a0985
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c490a29bcf7410bc54959ee71375605964379ed5..f3eeeef09c41b14c04f33787b9a7927b4c16bf88 100644 index 45160b93a24dc74f6368441e2a4fe659ceaf5bf5..6573e72d041714ccc2bf0e3c8734bc212caf534e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -510,7 +510,7 @@ public final class CraftServer implements Server { @@ -966,6 +966,7 @@ public final class CraftServer implements Server {
// Paper start
@Override
public File getPluginsFolder() {
- return (File) this.console.options.valueOf("plugins");
+ return this.console.getPluginsFolder();
}
private List<File> extraPluginJars() {
@@ -1113,6 +1113,7 @@ public final class CraftServer implements Server {
this.enablePlugins(PluginLoadOrder.STARTUP); this.enablePlugins(PluginLoadOrder.STARTUP);
this.enablePlugins(PluginLoadOrder.POSTWORLD); this.enablePlugins(PluginLoadOrder.POSTWORLD);
this.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.RELOAD)); this.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.RELOAD));
+ if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins + if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins
org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Disable watchdog early timeout on reload
} }
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 3c7a771c48cc2732cc038ca11bb93ec5f8c2d667..183d8abcaa968117553601a0e9a27e8144737247 100644 index adf28b8e77d42267ce41713e031ee316366202e8..29698be6e4990769cbe1c00088dfb9cfc73d966a 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -74,6 +74,7 @@ import org.bukkit.potion.PotionType; @@ -72,6 +72,7 @@ import org.bukkit.potion.PotionType;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public final class CraftMagicNumbers implements UnsafeValues { public final class CraftMagicNumbers implements UnsafeValues {
@ -1904,22 +1847,20 @@ index 3c7a771c48cc2732cc038ca11bb93ec5f8c2d667..183d8abcaa968117553601a0e9a27e81
public static final UnsafeValues INSTANCE = new CraftMagicNumbers(); public static final UnsafeValues INSTANCE = new CraftMagicNumbers();
private CraftMagicNumbers() {} private CraftMagicNumbers() {}
@@ -392,7 +393,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -356,7 +357,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
if (pluginIndex < minimumIndex) { throw new InvalidPluginException("Plugin API version " + pdf.getAPIVersion() + " is lower than the minimum allowed version. Please update or replace it.");
throw new InvalidPluginException("Plugin API version " + pdf.getAPIVersion() + " is lower than the minimum allowed version. Please update or replace it."); }
}
- } else { - if (toCheck.isOlderThan(ApiVersion.FLATTENING)) {
+ } else if (!DISABLE_PLUGIN_REWRITING) { + if (!DISABLE_PLUGIN_REWRITING && toCheck.isOlderThan(ApiVersion.FLATTENING)) { // Paper
if (minimumIndex == -1) { CraftLegacy.init();
CraftLegacy.init(); }
Bukkit.getLogger().log(Level.WARNING, "Legacy plugin " + pdf.getFullName() + " does not specify an api-version.");
@@ -408,6 +409,9 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -371,6 +372,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override @Override
public byte[] processClass(PluginDescriptionFile pdf, String path, byte[] clazz) { public byte[] processClass(PluginDescriptionFile pdf, String path, byte[] clazz) {
+ if (DISABLE_PLUGIN_REWRITING) { + if (DISABLE_PLUGIN_REWRITING) return clazz; // Paper
+ return clazz;
+ }
try { try {
clazz = Commodore.convert(clazz, !CraftMagicNumbers.isLegacy(pdf)); clazz = Commodore.convert(clazz, pdf.getName(), ApiVersion.getOrCreateVersion(pdf.getAPIVersion()));
} catch (Exception ex) { } catch (Exception ex) {

Datei anzeigen

@ -6,18 +6,18 @@ Subject: [PATCH] Remap reflection calls in plugins using internals
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 69f6e6aa7f71c155651826400c6d41f075eb9ea3..ccdf5120013adfe9604d503dd3570bc74c2cca91 100644 index ddd9bf846c7e918a1a36a6035b220db201c42440..447d98e58fbcb70ab50c27ef077abb27558e3577 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -36,7 +36,6 @@ dependencies { @@ -34,7 +34,6 @@ dependencies {
implementation("org.ow2.asm:asm-commons:9.7") implementation("org.ow2.asm:asm-commons:9.7")
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
implementation("commons-lang:commons-lang:2.6") implementation("commons-lang:commons-lang:2.6")
- implementation("net.fabricmc:mapping-io:0.5.0") // Paper - needed to read mappings for stacktrace deobfuscation - implementation("net.fabricmc:mapping-io:0.5.0") // Paper - needed to read mappings for stacktrace deobfuscation
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1")
runtimeOnly("com.mysql:mysql-connector-j:8.2.0")
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
@@ -58,6 +57,12 @@ dependencies {
runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
@@ -48,6 +47,12 @@ dependencies {
testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
implementation("net.neoforged:AutoRenamingTool:2.0.3") // Paper - remap plugins implementation("net.neoforged:AutoRenamingTool:2.0.3") // Paper - remap plugins
implementation("net.neoforged:srgutils:1.0.9") // Paper - remap plugins - bump transitive of ART implementation("net.neoforged:srgutils:1.0.9") // Paper - remap plugins - bump transitive of ART
@ -30,27 +30,6 @@ index 69f6e6aa7f71c155651826400c6d41f075eb9ea3..ccdf5120013adfe9604d503dd3570bc7
} }
paperweight { paperweight {
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
index 59699c59fdfc611177fdb3136f84ab539b17d9c9..3be5e7629f0a45e32a70524eec13df7aab648f00 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
@@ -4,6 +4,7 @@ import com.destroystokyo.paper.entity.RangedEntity;
import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
+import io.papermc.paper.util.MappingEnvironment;
import io.papermc.paper.util.ObfHelper;
import java.lang.reflect.Constructor;
import java.util.EnumSet;
@@ -249,7 +250,7 @@ public class MobGoalHelper {
}
public static String getUsableName(Class<?> clazz) {
- String name = ObfHelper.INSTANCE.deobfClassName(clazz.getName());
+ String name = MappingEnvironment.reobf() ? ObfHelper.INSTANCE.deobfClassName(clazz.getName()) : clazz.getName();
name = name.substring(name.lastIndexOf(".") + 1);
boolean flag = false;
// inner classes
diff --git a/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java diff --git a/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java
index 893ad5e7c2d32ccd64962d95d146bbd317c28ab8..3d73ea0e63c97b2b08e719b7be7af3894fb2d4e8 100644 index 893ad5e7c2d32ccd64962d95d146bbd317c28ab8..3d73ea0e63c97b2b08e719b7be7af3894fb2d4e8 100644
--- a/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java --- a/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java
@ -665,37 +644,11 @@ index 0000000000000000000000000000000000000000..c0a486cb46ff30353c3ff09567891cd3
+ return this.pool.computeIfAbsent(string, Function.identity()); + return this.pool.computeIfAbsent(string, Function.identity());
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
index 0a2e894d8bd1268fcbd4460745304816be46beff..93d6813c63618e39efb1f9f0097843dc9c014fed 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
@@ -32,7 +32,7 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
this.maxDuration = maxRunTime;
this.entryCondition = requiredMemoryState;
// Paper start - configurable behavior tick rate and timings
- String key = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName());
+ String key = io.papermc.paper.util.MappingEnvironment.reobf() ? io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName()) : this.getClass().getName();
int lastSeparator = key.lastIndexOf('.');
if (lastSeparator != -1) {
key = key.substring(lastSeparator + 1);
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
index de2dfaf3cb41bafd48fa4699096a0a7304cd3201..05d1087e318137323718f6ff30f68b70bbc5bec9 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
@@ -33,7 +33,7 @@ public abstract class Sensor<E extends LivingEntity> {
public Sensor(int senseInterval) {
// Paper start - configurable sensor tick rate and timings
- String key = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName());
+ String key = io.papermc.paper.util.MappingEnvironment.reobf() ? io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName()) : this.getClass().getName();
int lastSeparator = key.lastIndexOf('.');
if (lastSeparator != -1) {
key = key.substring(lastSeparator + 1);
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
index 106af2b2c7ff72c7549975aef75cdcff8d9a7d97..c0adfa72a6b43b72825797572c5c2557042e2a42 100644 index 457a963ee6ebd3cf5c3831f6660e3850335af49f..61744d8fde3ba98585cf261fc09f0acc042b67b8 100644
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java --- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java +++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
@@ -141,7 +141,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater { @@ -128,7 +128,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
} }
} }
@ -704,60 +657,3 @@ index 106af2b2c7ff72c7549975aef75cdcff8d9a7d97..c0adfa72a6b43b72825797572c5c2557
boolean runNext(Level world); boolean runNext(Level world);
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index bc008773f8cf0d416182152ecfc5a64b70744009..757be022ace25b816d4630d134e6b7ff74e584c3 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -57,36 +57,20 @@ public class Commodore {
// Paper start - Plugin rewrites
private static final String CB_PACKAGE = org.bukkit.Bukkit.getServer().getClass().getPackageName().replace('.', '/');
- private static final Map<String, String> SEARCH_AND_REMOVE = initReplacementsMap();
- private static Map<String, String> initReplacementsMap() {
- Map<String, String> getAndRemove = new HashMap<>();
- // Be wary of maven shade's relocations
-
- final java.util.jar.Manifest manifest = io.papermc.paper.util.JarManifests.manifest(Commodore.class);
- if (Boolean.getBoolean( "debug.rewriteForIde") && manifest != null)
- {
- // unversion incoming calls for pre-relocate debug work
- final String NMS_REVISION_PACKAGE = "v" + manifest.getMainAttributes().getValue("CraftBukkit-Package-Version") + "/";
-
- getAndRemove.put("org/bukkit/".concat("craftbukkit/" + NMS_REVISION_PACKAGE), NMS_REVISION_PACKAGE);
- }
-
- return getAndRemove;
- }
+ private static final String CB_PACKAGE_PREFIX = "org/bukkit/".concat("craftbukkit/");
+ private static final String LEGACY_CB_PACKAGE_PREFIX = CB_PACKAGE_PREFIX + io.papermc.paper.util.MappingEnvironment.LEGACY_CB_VERSION + "/";
@Nonnull
private static String getOriginalOrRewrite(@Nonnull String original)
{
- String rewrite = null;
- for ( Map.Entry<String, String> entry : SEARCH_AND_REMOVE.entrySet() )
- {
- if ( original.contains( entry.getKey() ) )
- {
- rewrite = original.replace( entry.getValue(), "" );
+ // Relocation is applied in reobf, and when mappings are present they handle the relocation
+ if (!io.papermc.paper.util.MappingEnvironment.reobf() && !io.papermc.paper.util.MappingEnvironment.hasMappings()) {
+ if (original.contains(LEGACY_CB_PACKAGE_PREFIX)) {
+ original = original.replace(LEGACY_CB_PACKAGE_PREFIX, CB_PACKAGE_PREFIX);
}
}
- return rewrite != null ? rewrite : original;
+ return original;
}
// Paper end - Plugin rewrites
@@ -156,7 +140,7 @@ public class Commodore {
ClassReader cr = new ClassReader(b);
ClassWriter cw = new ClassWriter(cr, 0);
- cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, cw) {
+ cr.accept(new ClassRemapper(new ClassVisitor(Opcodes.ASM9, io.papermc.paper.pluginremap.reflect.ReflectionRemapper.visitor(cw)) { // Paper
// Paper start - Rewrite plugins
@Override

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add WorldEdit plugin flag test task
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index ccdf5120013adfe9604d503dd3570bc74c2cca91..73b3e61cbbdf5025c24d289597648f01f632a5e3 100644 index 447d98e58fbcb70ab50c27ef077abb27558e3577..3b9eb1fdc0685aec10b13a8e0e6b3afa4d953250 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -1,9 +1,11 @@ @@ -1,9 +1,11 @@
@ -20,7 +20,7 @@ index ccdf5120013adfe9604d503dd3570bc74c2cca91..73b3e61cbbdf5025c24d289597648f01
} }
val log4jPlugins = sourceSets.create("log4jPlugins") val log4jPlugins = sourceSets.create("log4jPlugins")
@@ -186,6 +188,25 @@ tasks.registerRunTask("runDevServer") { @@ -176,6 +178,25 @@ tasks.registerRunTask("runDevServer") {
jvmArgs("-DPaper.pushPaperAssetsRoot=true") jvmArgs("-DPaper.pushPaperAssetsRoot=true")
} }

Datei anzeigen

@ -17,7 +17,7 @@ index 5a720c0a751e7a83976727d01cc5bc6282702255..48c40f12649735f14204c516eace6905
+ // Paper start + // Paper start
+ @Override + @Override
+ public File getPluginsFolder() { + public File getPluginsFolder() {
+ return (File) this.console.options.valueOf("plugins"); + return this.console.getPluginsFolder();
+ } + }
+ +
+ private List<File> extraPluginJars() { + private List<File> extraPluginJars() {

Datei anzeigen

@ -273,7 +273,7 @@ index 0000000000000000000000000000000000000000..8117578ced94aa6bf01871f6526a3883
+ } + }
+ +
+ public static String getUsableName(Class<?> clazz) { + public static String getUsableName(Class<?> clazz) {
+ String name = ObfHelper.INSTANCE.deobfClassName(clazz.getName()); + String name = MappingEnvironment.reobf() ? ObfHelper.INSTANCE.deobfClassName(clazz.getName()) : clazz.getName();
+ name = name.substring(name.lastIndexOf(".") + 1); + name = name.substring(name.lastIndexOf(".") + 1);
+ boolean flag = false; + boolean flag = false;
+ // inner classes + // inner classes

Datei anzeigen

@ -47,7 +47,7 @@ index f639cafa64d98a001e622882c647701547f5c3ac..03092417cd8ab5c6d266f3af9f20f47b
this.maxDuration = maxRunTime; this.maxDuration = maxRunTime;
this.entryCondition = requiredMemoryState; this.entryCondition = requiredMemoryState;
+ // Paper start - configurable behavior tick rate and timings + // Paper start - configurable behavior tick rate and timings
+ String key = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName()); + String key = io.papermc.paper.util.MappingEnvironment.reobf() ? io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName()) : this.getClass().getName();
+ int lastSeparator = key.lastIndexOf('.'); + int lastSeparator = key.lastIndexOf('.');
+ if (lastSeparator != -1) { + if (lastSeparator != -1) {
+ key = key.substring(lastSeparator + 1); + key = key.substring(lastSeparator + 1);
@ -107,7 +107,7 @@ index 671fc7725d7c801a2ba009da5bd1bc1a9530f187..9e90cb2f51d1bacacb287e912d14ab91
public Sensor(int senseInterval) { public Sensor(int senseInterval) {
+ // Paper start - configurable sensor tick rate and timings + // Paper start - configurable sensor tick rate and timings
+ String key = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName()); + String key = io.papermc.paper.util.MappingEnvironment.reobf() ? io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName()) : this.getClass().getName();
+ int lastSeparator = key.lastIndexOf('.'); + int lastSeparator = key.lastIndexOf('.');
+ if (lastSeparator != -1) { + if (lastSeparator != -1) {
+ key = key.substring(lastSeparator + 1); + key = key.substring(lastSeparator + 1);