mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-03 23:07:40 +01:00
Work
This commit is contained in:
parent
a616fad617
commit
0898d2405e
@ -1626,6 +1626,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
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");
|
||||||
|
|
||||||
|
@@ -0,0 +0,0 @@ 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>();
|
||||||
@@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager {
|
@@ -0,0 +0,0 @@ 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 {
|
||||||
|
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
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)
|
||||||
@@ -0,0 +0,0 @@ tasks.shadowJar {
|
@@ -0,0 +0,0 @@ tasks.shadowJar {
|
||||||
}
|
configurations = listOf(project.configurations.vanillaServer.get())
|
||||||
}
|
}
|
||||||
|
|
||||||
+// Paper start
|
+// Paper start
|
||||||
|
@ -14,28 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
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
|
||||||
@@ -0,0 +0,0 @@ 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..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
@ -108,19 +89,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
|
||||||
@@ -0,0 +0,0 @@ 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..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
@ -443,33 +411,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/util/TraceUtil.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/util/TraceUtil.java
|
|
||||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/CrashReport.java
|
--- a/src/main/java/net/minecraft/CrashReport.java
|
||||||
@ -499,8 +440,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- 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
|
||||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
@@ -0,0 +0,0 @@ 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,8 +454,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- 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();
|
|
||||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -524,26 +465,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
|
|
||||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
@ -556,19 +477,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
|
||||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
|
||||||
@ -596,60 +504,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
} 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (root != null) {
|
||||||
@@ -0,0 +0,0 @@ public class OldUsersConverter {
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
||||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java
|
|
||||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
||||||
@@ -0,0 +0,0 @@ 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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
|
@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
|
||||||
}
|
}
|
||||||
log.log( Level.SEVERE, "\tStack:" );
|
log.log( Level.SEVERE, "\tStack:" );
|
@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/resources/log4j2.xml
|
--- a/src/main/resources/log4j2.xml
|
||||||
+++ b/src/main/resources/log4j2.xml
|
+++ b/src/main/resources/log4j2.xml
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
<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}" />
|
@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+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")
|
||||||
|
|
||||||
@ -34,54 +34,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
)
|
)
|
||||||
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)
|
||||||
@@ -0,0 +0,0 @@ tasks.compileTestJava {
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -0,0 +0,0 @@ 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()
|
|
||||||
@@ -0,0 +0,0 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM
|
@@ -0,0 +0,0 @@ val runtimeClasspathWithoutVanillaServer = configurations.runtimeClasspath.flatM
|
||||||
runtime.filterNot { it.asFile.absolutePath == vanilla }
|
runtime.filterNot { it.asFile.absolutePath == vanilla }
|
||||||
}
|
}
|
||||||
@ -1533,7 +1485,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ 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
|
||||||
@ -1875,23 +1827,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/ja
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
||||||
@@ -0,0 +0,0 @@ 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() {
|
|
||||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
@ -1905,21 +1848,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
private CraftMagicNumbers() {}
|
private CraftMagicNumbers() {}
|
||||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -0,0 +0,0 @@ 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.");
|
|
||||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -0,0 +0,0 @@ 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) {
|
@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
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
|
||||||
|
|
||||||
|
runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
||||||
@@ -0,0 +0,0 @@ dependencies {
|
@@ -0,0 +0,0 @@ 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
|
||||||
@ -30,27 +30,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
|
||||||
@@ -0,0 +0,0 @@ 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;
|
|
||||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java
|
--- a/src/main/java/io/papermc/paper/configuration/serializer/PacketClassSerializer.java
|
||||||
@ -665,32 +644,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
|
||||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
|
||||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||||
@ -704,60 +657,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
|
|
||||||
@@ -0,0 +0,0 @@ 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
|
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ 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
|
|
@ -87,28 +87,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+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 {
|
||||||
|
@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
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..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
@ -9,9 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -0,0 +0,0 @@ dependencies {
|
@@ -0,0 +0,0 @@ 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")
|
@ -57,18 +57,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ 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
|
||||||
@@ -0,0 +0,0 @@ relocation {
|
@@ -0,0 +0,0 @@ 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..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
@ -267,7 +267,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
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;
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
@ -350,11 +350,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
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) {
|
||||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -0,0 +0,0 @@ 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());
|
||||||
@ -453,8 +453,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
|
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
|
||||||
@@ -0,0 +0,0 @@ public class Main {
|
@@ -0,0 +0,0 @@ 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...");
|
||||||
@ -596,29 +596,26 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThre
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
||||||
@@ -0,0 +0,0 @@ import java.io.IOException;
|
@@ -0,0 +0,0 @@ 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;
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class TerminalConsoleWriterThread extends Thread {
|
@@ -0,0 +0,0 @@ public class TerminalConsoleWriterThread extends Thread {
|
||||||
Logger.getLogger(TerminalConsoleWriterThread.class.getName()).log(Level.SEVERE, null, ex);
|
void setCompletion(int completion) {
|
||||||
}
|
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
|
||||||
@ -633,22 +630,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/resources/log4j2.xml
|
+++ b/src/main/resources/log4j2.xml
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
<?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 />
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // 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() {
|
||||||
|
@ -273,7 +273,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ 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
|
||||||
|
@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
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 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user