More work for 1.14

This commit is contained in:
Shane Freeder 2019-04-26 02:24:00 +01:00
parent 7e6db27085
commit 818e88dbc5
35 changed files with 371 additions and 400 deletions

View File

@ -1,14 +1,14 @@
From 275f3eef9f154b760b5b1a5284f704fff1f4694c Mon Sep 17 00:00:00 2001 From cbac1504f2d1b1c6ebe7c912bbe54df2e4a856f9 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc> From: kashike <kashike@vq.lc>
Date: Thu, 3 Mar 2016 02:15:57 -0600 Date: Thu, 3 Mar 2016 02:15:57 -0600
Subject: [PATCH] Expose server CommandMap Subject: [PATCH] Expose server CommandMap
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 c6e6ae4fe7..19fef2496e 100644 index 9c54d151df..1c96beab7d 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
@@ -1643,6 +1643,7 @@ public final class CraftServer implements Server { @@ -1579,6 +1579,7 @@ public final class CraftServer implements Server {
return helpMap; return helpMap;
} }

View File

@ -1,14 +1,14 @@
From 03ecaeca914d17d06f7a507ffbccba95a17d5c6f Mon Sep 17 00:00:00 2001 From a4560c5d987300561be8cf3e09f690b885d9b221 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc> From: kashike <kashike@vq.lc>
Date: Thu, 3 Mar 2016 02:18:39 -0600 Date: Thu, 3 Mar 2016 02:18:39 -0600
Subject: [PATCH] Be a bit more informative in maxHealth exception Subject: [PATCH] Be a bit more informative in maxHealth exception
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 3a15b47dd6..5f14fb8501 100644 index d01e06f1b9..defcfc9337 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -100,7 +100,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -99,7 +99,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setHealth(double health) { public void setHealth(double health) {
health = (float) health; health = (float) health;
if ((health < 0) || (health > getMaxHealth())) { if ((health < 0) || (health > getMaxHealth())) {

View File

@ -1,14 +1,14 @@
From 6648715ea2f2eec29832094e11db75f068948fc0 Mon Sep 17 00:00:00 2001 From 7ee3c5a8e6f38b0679e2450f39f8e2e9e2413c03 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com> From: Techcable <Techcable@outlook.com>
Date: Thu, 3 Mar 2016 02:32:10 -0600 Date: Thu, 3 Mar 2016 02:32:10 -0600
Subject: [PATCH] Player Tab List and Title APIs Subject: [PATCH] Player Tab List and Title APIs
diff --git a/src/main/java/net/minecraft/server/IChatBaseComponent.java b/src/main/java/net/minecraft/server/IChatBaseComponent.java diff --git a/src/main/java/net/minecraft/server/IChatBaseComponent.java b/src/main/java/net/minecraft/server/IChatBaseComponent.java
index 62fba42c37..48fecffdfe 100644 index aa8601920b..6e867e2347 100644
--- a/src/main/java/net/minecraft/server/IChatBaseComponent.java --- a/src/main/java/net/minecraft/server/IChatBaseComponent.java
+++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java +++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java
@@ -398,6 +398,7 @@ public interface IChatBaseComponent extends Message, Iterable<IChatBaseComponent @@ -433,6 +433,7 @@ public interface IChatBaseComponent extends Message, Iterable<IChatBaseComponent
return IChatBaseComponent.ChatSerializer.a.toJsonTree(ichatbasecomponent); return IChatBaseComponent.ChatSerializer.a.toJsonTree(ichatbasecomponent);
} }
@ -17,10 +17,10 @@ index 62fba42c37..48fecffdfe 100644
public static IChatBaseComponent a(String s) { public static IChatBaseComponent a(String s) {
return (IChatBaseComponent) ChatDeserializer.a(IChatBaseComponent.ChatSerializer.a, s, IChatBaseComponent.class, false); return (IChatBaseComponent) ChatDeserializer.a(IChatBaseComponent.ChatSerializer.a, s, IChatBaseComponent.class, false);
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
index 7b18c16402..15d62cf066 100644 index 3a6e780007..535056c64e 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java --- a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
@@ -42,11 +42,28 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> { @@ -43,12 +43,29 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> {
} }
} }
@ -36,6 +36,7 @@ index 7b18c16402..15d62cf066 100644
+ } + }
+ // Paper end + // Paper end
@Override
public void b(PacketDataSerializer packetdataserializer) throws IOException { public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.a((Enum) this.a); packetdataserializer.a((Enum) this.a);
if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE || this.a == PacketPlayOutTitle.EnumTitleAction.ACTIONBAR) { if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE || this.a == PacketPlayOutTitle.EnumTitleAction.ACTIONBAR) {
@ -51,7 +52,7 @@ index 7b18c16402..15d62cf066 100644
if (this.a == PacketPlayOutTitle.EnumTitleAction.TIMES) { if (this.a == PacketPlayOutTitle.EnumTitleAction.TIMES) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5496fae409..b8400876e5 100644 index 6b93cc3a57..d56fbdf80b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -61,7 +62,7 @@ index 5496fae409..b8400876e5 100644
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.io.BaseEncoding; import com.google.common.io.BaseEncoding;
@@ -201,6 +202,96 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -206,6 +207,96 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
} }

View File

@ -1,22 +1,22 @@
From 645bb0bb0df195ec9f1eb576f86119b6eb3e4012 Mon Sep 17 00:00:00 2001 From 55aad3b4034fa8a84069684e9dca4cddfd304fc5 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io> From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:33:53 -0600 Date: Thu, 3 Mar 2016 02:33:53 -0600
Subject: [PATCH] Ensure inv drag is in bounds Subject: [PATCH] Ensure inv drag is in bounds
diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java
index b06f229534..2f0f667ad6 100644 index 7a27993476..a2805011df 100644
--- a/src/main/java/net/minecraft/server/Container.java --- a/src/main/java/net/minecraft/server/Container.java
+++ b/src/main/java/net/minecraft/server/Container.java +++ b/src/main/java/net/minecraft/server/Container.java
@@ -139,7 +139,7 @@ public abstract class Container { @@ -201,7 +201,7 @@ public abstract class Container {
this.c(); this.d();
} }
} else if (this.g == 1) { } else if (this.h == 1) {
- Slot slot = (Slot) this.slots.get(i); - Slot slot = (Slot) this.slots.get(i);
+ Slot slot = i < this.slots.size() ? this.slots.get(i) : null; // Paper - Ensure drag in bounds + Slot slot = i < this.slots.size() ? this.slots.get(i) : null; // Paper - Ensure drag in bounds
itemstack1 = playerinventory.getCarried(); itemstack1 = playerinventory.getCarried();
if (slot != null && a(slot, itemstack1, true) && slot.isAllowed(itemstack1) && (this.dragType == 2 || itemstack1.getCount() > this.h.size()) && this.b(slot)) { if (slot != null && a(slot, itemstack1, true) && slot.isAllowed(itemstack1) && (this.dragType == 2 || itemstack1.getCount() > this.i.size()) && this.b(slot)) {
-- --
2.21.0 2.21.0

View File

@ -0,0 +1,23 @@
From c79c27636c3f13a9de8cce8b259d834129af3c1f Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:39:54 -0600
Subject: [PATCH] Change implementation of (tile)entity removal list
use sets for faster removal
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 48360c2b47..25e5216e25 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -40,7 +40,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
public final List<TileEntity> tileEntityList = Lists.newArrayList();
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
protected final List<TileEntity> tileEntityListPending = Lists.newArrayList();
- protected final List<TileEntity> tileEntityListUnload = Lists.newArrayList();
+ protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); // Paper
private final long b = 16777215L;
private final Thread c;
private int d;
--
2.21.0

View File

@ -0,0 +1,41 @@
From 07c480b2091dfcf5cc56db87c01a25f65eb6b0f2 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:46:17 -0600
Subject: [PATCH] Add configurable portal search radius
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index be91b11242..320fd07c62 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -186,4 +186,9 @@ public class PaperWorldConfig {
private void allChunksAreSlimeChunks() {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
}
+
+ public int portalSearchRadius;
+ private void portalSearchRadius() {
+ portalSearchRadius = getInt("portal-search-radius", 128);
+ }
}
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 1685e694ba..e7ca777c16 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -70,10 +70,11 @@ public class PortalTravelAgent {
} else {
double d2 = Double.MAX_VALUE;
- for (int i = -128; i <= 128; ++i) {
+ int portalSearchRadius = world.paperConfig.portalSearchRadius; // Paper
+ for (int i = portalSearchRadius; i <= portalSearchRadius; ++i) { // Paper
BlockPosition blockposition2;
- for (int j = -128; j <= 128; ++j) {
+ for (int j = -world.paperConfig.portalSearchRadius; j <= world.paperConfig.portalSearchRadius; ++j) { // Paper
for (BlockPosition blockposition3 = blockposition.b(i, this.world.getHeight() - 1 - blockposition.getY(), j); blockposition3.getY() >= 0; blockposition3 = blockposition2) {
blockposition2 = blockposition3.down();
if (this.world.getType(blockposition3).getBlock() == PortalTravelAgent.b) {
--
2.21.0

View File

@ -1,39 +1,36 @@
From 85717e8f26f10adcd7edff6d7eb6af12f850e5ac Mon Sep 17 00:00:00 2001 From e37717afd97ae4f98d32fda26f0c0cc1b1d78dc1 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io> From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:48:12 -0600 Date: Thu, 3 Mar 2016 02:48:12 -0600
Subject: [PATCH] Add velocity warnings Subject: [PATCH] Add velocity warnings
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 19fef2496e..54864fe761 100644 index 1c96beab7d..01d5a49cf7 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
@@ -201,6 +201,7 @@ public final class CraftServer implements Server { @@ -230,6 +230,7 @@ public final class CraftServer implements Server {
public boolean ignoreVanillaPermissions = false; public boolean ignoreVanillaPermissions = false;
private final List<CraftPlayer> playerView; private final List<CraftPlayer> playerView;
public int reloadCount; public int reloadCount;
+ public static Exception excessiveVelEx; // Paper - Velocity warnings + public static Exception excessiveVelEx; // Paper - Velocity warnings
private final class BooleanWrapper { static {
private boolean value = true; ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 660e59ba15..466750f779 100644 index 852de0d625..5d9b4a58e2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -266,12 +266,44 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -397,10 +397,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public void setVelocity(Vector velocity) { public void setVelocity(Vector velocity) {
Preconditions.checkArgument(velocity != null, "velocity"); Preconditions.checkArgument(velocity != null, "velocity");
velocity.checkFinite(); velocity.checkFinite();
+
+ // Paper start - Warn server owners when plugins try to set super high velocities + // Paper start - Warn server owners when plugins try to set super high velocities
+ if (!(this instanceof org.bukkit.entity.Projectile) && isUnsafeVelocity(velocity)) { + if (!(this instanceof org.bukkit.entity.Projectile) && isUnsafeVelocity(velocity)) {
+ CraftServer.excessiveVelEx = new Exception("Excessive velocity set detected: tried to set velocity of entity " + entity.getName() + " id #" + getEntityId() + " to (" + velocity.getX() + "," + velocity.getY() + "," + velocity.getZ() + ")."); + CraftServer.excessiveVelEx = new Exception("Excessive velocity set detected: tried to set velocity of entity " + entity.getName() + " id #" + getEntityId() + " to (" + velocity.getX() + "," + velocity.getY() + "," + velocity.getZ() + ").");
+ } + }
+ // Paper end + // Paper end
+ +
entity.motX = velocity.getX(); entity.setMot(CraftVector.toNMS(velocity));
entity.motY = velocity.getY();
entity.motZ = velocity.getZ();
entity.velocityChanged = true; entity.velocityChanged = true;
} }
@ -64,9 +61,9 @@ index 660e59ba15..466750f779 100644
+ +
@Override @Override
public double getHeight() { public double getHeight() {
return getHandle().length; return getHandle().getHeight();
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 8e32c4e2cd..c080a61185 100644 index 70b187190f..56f5f54bd1 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
@@ -76,7 +76,19 @@ public class WatchdogThread extends Thread @@ -76,7 +76,19 @@ public class WatchdogThread extends Thread
@ -88,8 +85,8 @@ index 8e32c4e2cd..c080a61185 100644
+ } + }
+ // Paper end + // Paper end
log.log( Level.SEVERE, "------------------------------" ); log.log( Level.SEVERE, "------------------------------" );
log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log ); dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
-- --
2.21.0 2.21.0

View File

@ -1,4 +1,4 @@
From 7df97e1da4f97dcc72060dcede1d6ae5af0b9e03 Mon Sep 17 00:00:00 2001 From 3b560988fe8b70cd78cf8e5913ef9b8963cab5c2 Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com> From: Sudzzy <originmc@outlook.com>
Date: Thu, 3 Mar 2016 02:50:31 -0600 Date: Thu, 3 Mar 2016 02:50:31 -0600
Subject: [PATCH] Configurable inter-world teleportation safety Subject: [PATCH] Configurable inter-world teleportation safety
@ -16,10 +16,10 @@ The wanted destination was on top of the emerald block however the player ended
This only is the case if the player is teleporting between worlds. This only is the case if the player is teleporting between worlds.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 3137128780..40b54191e6 100644 index 320fd07c62..94f5c90b3c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -199,4 +199,9 @@ public class PaperWorldConfig { @@ -191,4 +191,9 @@ public class PaperWorldConfig {
private void portalSearchRadius() { private void portalSearchRadius() {
portalSearchRadius = getInt("portal-search-radius", 128); portalSearchRadius = getInt("portal-search-radius", 128);
} }
@ -30,10 +30,10 @@ index 3137128780..40b54191e6 100644
+ } + }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b8400876e5..237210cc89 100644 index d56fbdf80b..b993d236b5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -717,7 +717,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -743,7 +743,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (fromWorld == toWorld) { if (fromWorld == toWorld) {
entity.playerConnection.teleport(to); entity.playerConnection.teleport(to);
} else { } else {

View File

@ -1,58 +0,0 @@
From e268b8b3e6cbcbb37ebcd90d00a8d2c99c1394ed Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:46:17 -0600
Subject: [PATCH] Add configurable portal search radius
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 05d2d50e54..3137128780 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -194,4 +194,9 @@ public class PaperWorldConfig {
private void allChunksAreSlimeChunks() {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
}
+
+ public int portalSearchRadius;
+ private void portalSearchRadius() {
+ portalSearchRadius = getInt("portal-search-radius", 128);
+ }
}
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index b911d830a0..aca4071420 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -13,7 +13,7 @@ import org.bukkit.util.Vector;
public class PortalTravelAgent {
private static final BlockPortal a = (BlockPortal) Blocks.NETHER_PORTAL;
- private final WorldServer world;
+ public final WorldServer world; // Paper - private -> public
private final Random c;
private final Long2ObjectMap<PortalTravelAgent.ChunkCoordinatesPortal> d = new Long2ObjectOpenHashMap(4096);
@@ -93,7 +93,7 @@ public class PortalTravelAgent {
public boolean b(Entity entity, float f) {
// CraftBukkit start - Modularize portal search process and entity teleportation
- BlockPosition found = this.findPortal(entity.locX, entity.locY, entity.locZ, 128);
+ BlockPosition found = this.findPortal(entity.locX, entity.locY, entity.locZ, world.paperConfig.portalSearchRadius); // Paper - Configurable search radius
if (found == null) {
return false;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftTravelAgent.java b/src/main/java/org/bukkit/craftbukkit/CraftTravelAgent.java
index d4639c8221..e1eb3aa0f3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftTravelAgent.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftTravelAgent.java
@@ -12,7 +12,7 @@ public class CraftTravelAgent extends PortalTravelAgent implements TravelAgent {
public static TravelAgent DEFAULT = null;
- private int searchRadius = 128;
+ private int searchRadius = world.paperConfig.portalSearchRadius; // Paper - Configurable search radius
private int creationRadius = 16;
private boolean canCreatePortal = true;
--
2.21.0

View File

@ -1,4 +1,4 @@
From db3e4015bc83abf1027c05c559d97961b7855218 Mon Sep 17 00:00:00 2001 From 4a49b7191988e3bc5f52e7ed14194198b26c4c3c Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io> From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 03:15:41 -0600 Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event Subject: [PATCH] Add exception reporting event
@ -49,7 +49,7 @@ index 0000000000..f699ce18ca
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index cb56d067b9..67cd4af4f5 100644 index 1cf5e388e4..c4103680d4 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -57,30 +57,22 @@ index cb56d067b9..67cd4af4f5 100644
+import com.destroystokyo.paper.exception.ServerInternalException; +import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@@ -424,6 +425,7 @@ public class Chunk implements IChunkAccess { import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
return this.getBlockData(i, j, k).b(this.world, new BlockPosition(i, j, k)); @@ -528,10 +529,15 @@ public class Chunk implements IChunkAccess {
}
+ public IBlockData getBlockData(BlockPosition blockposition) { return getType(blockposition); } // Paper
public IBlockData getType(BlockPosition blockposition) {
return this.getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ());
}
@@ -820,10 +822,15 @@ public class Chunk implements IChunkAccess {
this.tileEntities.remove(blockposition); this.tileEntities.remove(blockposition);
// Paper end // Paper end
} else { } else {
- System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() - System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()
- + " (" + getType(blockposition) + ") where there was no entity tile!"); - + " (" + getType(blockposition) + ") where there was no entity tile!");
- System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16)); - System.out.println("Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
- new Exception().printStackTrace(); - new Exception().printStackTrace();
+ // Paper start + // Paper start
+ ServerInternalException e = new ServerInternalException( + ServerInternalException e = new ServerInternalException(
+ "Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + "Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + ","
+ + tileentity.position.getY() + "," + tileentity.position.getZ() + + tileentity.position.getY() + "," + tileentity.position.getZ()
+ + " (" + getBlockData(blockposition) + ") where there was no entity tile!\n" + + + " (" + getType(blockposition) + ") where there was no entity tile!\n" +
+ "Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16)); + "Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
+ e.printStackTrace(); + e.printStackTrace();
+ ServerInternalException.reportInternalException(e); + ServerInternalException.reportInternalException(e);
+ // Paper end + // Paper end
@ -88,38 +80,21 @@ index cb56d067b9..67cd4af4f5 100644
} }
} }
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index c2ecc034e8..1ed7c7e2c9 100644 index 4f0fbe4a0d..2dd1c28fab 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -13,6 +13,7 @@ import java.util.concurrent.CompletableFuture; @@ -14,6 +14,9 @@ import java.util.concurrent.Executor;
import java.util.function.BooleanSupplier; import java.util.function.BooleanSupplier;
import java.util.function.Consumer; import java.util.function.Supplier;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+import com.destroystokyo.paper.exception.ServerInternalException; +import com.destroystokyo.paper.exception.ServerInternalException;
import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Logger;
@@ -209,9 +210,16 @@ public class ChunkProviderServer implements IChunkProvider { public class ChunkProviderServer extends IChunkProvider {
ichunkaccess.setLastSaved(this.world.getTime());
this.chunkLoader.saveChunk(this.world, ichunkaccess, unloaded); // Spigot
} catch (IOException ioexception) {
- ChunkProviderServer.a.error("Couldn't save chunk", ioexception);
+ // Paper start
+ String msg = "Couldn\'t save chunk";
+ ChunkProviderServer.a.error(msg, ioexception);
+ ServerInternalException.reportInternalException(ioexception);
} catch (ExceptionWorldConflict exceptionworldconflict) {
- ChunkProviderServer.a.error("Couldn't save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
+ ChunkProviderServer.a.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
+ String msg = "Couldn\'t save chunk; already in use by another instance of Minecraft?";
+ ChunkProviderServer.a.error(msg, exceptionworldconflict);
+ ServerInternalException.reportInternalException(exceptionworldconflict);
+ // Paper end
}
}
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
index 09ef8729d9..bf67dbf54a 100644 index 1dd793d2fb..61ea2818b1 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -145,8 +120,28 @@ index 09ef8729d9..bf67dbf54a 100644
} }
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 528d0f0cd2..be903252be 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -621,6 +621,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.world.checkSession();
} catch (ExceptionWorldConflict exceptionworldconflict) {
PlayerChunkMap.LOGGER.error("Couldn't save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exceptionworldconflict); // Paper
return;
}
@@ -647,6 +648,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.write(chunkcoordintpair, nbttagcompound);
} catch (Exception exception) {
PlayerChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception);
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index ab151a14d0..0f1c74dd33 100644 index d4a9af975d..88b5aa3a51 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java --- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -156,71 +151,52 @@ index ab151a14d0..0f1c74dd33 100644
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
@@ -103,6 +104,7 @@ public class RegionFile { @@ -142,6 +143,7 @@ public class RegionFile implements AutoCloseable {
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
}
}
@@ -275,6 +277,7 @@ public class RegionFile {
this.b(i, j, (int) (SystemUtils.getTimeMillis() / 1000L));
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index c5ca896919..e507a996f1 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.collect.Maps;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@@ -71,6 +72,7 @@ public class RegionFileCache {
} }
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
} }
} catch (IOException ioexception) {
+ ServerInternalException.reportInternalException(ioexception); // Paper
return null;
}
}
@@ -252,6 +254,7 @@ public class RegionFile implements AutoCloseable {
this.b(chunkcoordintpair, (int) (SystemUtils.getTimeMillis() / 1000L));
} catch (IOException ioexception) {
ioexception.printStackTrace();
+ ServerInternalException.reportInternalException(ioexception); // Paper
} }
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 6720a9648e..2aa0db5c22 100644 index 9d4febfbb6..7e58e4714a 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java --- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -10,6 +10,7 @@ import org.apache.logging.log4j.LogManager; @@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
// CraftBukkit start // CraftBukkit start
+import com.destroystokyo.paper.exception.ServerInternalException; +import com.destroystokyo.paper.exception.ServerInternalException;
import org.bukkit.craftbukkit.util.LongHash;
import org.bukkit.craftbukkit.util.LongHashSet;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
@@ -171,6 +172,7 @@ public final class SpawnerCreature { // CraftBukkit end
entityinsentient = (EntityInsentient) biomebase_biomemeta.b.a((World) worldserver);
} catch (Exception exception) {
SpawnerCreature.a.warn("Failed to create mob", exception);
+ ServerInternalException.reportInternalException(exception); // Paper
return j1;
}
@@ -291,6 +293,7 @@ public final class SpawnerCreature { @@ -83,6 +84,7 @@ public final class SpawnerCreature {
entityinsentient = (EntityInsentient) biomebase_biomemeta.b.a(generatoraccess.getMinecraftWorld()); entityinsentient = (EntityInsentient) entity;
} catch (Exception exception) {
SpawnerCreature.LOGGER.warn("Failed to create mob", exception);
+ ServerInternalException.reportInternalException(exception); // Paper
return;
}
@@ -208,6 +210,7 @@ public final class SpawnerCreature {
entity = biomebase_biomemeta.b.a(generatoraccess.getMinecraftWorld());
} catch (Exception exception) { } catch (Exception exception) {
SpawnerCreature.a.warn("Failed to create mob", exception); SpawnerCreature.LOGGER.warn("Failed to create mob", exception);
+ ServerInternalException.reportInternalException(exception); // Paper + ServerInternalException.reportInternalException(exception); // Paper
continue; continue;
} }
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 58122b18eb..0ac1fb53a4 100644 index d004494aea..d3ed749e1c 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java --- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java +++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
@ -229,80 +205,85 @@ index 58122b18eb..0ac1fb53a4 100644
+import com.destroystokyo.paper.exception.ServerInternalException; +import com.destroystokyo.paper.exception.ServerInternalException;
+ +
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -136,6 +138,7 @@ public class VillageSiege {
entityzombie.prepare(this.a.getDamageScaler(new BlockPosition(entityzombie)), (GroupDataEntity) null, (NBTTagCompound) null); @@ -98,6 +100,7 @@ public class VillageSiege {
entityzombie.prepare(this.a, this.a.getDamageScaler(new BlockPosition(entityzombie)), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null);
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper + ServerInternalException.reportInternalException(exception); // Paper
return false; return;
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 09cf98ccdd..6e7c0c9da4 100644 index 25e5216e25..55e8c7c7d4 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1,6 +1,8 @@ @@ -2,6 +2,12 @@ package net.minecraft.server;
package net.minecraft.server;
import co.aikar.timings.Timing;
import co.aikar.timings.Timings; import co.aikar.timings.Timings;
+<<<<<<< HEAD
+=======
+import com.destroystokyo.paper.event.server.ServerExceptionEvent; +import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerInternalException; +import com.destroystokyo.paper.exception.ServerInternalException;
import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects;
+>>>>>>> Add exception reporting event
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import it.unimi.dsi.fastutil.longs.LongSet; import java.io.IOException;
@@ -1151,8 +1153,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc import java.util.Collection;
} catch (Throwable throwable1) { @@ -675,8 +681,11 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
entity.tickTimer.stopTiming(); gameprofilerfiller.exit();
// Paper start - Prevent tile entity and entity crashes } catch (Throwable throwable) {
- System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ);
+ String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ;
+ System.err.println(msg);
throwable1.printStackTrace();
+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable1)));
entity.dead = true;
continue;
// Paper end
@@ -1217,8 +1221,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.methodProfiler.exit();
} catch (Throwable throwable2) {
// Paper start - Prevent tile entity and entity crashes // Paper start - Prevent tile entity and entity crashes
- System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()); - System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
+ String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ(); + String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ();
+ System.err.println(msg); + System.err.println(msg);
throwable2.printStackTrace(); throwable.printStackTrace();
+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable2))); + getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable)));
+ // Paper end
tilesThisCycle--; tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--); this.tileEntityListTick.remove(tileTickPosition--);
continue; continue;
@@ -750,8 +759,10 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
consumer.accept(entity);
} catch (Throwable throwable) {
// Paper start - Prevent tile entity and entity crashes
- System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ);
+ String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ;
+ System.err.println(msg);
throwable.printStackTrace();
+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable)));
entity.dead = true;
return;
// Paper end
diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java
index 478bf49976..8d51af2867 100644 index 3c5b3fe101..47a4ea9985 100644
--- a/src/main/java/net/minecraft/server/WorldPersistentData.java --- a/src/main/java/net/minecraft/server/WorldPersistentData.java
+++ b/src/main/java/net/minecraft/server/WorldPersistentData.java +++ b/src/main/java/net/minecraft/server/WorldPersistentData.java
@@ -138,6 +138,7 @@ public class WorldPersistentData { @@ -113,6 +113,7 @@ public class WorldPersistentData {
nbttagcompound = GameProfileSerializer.a(this.c, DataFixTypes.SAVED_DATA, nbttagcompound1, j, i);
nbttagcompound = GameProfileSerializer.a(idatamanager.i(), DataFixTypes.SAVED_DATA, nbttagcompound1, j, i); } catch (Throwable throwable4) {
} catch (Throwable throwable1) { throwable = throwable4;
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(throwable1); // Paper + com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(throwable); // Paper
throwable = throwable1; throw throwable4;
throw throwable1;
} finally { } finally {
if (pushbackinputstream != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index d75cc42e11..0e9d5fe3a7 100644 index d99634062b..86a5ee8aac 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -17,6 +17,9 @@ import java.util.function.Consumer; @@ -16,6 +16,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.logging.Level; import java.util.logging.Level;
import co.aikar.timings.MinecraftTimings; // Paper
+import com.destroystokyo.paper.ServerSchedulerReportingWrapper; +import com.destroystokyo.paper.ServerSchedulerReportingWrapper;
+import com.destroystokyo.paper.event.server.ServerExceptionEvent; +import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerSchedulerException; +import com.destroystokyo.paper.exception.ServerSchedulerException;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.plugin.IllegalPluginAccessException; import org.bukkit.plugin.IllegalPluginAccessException;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@@ -391,20 +394,26 @@ public class CraftScheduler implements BukkitScheduler { @@ -390,20 +393,26 @@ public class CraftScheduler implements BukkitScheduler {
try { try {
task.run(); task.run();
} catch (final Throwable throwable) { } catch (final Throwable throwable) {

View File

@ -1,4 +1,4 @@
From eca375524913b4560c8084481d44c4f819cdca13 Mon Sep 17 00:00:00 2001 From 4d06ddd34329ea79d1a5fde510b9f360cafb0b24 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc> From: kashike <kashike@vq.lc>
Date: Tue, 8 Mar 2016 18:28:43 -0800 Date: Tue, 8 Mar 2016 18:28:43 -0800
Subject: [PATCH] Don't nest if we don't need to when cerealising text Subject: [PATCH] Don't nest if we don't need to when cerealising text
@ -6,10 +6,10 @@ Subject: [PATCH] Don't nest if we don't need to when cerealising text
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
index 28a2628350..eba6aadad7 100644 index fa4eab5b0b..0ab611564e 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java --- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java
@@ -27,7 +27,14 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> { @@ -29,7 +29,14 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> {
public void b(PacketDataSerializer packetdataserializer) throws IOException { public void b(PacketDataSerializer packetdataserializer) throws IOException {
// Spigot start // Spigot start
if (components != null) { if (components != null) {

View File

@ -1,4 +1,4 @@
From 9ec1a2698aee9535ee3990f479b4a66dcee686cc Mon Sep 17 00:00:00 2001 From 3e23947760e0ec7eb777f34679372e128c282a02 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 8 Mar 2016 23:25:45 -0500 Date: Tue, 8 Mar 2016 23:25:45 -0500
Subject: [PATCH] Disable Scoreboards for non players by default Subject: [PATCH] Disable Scoreboards for non players by default
@ -11,10 +11,10 @@ So avoid looking up scoreboards and short circuit to the "not on a team"
logic which is most likely to be true. logic which is most likely to be true.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 40b54191e6..06417c8250 100644 index 94f5c90b3c..30f0dcfd51 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -204,4 +204,9 @@ public class PaperWorldConfig { @@ -196,4 +196,9 @@ public class PaperWorldConfig {
private void disableTeleportationSuffocationCheck() { private void disableTeleportationSuffocationCheck() {
disableTeleportationSuffocationCheck = getBoolean("disable-teleportation-suffocation-check", false); disableTeleportationSuffocationCheck = getBoolean("disable-teleportation-suffocation-check", false);
} }
@ -25,10 +25,10 @@ index 40b54191e6..06417c8250 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ad30cdd824..c7f83d4343 100644 index 49245b5c5f..9ad8893943 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2264,6 +2264,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -2188,6 +2188,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@Nullable @Nullable
public ScoreboardTeamBase getScoreboardTeam() { public ScoreboardTeamBase getScoreboardTeam() {
@ -37,15 +37,15 @@ index ad30cdd824..c7f83d4343 100644
} }
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index c5cc0b471b..0ba15fce63 100644 index d85172e728..e3613a8e67 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -538,6 +538,7 @@ public abstract class EntityLiving extends Entity { @@ -578,6 +578,7 @@ public abstract class EntityLiving extends Entity {
if (nbttagcompound.hasKeyOfType("Team", 8)) { if (nbttagcompound.hasKeyOfType("Team", 8)) {
String s = nbttagcompound.getString("Team"); String s = nbttagcompound.getString("Team");
ScoreboardTeam scoreboardteam = this.world.getScoreboard().getTeam(s); ScoreboardTeam scoreboardteam = this.world.getScoreboard().getTeam(s);
+ if (!world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { scoreboardteam = null; } // Paper + if (!world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { scoreboardteam = null; } // Paper
boolean flag = scoreboardteam != null && this.world.getScoreboard().addPlayerToTeam(this.bu(), scoreboardteam); boolean flag = scoreboardteam != null && this.world.getScoreboard().addPlayerToTeam(this.getUniqueIDString(), scoreboardteam);
if (!flag) { if (!flag) {
-- --

View File

@ -1,14 +1,14 @@
From 6ed6c06f48ff7c4a5a206dccd1ef433b8bbdd2ad Mon Sep 17 00:00:00 2001 From 36f151f93826062aa0d486731dd87c96c6ced8dc Mon Sep 17 00:00:00 2001
From: mrapple <tony@oc.tc> From: mrapple <tony@oc.tc>
Date: Sun, 25 Nov 2012 13:43:39 -0600 Date: Sun, 25 Nov 2012 13:43:39 -0600
Subject: [PATCH] Add methods for working with arrows stuck in living entities Subject: [PATCH] Add methods for working with arrows stuck in living entities
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 5f14fb8501..716eda9902 100644 index defcfc9337..424b2b7088 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -537,4 +537,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -538,4 +538,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public boolean isCollidable() { public boolean isCollidable() {
return getHandle().collides; return getHandle().collides;
} }

View File

@ -1,14 +1,14 @@
From ced6f93ab463262802669d48ad20f64237f9cf3e Mon Sep 17 00:00:00 2001 From a48383fd414daf754066154d927930852400201e Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com> From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 4 Apr 2015 23:17:52 -0400 Date: Sat, 4 Apr 2015 23:17:52 -0400
Subject: [PATCH] Complete resource pack API Subject: [PATCH] Complete resource pack API
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 9a83e5fc0b..8a403354d9 100644 index 9d7bbafe02..e83ebaf4f4 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1302,7 +1302,11 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -1344,7 +1344,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
// CraftBukkit start // CraftBukkit start
public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) { public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {
PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.getWorldServer());
@ -22,10 +22,10 @@ index 9a83e5fc0b..8a403354d9 100644
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 237210cc89..5b9f2dd4a6 100644 index b993d236b5..326200fd58 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -126,6 +126,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -131,6 +131,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private double health = 20; private double health = 20;
private boolean scaledHealth = false; private boolean scaledHealth = false;
private double healthScale = 20; private double healthScale = 20;
@ -36,7 +36,7 @@ index 237210cc89..5b9f2dd4a6 100644
public CraftPlayer(CraftServer server, EntityPlayer entity) { public CraftPlayer(CraftServer server, EntityPlayer entity) {
super(server, entity); super(server, entity);
@@ -1737,6 +1741,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1753,6 +1757,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().server.getCommandDispatcher().a(getHandle()); getHandle().server.getCommandDispatcher().a(getHandle());
} }

View File

@ -1,4 +1,4 @@
From c1b75aa5e3a7cdc24024773406bb873d6e33943f Mon Sep 17 00:00:00 2001 From dfe7064ed97f2a3c987416aea3c613aea3fc8a7a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 4 Mar 2013 23:46:10 -0500 Date: Mon, 4 Mar 2013 23:46:10 -0500
Subject: [PATCH] Chunk Save Reattempt Subject: [PATCH] Chunk Save Reattempt
@ -6,12 +6,12 @@ Subject: [PATCH] Chunk Save Reattempt
We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks. We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks.
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 0f1c74dd33..9626396745 100644 index 88b5aa3a51..b062a31c49 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java --- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -276,8 +276,7 @@ public class RegionFile { @@ -253,8 +253,7 @@ public class RegionFile implements AutoCloseable {
this.b(i, j, (int) (SystemUtils.getTimeMillis() / 1000L)); this.b(chunkcoordintpair, (int) (SystemUtils.getTimeMillis() / 1000L));
} catch (IOException ioexception) { } catch (IOException ioexception) {
- ioexception.printStackTrace(); - ioexception.printStackTrace();
- ServerInternalException.reportInternalException(ioexception); // Paper - ServerInternalException.reportInternalException(ioexception); // Paper
@ -20,39 +20,33 @@ index 0f1c74dd33..9626396745 100644
} }
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index e507a996f1..5dbd1d517a 100644 index ad76ed27dc..75731c9195 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java --- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -95,11 +95,29 @@ public class RegionFileCache { @@ -79,6 +79,7 @@ public abstract class RegionFileCache implements AutoCloseable {
}
@Nullable protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException {
public static synchronized void write(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException {
+ int attempts = 0; Exception laste = null; while (attempts++ < 5) { try { // Paper + int attempts = 0; Exception laste = null; while (attempts++ < 5) { try { // Paper
RegionFile regionfile = a(file, i, j); RegionFile regionfile = this.a(chunkcoordintpair, false); // CraftBukkit
DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair);
Throwable throwable = null;
@@ -103,6 +104,15 @@ public abstract class RegionFileCache implements AutoCloseable {
DataOutputStream dataoutputstream = regionfile.c(i & 31, j & 31); }
NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream);
dataoutputstream.close(); + } catch (Exception ex) {
+ // Paper start + laste = ex;
+ laste = null; break; // Paper
+ } catch (Exception exception) {
+ //ChunkRegionLoader.a.error("Failed to save chunk", exception); // Paper
+ laste = exception; // Paper
+ }
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ } + }
+ }
+
+ if (laste != null) { + if (laste != null) {
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(laste); + com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(laste);
+ MinecraftServer.LOGGER.error("Failed to save chunk", laste); + MinecraftServer.LOGGER.error("Failed to save chunk", laste);
+ } + }
+ // Paper end
} }
public static synchronized boolean chunkExists(File file, int i, int j) { public void close() throws IOException {
-- --
2.21.0 2.21.0

View File

@ -1,4 +1,4 @@
From 7272a07d2a6c2b85366e6b9d769a3ae244a5f1d4 Mon Sep 17 00:00:00 2001 From fe3c0cae53d542ce74b4ef691996f63f62e36a90 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 13:17:38 -0400 Date: Fri, 18 Mar 2016 13:17:38 -0400
Subject: [PATCH] Default loading permissions.yml before plugins Subject: [PATCH] Default loading permissions.yml before plugins
@ -16,12 +16,12 @@ modify that. Under the previous logic, plugins were unable (cleanly) override pe
A config option has been added for those who depend on the previous behavior, but I don't expect that. A config option has been added for those who depend on the previous behavior, but I don't expect that.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 4e932ea235..e4ba7146d1 100644 index 7691409f6c..809b3a1a4a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -223,4 +223,9 @@ public class PaperConfig { @@ -210,4 +210,9 @@ public class PaperConfig {
enableFileIOThreadSleep = getBoolean("settings.sleep-between-chunk-saves", false); " - Interval: " + timeSummary(Timings.getHistoryInterval() / 20) +
if (enableFileIOThreadSleep) Bukkit.getLogger().info("Enabled sleeping between chunk saves, beware of memory issues"); " - Length: " + timeSummary(Timings.getHistoryLength() / 20));
} }
+ +
+ public static boolean loadPermsBeforePlugins = true; + public static boolean loadPermsBeforePlugins = true;
@ -30,10 +30,10 @@ index 4e932ea235..e4ba7146d1 100644
+ } + }
} }
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 54864fe761..6f2d74cf1c 100644 index 01d5a49cf7..b2861fd0ba 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
@@ -342,6 +342,7 @@ public final class CraftServer implements Server { @@ -364,6 +364,7 @@ public final class CraftServer implements Server {
if (type == PluginLoadOrder.STARTUP) { if (type == PluginLoadOrder.STARTUP) {
helpMap.clear(); helpMap.clear();
helpMap.initializeGeneralTopics(); helpMap.initializeGeneralTopics();
@ -41,7 +41,7 @@ index 54864fe761..6f2d74cf1c 100644
} }
Plugin[] plugins = pluginManager.getPlugins(); Plugin[] plugins = pluginManager.getPlugins();
@@ -361,7 +362,7 @@ public final class CraftServer implements Server { @@ -383,7 +384,7 @@ public final class CraftServer implements Server {
commandMap.registerServerAliases(); commandMap.registerServerAliases();
DefaultPermissions.registerCorePermissions(); DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions();

View File

@ -1,4 +1,4 @@
From d4818b38c5161ad66b8d3ffc6c3e38a8a22d40e4 Mon Sep 17 00:00:00 2001 From eee12efdff4e2f32f84f028a95839c0da8018e70 Mon Sep 17 00:00:00 2001
From: William <admin@domnian.com> From: William <admin@domnian.com>
Date: Fri, 18 Mar 2016 03:30:17 -0400 Date: Fri, 18 Mar 2016 03:30:17 -0400
Subject: [PATCH] Allow Reloading of Custom Permissions Subject: [PATCH] Allow Reloading of Custom Permissions
@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Custom Permissions
https://github.com/PaperMC/Paper/issues/49 https://github.com/PaperMC/Paper/issues/49
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 6f2d74cf1c..c291bceedd 100644 index b2861fd0ba..591d3702b5 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
@@ -2093,5 +2093,23 @@ public final class CraftServer implements Server { @@ -2029,5 +2029,23 @@ public final class CraftServer implements Server {
return false; return false;
} }
} }

View File

@ -1,4 +1,4 @@
From 2fab64d6e4e209edbcfc14e8c325890bfa935caf Mon Sep 17 00:00:00 2001 From 616a1b27492ade45ede12846a3777483571eade3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 13:50:14 -0400 Date: Fri, 18 Mar 2016 13:50:14 -0400
Subject: [PATCH] Remove Metadata on reload Subject: [PATCH] Remove Metadata on reload
@ -7,10 +7,10 @@ Metadata is not meant to persist reload as things break badly with non primitive
This will remove metadata on reload so it does not crash everything if a plugin uses it. This will remove metadata on reload so it does not crash everything if a plugin uses it.
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 c291bceedd..5e821b84d6 100644 index 591d3702b5..cf9594ea2b 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
@@ -799,8 +799,18 @@ public final class CraftServer implements Server { @@ -795,8 +795,18 @@ public final class CraftServer implements Server {
world.paperConfig.init(); // Paper world.paperConfig.init(); // Paper
} }

View File

@ -1,4 +1,4 @@
From 5c09f39b2cf1a6c4c976c3902ac4ed220e99b893 Mon Sep 17 00:00:00 2001 From 989e29da01a1fe8a5673b645ea326833b94d7391 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 14:19:19 -0400 Date: Fri, 18 Mar 2016 14:19:19 -0400
Subject: [PATCH] Undead horse leashing Subject: [PATCH] Undead horse leashing
@ -6,10 +6,10 @@ Subject: [PATCH] Undead horse leashing
default false to match vanilla, but option to allow undead horse types to be leashed. default false to match vanilla, but option to allow undead horse types to be leashed.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 06417c8250..66243835a5 100644 index 30f0dcfd51..89556dc94a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -209,4 +209,9 @@ public class PaperWorldConfig { @@ -201,4 +201,9 @@ public class PaperWorldConfig {
private void nonPlayerEntitiesOnScoreboards() { private void nonPlayerEntitiesOnScoreboards() {
nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false); nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false);
} }
@ -20,18 +20,18 @@ index 06417c8250..66243835a5 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java
index fc89cc89a4..953277631a 100644 index e9f34c9307..8ce2fca806 100644
--- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java --- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java +++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java
@@ -113,7 +113,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven @@ -107,7 +107,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven
}
@Override
public boolean a(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
- return super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD; - return super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD;
+ return world.paperConfig.allowLeashingUndeadHorse ? super.a(entityhuman) : super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD; // Paper + return world.paperConfig.allowLeashingUndeadHorse ? super.a(entityhuman) : super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD; // Paper
} }
protected void u(float f) { @Override
-- --
2.21.0 2.21.0

View File

@ -1,4 +1,4 @@
From 08653afb00866b63ce45e73d12eac4be100fe9f9 Mon Sep 17 00:00:00 2001 From 254ea00cb305b0db306aafaf25b383c0e3b83fb4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 28 May 2015 23:00:19 -0400 Date: Thu, 28 May 2015 23:00:19 -0400
Subject: [PATCH] Handle Item Meta Inconsistencies Subject: [PATCH] Handle Item Meta Inconsistencies
@ -18,7 +18,7 @@ For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's. ItemMeta API equivalents, and should deprecate the old API's.
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index a7fc148591..37d37f1f64 100644 index aa6a58dd88..b643a41235 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java --- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -7,6 +7,8 @@ import com.mojang.brigadier.StringReader; @@ -7,6 +7,8 @@ import com.mojang.brigadier.StringReader;
@ -30,7 +30,7 @@ index a7fc148591..37d37f1f64 100644
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import java.util.Random; import java.util.Random;
@@ -65,6 +67,22 @@ public final class ItemStack { @@ -66,6 +68,22 @@ public final class ItemStack {
decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT));
return decimalformat; return decimalformat;
} }
@ -53,7 +53,7 @@ index a7fc148591..37d37f1f64 100644
public ItemStack(IMaterial imaterial) { public ItemStack(IMaterial imaterial) {
this(imaterial, 1); this(imaterial, 1);
@@ -107,6 +125,7 @@ public final class ItemStack { @@ -100,6 +118,7 @@ public final class ItemStack {
if (nbttagcompound.hasKeyOfType("tag", 10)) { if (nbttagcompound.hasKeyOfType("tag", 10)) {
// CraftBukkit start - make defensive copy as this data may be coming from the save thread // CraftBukkit start - make defensive copy as this data may be coming from the save thread
this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone(); this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone();
@ -61,7 +61,7 @@ index a7fc148591..37d37f1f64 100644
this.getItem().a(this.tag); this.getItem().a(this.tag);
// CraftBukkit end // CraftBukkit end
} }
@@ -612,6 +631,7 @@ public final class ItemStack { @@ -613,6 +632,7 @@ public final class ItemStack {
// Paper end // Paper end
public void setTag(@Nullable NBTTagCompound nbttagcompound) { public void setTag(@Nullable NBTTagCompound nbttagcompound) {
this.tag = nbttagcompound; this.tag = nbttagcompound;
@ -69,27 +69,19 @@ index a7fc148591..37d37f1f64 100644
} }
public IChatBaseComponent getName() { public IChatBaseComponent getName() {
@@ -688,6 +708,7 @@ public final class ItemStack { @@ -689,6 +709,7 @@ public final class ItemStack {
nbttagcompound.setString("id", String.valueOf(IRegistry.ENCHANTMENT.getKey(enchantment))); nbttagcompound.setString("id", String.valueOf(IRegistry.ENCHANTMENT.getKey(enchantment)));
nbttagcompound.setShort("lvl", (short) ((byte) i)); nbttagcompound.setShort("lvl", (short) ((byte) i));
nbttaglist.add((NBTBase) nbttagcompound); nbttaglist.add(nbttagcompound);
+ processEnchantOrder(nbttagcompound); // Paper + processEnchantOrder(nbttagcompound); // Paper
} }
public boolean hasEnchantments() { public boolean hasEnchantments() {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index f907d4f3b7..eeb2c5689e 100644 index 9ed7f8ede4..6c00ca7378 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -4,6 +4,7 @@ import static org.bukkit.craftbukkit.inventory.CraftMetaItem.ENCHANTMENTS; @@ -178,28 +178,11 @@ public final class CraftItemStack extends ItemStack {
import static org.bukkit.craftbukkit.inventory.CraftMetaItem.ENCHANTMENTS_ID;
import static org.bukkit.craftbukkit.inventory.CraftMetaItem.ENCHANTMENTS_LVL;
+import java.util.Iterator;
import java.util.Map;
import net.minecraft.server.EnchantmentManager;
@@ -187,28 +188,11 @@ public final class CraftItemStack extends ItemStack {
public void addUnsafeEnchantment(Enchantment ench, int level) { public void addUnsafeEnchantment(Enchantment ench, int level) {
Validate.notNull(ench, "Cannot add null enchantment"); Validate.notNull(ench, "Cannot add null enchantment");
@ -123,7 +115,7 @@ index f907d4f3b7..eeb2c5689e 100644
} }
static boolean makeTag(net.minecraft.server.ItemStack item) { static boolean makeTag(net.minecraft.server.ItemStack item) {
@@ -225,66 +209,32 @@ public final class CraftItemStack extends ItemStack { @@ -216,66 +199,32 @@ public final class CraftItemStack extends ItemStack {
@Override @Override
public boolean containsEnchantment(Enchantment ench) { public boolean containsEnchantment(Enchantment ench) {
@ -201,43 +193,43 @@ index f907d4f3b7..eeb2c5689e 100644
static Map<Enchantment, Integer> getEnchantments(net.minecraft.server.ItemStack item) { static Map<Enchantment, Integer> getEnchantments(net.minecraft.server.ItemStack item) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index ef6437f380..2508cfcfa2 100644 index e3ca978f89..b3f8249b06 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -8,6 +8,7 @@ import java.lang.reflect.Constructor; @@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.lang.reflect.InvocationTargetException; import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
+import java.util.Comparator; import java.util.EnumSet;
+import java.util.Comparator; // Paper
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.LinkedHashMap;
@@ -24,6 +25,7 @@ import com.google.common.collect.SetMultimap; @@ -32,6 +33,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
+import java.util.TreeMap; // Paper
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
@@ -41,6 +43,7 @@ import net.minecraft.server.EnumChatFormat;
import net.minecraft.server.EnumItemSlot; import net.minecraft.server.EnumItemSlot;
import net.minecraft.server.GenericAttributes; import net.minecraft.server.GenericAttributes;
import net.minecraft.server.IChatBaseComponent; import net.minecraft.server.IChatBaseComponent;
+import com.google.common.collect.ImmutableSortedMap; +import com.google.common.collect.ImmutableSortedMap; // Paper
import net.minecraft.server.NBTBase; import net.minecraft.server.NBTBase;
import net.minecraft.server.NBTCompressedStreamTools;
import net.minecraft.server.NBTTagCompound; import net.minecraft.server.NBTTagCompound;
import net.minecraft.server.NBTTagList; @@ -263,7 +266,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -66,6 +68,7 @@ import java.util.Arrays; private List<IChatBaseComponent> lore;
import java.util.EnumSet; private Integer customModelData;
import java.util.LinkedHashMap; private String blockData;
import java.util.Set;
+import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.EnumChatFormat;
@@ -257,7 +260,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable {
private IChatBaseComponent displayName;
private IChatBaseComponent locName;
private List<String> lore;
- private Map<Enchantment, Integer> enchantments; - private Map<Enchantment, Integer> enchantments;
+ private EnchantmentMap enchantments; // Paper + private EnchantmentMap enchantments; // Paper
private Multimap<Attribute, AttributeModifier> attributeModifiers; private Multimap<Attribute, AttributeModifier> attributeModifiers;
private int repairCost; private int repairCost;
private int hideFlag; private int hideFlag;
@@ -268,7 +271,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -274,7 +277,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
private static final CraftCustomTagTypeRegistry TAG_TYPE_REGISTRY = new CraftCustomTagTypeRegistry(); private static final CraftCustomTagTypeRegistry TAG_TYPE_REGISTRY = new CraftCustomTagTypeRegistry();
private NBTTagCompound internalTag; private NBTTagCompound internalTag;
@ -245,9 +237,9 @@ index ef6437f380..2508cfcfa2 100644
+ private final Map<String, NBTBase> unhandledTags = new TreeMap<>(); // Paper + private final Map<String, NBTBase> unhandledTags = new TreeMap<>(); // Paper
private final CraftCustomItemTagContainer publicItemTagContainer = new CraftCustomItemTagContainer(TAG_TYPE_REGISTRY); private final CraftCustomItemTagContainer publicItemTagContainer = new CraftCustomItemTagContainer(TAG_TYPE_REGISTRY);
CraftMetaItem(CraftMetaItem meta) { private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only
@@ -284,7 +287,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -295,7 +298,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
} this.blockData = meta.blockData;
if (meta.enchantments != null) { // Spigot if (meta.enchantments != null) { // Spigot
- this.enchantments = new LinkedHashMap<Enchantment, Integer>(meta.enchantments); - this.enchantments = new LinkedHashMap<Enchantment, Integer>(meta.enchantments);
@ -255,7 +247,7 @@ index ef6437f380..2508cfcfa2 100644
} }
if (meta.hasAttributeModifiers()) { if (meta.hasAttributeModifiers()) {
@@ -367,13 +370,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -391,13 +394,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
} }
} }
@ -271,7 +263,7 @@ index ef6437f380..2508cfcfa2 100644
for (int i = 0; i < ench.size(); i++) { for (int i = 0; i < ench.size(); i++) {
String id = ((NBTTagCompound) ench.get(i)).getString(ENCHANTMENTS_ID.NBT); String id = ((NBTTagCompound) ench.get(i)).getString(ENCHANTMENTS_ID.NBT);
@@ -515,13 +518,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -549,13 +552,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
} }
} }
@ -287,7 +279,7 @@ index ef6437f380..2508cfcfa2 100644
for (Map.Entry<?, ?> entry : ench.entrySet()) { for (Map.Entry<?, ?> entry : ench.entrySet()) {
// Doctor older enchants // Doctor older enchants
String enchantKey = entry.getKey().toString(); String enchantKey = entry.getKey().toString();
@@ -756,13 +759,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -798,13 +801,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
} }
public Map<Enchantment, Integer> getEnchants() { public Map<Enchantment, Integer> getEnchants() {
@ -303,16 +295,16 @@ index ef6437f380..2508cfcfa2 100644
} }
if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) { if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) {
@@ -1089,7 +1092,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -1170,7 +1173,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
clone.lore = new ArrayList<String>(this.lore); clone.customModelData = this.customModelData;
} clone.blockData = this.blockData;
if (this.enchantments != null) { if (this.enchantments != null) {
- clone.enchantments = new LinkedHashMap<Enchantment, Integer>(this.enchantments); - clone.enchantments = new LinkedHashMap<Enchantment, Integer>(this.enchantments);
+ clone.enchantments = new EnchantmentMap(this.enchantments); // Paper + clone.enchantments = new EnchantmentMap(this.enchantments); // Paper
} }
if (this.hasAttributeModifiers()) { if (this.hasAttributeModifiers()) {
clone.attributeModifiers = HashMultimap.create(this.attributeModifiers); clone.attributeModifiers = HashMultimap.create(this.attributeModifiers);
@@ -1295,6 +1298,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @@ -1395,6 +1398,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
} }
} }

View File

@ -1,4 +1,4 @@
From 95f17033a7ed30132e1486f3b5b456dfe42e24cb Mon Sep 17 00:00:00 2001 From cf9d4765f9a0d62dc30e80f49f03bdc67c590c8c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 15:12:22 -0400 Date: Fri, 18 Mar 2016 15:12:22 -0400
Subject: [PATCH] Configurable Non Player Arrow Despawn Rate Subject: [PATCH] Configurable Non Player Arrow Despawn Rate
@ -6,10 +6,10 @@ Subject: [PATCH] Configurable Non Player Arrow Despawn Rate
Can set a much shorter despawn rate for arrows that players can not pick up. Can set a much shorter despawn rate for arrows that players can not pick up.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 66243835a5..803e680894 100644 index 89556dc94a..98049567f4 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -214,4 +214,19 @@ public class PaperWorldConfig { @@ -206,4 +206,19 @@ public class PaperWorldConfig {
private void allowLeashingUndeadHorse() { private void allowLeashingUndeadHorse() {
allowLeashingUndeadHorse = getBoolean("allow-leashing-undead-horse", false); allowLeashingUndeadHorse = getBoolean("allow-leashing-undead-horse", false);
} }
@ -30,12 +30,12 @@ index 66243835a5..803e680894 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index e8ce99eb96..feafb82dd3 100644 index bc391812d3..b5b569ef95 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java --- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -261,7 +261,7 @@ public abstract class EntityArrow extends Entity implements IProjectile { @@ -263,7 +263,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
protected void f() { protected void i() {
++this.despawnCounter; ++this.despawnCounter;
- if (this.despawnCounter >= world.spigotConfig.arrowDespawnRate) { // Spigot - if (this.despawnCounter >= world.spigotConfig.arrowDespawnRate) { // Spigot
+ if (this.despawnCounter >= (fromPlayer == PickupStatus.CREATIVE_ONLY ? world.paperConfig.creativeArrowDespawnRate : (fromPlayer == PickupStatus.DISALLOWED ? world.paperConfig.nonPlayerArrowDespawnRate : world.spigotConfig.arrowDespawnRate))) { // Spigot // Paper + if (this.despawnCounter >= (fromPlayer == PickupStatus.CREATIVE_ONLY ? world.paperConfig.creativeArrowDespawnRate : (fromPlayer == PickupStatus.DISALLOWED ? world.paperConfig.nonPlayerArrowDespawnRate : world.spigotConfig.arrowDespawnRate))) { // Spigot // Paper

View File

@ -1,4 +1,4 @@
From b1d5dfc632f2a84e5332754114d2a2ba0a866578 Mon Sep 17 00:00:00 2001 From 87bc4fe3532a93119223040e6cc70d3fc4f93303 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 20:16:03 -0400 Date: Fri, 18 Mar 2016 20:16:03 -0400
Subject: [PATCH] Add World Util Methods Subject: [PATCH] Add World Util Methods
@ -6,22 +6,22 @@ Subject: [PATCH] Add World Util Methods
Methods that can be used for other patches to help improve logic. Methods that can be used for other patches to help improve logic.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 67cd4af4f5..3f9de7e55a 100644 index c4103680d4..9433d04f43 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -637,6 +637,7 @@ public class Chunk implements IChunkAccess { @@ -388,6 +388,7 @@ public class Chunk implements IChunkAccess {
} return this.world.getChunkProvider().getLightEngine();
} }
+ public final int getLightSubtracted(BlockPosition blockposition, int i) { return this.a(blockposition, i); } // Paper - OBFHELPER + public final int getLightSubtracted(BlockPosition blockposition, int i) { return this.a(blockposition, i); } // Paper - OBFHELPER
public int a(BlockPosition blockposition, int i) { public int a(BlockPosition blockposition, int i) {
return this.a(blockposition, i, this.world.o().g()); return this.a(blockposition, i, this.world.getWorldProvider().g());
} }
diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java
index 646c5a91b8..554825ec1f 100644 index bac6c9d65b..0930552b1f 100644
--- a/src/main/java/net/minecraft/server/IWorldReader.java --- a/src/main/java/net/minecraft/server/IWorldReader.java
+++ b/src/main/java/net/minecraft/server/IWorldReader.java +++ b/src/main/java/net/minecraft/server/IWorldReader.java
@@ -38,6 +38,22 @@ public interface IWorldReader extends IBlockAccess { @@ -36,6 +36,22 @@ public interface IWorldReader extends IIBlockAccess {
} }
int getLightLevel(BlockPosition blockposition, int i); int getLightLevel(BlockPosition blockposition, int i);
@ -42,23 +42,23 @@ index 646c5a91b8..554825ec1f 100644
+ } + }
+ // Paper end + // Paper end
boolean isChunkLoaded(int i, int j, boolean flag); @Nullable
IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 6e7c0c9da4..fd45090685 100644 index 55e8c7c7d4..e8831e2a40 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -79,7 +79,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc @@ -49,7 +49,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
public final List<Entity> k = Lists.newArrayList(); protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); // Paper
protected final IntHashMap<Entity> entitiesById = new IntHashMap<>(); private final long b = 16777215L;
private final long F = 16777215L; private final Thread c;
- private int G; - private int d;
+ private int G; public int getSkylightSubtracted() { return this.G; } public void setSkylightSubtracted(int value) { this.G = value;} // Paper - OBFHELPER + private int d; public int getSkylightSubtracted() { return this.d; } public void setSkylightSubtracted(int value) { this.d = value;} // Paper - OBFHELPER
protected int m = (new Random()).nextInt(); protected int j = (new Random()).nextInt();
protected final int n = 1013904223; protected final int k = 1013904223;
protected float o; protected float l;
@@ -268,6 +268,83 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc @@ -211,6 +211,83 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
return this.getType(blockposition).isAir(); return i < 0 || i >= 256;
} }
+ // Paper start + // Paper start

View File

@ -1,14 +1,14 @@
From c48af2c45b56bb77f6f7d8ff7286e3edb2100c71 Mon Sep 17 00:00:00 2001 From 0ef7232e104adf85bbf7fd538240d57576a5f9ec Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com> From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sun, 21 Jun 2015 15:07:20 -0400 Date: Sun, 21 Jun 2015 15:07:20 -0400
Subject: [PATCH] Custom replacement for eaten items Subject: [PATCH] Custom replacement for eaten items
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 0ba15fce63..a12cc1e92f 100644 index e3613a8e67..44570edcae 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2600,12 +2600,13 @@ public abstract class EntityLiving extends Entity { @@ -2811,12 +2811,13 @@ public abstract class EntityLiving extends Entity {
protected void q() { protected void q() {
if (!this.activeItem.isEmpty() && this.isHandRaised()) { if (!this.activeItem.isEmpty() && this.isHandRaised()) {
@ -23,7 +23,7 @@ index 0ba15fce63..a12cc1e92f 100644
world.getServer().getPluginManager().callEvent(event); world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@@ -2620,9 +2621,20 @@ public abstract class EntityLiving extends Entity { @@ -2831,9 +2832,20 @@ public abstract class EntityLiving extends Entity {
itemstack = this.activeItem.a(this.world, this); itemstack = this.activeItem.a(this.world, this);
} }
@ -33,9 +33,9 @@ index 0ba15fce63..a12cc1e92f 100644
+ itemstack = CraftItemStack.asNMSCopy(event.getReplacement()); + itemstack = CraftItemStack.asNMSCopy(event.getReplacement());
+ } + }
+ // Paper end + // Paper end
this.a(this.cU(), itemstack); this.a(this.getRaisedHand(), itemstack);
// CraftBukkit end // CraftBukkit end
this.da(); this.dp();
+ // Paper start - if the replacement is anything but the default, update the client inventory + // Paper start - if the replacement is anything but the default, update the client inventory
+ if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) { + if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) {
+ ((EntityPlayer) this).getBukkitEntity().updateInventory(); + ((EntityPlayer) this).getBukkitEntity().updateInventory();

View File

@ -1,16 +1,16 @@
From 36bbdf4c9c7c6b8cb7e51c4bb264c0d041c0ca62 Mon Sep 17 00:00:00 2001 From 464d72e32ae10b3fe24c1191eb13cabde58a3872 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 27 Sep 2015 01:18:02 -0400 Date: Sun, 27 Sep 2015 01:18:02 -0400
Subject: [PATCH] handle NaN health/absorb values and repair bad data Subject: [PATCH] handle NaN health/absorb values and repair bad data
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index a12cc1e92f..2454083b2d 100644 index 44570edcae..5ae7014887 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -499,7 +499,13 @@ public abstract class EntityLiving extends Entity { @@ -539,7 +539,13 @@ public abstract class EntityLiving extends Entity {
}
@Override
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
- this.setAbsorptionHearts(nbttagcompound.getFloat("AbsorptionAmount")); - this.setAbsorptionHearts(nbttagcompound.getFloat("AbsorptionAmount"));
+ // Paper start - jvm keeps optimizing the setter + // Paper start - jvm keeps optimizing the setter
@ -23,7 +23,7 @@ index a12cc1e92f..2454083b2d 100644
if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isClientSide) { if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isClientSide) {
GenericAttributes.a(this.getAttributeMap(), nbttagcompound.getList("Attributes", 10)); GenericAttributes.a(this.getAttributeMap(), nbttagcompound.getList("Attributes", 10));
} }
@@ -891,6 +897,10 @@ public abstract class EntityLiving extends Entity { @@ -984,6 +990,10 @@ public abstract class EntityLiving extends Entity {
} }
public void setHealth(float f) { public void setHealth(float f) {
@ -34,7 +34,7 @@ index a12cc1e92f..2454083b2d 100644
// CraftBukkit start - Handle scaled health // CraftBukkit start - Handle scaled health
if (this instanceof EntityPlayer) { if (this instanceof EntityPlayer) {
org.bukkit.craftbukkit.entity.CraftPlayer player = ((EntityPlayer) this).getBukkitEntity(); org.bukkit.craftbukkit.entity.CraftPlayer player = ((EntityPlayer) this).getBukkitEntity();
@@ -2465,7 +2475,7 @@ public abstract class EntityLiving extends Entity { @@ -2669,7 +2679,7 @@ public abstract class EntityLiving extends Entity {
} }
public void setAbsorptionHearts(float f) { public void setAbsorptionHearts(float f) {
@ -44,10 +44,10 @@ index a12cc1e92f..2454083b2d 100644
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5b9f2dd4a6..d0f8ad0b69 100644 index 326200fd58..e866480f04 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1537,6 +1537,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1563,6 +1563,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void setRealHealth(double health) { public void setRealHealth(double health) {

View File

@ -1,4 +1,4 @@
From 86123fbf9b9faa759b1e7434b45c4989462fbe53 Mon Sep 17 00:00:00 2001 From 39bc4d6e5b8c9f20b00e7b94737aa73615d0c13a Mon Sep 17 00:00:00 2001
From: Gabscap <git@gabscap.de> From: Gabscap <git@gabscap.de>
Date: Sat, 19 Mar 2016 22:25:11 +0100 Date: Sat, 19 Mar 2016 22:25:11 +0100
Subject: [PATCH] Waving banner workaround Subject: [PATCH] Waving banner workaround
@ -6,7 +6,7 @@ Subject: [PATCH] Waving banner workaround
This patch is a workaround for MC-63720 This patch is a workaround for MC-63720
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java
index c5c3f40ce0..6413f76e78 100644 index 88c3d7efaf..15af5927f3 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java --- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java
@@ -4,7 +4,13 @@ import java.io.IOException; @@ -4,7 +4,13 @@ import java.io.IOException;
@ -32,7 +32,7 @@ index c5c3f40ce0..6413f76e78 100644
+ // Paper end + // Paper end
} }
public void a(PacketDataSerializer packetdataserializer) throws IOException { @Override
-- --
2.21.0 2.21.0

View File

@ -1,4 +1,4 @@
From be2cfdf1b97735d405aa7f13d4507e4c9f4fbd29 Mon Sep 17 00:00:00 2001 From da7e2198ebbb80405295fbe12e64addb0c7de6bc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 22 Mar 2016 00:33:47 -0400 Date: Tue, 22 Mar 2016 00:33:47 -0400
Subject: [PATCH] Use a Shared Random for Entities Subject: [PATCH] Use a Shared Random for Entities
@ -6,10 +6,10 @@ Subject: [PATCH] Use a Shared Random for Entities
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created. Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index c7f83d4343..cbbb243d1c 100644 index 9ad8893943..5744760acc 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -49,6 +49,20 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -51,6 +51,20 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
// CraftBukkit start // CraftBukkit start
private static final int CURRENT_LEVEL = 2; private static final int CURRENT_LEVEL = 2;
@ -31,9 +31,9 @@ index c7f83d4343..cbbb243d1c 100644
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
} }
@@ -182,7 +196,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -182,7 +196,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.length = 1.8F; this.B = Vec3D.a;
this.aA = 1.0F; this.av = 1.0F;
this.aB = 1.0F; this.aw = 1.0F;
- this.random = new Random(); - this.random = new Random();
+ this.random = SHARED_RANDOM; // Paper + this.random = SHARED_RANDOM; // Paper
this.fireTicks = -this.getMaxFireTicks(); this.fireTicks = -this.getMaxFireTicks();

View File

@ -1,14 +1,14 @@
From e1625b6c8dfcb3cb82f0e3a14397ce35eb32d94d Mon Sep 17 00:00:00 2001 From 5b49cb442c080f47eacf6e695ab324164edda124 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 22 Mar 2016 12:04:28 -0500 Date: Tue, 22 Mar 2016 12:04:28 -0500
Subject: [PATCH] Configurable spawn chances for skeleton horses Subject: [PATCH] Configurable spawn chances for skeleton horses
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 803e680894..be380ac75e 100644 index 98049567f4..2a71381dae 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -229,4 +229,12 @@ public class PaperWorldConfig { @@ -221,4 +221,12 @@ public class PaperWorldConfig {
log("Non Player Arrow Despawn Rate: " + nonPlayerArrowDespawnRate); log("Non Player Arrow Despawn Rate: " + nonPlayerArrowDespawnRate);
log("Creative Arrow Despawn Rate: " + creativeArrowDespawnRate); log("Creative Arrow Despawn Rate: " + creativeArrowDespawnRate);
} }
@ -22,18 +22,18 @@ index 803e680894..be380ac75e 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index ed6f3afcfe..aaeb888a8c 100644 index e176c63fed..9a4a558467 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -480,7 +480,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { @@ -397,7 +397,7 @@ public class WorldServer extends World {
blockposition = this.a(new BlockPosition(j + (l & 15), 0, k + (l >> 8 & 15))); blockposition = this.a(this.a(j, 0, k, 15));
if (this.isRainingAt(blockposition)) { if (this.isRainingAt(blockposition)) {
DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition); DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition);
- boolean flag2 = this.getGameRules().getBoolean("doMobSpawning") && this.random.nextDouble() < (double) difficultydamagescaler.b() * 0.01D; - boolean flag1 = this.getGameRules().getBoolean("doMobSpawning") && this.random.nextDouble() < (double) difficultydamagescaler.b() * 0.01D;
+ boolean flag2 = this.getGameRules().getBoolean("doMobSpawning") && this.random.nextDouble() < (double) difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance; // Paper + boolean flag1 = this.getGameRules().getBoolean("doMobSpawning") && this.random.nextDouble() < (double) difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance; // Paper;
if (flag2) { if (flag1) {
EntityHorseSkeleton entityhorseskeleton = new EntityHorseSkeleton(this); EntityHorseSkeleton entityhorseskeleton = (EntityHorseSkeleton) EntityTypes.SKELETON_HORSE.a((World) this);
-- --
2.21.0 2.21.0