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 df7e6433ad
commit 8a3c4f1d42
4 changed files with 24 additions and 39 deletions

View file

@ -1,33 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MiniDigger | Martin <admin@minidigger.dev>
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
@@ -0,0 +0,0 @@
<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
@@ -0,0 +0,0 @@ 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
--

View file

@ -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
@@ -0,0 +0,0 @@ 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

@ -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
@@ -0,0 +0,0 @@
<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
@@ -0,0 +0,0 @@ import java.io.FileOutputStream;
@ -81,8 +94,11 @@ index 9b4a0f0678..2c6814f131 100644
{
OptionParser parser = new OptionParser();
@@ -0,0 +0,0 @@ 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

@ -10,7 +10,7 @@ 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
@@ -0,0 +0,0 @@
@ -22,6 +22,7 @@ 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() {}
@ -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
@@ -0,0 +0,0 @@
@ -71,6 +72,7 @@ index 935136771e..90319909e5 100644
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