Fix 2 plugin specific issues with loot drop and pathfinders

Based on what that collection does, won't really cause any real issue for UC.
So let it silently be ignored.

Fixes #3269
Fixes #3255
This commit is contained in:
Aikar 2020-05-01 21:44:06 -04:00
parent 6e41f7b79a
commit 68fb98b50f
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
4 changed files with 34 additions and 51 deletions

View file

@ -1,4 +1,4 @@
From 491d3e52a6cfdeff2c5e7345a425065940c3b610 Mon Sep 17 00:00:00 2001
From 0de5fb76ae2419f13e122b84c9732b8f19c6604d Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Wed, 3 Oct 2018 20:09:18 -0400
Subject: [PATCH] Hook into CB plugin rewrites
@ -7,8 +7,21 @@ Allows us to do fun stuff like rewrite the OBC util fastutil location to
our own relocation. Also lets us rewrite NMS calls for when we're
debugging in an IDE pre-relocate.
diff --git a/pom.xml b/pom.xml
index fd417a9eeb..bc8438ae1a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,7 +87,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
- <version>7.3.1</version>
+ <version>8.0.1</version> <!-- Paper -->
<scope>compile</scope>
</dependency>
<!-- deprecated API depend -->
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 9b4a0f0678..2c6814f131 100644
index 9b4a0f0678..4ae41fd255 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -6,7 +6,9 @@ import java.io.FileOutputStream;
@ -80,9 +93,12 @@ index 9b4a0f0678..2c6814f131 100644
public static void main(String[] args)
{
OptionParser parser = new OptionParser();
@@ -130,15 +173,90 @@ public class Commodore
@@ -128,17 +171,92 @@ public class Commodore
ClassReader cr = new ClassReader( b );
ClassWriter cw = new ClassWriter( cr, 0 );
cr.accept( new ClassVisitor( Opcodes.ASM7, cw )
- cr.accept( new ClassVisitor( Opcodes.ASM7, cw )
+ cr.accept( new ClassVisitor( Opcodes.ASM8, cw) // Paper
{
+ // Paper start - Rewrite plugins
+ @Override

View file

@ -1,4 +1,4 @@
From 92483b5800e7db9d3c1046ab607bec5e35b9ee4f Mon Sep 17 00:00:00 2001
From 7739f39ca832f6942b113739172d2bf9c948134b Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Mon, 6 Apr 2020 17:53:29 -0700
Subject: [PATCH] Remove streams from Mob AI System
@ -10,10 +10,10 @@ Also optimise the stream.anyMatch statement to move to a bitset
where we can replace the call with a single bitwise operation.
diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java
index bdb90a3466..134f7d0013 100644
index bdb90a3466..93009d83f0 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoal.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoal.java
@@ -1,10 +1,11 @@
@@ -1,10 +1,12 @@
package net.minecraft.server;
+import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet; // Paper - remove streams from pathfindergoalselector
@ -22,11 +22,12 @@ index bdb90a3466..134f7d0013 100644
public abstract class PathfinderGoal {
- private final EnumSet<PathfinderGoal.Type> a = EnumSet.noneOf(PathfinderGoal.Type.class);
+ private final EnumSet<PathfinderGoal.Type> a = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
+ private final OptimizedSmallEnumSet<Type> goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector
public PathfinderGoal() {}
@@ -28,16 +29,20 @@ public abstract class PathfinderGoal {
@@ -28,16 +30,20 @@ public abstract class PathfinderGoal {
public void e() {}
public void a(EnumSet<PathfinderGoal.Type> enumset) {
@ -52,7 +53,7 @@ index bdb90a3466..134f7d0013 100644
public static enum Type {
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
index 935136771e..90319909e5 100644
index 935136771e..84d2abbcb9 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -1,8 +1,10 @@
@ -66,16 +67,17 @@ index 935136771e..90319909e5 100644
import java.util.Map;
import java.util.Set;
import java.util.stream.Stream;
@@ -26,7 +28,7 @@ public class PathfinderGoalSelector {
@@ -26,7 +28,8 @@ public class PathfinderGoalSelector {
private final Map<PathfinderGoal.Type, PathfinderGoalWrapped> c = new EnumMap(PathfinderGoal.Type.class);
private final Set<PathfinderGoalWrapped> d = Sets.newLinkedHashSet();private Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER
private final GameProfilerFiller e;
- private final EnumSet<PathfinderGoal.Type> f = EnumSet.noneOf(PathfinderGoal.Type.class);
+ private final EnumSet<PathfinderGoal.Type> f = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
+ private final OptimizedSmallEnumSet<PathfinderGoal.Type> goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector
private int g = 3;private int getTickRate() { return g; } // Paper - OBFHELPER
private int curRate;private int getCurRate() { return curRate; } private void incRate() { this.curRate++; } // Paper TODO
@@ -58,33 +60,36 @@ public class PathfinderGoalSelector {
@@ -58,33 +61,36 @@ public class PathfinderGoalSelector {
// Paper end
public void a(PathfinderGoal pathfindergoal) {
@ -134,7 +136,7 @@ index 935136771e..90319909e5 100644
this.c.forEach((pathfindergoal_type, pathfindergoalwrapped) -> {
if (!pathfindergoalwrapped.g()) {
this.c.remove(pathfindergoal_type);
@@ -93,30 +98,58 @@ public class PathfinderGoalSelector {
@@ -93,30 +99,58 @@ public class PathfinderGoalSelector {
});
this.e.exit();
this.e.enter("goalUpdate");
@ -215,7 +217,7 @@ index 935136771e..90319909e5 100644
this.e.exit();
}
@@ -125,11 +158,11 @@ public class PathfinderGoalSelector {
@@ -125,11 +159,11 @@ public class PathfinderGoalSelector {
}
public void a(PathfinderGoal.Type pathfindergoal_type) {

View file

@ -1,4 +1,4 @@
From 93db05c5d0cdd9759162cf22844ab6801120ebd9 Mon Sep 17 00:00:00 2001
From 1ed9ecc32fcec1fa395073143d271c8373b498b9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 25 Apr 2020 06:46:35 -0400
Subject: [PATCH] Fix numerous item duplication issues and teleport issues
@ -79,7 +79,7 @@ index 8ad131e4fc..d35a0b2d94 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index c3f7e46121..b0942e88e1 100644
index c3f7e46121..73b271f6f3 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -776,7 +776,8 @@ public class CraftEventFactory {
@ -88,7 +88,7 @@ index c3f7e46121..b0942e88e1 100644
- world.dropItem(entity.getLocation(), stack);
+ world.dropItem(entity.getLocation(), stack); // Paper - note: dropItem already clones due to this being bukkit -> NMS
+ stack.setAmount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe
+ if (stack instanceof CraftItemStack) stack.setAmount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe, but don't nuke bukkit stacks of manually added items
}
return event;

View file

@ -1,35 +0,0 @@
From fc0872e1d7d932dd86557d11134fd650901a0ca9 Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@minidigger.me>
Date: Thu, 30 Apr 2020 16:17:14 +0200
Subject: [PATCH] Fix commodore by updating asm
diff --git a/pom.xml b/pom.xml
index fd417a9eeb..bc8438ae1a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,7 +87,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
- <version>7.3.1</version>
+ <version>8.0.1</version> <!-- Paper -->
<scope>compile</scope>
</dependency>
<!-- deprecated API depend -->
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
index 2c6814f131..4ae41fd255 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java
@@ -171,7 +171,7 @@ public class Commodore
ClassReader cr = new ClassReader( b );
ClassWriter cw = new ClassWriter( cr, 0 );
- cr.accept( new ClassVisitor( Opcodes.ASM7, cw )
+ cr.accept( new ClassVisitor( Opcodes.ASM8, cw) // Paper
{
// Paper start - Rewrite plugins
@Override
--
2.26.2