Compare commits

...

71 commits

Author SHA1 Message Date
sulu5890
e39995d213
Update Log4J (1.12.2) (#7154)
* Update Log4j

* update log4j (again)
2021-12-19 16:10:22 -08:00
Zach Brown
77cce8236f
Backport map maker workflow fix for #2221 2019-07-14 13:37:14 -05:00
kashike
33d42c8e7d
Merge pull request #2264 from Spottedleaf/fix-logging2
Queue log events when log buffer is full
2019-06-29 21:09:27 -07:00
Spottedleaf
0626875a59 Queue log events when log buffer is full
This should resolve out of order logs when the buffer is full
2019-06-29 21:00:16 -07:00
Spottedleaf
cf582da30c Anti-Xray improvements (#2226) 2019-06-24 07:58:10 -05:00
Zach Brown
f59f630b7b
Backport some fixes from newer versions
MC-114618 EntityAreaEffectCloud negative size fix
Option to prevent players from moving into unloaded chunks

Fixes GH-2114
2019-06-02 21:44:15 -05:00
Shane Freeder
8f7f4cfb3c Don't drop items into the world if BlockPlaceEvent is cancelled (Fixes #1970) 2019-04-14 21:05:41 +01:00
Zach Brown
b8c184a4d9
Backport changes to deprecated CustomTimingsHandler
This will allow us to build against JDK11 which is good since it seems
like this will be sticking around for a while.
2019-04-07 06:53:59 -04:00
Zach Brown
3b0b967c78
Allow disabling village sieges entirely
Fixes GH-1944
2019-04-07 06:35:12 -04:00
Aikar
e0847a4cea
Reuse buffers for chunk compression to optimize memory use
Instead of allocating a buffer for every chunk compression, reuse
the same 64k sized buffer.

Also stopped doing dynamic compression levels. It wasn't helping enough.

This will improve memory usage and zlib performance of chunk compression.
2019-03-29 00:03:53 -04:00
Aikar
5e4ae76bc3
Fix null task issue with timings 2019-03-26 01:39:57 -04:00
Aikar
1073a39560
Fix plugin errors corrupting timings stack
plugins that threw an error could get timings thrown off in its state

this likely led to inconsistent and unexplainable data in timings reports.

this ensures that exceptions will still stopTiming and let the system
auto self recover from corrupt stacks too.
2019-03-26 00:51:19 -04:00
Aikar
2d68918daa
missed a spot for pickupDelay fix 2019-03-24 18:15:10 -04:00
Aikar
745476f4da
don't go below 0 for pickupDelay, breaks picking up items
vanilla checks for == 0

Fixes #1911
2019-03-24 18:09:51 -04:00
AgentTroll
f81358ab8c
Update entity Metadata for all tracked players 2019-03-24 17:46:02 -04:00
Aikar
14eac29ac6
Backport Timings Improvements 2019-03-24 17:34:36 -04:00
Aikar
677997fa9e
Remove Entity slice debug logs
As per 1.13, we have no evidence these illegal states are causing
issues we can identify, so just going to hide the fact its happening
(but still have the code to auto fix it)
2019-03-04 23:47:42 -05:00
Aikar
0b1a9b2e8f
MC-145260: Fix Whitelist On/Off inconsistency - Fixes #1880
Mojang stored whitelist state in 2 places (Whitelist Object, PlayerList)

some things checked PlayerList, some checked object. This moves
everything to the Whitelist object.
2019-03-04 23:47:41 -05:00
Aikar
ab99f9da52
Handle Excessive Signs in Chunks creating too large of packets
Also adds a limit to stop sending Sign data to client after 500
signs per chunk to limit client lag.

Use -DPaper.excessiveSignsLimit=500 to configure that limit, or -1
to disable the limit and let your players be abused.

fixes #1878
2019-03-04 23:47:41 -05:00
Aikar
d70aa91fd3
don't check convert signs boolean every sign save
that lookup isn't "cheap", and synchronizes so cache it to a boolean instead
2019-03-04 23:35:10 -05:00
Aikar
013f8d2c77
Remove outbound string length limits on signs, improve codepoint logic
now 80 chars counts multi sized code points the same so 80 chinese
characters would be allowed too.

Removed outbound limit as it doesn't solve the chunk oversize problem.

proper fix for chunk sending in another patch next.
2019-03-04 23:34:48 -05:00
Zach Brown
3d60b705ba
Backport: Fire PlayerArmorChangeEvent for more cases 2019-03-03 15:27:02 -05:00
Shane Freeder
c66f02b179 Backport: Fix NPE during server initialization from server list pings 2019-02-28 19:10:22 +00:00
Shane Freeder
627b6dec02 Apply sign limits to signs text content 2019-02-28 18:48:57 +00:00
Aikar
4ba151e59d
Fix incorrect check on vehicle for auto dismount
This fixes an issue where players are dismounted from their horse on logout.
2019-02-28 02:44:47 -05:00
Aikar
087a5e99b8
Strip extra Sign data to/from client - #1876
modified clients can send abnormally large data from the client
to the server and it would get stored on the sign as sent.

the client can barely render around 16 characters as-is, but formatting
codes can get it to be more than 16 actual length.

Set a limit of 80 which should give an average of 16 characters 2
sets of legacy formatting codes which should be plenty for all uses.

This does not strip any existing data from the NBT as plugins
may use this for storing data out of the rendered area.

it only impacts data sent to and from the client.

Set -DPaper.maxSignLength=XX to change limit or -1 to disable

Also fix sign edit memory leak
2019-02-28 00:42:40 -05:00
Aikar
1627071d50
Improvements to Timings concurrency and lookup performance
ConcurrentHashMap synchronizes on .computeIfAbsent even on hits,
so this does a .get(key) first, which most of our use should
be hits, and then falls back to the CHM computeIfAbsent for thread safe puts.

Also improve concurrency on handler and group collections to use a synchronized
list instead of an array deque for concurrency safety.
2019-02-23 16:32:20 -05:00
Aikar
5719e128fa
Updated Upstream (Spigot)
This brings in Spigots Oversized Chunks fix so that servers migrating from
Spigot 1.12 to Paper 1.12 can safely transition the save formats.

Spigot Changes:
79a30d7d Allow Saving Large Chunks
2019-02-23 16:31:43 -05:00
Aikar
64efe67de3
Update default book configs to match 1.13.2 2019-02-16 18:32:52 -05:00
Aikar
132c2c533d
Fix loot table restriction when replenish is disabled - Fixes #1860 2019-02-16 18:28:09 -05:00
Aikar
e8f86cb97d
Allow Saving of Oversized Chunks - READ COMMIT DETAILS!!!
Please test this build on a local TEST SERVER before sending to your live server!

PaperMC is not responsible for any data loss to your chunks.

-------------------------------------------------------------------

The Minecraft World Region File format has a hard cap of 1MB per chunk.
This is due to the fact that the header of the file format only allocates
a single byte for sector count, meaning a maximum of 256 sectors, at 4k per sector.

This limit can be reached fairly easily with books, resulting in the chunk being unable
to save to the world. Worse off, is that nothing printed when this occured, and silently
performed a chunk rollback on next load.

This leads to security risk with duplication and is being actively exploited.

This patch catches the too large scenario, falls back and moves any large Entity
or Tile Entity into a new compound, and this compound is saved into a different file.

On Chunk Load, we check for oversized status, and if so, we load the extra file and
merge the Entities and Tile Entities from the oversized chunk back into the level to
then be loaded as normal.

Once a chunk is returned back to normal size, the oversized flag will clear, and no
extra data file will exist.

This fix maintains compatability with all existing Anvil Region Format tools as it
does not alter the save format. They will just not know about the extra entities.

This fix also maintains compatability if someone switches server jars to one without
this fix, as the data will remain in the oversized file. Once the server returns
to a jar with this fix, the data will be restored.
2019-02-15 21:50:25 -05:00
Shane Freeder
af759c3e98
Address some issues with book limits (#1798) 2019-01-12 17:31:22 +00:00
Connor (Vectrix)
2ee16de8ae Ensure the passenger player gets retracked by the vehicle player on disconnection (#1781) 2019-01-01 00:32:33 -06:00
Shane Freeder
ac697484cf
Cleanup after plugins which don't sucessfully enable
This change closes the plugin via the plugin manager, which disables
the plugin, as intended, but also cleans up after the plugin, preventing
any further errors or issues caused by tasks scheduled by the plugin before
it failed.

Backport of 1.13 cf772531f4
2018-12-06 22:09:08 -05:00
Zach Brown
cbd70031ec
Update upstream CB/S
--- work/CraftBukkit
Submodule work/CraftBukkit d7bebeff0..acbc348e9:
  > SPIGOT-4477: Arrows only firing direction of boat
  > Improve zombie villagers

--- work/Spigot
Submodule work/Spigot dcd16439b..e8ded36bc:
  > Rebuild patches
  > Add PlayerConnection timings
2018-12-06 22:02:57 -05:00
Amosar
ea0646b6f6
backport: SPIGOT-2719: Comparator and Observer don't trigger BlockRedstoneEvent 2018-12-01 20:04:38 +00:00
Aikar
cedf38aac0
Handle Large Packets disconnecting client
If a players inventory is too big to send in a single packet,
split the inventory set into multiple packets instead.
2018-11-27 21:56:54 -05:00
Zach Brown
b82359ef5a
Persist ArmorStand canTick API value across restarts 2018-11-27 18:40:56 -05:00
Aikar
cfe5920cab
Prevent rayTrace from loading chunks
ray tracing into an unloaded chunk should be treated as a miss
this saves a ton of lag for when AI tries to raytrace near unloaded chunks.
2018-11-26 19:44:34 -05:00
Aikar
a62a77885d
Specify charset explicitly on getBytes 2018-11-17 00:39:22 -05:00
Aikar
07c797387b
Limit Book Sizes 2018-11-17 00:32:40 -05:00
BlackHole
531dfad2d2
Fix PreFillProfileEvent 2018-11-08 19:00:27 -05:00
Zach Brown
67787d388c
Fix server icon encoding to show on newer clients
The base64 encoding method for server favicons in 1.12 puts newlines in
the encoded string. The 1.13 client and server pair fixed this issue and
no longer consider it valid. Luckily the 1.12.2 client will parse the
correct encoding just fine as well.

This fixes the encoding so that the server icon will display properly on
both 1.12.2 clients as well as newer clients.

Shout out to ViaVersion whose contributors noticed this some time ago.
2018-11-05 21:53:33 -05:00
Aikar
857123a653
Keep players yaw/pitch on vehicle updates 2018-11-02 23:24:35 -04:00
Zach Brown
4297106c09
Do not let the server load chunks from newer versions
If the server attempts to load a chunk generated by a newer version of
the game, immediately stop the server to prevent data corruption.

You can override this functionality at your own peril.
2018-10-23 22:06:33 -04:00
Zach Brown
b15c43a389
Update upstream for minecart spawner improvement 2018-10-23 19:03:32 -04:00
Aikar
e7245e68bd
Backport Timings improvements from 1.13 2018-10-17 23:11:04 -04:00
Aikar
fce9e20719
MC-54026: Backport 1.13 client desync fix on fast tools 2018-10-17 22:53:08 -04:00
Aikar
ca8dc1b847
Actually fix mob spawning for real
Fixes #1567
2018-10-12 16:54:46 -04:00
Aikar
be4fc8c7af
Backport the dupe uuid and entity log changes 2018-10-12 01:38:32 -04:00
Aikar
8601385dd7
Further improve village door code for 1.12 2018-10-11 21:50:37 -04:00
Aikar
b91846a31b
Backport Detect and recover from corrupt region files
see 0693716984
2018-10-11 21:16:12 -04:00
Aikar
33d2de5f72
Improve Village Door fix to not merge villages (Iron Titan)
Improves doors to better handle unloaded state so they need 1200 LOADED ticks
in order to not be dismissed.

Also improves the villages to not even tick when the center of the village + 1
is not loaded, improving server performance (and helping door issue)

This should keep Iron Titans back working
2018-10-11 21:16:08 -04:00
Shane Freeder
583be93c81
Fix inversion issue in last patch 2018-10-11 20:03:52 +01:00
Shane Freeder
87d2e76860
Fix oversight in behavior of last patch 2018-10-08 20:29:37 +01:00
Shane Freeder
c353860748
Backport: Prevent mob spawning from loading/generating chunks 2018-10-08 18:18:00 +01:00
Aikar
f949449338
Backport Water Activation Range
Adds Entity Activation Range for water mobs
and no longer gives immunity to mobs (squid) that know how to
pathfind in water.
2018-10-06 01:13:48 -04:00
Aikar
67370956a0
Backport light fix for recheck gaps 2018-10-06 01:04:31 -04:00
Aikar
3ac4505b1e
Fix bug in the last commit for loot table fix 2018-10-01 20:28:06 -04:00
Zach Brown
7ec576d1fc
Fix cancelled lootables 2018-09-29 22:42:20 -04:00
Aikar
a690c979f1
Backport Village Door fix from 1.13 2018-09-29 12:14:40 -04:00
Aikar
22fd638482
Fix issues with entity loss due to unloaded chunks
Vanilla has risk of losing entities by causing them to be
removed from all chunks if they try to move into an unloaded chunk.

This pretty much means high chance this entity will be lost in this scenario.

There is another case that adding an enttiy to the world can fail if
the chunk isn't loaded.

Lots of the server is designed around addEntity never expecting to fail for these reasons,
nor is it really logical.

This change ensures the chunks are always loaded when entities are
added to the world, or a valid entity moves between chunks.

Hopefully will fix issues #1496 and #1434
2018-09-27 23:52:46 -04:00
Aikar
de977253d9
Re-add toggle for light queue, bump queue time
there is apparently bugs with relighting, so turning toggle back on

also bumped the max time threshold to reduce risk of starving the queue

allows it to violate TPS some, but at cost of better light data

also fixed some chunk neighbor checks
2018-09-25 23:37:01 -04:00
Zach Brown
c1cd6183f5
Update 1.12.2 distribution info just in case 2018-09-24 21:03:09 -04:00
Zach Brown
69c8e71723
Allow zero revive health when it matches maxHealth
Apparently a zero max health attribute is perfectly fine in vanilla and
our own revive handling code appears to handle the case fine, even when
EntityDeathEvent is cancelled. So we should allow it to avoid issues
when these mobs are killed.
2018-09-24 20:54:43 -04:00
Aikar
9759652bfb
Backport light queue changes from 1.13 2018-09-23 20:45:32 -04:00
BillyGalbreath
e0a25a9b99
Fix NPE race condition in ServerListPingEvent
Fixes GH-1473

If a ping is responded to prior to the server sample being populated
(pre-tick as an example) it can result in an NPE.
2018-09-23 00:05:54 -04:00
Aikar
4909d1366c
Sync Player Position to Vehicles
Player Positions could become desynced with their vehicle resulting
in chunk conflicts about which chunk the entity should really be in.
2018-09-21 11:40:46 -04:00
Aikar
15712119ad
Optimize Region File Cache
CraftBukkit added synchronization to read and write methods. This adds
much more contention on this object for accessing region files, as
the entire read and write of NBT data is now a blocking operation.

This causes issues when something then simply needs to check if a chunk exists
on the main thread, causing a block...

However, this synchronization was unnecessary, because there is already
enough synchronization done to keep things safe

1) Obtaining a Region File: Those methods are still static synchronized.
   Meaning we can safely obtain a Region File concurrently.

2) RegionFile data access: Methods reading and manipulating data from
   a region file are also marked synchronized, ensuring that no 2 processes
   are reading or writing data at the same time.

3) Checking a region file for chunkExists: getOffset is also synchronized
   ensuring that even if a chunk is currently being written, it will be safe.

By removing these synchronizations, we reduce the locking to only
when data is being write or read.

GZIP compression and NBT Buffer creation will no longer be part of the
synchronized context, reducing lock times.

Ultimately: This brings us back to Vanilla, which has had no indication of region file loss.
2018-09-16 14:26:30 -04:00
Aikar
ec58c208b3
Performance & Concurrency Improvements to Permissions
Modifying of permissions was only half protected, enabling concurrency
issues to occur if permissions were modified async.

While no plugin really should be doing that, modifying operations
are not heavily called, so they are safe to add synchronization to.

Now, all modification API's will be synchronized ensuring safety.

Additionally, hasPermission was victim to a common java newbie mistake
of calling if (containsKey(k)) return get(k), resulting in 2 map lookups.

Optimized it to simply be a single get call cutting permission map
lookups in half.
2018-09-13 20:59:32 -04:00
Zach Brown
cce3635569
Update branch for github version checking 2018-09-13 12:06:16 -04:00
109 changed files with 3201 additions and 831 deletions

View file

@ -1,14 +1,14 @@
From 7836876ec5222a072d9d65d965f4edcc0ea8bbe4 Mon Sep 17 00:00:00 2001
From f689646087896900f4b4a46521b3a5d5487184b3 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 00:16:08 +0100
Subject: [PATCH] POM changes
diff --git a/pom.xml b/pom.xml
index 7c81917d..4c5bda27 100644
index 7c81917d..3889d668 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,39 +3,39 @@
@@ -3,46 +3,46 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@ -40,50 +40,45 @@ index 7c81917d..4c5bda27 100644
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<repository>
- <distributionManagement>
- <repository>
- <id>spigotmc-releases</id>
- <url>https://hub.spigotmc.org/nexus/content/repositories/releases/</url>
+ <id>destroystokyo-releases</id>
+ <url>https://destroystokyo.com/repo/repository/maven-releases/</url>
</repository>
<snapshotRepository>
- </repository>
- <snapshotRepository>
- <id>spigotmc-snapshots</id>
- <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
+ <id>destroystokyo-snapshots</id>
+ <url>https://destroystokyo.com/repo/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
- <repositories>
- <repository>
- <id>spigotmc-public</id>
- <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
- </repository>
- </repositories>
-
<pluginRepositories>
<pluginRepository>
<id>spigotmc-public</id>
@@ -43,6 +43,17 @@
</pluginRepository>
</pluginRepositories>
+ <repositories>
+ <repository>
- </snapshotRepository>
- </distributionManagement>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>spigotmc-public</id>
+ <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
+ </repository>
+ </pluginRepository>
+ </pluginRepositories>
<repositories>
<repository>
<id>spigotmc-public</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
+ <repository>
+ <id>sonatype</id>
+ <url>https://oss.sonatype.org/content/groups/public/</url>
+ </repository>
+ </repositories>
+
</repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>spigotmc-public</id>
- <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
- </pluginRepository>
- </pluginRepositories>
-
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
@@ -56,6 +67,13 @@
@@ -56,6 +56,13 @@
<version>1.1.1</version>
<scope>compile</scope>
</dependency>
@ -97,7 +92,7 @@ index 7c81917d..4c5bda27 100644
<!-- bundled with Minecraft, should be kept in sync -->
<dependency>
<groupId>com.google.guava</groupId>
@@ -100,15 +118,12 @@
@@ -100,15 +107,12 @@
</dependencies>
<build>
@ -114,7 +109,7 @@ index 7c81917d..4c5bda27 100644
<dependencies>
<!-- we need our custom version as it fixes some bugs on case sensitive file systems -->
<dependency>
@@ -131,6 +146,7 @@
@@ -131,6 +135,7 @@
</execution>
</executions>
<configuration>
@ -122,7 +117,7 @@ index 7c81917d..4c5bda27 100644
<!-- when downloading via Maven we can pull depends individually -->
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
@@ -138,33 +154,4 @@
@@ -138,33 +143,4 @@
</plugins>
</build>
@ -157,5 +152,5 @@ index 7c81917d..4c5bda27 100644
- </profiles>
</project>
--
2.18.0
2.19.0

View file

@ -1,14 +1,14 @@
From f428f0343bf4b0aa2c42fa1755d9523eaec91d3b Mon Sep 17 00:00:00 2001
From bf38aff997d53e25de73849488a72a7422f36b97 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 1 Apr 2016 00:02:47 -0400
Subject: [PATCH] add Trove and FastUtil to Bukkit
diff --git a/pom.xml b/pom.xml
index 4220760f..623d9eae 100644
index 3889d668..c5b3f430 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,6 +55,19 @@
@@ -44,6 +44,19 @@
</repositories>
<dependencies>
@ -29,5 +29,5 @@ index 4220760f..623d9eae 100644
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
--
2.16.2
2.19.0

View file

@ -1,4 +1,4 @@
From 0644771327501a754ae14c834e50fc97f6417085 Mon Sep 17 00:00:00 2001
From 199ec5e113fd5ba5d362cc12be1144b26fe9fccc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 29 Feb 2016 18:48:17 -0600
Subject: [PATCH] Timings v2
@ -6,16 +6,16 @@ Subject: [PATCH] Timings v2
diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java
new file mode 100644
index 00000000..4d8b633e
index 00000000..597d39a3
--- /dev/null
+++ b/src/main/java/co/aikar/timings/FullServerTickHandler.java
@@ -0,0 +1,82 @@
@@ -0,0 +1,81 @@
+package co.aikar.timings;
+
+import static co.aikar.timings.TimingsManager.*;
+
+public class FullServerTickHandler extends TimingHandler {
+ private static final TimingIdentifier IDENTITY = new TimingIdentifier("Minecraft", "Full Server Tick", null, false);
+ private static final TimingIdentifier IDENTITY = new TimingIdentifier("Minecraft", "Full Server Tick", null);
+ final TimingData minuteData;
+ double avgFreeMemory = -1D;
+ double avgUsedMemory = -1D;
@ -62,8 +62,7 @@ index 00000000..4d8b633e
+ long start = System.nanoTime();
+ TimingsManager.tick();
+ long diff = System.nanoTime() - start;
+ CURRENT = TIMINGS_TICK;
+ TIMINGS_TICK.addDiff(diff);
+ TIMINGS_TICK.addDiff(diff, null);
+ // addDiff for TIMINGS_TICK incremented this, bring it back down to 1 per tick.
+ record.setCurTickCount(record.getCurTickCount()-1);
+
@ -94,10 +93,10 @@ index 00000000..4d8b633e
+}
diff --git a/src/main/java/co/aikar/timings/NullTimingHandler.java b/src/main/java/co/aikar/timings/NullTimingHandler.java
new file mode 100644
index 00000000..8c43e206
index 00000000..3222c8c2
--- /dev/null
+++ b/src/main/java/co/aikar/timings/NullTimingHandler.java
@@ -0,0 +1,61 @@
@@ -0,0 +1,63 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -124,6 +123,8 @@ index 00000000..8c43e206
+package co.aikar.timings;
+
+public final class NullTimingHandler implements Timing {
+ public static final Timing NULL = new NullTimingHandler();
+
+ @Override
+ public Timing startTiming() {
+ return this;
@ -161,7 +162,7 @@ index 00000000..8c43e206
+}
diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java
new file mode 100644
index 00000000..feddcdbd
index 00000000..34e52ec4
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimedEventExecutor.java
@@ -0,0 +1,81 @@
@ -241,17 +242,17 @@ index 00000000..feddcdbd
+ executor.execute(listener, event);
+ return;
+ }
+ timings.startTiming();
+ executor.execute(listener, event);
+ timings.stopTiming();
+ try (Timing ignored = timings.startTiming()) {
+ executor.execute(listener, event);
+ }
+ }
+}
diff --git a/src/main/java/co/aikar/timings/Timing.java b/src/main/java/co/aikar/timings/Timing.java
new file mode 100644
index 00000000..b2260104
index 00000000..be860865
--- /dev/null
+++ b/src/main/java/co/aikar/timings/Timing.java
@@ -0,0 +1,76 @@
@@ -0,0 +1,77 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -314,8 +315,9 @@ index 00000000..b2260104
+ void stopTimingIfSync();
+
+ /**
+ * Stops timing and disregards current timing data.
+ * @deprecated Doesn't do anything - Removed
+ */
+ @Deprecated
+ void abort();
+
+ /**
@ -456,10 +458,10 @@ index 00000000..f222d6b7
+}
diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java
new file mode 100644
index 00000000..916b6f9d
index 00000000..1b813cf7
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingHandler.java
@@ -0,0 +1,209 @@
@@ -0,0 +1,202 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -487,16 +489,22 @@ index 00000000..916b6f9d
+
+import co.aikar.util.LoadingIntMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+import org.bukkit.Bukkit;
+
+import java.util.ArrayDeque;
+import java.util.Deque;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.bukkit.Bukkit;
+
+class TimingHandler implements Timing {
+
+ private static int idPool = 1;
+ final int id = idPool++;
+ private static AtomicInteger idPool = new AtomicInteger(1);
+ static Deque<TimingHandler> TIMING_STACK = new ArrayDeque<>();
+ final int id = idPool.getAndIncrement();
+
+ final String name;
+ final TimingIdentifier identifier;
+ private final boolean verbose;
+
+ private final Int2ObjectOpenHashMap<TimingData> children = new LoadingIntMap<>(TimingData::new);
@ -509,17 +517,10 @@ index 00000000..916b6f9d
+ private boolean added;
+ private boolean timed;
+ private boolean enabled;
+ private TimingHandler parent;
+
+ TimingHandler(TimingIdentifier id) {
+ if (id.name.startsWith("##")) {
+ verbose = true;
+ this.name = id.name.substring(3);
+ } else {
+ this.name = id.name;
+ verbose = false;
+ }
+
+ this.identifier = id;
+ this.verbose = id.name.startsWith("##");
+ this.record = new TimingData(this.id);
+ this.groupHandler = id.groupHandler;
+
@ -546,55 +547,52 @@ index 00000000..916b6f9d
+
+ @Override
+ public Timing startTimingIfSync() {
+ if (Bukkit.isPrimaryThread()) {
+ startTiming();
+ }
+ startTiming();
+ return this;
+ }
+
+ @Override
+ public void stopTimingIfSync() {
+ if (Bukkit.isPrimaryThread()) {
+ stopTiming();
+ }
+ stopTiming();
+ }
+
+ public Timing startTiming() {
+ if (enabled && ++timingDepth == 1) {
+ if (enabled && Bukkit.isPrimaryThread() && ++timingDepth == 1) {
+ start = System.nanoTime();
+ parent = TimingsManager.CURRENT;
+ TimingsManager.CURRENT = this;
+ TIMING_STACK.addLast(this);
+ }
+ return this;
+ }
+
+ public void stopTiming() {
+ if (enabled && --timingDepth == 0 && start != 0) {
+ if (!Bukkit.isPrimaryThread()) {
+ Bukkit.getLogger().log(Level.SEVERE, "stopTiming called async for " + name);
+ new Throwable().printStackTrace();
+ start = 0;
+ return;
+ if (enabled && timingDepth > 0 && Bukkit.isPrimaryThread() && --timingDepth == 0 && start != 0) {
+ TimingHandler last;
+ while ((last = TIMING_STACK.removeLast()) != this) {
+ last.timingDepth = 0;
+ String reportTo;
+ if ("minecraft".equals(last.identifier.group)) {
+ reportTo = "Paper! This is a potential bug in Paper";
+ } else {
+ reportTo = "the plugin " + last.identifier.group + "(Look for errors above this in the logs)";
+ }
+ Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Report this to " + reportTo + " (" + last.identifier +" did not stopTiming)", new Throwable());
+ }
+ addDiff(System.nanoTime() - start);
+ addDiff(System.nanoTime() - start, TIMING_STACK.peekLast());
+
+ start = 0;
+ }
+ }
+
+ @Override
+ public void abort() {
+ if (enabled && timingDepth > 0) {
+ start = 0;
+ }
+ public final void abort() {
+
+ }
+
+ void addDiff(long diff) {
+ if (TimingsManager.CURRENT == this) {
+ TimingsManager.CURRENT = parent;
+ if (parent != null) {
+ parent.children.get(id).add(diff);
+ }
+ void addDiff(long diff, TimingHandler parent) {
+ if (parent != null) {
+ parent.children.get(id).add(diff);
+ }
+
+ record.add(diff);
+ if (!added) {
+ added = true;
@ -602,15 +600,13 @@ index 00000000..916b6f9d
+ TimingsManager.HANDLERS.add(this);
+ }
+ if (groupHandler != null) {
+ groupHandler.addDiff(diff);
+ groupHandler.addDiff(diff, parent);
+ groupHandler.children.get(id).add(diff);
+ }
+ }
+
+ /**
+ * Reset this timer, setting all values to zero.
+ *
+ * @param full
+ */
+ void reset(boolean full) {
+ record.reset();
@ -640,8 +636,7 @@ index 00000000..916b6f9d
+ }
+
+ /**
+ * This is simply for the Closeable interface so it can be used with
+ * try-with-resources ()
+ * This is simply for the Closeable interface so it can be used with try-with-resources ()
+ */
+ @Override
+ public void close() {
@ -671,10 +666,10 @@ index 00000000..916b6f9d
+}
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
new file mode 100644
index 00000000..c2c2fb83
index 00000000..d84c36d2
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingHistory.java
@@ -0,0 +1,352 @@
@@ -0,0 +1,344 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -775,7 +770,6 @@ index 00000000..c2c2fb83
+ entries[i++] = new TimingHistoryEntry(handler);
+ }
+
+
+ // Information about all loaded chunks/entities
+ //noinspection unchecked
+ this.worlds = toObjectMapper(Bukkit.getWorlds(), new Function<World, JSONPair>() {
@ -878,11 +872,11 @@ index 00000000..c2c2fb83
+
+ @SuppressWarnings("unchecked")
+ final Map<EntityType, Counter> entityCounts = MRUMapCache.of(LoadingMap.of(
+ new EnumMap<EntityType, Counter>(EntityType.class), Counter.LOADER
+ new EnumMap<EntityType, Counter>(EntityType.class), k -> new Counter()
+ ));
+ @SuppressWarnings("unchecked")
+ final Map<Material, Counter> tileEntityCounts = MRUMapCache.of(LoadingMap.of(
+ new EnumMap<Material, Counter>(Material.class), Counter.LOADER
+ new EnumMap<Material, Counter>(Material.class), k -> new Counter()
+ ));
+
+ static class RegionId {
@ -1012,13 +1006,6 @@ index 00000000..c2c2fb83
+
+ private static class Counter {
+ private int count = 0;
+ @SuppressWarnings({"rawtypes", "SuppressionAnnotation", "Guava"})
+ static Function LOADER = new LoadingMap.Feeder<Counter>() {
+ @Override
+ public Counter apply() {
+ return new Counter();
+ }
+ };
+ public int increment() {
+ return ++count;
+ }
@ -1090,10 +1077,10 @@ index 00000000..0e114eb3
+}
diff --git a/src/main/java/co/aikar/timings/TimingIdentifier.java b/src/main/java/co/aikar/timings/TimingIdentifier.java
new file mode 100644
index 00000000..623dda49
index 00000000..86bf5505
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingIdentifier.java
@@ -0,0 +1,102 @@
@@ -0,0 +1,112 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -1119,12 +1106,15 @@ index 00000000..623dda49
+ */
+package co.aikar.timings;
+
+import com.google.common.base.Function;
+import co.aikar.util.LoadingMap;
+import co.aikar.util.MRUMapCache;
+
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * <p>Used as a basis for fast HashMap key comparisons for the Timing Map.</p>
@ -1135,26 +1125,17 @@ index 00000000..623dda49
+ /**
+ * Holds all groups. Autoloads on request for a group by name.
+ */
+ static final Map<String, TimingGroup> GROUP_MAP = MRUMapCache.of(
+ LoadingMap.newIdentityHashMap(new Function<String, TimingGroup>() {
+ @Override
+ public TimingGroup apply(String group) {
+ return new TimingGroup(group);
+ }
+ }, 64)
+ );
+ static final TimingGroup DEFAULT_GROUP = getGroup("Minecraft");
+ static final Map<String, TimingGroup> GROUP_MAP = LoadingMap.of(new ConcurrentHashMap<>(64, .5F), TimingGroup::new);
+ private static final TimingGroup DEFAULT_GROUP = getGroup("Minecraft");
+ final String group;
+ final String name;
+ final TimingHandler groupHandler;
+ final boolean protect;
+ private final int hashCode;
+
+ TimingIdentifier(String group, String name, Timing groupHandler, boolean protect) {
+ this.group = group != null ? group.intern() : DEFAULT_GROUP.name;
+ this.name = name.intern();
+ TimingIdentifier(String group, String name, Timing groupHandler) {
+ this.group = group != null ? group: DEFAULT_GROUP.name;
+ this.name = name;
+ this.groupHandler = groupHandler != null ? groupHandler.getTimingHandler() : null;
+ this.protect = protect;
+ this.hashCode = (31 * this.group.hashCode()) + this.name.hashCode();
+ }
+
@ -1163,11 +1144,9 @@ index 00000000..623dda49
+ return DEFAULT_GROUP;
+ }
+
+ return GROUP_MAP.get(groupName.intern());
+ return GROUP_MAP.get(groupName);
+ }
+
+ // We are using .intern() on the strings so it is guaranteed to be an identity comparison.
+ @SuppressWarnings("StringEquality")
+ @Override
+ public boolean equals(Object o) {
+ if (o == null) {
@ -1175,7 +1154,7 @@ index 00000000..623dda49
+ }
+
+ TimingIdentifier that = (TimingIdentifier) o;
+ return group == that.group && name == that.name;
+ return Objects.equals(group, that.group) && Objects.equals(name, that.name);
+ }
+
+ @Override
@ -1183,22 +1162,40 @@ index 00000000..623dda49
+ return hashCode;
+ }
+
+ @Override
+ public String toString() {
+ return "TimingIdentifier{id=" + group + ":" + name +'}';
+ }
+
+ static class TimingGroup {
+
+ private static int idPool = 1;
+ final int id = idPool++;
+ private static AtomicInteger idPool = new AtomicInteger(1);
+ final int id = idPool.getAndIncrement();
+
+ final String name;
+ ArrayDeque<TimingHandler> handlers = new ArrayDeque<TimingHandler>(64);
+ final List<TimingHandler> handlers = Collections.synchronizedList(new ArrayList<>(64));
+
+ private TimingGroup(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ TimingGroup that = (TimingGroup) o;
+ return id == that.id;
+ }
+
+ @Override
+ public int hashCode() {
+ return id;
+ }
+ }
+}
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
new file mode 100644
index 00000000..32e4bb1e
index 00000000..04ac8643
--- /dev/null
+++ b/src/main/java/co/aikar/timings/Timings.java
@@ -0,0 +1,284 @@
@ -1278,7 +1275,7 @@ index 00000000..32e4bb1e
+ */
+ public static Timing of(Plugin plugin, String name, Timing groupHandler) {
+ Preconditions.checkNotNull(plugin, "Plugin can not be null");
+ return TimingsManager.getHandler(plugin.getName(), name, groupHandler, true);
+ return TimingsManager.getHandler(plugin.getName(), name, groupHandler);
+ }
+
+ /**
@ -1483,7 +1480,7 @@ index 00000000..32e4bb1e
+ }
+
+ static TimingHandler ofSafe(String groupName, String name, Timing groupHandler) {
+ return TimingsManager.getHandler(groupName, name, groupHandler, false);
+ return TimingsManager.getHandler(groupName, name, groupHandler);
+ }
+}
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
@ -1613,10 +1610,10 @@ index 00000000..56b10e89
+}
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
new file mode 100644
index 00000000..df7f4259
index 00000000..40546c05
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -0,0 +1,342 @@
@@ -0,0 +1,352 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -1772,21 +1769,31 @@ index 00000000..df7f4259
+
+
+ Map handlers = createObject();
+ for (TimingIdentifier.TimingGroup group : TimingIdentifier.GROUP_MAP.values()) {
+ for (TimingHandler id : group.handlers) {
+ if (!id.isTimed() && !id.isSpecial()) {
+ continue;
+ }
+ handlers.put(id.id, toArray(
+ group.id,
+ id.name
+ ));
+ }
+ }
+ Map groupData;
+ synchronized (TimingIdentifier.GROUP_MAP) {
+ for (TimingIdentifier.TimingGroup group : TimingIdentifier.GROUP_MAP.values()) {
+ synchronized (group.handlers) {
+ for (TimingHandler id : group.handlers) {
+ if (!id.isTimed() && !id.isSpecial()) {
+ continue;
+ }
+
+ String name = id.identifier.name;
+ if (name.startsWith("##")) {
+ name = name.substring(3);
+ }
+ handlers.put(id.id, toArray(
+ group.id,
+ name
+ ));
+ }
+ }
+ }
+
+ groupData = toObjectMapper(TimingIdentifier.GROUP_MAP.values(), group -> pair(group.id, group.name));
+ }
+ parent.put("idmap", createObject(
+ pair("groups", toObjectMapper(
+ TimingIdentifier.GROUP_MAP.values(), group -> pair(group.id, group.name))),
+ pair("groups", groupData),
+ pair("handlers", handlers),
+ pair("worlds", toObjectMapper(TimingHistory.worldMap.entrySet(), input -> pair(input.getValue(), input.getKey()))),
+ pair("tileentity",
@ -1961,10 +1968,10 @@ index 00000000..df7f4259
+}
diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java
new file mode 100644
index 00000000..58ed35e0
index 00000000..9319ed94
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimingsManager.java
@@ -0,0 +1,196 @@
@@ -0,0 +1,183 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -1990,48 +1997,35 @@ index 00000000..58ed35e0
+ */
+package co.aikar.timings;
+
+import com.google.common.base.Function;
+import co.aikar.util.LoadingMap;
+import com.google.common.collect.EvictingQueue;
+import org.bukkit.Bukkit;
+import org.bukkit.Server;
+import org.bukkit.command.Command;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.java.PluginClassLoader;
+import co.aikar.util.LoadingMap;
+
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+
+public final class TimingsManager {
+ static final Map<TimingIdentifier, TimingHandler> TIMING_MAP =
+ Collections.synchronizedMap(LoadingMap.newHashMap(
+ new Function<TimingIdentifier, TimingHandler>() {
+ @Override
+ public TimingHandler apply(TimingIdentifier id) {
+ return (id.protect ?
+ new UnsafeTimingHandler(id) :
+ new TimingHandler(id)
+ );
+ }
+ },
+ 256, .5F
+ ));
+ static final Map<TimingIdentifier, TimingHandler> TIMING_MAP = LoadingMap.of(
+ new ConcurrentHashMap<>(4096, .5F), TimingHandler::new
+ );
+ public static final FullServerTickHandler FULL_SERVER_TICK = new FullServerTickHandler();
+ public static final TimingHandler TIMINGS_TICK = Timings.ofSafe("Timings Tick", FULL_SERVER_TICK);
+ public static final Timing PLUGIN_GROUP_HANDLER = Timings.ofSafe("Plugins");
+ public static List<String> hiddenConfigs = new ArrayList<String>();
+ public static boolean privacy = false;
+
+ static final Collection<TimingHandler> HANDLERS = new ArrayDeque<TimingHandler>();
+ static final ArrayDeque<TimingHistory.MinuteReport> MINUTE_REPORTS = new ArrayDeque<TimingHistory.MinuteReport>();
+ static final List<TimingHandler> HANDLERS = new ArrayList<>(1024);
+ static final List<TimingHistory.MinuteReport> MINUTE_REPORTS = new ArrayList<>(64);
+
+ static EvictingQueue<TimingHistory> HISTORY = EvictingQueue.create(12);
+ static TimingHandler CURRENT;
+ static long timingStart = 0;
+ static long historyStart = 0;
+ static boolean needsFullReset = false;
@ -2108,8 +2102,8 @@ index 00000000..58ed35e0
+ historyStart = System.currentTimeMillis();
+ }
+
+ static TimingHandler getHandler(String group, String name, Timing parent, boolean protect) {
+ return TIMING_MAP.get(new TimingIdentifier(group, name, parent, protect));
+ static TimingHandler getHandler(String group, String name, Timing parent) {
+ return TIMING_MAP.get(new TimingIdentifier(group, name, parent));
+ }
+
+
@ -2551,10 +2545,10 @@ index 00000000..24eae4be
+}
diff --git a/src/main/java/co/aikar/util/LoadingMap.java b/src/main/java/co/aikar/util/LoadingMap.java
new file mode 100644
index 00000000..1474384e
index 00000000..dfefda35
--- /dev/null
+++ b/src/main/java/co/aikar/util/LoadingMap.java
@@ -0,0 +1,340 @@
@@ -0,0 +1,343 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -2580,20 +2574,14 @@ index 00000000..1474384e
+ */
+package co.aikar.util;
+
+
+import com.google.common.base.Function;
+import org.bukkit.Material;
+import co.aikar.timings.TimingHistory;
+import org.w3c.dom.css.Counter;
+
+import java.lang.reflect.Constructor;
+import java.util.AbstractMap;
+import java.util.Collection;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+
+/**
+ * Allows you to pass a Loader function that when a key is accessed that doesn't exists,
@ -2610,16 +2598,16 @@ index 00000000..1474384e
+ * @param <K> Key
+ * @param <V> Value
+ */
+public class LoadingMap <K,V> extends AbstractMap<K, V> {
+public class LoadingMap <K, V> extends AbstractMap<K, V> {
+ private final Map<K, V> backingMap;
+ private final Function<K, V> loader;
+ private final java.util.function.Function<K, V> loader;
+
+ /**
+ * Initializes an auto loading map using specified loader and backing map
+ * @param backingMap Map to wrap
+ * @param loader Loader
+ */
+ public LoadingMap(Map<K, V> backingMap, Function<K, V> loader) {
+ public LoadingMap(Map<K, V> backingMap, java.util.function.Function<K, V> loader) {
+ this.backingMap = backingMap;
+ this.loader = loader;
+ }
@ -2634,7 +2622,7 @@ index 00000000..1474384e
+ * @return Map
+ */
+ public static <K, V> Map<K, V> of(Map<K, V> backingMap, Function<K, V> loader) {
+ return new LoadingMap<K, V>(backingMap, loader);
+ return new LoadingMap<>(backingMap, loader);
+ }
+
+ /**
@ -2654,7 +2642,7 @@ index 00000000..1474384e
+ */
+ public static <K, V> Map<K, V> newAutoMap(Map<K, V> backingMap, final Class<? extends K> keyClass,
+ final Class<? extends V> valueClass) {
+ return new LoadingMap<K, V>(backingMap, new AutoInstantiatingLoader<K, V>(keyClass, valueClass));
+ return new LoadingMap<>(backingMap, new AutoInstantiatingLoader<>(keyClass, valueClass));
+ }
+ /**
+ * Creates a LoadingMap with an auto instantiating loader.
@ -2687,7 +2675,7 @@ index 00000000..1474384e
+ * @return Map that auto instantiates on .get()
+ */
+ public static <K, V> Map<K, V> newHashAutoMap(final Class<? extends K> keyClass, final Class<? extends V> valueClass) {
+ return newAutoMap(new HashMap<K, V>(), keyClass, valueClass);
+ return newAutoMap(new HashMap<>(), keyClass, valueClass);
+ }
+
+ /**
@ -2718,7 +2706,7 @@ index 00000000..1474384e
+ * @return Map that auto instantiates on .get()
+ */
+ public static <K, V> Map<K, V> newHashAutoMap(final Class<? extends K> keyClass, final Class<? extends V> valueClass, int initialCapacity, float loadFactor) {
+ return newAutoMap(new HashMap<K, V>(initialCapacity, loadFactor), keyClass, valueClass);
+ return newAutoMap(new HashMap<>(initialCapacity, loadFactor), keyClass, valueClass);
+ }
+
+ /**
@ -2746,7 +2734,7 @@ index 00000000..1474384e
+ * @return Map
+ */
+ public static <K, V> Map<K, V> newHashMap(Function<K, V> loader) {
+ return new LoadingMap<K, V>(new HashMap<K, V>(), loader);
+ return new LoadingMap<>(new HashMap<>(), loader);
+ }
+
+ /**
@ -2754,13 +2742,25 @@ index 00000000..1474384e
+ *
+ * @param loader Loader to use
+ * @param initialCapacity Initial capacity to use
+ * @param <K> Key Type of the Map
+ * @param <V> Value Type of the Map
+ * @return Map
+ */
+ public static <K, V> Map<K, V> newHashMap(Function<K, V> loader, int initialCapacity) {
+ return new LoadingMap<>(new HashMap<>(initialCapacity), loader);
+ }
+ /**
+ * Initializes an auto loading map using a HashMap
+ *
+ * @param loader Loader to use
+ * @param initialCapacity Initial capacity to use
+ * @param loadFactor Load factor to use
+ * @param <K> Key Type of the Map
+ * @param <V> Value Type of the Map
+ * @return Map
+ */
+ public static <K, V> Map<K, V> newHashMap(Function<K, V> loader, int initialCapacity, float loadFactor) {
+ return new LoadingMap<K, V>(new HashMap<K, V>(initialCapacity, loadFactor), loader);
+ return new LoadingMap<>(new HashMap<>(initialCapacity, loadFactor), loader);
+ }
+
+ /**
@ -2772,7 +2772,7 @@ index 00000000..1474384e
+ * @return Map
+ */
+ public static <K, V> Map<K, V> newIdentityHashMap(Function<K, V> loader) {
+ return new LoadingMap<K, V>(new IdentityHashMap<K, V>(), loader);
+ return new LoadingMap<>(new IdentityHashMap<>(), loader);
+ }
+
+ /**
@ -2785,7 +2785,7 @@ index 00000000..1474384e
+ * @return Map
+ */
+ public static <K, V> Map<K, V> newIdentityHashMap(Function<K, V> loader, int initialCapacity) {
+ return new LoadingMap<K, V>(new IdentityHashMap<K, V>(initialCapacity), loader);
+ return new LoadingMap<>(new IdentityHashMap<>(initialCapacity), loader);
+ }
+
+ @Override
@ -2802,14 +2802,11 @@ index 00000000..1474384e
+
+ @Override
+ public V get(Object key) {
+ V res = backingMap.get(key);
+ if (res == null && key != null) {
+ res = loader.apply((K) key);
+ if (res != null) {
+ backingMap.put((K) key, res);
+ }
+ V v = backingMap.get(key);
+ if (v != null) {
+ return v;
+ }
+ return res;
+ return backingMap.computeIfAbsent((K) key, loader);
+ }
+
+ public V put(K key, V value) {return backingMap.put(key, value);}
@ -2840,7 +2837,7 @@ index 00000000..1474384e
+ }
+
+ public LoadingMap<K, V> clone() {
+ return new LoadingMap<K, V>(backingMap, loader);
+ return new LoadingMap<>(backingMap, loader);
+ }
+
+ private static class AutoInstantiatingLoader<K, V> implements Function<K, V> {
@ -3236,10 +3233,18 @@ index 00000000..5527e7c8
+
+}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 1b5b37bf..bdc0de8c 100644
index 1b5b37bf..22fe0663 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -31,7 +31,7 @@ public class SimpleCommandMap implements CommandMap {
@@ -10,6 +10,7 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
+import co.aikar.timings.Timing;
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -31,7 +32,7 @@ public class SimpleCommandMap implements CommandMap {
register("bukkit", new VersionCommand("version"));
register("bukkit", new ReloadCommand("reload"));
register("bukkit", new PluginsCommand("plugins"));
@ -3248,7 +3253,7 @@ index 1b5b37bf..bdc0de8c 100644
}
public void setFallbackCommands() {
@@ -60,6 +60,7 @@ public class SimpleCommandMap implements CommandMap {
@@ -60,6 +61,7 @@ public class SimpleCommandMap implements CommandMap {
* {@inheritDoc}
*/
public boolean register(String label, String fallbackPrefix, Command command) {
@ -3256,7 +3261,7 @@ index 1b5b37bf..bdc0de8c 100644
label = label.toLowerCase(java.util.Locale.ENGLISH).trim();
fallbackPrefix = fallbackPrefix.toLowerCase(java.util.Locale.ENGLISH).trim();
boolean registered = register(label, command, false, fallbackPrefix);
@@ -135,6 +136,12 @@ public class SimpleCommandMap implements CommandMap {
@@ -135,16 +137,22 @@ public class SimpleCommandMap implements CommandMap {
return false;
}
@ -3267,8 +3272,24 @@ index 1b5b37bf..bdc0de8c 100644
+ // Paper end
+
try {
target.timings.startTiming(); // Spigot
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
- target.timings.startTiming(); // Spigot
- // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
- target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
- target.timings.stopTiming(); // Spigot
+ try (Timing ignored = target.timings.startTiming()) { // Paper - use try with resources
+ // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
+ target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
+ }
} catch (CommandException ex) {
- target.timings.stopTiming(); // Spigot
+ //target.timings.stopTiming(); // Spigot // Paper
throw ex;
} catch (Throwable ex) {
- target.timings.stopTiming(); // Spigot
+ //target.timings.stopTiming(); // Spigot // Paper
throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
}
diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java
deleted file mode 100644
index bba914d7..00000000
@ -3677,10 +3698,10 @@ index 5ca863b3..04804706 100644
+ public String getData(); // Spigot
+}
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
index 8d982974..7e89b97b 100644
index 8d982974..40aa8a19 100644
--- a/src/main/java/org/spigotmc/CustomTimingsHandler.java
+++ b/src/main/java/org/spigotmc/CustomTimingsHandler.java
@@ -1,165 +1,76 @@
@@ -1,165 +1,104 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@ -3723,7 +3744,6 @@ index 8d982974..7e89b97b 100644
+import co.aikar.timings.Timing;
+import co.aikar.timings.Timings;
+import co.aikar.timings.TimingsManager;
+import sun.reflect.Reflection;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
@ -3744,6 +3764,8 @@ index 8d982974..7e89b97b 100644
+@Deprecated
+public final class CustomTimingsHandler {
+ private final Timing handler;
+ private static Boolean sunReflectAvailable;
+ private static Method getCallerClass;
- private static Queue<CustomTimingsHandler> HANDLERS = new ConcurrentLinkedQueue<CustomTimingsHandler>();
- /*========================================================================*/
@ -3756,24 +3778,25 @@ index 8d982974..7e89b97b 100644
- private long curTickTotal = 0;
- private long violations = 0;
+ public CustomTimingsHandler(String name) {
+ Timing timing;
+ if (sunReflectAvailable == null) {
+ String javaVer = System.getProperty("java.version");
+ String[] elements = javaVer.split("\\.");
- public CustomTimingsHandler(String name)
- {
- this( name, null );
- }
+ Plugin plugin = null;
+ try {
+ plugin = TimingsManager.getPluginByClassloader(Reflection.getCallerClass(2));
+ } catch (Exception ignored) {}
-
- public CustomTimingsHandler(String name, CustomTimingsHandler parent)
- {
- this.name = name;
- this.parent = parent;
- HANDLERS.add( this );
- }
-
+ int major = Integer.parseInt(elements.length >= 2 ? elements[1] : javaVer);
+ if (major <= 8) {
+ sunReflectAvailable = true;
- /**
- * Prints the timings and extra data to the given stream.
- *
@ -3789,21 +3812,18 @@ index 8d982974..7e89b97b 100644
- if ( count == 0 )
- {
- continue;
+ new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace();
+ if (plugin != null) {
+ timing = Timings.of(plugin, "(Deprecated API) " + name);
+ } else {
+ try {
+ final Method ofSafe = TimingsManager.class.getMethod("getHandler", String.class, String.class, Timing.class, boolean.class);
+ timing = (Timing) ofSafe.invoke("Minecraft", "(Deprecated API) " + name, null, true);
+ } catch (Exception e) {
+ Bukkit.getLogger().log(Level.SEVERE, "This handler could not be registered");
+ timing = Timings.NULL_HANDLER;
+ try {
+ Class<?> reflection = Class.forName("sun.reflect.Reflection");
+ getCallerClass = reflection.getMethod("getCallerClass", int.class);
+ } catch (ClassNotFoundException | NoSuchMethodException ignored) {
+ }
+ } else {
+ sunReflectAvailable = false;
}
- long avg = time / count;
-
- printStream.println( " " + timings.name + " Time: " + time + " Count: " + count + " Avg: " + avg + " Violations: " + timings.violations );
}
- }
- printStream.println( "# Version " + Bukkit.getVersion() );
- int entities = 0;
- int livingEntities = 0;
@ -3811,11 +3831,10 @@ index 8d982974..7e89b97b 100644
- {
- entities += world.getEntities().size();
- livingEntities += world.getLivingEntities().size();
- }
}
- printStream.println( "# Entities " + entities );
- printStream.println( "# LivingEntities " + livingEntities );
+ handler = timing;
}
- }
- /**
- * Resets all timings.
@ -3827,12 +3846,15 @@ index 8d982974..7e89b97b 100644
- for ( CustomTimingsHandler timings : HANDLERS )
- {
- timings.reset();
- }
- }
+ Class calling = null;
+ if (sunReflectAvailable) {
+ try {
+ calling = (Class) getCallerClass.invoke(null, 2);
+ } catch (IllegalAccessException | java.lang.reflect.InvocationTargetException ignored) {
}
}
- TimingsCommand.timingStart = System.nanoTime();
- }
+ public void startTiming() { handler.startTiming(); }
+ public void stopTiming() { handler.stopTiming(); }
- /**
- * Ticked every tick by CraftBukkit to count the number of times a timer
@ -3853,7 +3875,8 @@ index 8d982974..7e89b97b 100644
- }
- }
- }
-
+ Timing timing;
- /**
- * Starts timing to track a section of code.
- */
@ -3869,7 +3892,11 @@ index 8d982974..7e89b97b 100644
- }
- }
- }
-
+ Plugin plugin = null;
+ try {
+ plugin = TimingsManager.getPluginByClassloader(calling);
+ } catch (Exception ignored) {}
- /**
- * Stops timing a section of code.
- */
@ -3889,10 +3916,22 @@ index 8d982974..7e89b97b 100644
- if ( parent != null )
- {
- parent.stopTiming();
- }
- }
- }
-
+ new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace();
+ if (plugin != null) {
+ timing = Timings.of(plugin, "(Deprecated API) " + name);
+ } else {
+ try {
+ final Method ofSafe = TimingsManager.class.getMethod("getHandler", String.class, String.class, Timing.class);
+ ofSafe.setAccessible(true);
+ timing = (Timing) ofSafe.invoke(null, "Minecraft", "(Deprecated API) " + name, null);
+ } catch (Exception e) {
+ Bukkit.getLogger().log(Level.SEVERE, "This handler could not be registered");
+ timing = Timings.NULL_HANDLER;
}
}
+ handler = timing;
}
- /**
- * Reset this timer, setting all values to zero.
- */
@ -3905,7 +3944,10 @@ index 8d982974..7e89b97b 100644
- start = 0;
- timingDepth = 0;
- }
+ public void startTiming() { handler.startTiming(); }
+ public void stopTiming() { handler.stopTiming(); }
+
}
--
2.18.0
2.21.0

View file

@ -1,11 +1,11 @@
From 5a25f66a6e73b622258aeee69d25128aed24693a Mon Sep 17 00:00:00 2001
From 20265a5d5266c8df40625c55cee8dc01201174b3 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 17:58:01 -0600
Subject: [PATCH] Check Paper versions
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index 760d58eb..044361af 100644
index 386d841b..3005b099 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -28,6 +28,11 @@ import org.json.simple.JSONObject;
@ -20,7 +20,7 @@ index 760d58eb..044361af 100644
public class VersionCommand extends BukkitCommand {
public VersionCommand(String name) {
super(name);
@@ -151,7 +156,7 @@ public class VersionCommand extends BukkitCommand {
@@ -152,7 +157,7 @@ public class VersionCommand extends BukkitCommand {
private void sendVersion(CommandSender sender) {
if (hasVersion) {
@ -29,7 +29,7 @@ index 760d58eb..044361af 100644
lastCheck = System.currentTimeMillis();
hasVersion = false;
} else {
@@ -182,24 +187,28 @@ public class VersionCommand extends BukkitCommand {
@@ -183,24 +188,28 @@ public class VersionCommand extends BukkitCommand {
}
}
@ -70,7 +70,7 @@ index 760d58eb..044361af 100644
version = version.substring("git-Bukkit-".length());
int cbVersions = getDistance("craftbukkit", version.substring(0, version.indexOf(' ')));
if (cbVersions == -1) {
@@ -232,8 +241,16 @@ public class VersionCommand extends BukkitCommand {
@@ -233,8 +242,16 @@ public class VersionCommand extends BukkitCommand {
}
}
@ -88,7 +88,7 @@ index 760d58eb..044361af 100644
BufferedReader reader = Resources.asCharSource(
new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"),
Charsets.UTF_8
@@ -247,9 +264,58 @@ public class VersionCommand extends BukkitCommand {
@@ -248,9 +265,58 @@ public class VersionCommand extends BukkitCommand {
} finally {
reader.close();
}
@ -117,7 +117,7 @@ index 760d58eb..044361af 100644
+ }
+
+ // Contributed by Techcable <Techcable@outlook.com> in GH PR #65
+ private static final String BRANCH = "master";
+ private static final String BRANCH = "ver/1.12.2";
+ private static int getFromRepo(String repo, String hash) {
+ try {
+ HttpURLConnection connection = (HttpURLConnection) new URL("https://api.github.com/repos/" + repo + "/compare/" + BRANCH + "..." + hash).openConnection();
@ -148,5 +148,5 @@ index 760d58eb..044361af 100644
+ // Paper end
}
--
2.17.0
2.19.1

View file

@ -1,4 +1,4 @@
From b8567d82eae818cbf98656b6107c703d49d19916 Mon Sep 17 00:00:00 2001
From ac7d29681dd2be932b84ca9bb270906521656edc Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 20:24:35 -0600
Subject: [PATCH] Add exception reporting event
@ -458,28 +458,28 @@ index 00000000..5582999f
+ }
+}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index bdc0de8c..4aea03c6 100644
index 22fe0663..154b7d91 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -10,6 +10,9 @@ import java.util.List;
import java.util.Map;
@@ -11,6 +11,9 @@ import java.util.Map;
import java.util.regex.Pattern;
import co.aikar.timings.Timing;
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerCommandException;
+import com.destroystokyo.paper.exception.ServerTabCompleteException;
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -148,11 +151,14 @@ public class SimpleCommandMap implements CommandMap {
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
target.timings.stopTiming(); // Spigot
@@ -149,11 +152,14 @@ public class SimpleCommandMap implements CommandMap {
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
}
} catch (CommandException ex) {
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper
target.timings.stopTiming(); // Spigot
//target.timings.stopTiming(); // Spigot // Paper
throw ex;
} catch (Throwable ex) {
target.timings.stopTiming(); // Spigot
//target.timings.stopTiming(); // Spigot // Paper
- throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
+ String msg = "Unhandled exception executing '" + commandLine + "' in " + target;
+ server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper
@ -487,7 +487,7 @@ index bdc0de8c..4aea03c6 100644
}
// return true as command was handled
@@ -225,7 +231,9 @@ public class SimpleCommandMap implements CommandMap {
@@ -226,7 +232,9 @@ public class SimpleCommandMap implements CommandMap {
} catch (CommandException ex) {
throw ex;
} catch (Throwable ex) {
@ -592,5 +592,5 @@ index 80c152ba..b88f31ca 100644
}
}
--
2.17.0 (Apple Git-106)
2.21.0

View file

@ -1,4 +1,4 @@
From 15b5224e92a45ca15a6e5d34f97734922e539b92 Mon Sep 17 00:00:00 2001
From d70c376fbf3dfc694895e80aba6a00df4b88c775 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Thu, 3 Mar 2016 13:20:33 -0700
Subject: [PATCH] Use ASM for event executors.
@ -6,10 +6,10 @@ Subject: [PATCH] Use ASM for event executors.
Uses method handles for private or static methods.
diff --git a/pom.xml b/pom.xml
index 8d4032e2..21a4a8be 100644
index c5b3f430..09c42fe2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -128,6 +128,17 @@
@@ -117,6 +117,17 @@
<version>1.3</version>
<scope>test</scope>
</dependency>
@ -427,5 +427,5 @@ index d8b9c244..40fd71dc 100644
eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
} else {
--
2.17.0
2.19.0

View file

@ -1,4 +1,4 @@
From 4596b1efcb3648ea18ebf94eb07b49ee90c734e1 Mon Sep 17 00:00:00 2001
From 092987e5e264aae797401bdbab3bc9c4df9a186c Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Mon, 28 Nov 2016 10:16:39 -0500
Subject: [PATCH] Allow Reloading of Command Aliases
@ -55,10 +55,10 @@ index 30d60247..938959aa 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 4aea03c6..63d27392 100644
index 154b7d91..474cf4c3 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -282,4 +282,10 @@ public class SimpleCommandMap implements CommandMap {
@@ -283,4 +283,10 @@ public class SimpleCommandMap implements CommandMap {
}
}
}
@ -97,5 +97,5 @@ index f331a442..a977045d 100644
confirmed = true;
} else {
--
2.17.0 (Apple Git-106)
2.21.0

View file

@ -1,4 +1,4 @@
From b1eb117fbca758844625ae8de33b71f3d526ea0a Mon Sep 17 00:00:00 2001
From 4c9bcc7cd688a1c959ea8335a93b16c888d36f83 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 17 Jun 2017 16:30:44 -0400
Subject: [PATCH] Profile Lookup Events
@ -7,10 +7,10 @@ Adds a Pre Lookup Event and a Post Lookup Event so that plugins may prefill in p
profiles that had to be looked up.
diff --git a/pom.xml b/pom.xml
index c8b37997..13994dc2 100644
index 09c42fe2..d75bf7da 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,6 +62,13 @@
@@ -51,6 +51,13 @@
<!-- Trove Provided by CraftBukkit -->
<scope>provided</scope>
</dependency>
@ -241,5 +241,5 @@ index 00000000..aa0666d5
+
+}
--
2.15.1
2.19.0

View file

@ -1,4 +1,4 @@
From 21357c1c249a2ebea454a1bb6b7b435c3fecdbfa Mon Sep 17 00:00:00 2001
From fe849acd162816d608ef8b797037f95cfbb95dc3 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Thu, 21 Sep 2017 16:33:12 +0200
Subject: [PATCH] Allow plugins to use SLF4J for logging
@ -14,10 +14,10 @@ it without having to shade it in the plugin and going through
several layers of logging abstraction.
diff --git a/pom.xml b/pom.xml
index 13994dc2..45145c5f 100644
index d75bf7da..2fa2dd7c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,6 +122,14 @@
@@ -111,6 +111,14 @@
<scope>compile</scope>
</dependency>
@ -33,7 +33,7 @@ index 13994dc2..45145c5f 100644
<dependency>
<groupId>junit</groupId>
diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java
index c4e22c62..02670254 100644
index 55debf5d..8d2999ac 100644
--- a/src/main/java/org/bukkit/plugin/Plugin.java
+++ b/src/main/java/org/bukkit/plugin/Plugin.java
@@ -157,6 +157,12 @@ public interface Plugin extends TabExecutor {
@ -50,5 +50,5 @@ index c4e22c62..02670254 100644
* Returns the name of the plugin.
* <p>
--
2.15.1
2.19.0

View file

@ -1,4 +1,4 @@
From 2b7db879b8f87e7539717559348c34dfcee58f70 Mon Sep 17 00:00:00 2001
From 2ff79db56c78840998852477b7dc767ccf310a9c Mon Sep 17 00:00:00 2001
From: Kyle Wood <demonwav@gmail.com>
Date: Thu, 1 Mar 2018 19:37:52 -0600
Subject: [PATCH] Add version history to version command
@ -154,7 +154,7 @@ index 00000000..1daaca2f
+ }
+}
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index 044361af..c45faf4c 100644
index 3005b099..6bb7607d 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -31,6 +31,7 @@ import org.json.simple.parser.ParseException;
@ -165,15 +165,18 @@ index 044361af..c45faf4c 100644
// Paper end
public class VersionCommand extends BukkitCommand {
@@ -49,6 +50,7 @@ public class VersionCommand extends BukkitCommand {
@@ -49,8 +50,8 @@ public class VersionCommand extends BukkitCommand {
if (args.length == 0) {
sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
- sender.sendMessage(ChatColor.YELLOW + "This is a final build for 1.12.2. Please see https://www.spigotmc.org/ for details about upgrading.");
- // sendVersion(sender);
+ tellHistory(sender); // Paper
sendVersion(sender);
+ sendVersion(sender); // Paper - We'll say when, thanks
} else {
StringBuilder name = new StringBuilder();
@@ -85,6 +87,22 @@ public class VersionCommand extends BukkitCommand {
@@ -86,6 +87,22 @@ public class VersionCommand extends BukkitCommand {
return true;
}
@ -197,5 +200,5 @@ index 044361af..c45faf4c 100644
PluginDescriptionFile desc = plugin.getDescription();
sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + desc.getVersion());
--
2.17.1
2.19.1

View file

@ -1,4 +1,4 @@
From 13d2ed50d6346f5c8eb7833dd99f7c61e8fd0b29 Mon Sep 17 00:00:00 2001
From 8b9f3c48dcc40317ca51b6138eb6e3b766a8652c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 1 May 2018 21:33:35 -0400
Subject: [PATCH] Close Plugin Class Loaders on Disable
@ -100,7 +100,7 @@ index bd0588a2..cb2b0b9c 100644
lookupNames.clear();
HandlerList.unregisterAll();
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 40fd71dc..3e87c3dd 100644
index 40fd71dc..8b5cea64 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -317,7 +317,7 @@ public final class JavaPluginLoader implements PluginLoader {
@ -108,7 +108,7 @@ index 40fd71dc..3e87c3dd 100644
server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
// Paper start - Disable plugins that fail to load
- disablePlugin(jPlugin);
+ disablePlugin(jPlugin, true); // Paper - close Classloader on disable - She's dead jim
+ server.getPluginManager().disablePlugin(jPlugin, true); // Paper - close Classloader on disable - She's dead jim
return;
// Paper end
}
@ -144,5 +144,5 @@ index 40fd71dc..3e87c3dd 100644
}
}
--
2.17.1
2.19.2

View file

@ -1,4 +1,4 @@
From b86fe574c68b575d7b24b8f893b3b472d6369fd0 Mon Sep 17 00:00:00 2001
From 66e1c37f5010478c239e08b053a179592ca28145 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Tue, 21 Aug 2018 01:32:28 +0100
Subject: [PATCH] Improve death events
@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using
internal code.
diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
index ab9e81fd..a7b8f869 100644
index ab9e81fd..fef134c6 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
@@ -8,10 +8,19 @@ import org.bukkit.inventory.ItemStack;
@ -74,7 +74,7 @@ index ab9e81fd..a7b8f869 100644
+ */
+ public void setReviveHealth(double reviveHealth) throws IllegalArgumentException {
+ double maxHealth = ((LivingEntity) entity).getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue();
+ if ((reviveHealth <= 0) || (reviveHealth > maxHealth)) {
+ if ((maxHealth != 0 && reviveHealth <= 0) || (reviveHealth > maxHealth)) {
+ throw new IllegalArgumentException("Health must be between 0 (exclusive) and " + maxHealth + " (inclusive), but was " + reviveHealth);
+ }
+ this.reviveHealth = reviveHealth;
@ -173,5 +173,5 @@ index ab9e81fd..a7b8f869 100644
+ // Paper end
}
--
2.18.0.windows.1
2.19.0

View file

@ -0,0 +1,114 @@
From c4ffbeb0571e0c4f9a4b116127a362511d21908f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 13 Sep 2018 20:51:50 -0400
Subject: [PATCH] Performance & Concurrency Improvements to Permissions
Modifying of permissions was only half protected, enabling concurrency
issues to occur if permissions were modified async.
While no plugin really should be doing that, modifying operations
are not heavily called, so they are safe to add synchronization to.
Now, all modification API's will be synchronized ensuring safety.
Additionally, hasPermission was victim to a common java newbie mistake
of calling if (containsKey(k)) return get(k), resulting in 2 map lookups.
Optimized it to simply be a single get call cutting permission map
lookups in half.
diff --git a/src/main/java/org/bukkit/permissions/PermissibleBase.java b/src/main/java/org/bukkit/permissions/PermissibleBase.java
index d4cb00a82..486f69f86 100644
--- a/src/main/java/org/bukkit/permissions/PermissibleBase.java
+++ b/src/main/java/org/bukkit/permissions/PermissibleBase.java
@@ -68,8 +68,11 @@ public class PermissibleBase implements Permissible {
String name = inName.toLowerCase(java.util.Locale.ENGLISH);
- if (isPermissionSet(name)) {
- return permissions.get(name).getValue();
+ // Paper start
+ PermissionAttachmentInfo info = permissions.get(name);
+ if (info != null) {
+ return info.getValue();
+ // Paper end
} else {
Permission perm = Bukkit.getServer().getPluginManager().getPermission(name);
@@ -88,13 +91,16 @@ public class PermissibleBase implements Permissible {
String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH);
- if (isPermissionSet(name)) {
- return permissions.get(name).getValue();
+ // Paper start
+ PermissionAttachmentInfo info = permissions.get(name);
+ if (info != null) {
+ return info.getValue();
}
+ // Paper end
return perm.getDefault().getValue(isOp());
}
- public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
+ public synchronized PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) { // Paper - synchronized
if (name == null) {
throw new IllegalArgumentException("Permission name cannot be null");
} else if (plugin == null) {
@@ -111,7 +117,7 @@ public class PermissibleBase implements Permissible {
return result;
}
- public PermissionAttachment addAttachment(Plugin plugin) {
+ public synchronized PermissionAttachment addAttachment(Plugin plugin) { // Paper - synchronized
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
} else if (!plugin.isEnabled()) {
@@ -126,7 +132,7 @@ public class PermissibleBase implements Permissible {
return result;
}
- public void removeAttachment(PermissionAttachment attachment) {
+ public synchronized void removeAttachment(PermissionAttachment attachment) { // Paper - synchronized
if (attachment == null) {
throw new IllegalArgumentException("Attachment cannot be null");
}
@@ -145,7 +151,7 @@ public class PermissibleBase implements Permissible {
}
}
- public void recalculatePermissions() {
+ public synchronized void recalculatePermissions() { // Paper - synchronized
clearPermissions();
Set<Permission> defaults = Bukkit.getServer().getPluginManager().getDefaultPermissions(isOp());
Bukkit.getServer().getPluginManager().subscribeToDefaultPerms(isOp(), parent);
@@ -192,7 +198,7 @@ public class PermissibleBase implements Permissible {
}
}
- public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
+ public synchronized PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) { // Paper - synchronized
if (name == null) {
throw new IllegalArgumentException("Permission name cannot be null");
} else if (plugin == null) {
@@ -210,7 +216,7 @@ public class PermissibleBase implements Permissible {
return result;
}
- public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
+ public synchronized PermissionAttachment addAttachment(Plugin plugin, int ticks) { // Paper - synchronized
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
} else if (!plugin.isEnabled()) {
@@ -228,7 +234,7 @@ public class PermissibleBase implements Permissible {
}
}
- public Set<PermissionAttachmentInfo> getEffectivePermissions() {
+ public synchronized Set<PermissionAttachmentInfo> getEffectivePermissions() { // Paper - synchronized
return new HashSet<PermissionAttachmentInfo>(permissions.values());
}
--
2.18.0

View file

@ -1,4 +1,4 @@
From de17c631c117b92a3cb3256819347d169ed0225b Mon Sep 17 00:00:00 2001
From 3acadeb8f5cd933fd4103268cc19903601180d7f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 01:40:13 -0400
Subject: [PATCH] Add MinecraftKey Information to Objects
@ -6,7 +6,7 @@ Subject: [PATCH] Add MinecraftKey Information to Objects
Stores the reference to the objects respective MinecraftKey
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ed39b122ec..06c72b95f3 100644
index 87e08303..b11bb2a3 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -41,7 +41,7 @@ import org.bukkit.event.entity.EntityPortalEvent;
@ -18,7 +18,7 @@ index ed39b122ec..06c72b95f3 100644
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
@@ -1702,11 +1702,28 @@ public abstract class Entity implements ICommandListener {
@@ -1705,11 +1705,28 @@ public abstract class Entity implements ICommandListener {
return true;
}
@ -52,7 +52,7 @@ index ed39b122ec..06c72b95f3 100644
protected abstract void a(NBTTagCompound nbttagcompound);
diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java
new file mode 100644
index 0000000000..61c2b993c9
index 00000000..61c2b993
--- /dev/null
+++ b/src/main/java/net/minecraft/server/KeyedObject.java
@@ -0,0 +1,8 @@
@ -65,7 +65,7 @@ index 0000000000..61c2b993c9
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 5a5a588e7c..0176ca530c 100644
index 5a5a588e..0176ca53 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -7,7 +7,7 @@ import org.apache.logging.log4j.Logger;
@ -107,5 +107,5 @@ index 5a5a588e7c..0176ca530c 100644
}
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From a888d340ea17fc233b7d2e7e47f2eac246a71dbe Mon Sep 17 00:00:00 2001
From ef9dc7ddc60f9ce5456f7a6e5aa0b5a6e38eb0ed Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 02:10:36 -0400
Subject: [PATCH] Store reference to current Chunk for Entity and Block
@ -8,7 +8,7 @@ This enables us a fast reference to the entities current chunk instead
of having to look it up by hashmap lookups.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 4bbebb25af..f74ed3a143 100644
index ff030d98..d54cf9f8 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -25,7 +25,7 @@ public class Chunk {
@ -89,7 +89,7 @@ index 4bbebb25af..f74ed3a143 100644
// Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 06c72b95f3..0e3a94ab8c 100644
index b11bb2a3..2bb23c7b 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -121,7 +121,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -101,7 +101,7 @@ index 06c72b95f3..0e3a94ab8c 100644
public int ab; public int getChunkX() { return ab; } // Paper - OBFHELPER
public int ac; public int getChunkY() { return ac; } // Paper - OBFHELPER
public int ad; public int getChunkZ() { return ad; } // Paper - OBFHELPER
@@ -1703,6 +1703,38 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1706,6 +1706,38 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
// Paper start
@ -141,7 +141,7 @@ index 06c72b95f3..0e3a94ab8c 100644
private MinecraftKey entityKey = getMinecraftKey();
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 0176ca530c..29069b753e 100644
index 0176ca53..29069b75 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -28,6 +28,14 @@ public abstract class TileEntity implements KeyedObject {
@ -160,7 +160,7 @@ index 0176ca530c..29069b753e 100644
private MinecraftKey tileEntityKey = getMinecraftKey();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index c5a194ffea..833e3111de 100644
index c5a194ff..833e3111 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -9,6 +9,7 @@ import java.util.UUID;
@ -185,5 +185,5 @@ index c5a194ffea..833e3111de 100644
/**
* Order is *EXTREMELY* important -- keep it right! =D
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From 5e79bbc7dee8f1a2e42930e6899b7cf8e928b548 Mon Sep 17 00:00:00 2001
From 736cdf2368b8d0f95b7c643fa2766d9787378c10 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:55:47 -0400
Subject: [PATCH] MC Utils
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 952c96c0c..cbb1f2cae 100644
index 175ce12b..801dd26d 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -20,7 +20,7 @@ import org.bukkit.Server; // CraftBukkit
@ -26,7 +26,7 @@ index 952c96c0c..cbb1f2cae 100644
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
index 239440888..aafd23beb 100644
index 23944088..aafd23be 100644
--- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
+++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java
@@ -15,6 +15,8 @@ public class ChunkCoordIntPair {
@ -39,7 +39,7 @@ index 239440888..aafd23beb 100644
return (long) i & 4294967295L | ((long) j & 4294967295L) << 32;
}
diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
index 1f2fe87b6..2cb462b8e 100644
index 1f2fe87b..2cb462b8 100644
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
@@ -5,7 +5,7 @@ import javax.annotation.Nullable;
@ -52,7 +52,7 @@ index 1f2fe87b6..2cb462b8e 100644
protected DataPalette c;
private int e;
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index ba461ad48..2359b31f4 100644
index ba461ad4..2359b31f 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -13,6 +13,11 @@ import org.apache.logging.log4j.Logger;
@ -77,7 +77,7 @@ index ba461ad48..2359b31f4 100644
while (EntityTypes.g.size() <= i) {
EntityTypes.g.add(null); // Paper - Decompile fix
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 76bfbaa81..82d72ea15 100644
index 76bfbaa8..82d72ea1 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -14,6 +14,7 @@ import org.bukkit.Location;
@ -108,7 +108,7 @@ index 76bfbaa81..82d72ea15 100644
}
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
new file mode 100644
index 000000000..a4b0901cf
index 00000000..a4b0901c
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -0,0 +1,201 @@
@ -314,7 +314,7 @@ index 000000000..a4b0901cf
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index aa1ca6d91..e15c23367 100644
index aa1ca6d9..e15c2336 100644
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
@@ -22,7 +22,7 @@ public class NBTTagCompound extends NBTBase {
@ -341,7 +341,7 @@ index aa1ca6d91..e15c23367 100644
public UUID a(String s) {
return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least"));
diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java
index e0cb6aa6e..bc6383669 100644
index e0cb6aa6..bc638366 100644
--- a/src/main/java/net/minecraft/server/NBTTagList.java
+++ b/src/main/java/net/minecraft/server/NBTTagList.java
@@ -13,7 +13,7 @@ import org.apache.logging.log4j.Logger;
@ -354,7 +354,7 @@ index e0cb6aa6e..bc6383669 100644
public NBTTagList() {}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 8cede938a..cd2d58bfb 100644
index 8c604ef8..8efcb831 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -65,9 +65,9 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -370,7 +370,7 @@ index 8cede938a..cd2d58bfb 100644
// CraftBukkit start - multithreaded fields
private volatile int chatThrottle;
private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle");
@@ -2158,6 +2158,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2162,6 +2162,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
@ -379,5 +379,5 @@ index 8cede938a..cd2d58bfb 100644
return System.nanoTime() / 1000000L;
}
--
2.18.0
2.19.2

View file

@ -1,4 +1,4 @@
From 4892ce2583def9198563d017a95c06ef0d086e60 Mon Sep 17 00:00:00 2001
From 5c2b7e485fb417cedb926d24b98af63c462aa607 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2
@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
new file mode 100644
index 00000000..c6405aa1
index 000000000..baea97382
--- /dev/null
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -0,0 +1,128 @@
@ -63,7 +63,7 @@ index 00000000..c6405aa1
+ */
+ public static Timing getPluginTaskTimings(BukkitTask bukkitTask, long period) {
+ if (!bukkitTask.isSync()) {
+ return null;
+ return NullTimingHandler.NULL;
+ }
+ Plugin plugin;
+
@ -140,7 +140,7 @@ index 00000000..c6405aa1
+}
diff --git a/src/main/java/co/aikar/timings/TimedChunkGenerator.java b/src/main/java/co/aikar/timings/TimedChunkGenerator.java
new file mode 100644
index 00000000..089154f6
index 000000000..089154f62
--- /dev/null
+++ b/src/main/java/co/aikar/timings/TimedChunkGenerator.java
@@ -0,0 +1,131 @@
@ -277,7 +277,7 @@ index 00000000..089154f6
+}
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
new file mode 100644
index 00000000..e0ad559b
index 000000000..e0ad559b7
--- /dev/null
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
@@ -0,0 +1,99 @@
@ -381,7 +381,7 @@ index 00000000..e0ad559b
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 5ab2cf6e..b5795b6d 100644
index 5ab2cf6ee..b5795b6d3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -14,11 +14,14 @@ import java.util.concurrent.TimeUnit;
@ -425,7 +425,7 @@ index 5ab2cf6e..b5795b6d 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 2dca6dbc..35231096 100644
index 2dca6dbcb..352310960 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -35,6 +35,15 @@ public class Block {
@ -445,7 +445,7 @@ index 2dca6dbc..35231096 100644
public static int getId(Block block) {
return Block.REGISTRY.a(block); // CraftBukkit - decompile error
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 801dd26d..2c706f07 100644
index 801dd26d5..2c706f07e 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -938,7 +938,7 @@ public class Chunk {
@ -493,7 +493,7 @@ index 801dd26d..2c706f07 100644
private void z() {
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 86973cb9..bd006ef7 100644
index 86973cb98..bd006ef74 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -204,7 +204,7 @@ public class ChunkProviderServer implements IChunkProvider {
@ -506,7 +506,7 @@ index 86973cb9..bd006ef7 100644
this.chunkLoader.saveChunk(this.world, chunk, unloaded); // Spigot
} catch (IOException ioexception) {
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 50ec3adb..a401dec6 100644
index 50ec3adb8..a401dec60 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -423,7 +423,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@ -546,7 +546,7 @@ index 50ec3adb..a401dec6 100644
// return chunk; // CraftBukkit
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index e1cb96a8..8f2afcc3 100644
index e1cb96a88..8f2afcc32 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -24,7 +24,7 @@ import java.io.PrintStream;
@ -599,7 +599,7 @@ index e1cb96a8..8f2afcc3 100644
return waitable.get();
} catch (java.util.concurrent.ExecutionException e) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0e3a94ab..c8814396 100644
index 2bb23c7b2..375f9d03f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -25,7 +25,8 @@ import org.bukkit.block.BlockFace;
@ -621,7 +621,7 @@ index 0e3a94ab..c8814396 100644
// Spigot start
public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
@@ -531,7 +532,6 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -532,7 +533,6 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
public void move(EnumMoveType enummovetype, double d0, double d1, double d2) {
@ -629,7 +629,7 @@ index 0e3a94ab..c8814396 100644
if (this.noclip) {
this.a(this.getBoundingBox().d(d0, d1, d2));
this.recalcPosition();
@@ -925,7 +925,6 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -926,7 +926,6 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
this.world.methodProfiler.b();
}
@ -638,7 +638,7 @@ index 0e3a94ab..c8814396 100644
public void recalcPosition() {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 0026f29d..d15cfdd7 100644
index 0026f29d5..d15cfdd76 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -31,7 +31,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
@ -709,7 +709,7 @@ index 0026f29d..d15cfdd7 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index ce012402..a60f9460 100644
index ce0124020..a60f94608 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -175,7 +175,7 @@ public class EntityTracker {
@ -740,7 +740,7 @@ index ce012402..a60f9460 100644
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c1a8816b..8d08b536 100644
index c1a8816b4..8d08b536a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -48,8 +48,8 @@ import org.bukkit.Bukkit;
@ -887,7 +887,7 @@ index c1a8816b..8d08b536 100644
this.methodProfiler.b();
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index eeac3499..e4ed2e99 100644
index eeac34998..e4ed2e991 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1,5 +1,6 @@
@ -987,7 +987,7 @@ index eeac3499..e4ed2e99 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index ec3e0833..dacf9261 100644
index 8efcb8317..27a6d1e20 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -56,6 +56,7 @@ import org.bukkit.inventory.CraftingInventory;
@ -998,7 +998,23 @@ index ec3e0833..dacf9261 100644
// CraftBukkit end
public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1378,7 +1379,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -135,7 +136,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit end
public void e() {
- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.startTiming(); // Spigot
this.syncPosition();
this.player.playerTick();
this.player.setLocation(this.l, this.m, this.n, this.player.yaw, this.player.pitch);
@@ -208,7 +208,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854
this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0]));
}
- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.stopTiming(); // Spigot
}
@@ -1382,7 +1381,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit end
private void handleCommand(String s) {
@ -1007,7 +1023,7 @@ index ec3e0833..dacf9261 100644
// CraftBukkit start - whole method
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getName() + " issued server command: " + s);
@@ -1389,22 +1390,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1393,22 +1392,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -1035,7 +1051,7 @@ index ec3e0833..dacf9261 100644
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
index f74b0679..1fc632e0 100644
index f74b06794..1fc632e0c 100644
--- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
+++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java
@@ -1,15 +1,21 @@
@ -1065,7 +1081,7 @@ index f74b0679..1fc632e0 100644
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index d4acbed0..1d9f3e3d 100644
index d4acbed0c..1d9f3e3dd 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1,5 +1,6 @@
@ -1089,7 +1105,7 @@ index d4acbed0..1d9f3e3d 100644
public void addWhitelist(GameProfile gameprofile) {
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index 74e3f42c..66a80a77 100644
index 74e3f42cd..66a80a776 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -1,5 +1,7 @@
@ -1131,7 +1147,7 @@ index 74e3f42c..66a80a77 100644
return flag;
}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 29069b75..081e56f4 100644
index 29069b753..081e56f48 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -4,12 +4,13 @@ import javax.annotation.Nullable;
@ -1151,7 +1167,7 @@ index 29069b75..081e56f4 100644
private static final RegistryMaterials<MinecraftKey, Class<? extends TileEntity>> f = new RegistryMaterials();
protected World world;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 843320ff..d902e263 100644
index 843320ffb..d902e2630 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -19,11 +19,11 @@ import com.google.common.collect.Maps;
@ -1257,7 +1273,7 @@ index 843320ff..d902e263 100644
public boolean b(AxisAlignedBB axisalignedbb) {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index c891629b..95964c55 100644
index c891629bd..95964c550 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -308,13 +308,13 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -1391,7 +1407,7 @@ index c891629b..95964c55 100644
// CraftBukkit start
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 14851a3a..9042deed 100644
index 14851a3a5..9042deed6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1756,12 +1756,31 @@ public final class CraftServer implements Server {
@ -1428,10 +1444,10 @@ index 14851a3a..9042deed 100644
org.spigotmc.RestartCommand.restart();
diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
deleted file mode 100644
index 4c8ab2bc..00000000
index 666d1eb9e..000000000
--- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java
+++ /dev/null
@@ -1,174 +0,0 @@
@@ -1,175 +0,0 @@
-package org.bukkit.craftbukkit;
-
-import com.google.common.collect.Maps;
@ -1451,6 +1467,7 @@ index 4c8ab2bc..00000000
- public static final CustomTimingsHandler playerListTimer = new CustomTimingsHandler("Player List");
- public static final CustomTimingsHandler commandFunctionsTimer = new CustomTimingsHandler("Command Functions");
- public static final CustomTimingsHandler connectionTimer = new CustomTimingsHandler("Connection Handler");
- public static final CustomTimingsHandler playerConnectionTimer = new CustomTimingsHandler("** PlayerConnection");
- public static final CustomTimingsHandler tickablesTimer = new CustomTimingsHandler("Tickables");
- public static final CustomTimingsHandler schedulerTimer = new CustomTimingsHandler("Scheduler");
- public static final CustomTimingsHandler chunkIOTickTimer = new CustomTimingsHandler("ChunkIOTick");
@ -1607,7 +1624,7 @@ index 4c8ab2bc..00000000
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
index 3a95b446..b5efb9c3 100644
index 3a95b4465..b5efb9c3f 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
@@ -1,6 +1,8 @@
@ -1651,7 +1668,7 @@ index 3a95b446..b5efb9c3 100644
public void callStage3(QueuedChunk queuedChunk, Chunk chunk, Runnable runnable) throws RuntimeException {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 137b101a..cd99801f 100644
index 137b101a7..cd99801ff 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -41,7 +41,7 @@ import org.bukkit.configuration.serialization.DelegateDeserialization;
@ -1677,7 +1694,7 @@ index 137b101a..cd99801f 100644
public Player.Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index f11bd754..93b9134d 100644
index f11bd7545..93b9134d6 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -14,6 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@ -1753,12 +1770,13 @@ index f11bd754..93b9134d 100644
private boolean isReady(final int currentTick) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
index 7e7ce9a8..46029ce2 100644
index 7e7ce9a81..70252ef30 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
@@ -1,8 +1,8 @@
@@ -1,8 +1,9 @@
package org.bukkit.craftbukkit.scheduler;
+import co.aikar.timings.NullTimingHandler;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
-import org.spigotmc.CustomTimingsHandler; // Spigot
@ -1767,7 +1785,7 @@ index 7e7ce9a8..46029ce2 100644
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitTask;
@@ -25,11 +25,11 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@@ -25,11 +26,11 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
*/
private volatile long period;
private long nextRun;
@ -1781,7 +1799,7 @@ index 7e7ce9a8..46029ce2 100644
CraftTask() {
this(null, null, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING);
}
@@ -38,26 +38,12 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@@ -38,26 +39,12 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
this(null, task, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING);
}
@ -1806,21 +1824,22 @@ index 7e7ce9a8..46029ce2 100644
- CraftTask(final Plugin plugin, final Runnable task, final int id, final long period) {
- this(null, plugin, task, id, period);
- // Spigot end
+ timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : null; // Paper
+ timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : NullTimingHandler.NULL; // Paper
}
public final int getTaskId() {
@@ -73,7 +59,9 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@@ -73,7 +60,9 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
}
public void run() {
+ if (timings != null && isSync()) timings.startTiming(); // Paper
task.run();
+ if (timings != null && isSync()) timings.stopTiming(); // Paper
- task.run();
+ try (Timing ignored = timings.startTiming()) { // Paper
+ task.run();
+ } // Paper
}
long getPeriod() {
@@ -122,13 +110,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
@@ -122,13 +111,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
setPeriod(CraftTask.CANCEL);
return true;
}
@ -1835,7 +1854,7 @@ index 7e7ce9a8..46029ce2 100644
- // Spigot end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
index e52ef47b..3d90b342 100644
index e52ef47b7..3d90b3426 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java
@@ -5,6 +5,7 @@ import org.bukkit.util.CachedServerIcon;
@ -1847,7 +1866,7 @@ index e52ef47b..3d90b342 100644
this.value = value;
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 2bd690fd..38be7ed7 100644
index 2bd690fdf..38be7ed71 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -29,7 +29,7 @@ import net.minecraft.server.EntityWither;
@ -1909,5 +1928,5 @@ index 2bd690fd..38be7ed7 100644
}
}
--
2.16.1.windows.4
2.21.0

View file

@ -1,11 +1,11 @@
From 3245f2a838cecf17e9f9a315f5435b8a0c08ae48 Mon Sep 17 00:00:00 2001
From c92e98c74584715f42cdf0b959f3dae0e77d85b4 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 14:14:15 -0600
Subject: [PATCH] Drop falling block and tnt entities at the specified height
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0094d1a87d..4da846719d 100644
index 0094d1a8..4da84671 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -113,4 +113,14 @@ public class PaperWorldConfig {
@ -24,10 +24,10 @@ index 0094d1a87d..4da846719d 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 459bdbd6ec..335d2ce4cb 100644
index 375f9d03..c94b3416 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1799,6 +1799,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1802,6 +1802,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
return this.a(new ItemStack(item, i, 0), f);
}
@ -36,7 +36,7 @@ index 459bdbd6ec..335d2ce4cb 100644
public EntityItem a(ItemStack itemstack, float f) {
if (itemstack.isEmpty()) {
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 579e51a0aa..2ba5d51a5f 100644
index 579e51a0..2ba5d51a 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -84,6 +84,17 @@ public class EntityFallingBlock extends Entity {
@ -58,7 +58,7 @@ index 579e51a0aa..2ba5d51a5f 100644
blockposition = new BlockPosition(this);
boolean flag = this.block.getBlock() == Blocks.dS;
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 44b2d47351..0d70dd1d22 100644
index 44b2d473..0d70dd1d 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -57,6 +57,13 @@ public class EntityTNTPrimed extends Entity {
@ -76,5 +76,5 @@ index 44b2d47351..0d70dd1d22 100644
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From 40d24e0192a049584a4c70c8474ae23346e50f2d Mon Sep 17 00:00:00 2001
From dcec603731b64e91c8ea46cffff1039bd69170bf Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 23:45:08 -0600
Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 335d2ce4cb..cea987f33e 100644
index c94b3416..89c36a92 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -149,6 +149,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -16,7 +16,7 @@ index 335d2ce4cb..cea987f33e 100644
// Spigot start
public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
@@ -1545,6 +1546,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1548,6 +1549,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
}
@ -28,7 +28,7 @@ index 335d2ce4cb..cea987f33e 100644
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
@@ -1688,6 +1694,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1691,6 +1697,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
// CraftBukkit end
@ -42,7 +42,7 @@ index 335d2ce4cb..cea987f33e 100644
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1761,6 +1774,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1764,6 +1777,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
protected abstract void b(NBTTagCompound nbttagcompound);
@ -51,7 +51,7 @@ index 335d2ce4cb..cea987f33e 100644
NBTTagList nbttaglist = new NBTTagList();
double[] adouble1 = adouble;
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 2ba5d51a5f..abdc2dea9b 100644
index 2ba5d51a..abdc2dea 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -267,6 +267,14 @@ public class EntityFallingBlock extends Entity {
@ -70,7 +70,7 @@ index 2ba5d51a5f..abdc2dea9b 100644
public void a(boolean flag) {
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 0d70dd1d22..bb0904f865 100644
index 0d70dd1d..bb0904f8 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -109,6 +109,14 @@ public class EntityTNTPrimed extends Entity {
@ -89,7 +89,7 @@ index 0d70dd1d22..bb0904f865 100644
@Nullable
diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java
index bc6383669e..ca9eb2f3b2 100644
index bc638366..ca9eb2f3 100644
--- a/src/main/java/net/minecraft/server/NBTTagList.java
+++ b/src/main/java/net/minecraft/server/NBTTagList.java
@@ -153,6 +153,7 @@ public class NBTTagList extends NBTBase {
@ -101,7 +101,7 @@ index bc6383669e..ca9eb2f3b2 100644
if (i >= 0 && i < this.list.size()) {
NBTBase nbtbase = (NBTBase) this.list.get(i);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 26d4bd690b..31b765deaf 100644
index 26d4bd69..31b765de 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1071,6 +1071,12 @@ public abstract class World implements IBlockAccess {
@ -118,7 +118,7 @@ index 26d4bd690b..31b765deaf 100644
flag = true;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 833e3111de..6c23e88a54 100644
index 833e3111..6c23e88a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -761,4 +761,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -135,5 +135,5 @@ index 833e3111de..6c23e88a54 100644
+ // Paper end
}
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From 449eb3fe46c8082e18636765fd22ab8a9be1b4ca Mon Sep 17 00:00:00 2001
From a53e95b80e0de45aa9c636353c213ae43fedab19 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 23:58:50 -0600
Subject: [PATCH] Configurable top of nether void damage
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d3484489b..bf7af475c 100644
index d3484489..bf7af475 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -129,4 +129,10 @@ public class PaperWorldConfig {
@ -20,10 +20,10 @@ index d3484489b..bf7af475c 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 011cf59c0..296bdfba5 100644
index 89c36a92..6ee359e1 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -450,9 +450,15 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -451,9 +451,15 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
this.fallDistance *= 0.5F;
}
@ -39,7 +39,7 @@ index 011cf59c0..296bdfba5 100644
if (!this.world.isClientSide) {
this.setFlag(0, this.fireTicks > 0);
@@ -462,6 +468,18 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -463,6 +469,18 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
this.world.methodProfiler.b();
}
@ -58,7 +58,7 @@ index 011cf59c0..296bdfba5 100644
protected void I() {
if (this.portalCooldown > 0) {
--this.portalCooldown;
@@ -518,6 +536,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -519,6 +537,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
this.fireTicks = 0;
}
@ -67,7 +67,7 @@ index 011cf59c0..296bdfba5 100644
this.die();
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
index a9412d4e0..1f4025486 100644
index a9412d4e..1f402548 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
@@ -204,9 +204,15 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT
@ -87,5 +87,5 @@ index a9412d4e0..1f4025486 100644
int i;
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From c7b0d45e95bb420f3051f4bde3d28fc8d584a03a Mon Sep 17 00:00:00 2001
From 39f3432523b5ebe768a66a6939120854f169d185 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 01:17:12 -0600
Subject: [PATCH] Ensure commands are not ran async
@ -14,10 +14,10 @@ big slowdown in execution but throwing an exception at same time to raise awaren
that it is happening so that plugin authors can fix their code to stop executing commands async.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index da25a8bea..48379f414 100644
index 4174fbfd..44a3776e 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1311,6 +1311,29 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1313,6 +1313,29 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
if (!async && s.startsWith("/")) {
@ -48,7 +48,7 @@ index da25a8bea..48379f414 100644
} else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) {
// Do nothing, this is coming from a plugin
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bfddd1685..462ad1024 100644
index bfddd168..462ad102 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -645,6 +645,29 @@ public final class CraftServer implements Server {
@ -82,7 +82,7 @@ index bfddd1685..462ad1024 100644
return true;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
index a0cdd2317..984df4083 100644
index a0cdd231..984df408 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
@@ -14,6 +14,7 @@ public class ServerShutdownThread extends Thread {
@ -94,7 +94,7 @@ index a0cdd2317..984df4083 100644
} catch (ExceptionWorldConflict ex) {
ex.printStackTrace();
diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java
index 4b3aa85c9..e44c23016 100644
index 4b3aa85c..e44c2301 100644
--- a/src/main/java/org/spigotmc/AsyncCatcher.java
+++ b/src/main/java/org/spigotmc/AsyncCatcher.java
@@ -6,6 +6,7 @@ public class AsyncCatcher
@ -106,7 +106,7 @@ index 4b3aa85c9..e44c23016 100644
public static void catchOp(String reason)
{
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
index 49768734d..947c43a5d 100644
index 49768734..947c43a5 100644
--- a/src/main/java/org/spigotmc/RestartCommand.java
+++ b/src/main/java/org/spigotmc/RestartCommand.java
@@ -43,6 +43,7 @@ public class RestartCommand extends Command
@ -118,5 +118,5 @@ index 49768734d..947c43a5d 100644
{
if ( script.isFile() )
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 6ceadeb266a7fc9a4a41c7819ce49ec3e034b39c Mon Sep 17 00:00:00 2001
From 1f25a64e8de47c04bf521861d9b57662227ac759 Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event
@ -6,7 +6,7 @@ Subject: [PATCH] Add exception reporting event
diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
new file mode 100644
index 000000000..93397188b
index 00000000..93397188
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java
@@ -0,0 +1,38 @@
@ -50,7 +50,7 @@ index 000000000..93397188b
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 08d6ef09a..d5ef4ed0e 100644
index c79d3a93..65952ea9 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,6 @@
@ -89,7 +89,7 @@ index 08d6ef09a..d5ef4ed0e 100644
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 2b320cbd1..4e7e8e5fd 100644
index 2b320cbd..4e7e8e5f 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -12,6 +12,7 @@ import java.util.Iterator;
@ -144,7 +144,7 @@ index 2b320cbd1..4e7e8e5fd 100644
}
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
index 83322b85b..b943a9b20 100644
index 83322b85..b943a9b2 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -1,5 +1,7 @@
@ -172,7 +172,7 @@ index 83322b85b..b943a9b20 100644
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java
index 936d6c640..50056f49a 100644
index 936d6c64..50056f49 100644
--- a/src/main/java/net/minecraft/server/PersistentCollection.java
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
@@ -1,5 +1,6 @@
@ -199,7 +199,7 @@ index 936d6c640..50056f49a 100644
}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 1ba26de5c..6a92b5af8 100644
index c13e1eef..d2f08802 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -1,5 +1,6 @@
@ -209,7 +209,7 @@ index 1ba26de5c..6a92b5af8 100644
import com.google.common.collect.Lists;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -82,6 +83,7 @@ public class RegionFile {
@@ -103,6 +104,7 @@ public class RegionFile {
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
@ -217,7 +217,7 @@ index 1ba26de5c..6a92b5af8 100644
}
}
@@ -209,6 +211,7 @@ public class RegionFile {
@@ -247,6 +249,7 @@ public class RegionFile {
this.b(i, j, (int) (MinecraftServer.aw() / 1000L));
} catch (IOException ioexception) {
ioexception.printStackTrace();
@ -226,7 +226,7 @@ index 1ba26de5c..6a92b5af8 100644
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index c15a0d1f8..5f9e9ddef 100644
index c15a0d1f..5f9e9dde 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -1,5 +1,6 @@
@ -245,7 +245,7 @@ index c15a0d1f8..5f9e9ddef 100644
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 1c7c187c7..68a045323 100644
index 1c7c187c..68a04532 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -7,6 +7,7 @@ import java.util.Random;
@ -273,7 +273,7 @@ index 1c7c187c7..68a045323 100644
}
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 9ff4f23ab..6fce3015f 100644
index 9ff4f23a..6fce3015 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -1,5 +1,7 @@
@ -293,7 +293,7 @@ index 9ff4f23ab..6fce3015f 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 89197281e..6be9c1815 100644
index 89197281..6be9c181 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1,5 +1,7 @@
@ -329,7 +329,7 @@ index 89197281e..6be9c1815 100644
this.tileEntityListTick.remove(tileTickPosition--);
continue;
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 93b9134d6..26753fac5 100644
index 93b9134d..26753fac 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -15,6 +15,9 @@ import java.util.concurrent.atomic.AtomicReference;
@ -375,5 +375,5 @@ index 93b9134d6..26753fac5 100644
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
--
2.18.0
2.20.1

View file

@ -1,4 +1,4 @@
From e974cc2dc77b8e3ca057231ad712724603872f56 Mon Sep 17 00:00:00 2001
From 31b9eb4ce4fbadbc9629a9356e3619055f359597 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 8 Mar 2016 23:25:45 -0500
Subject: [PATCH] Disable Scoreboards for non players by default
@ -11,7 +11,7 @@ So avoid looking up scoreboards and short circuit to the "not on a team"
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
index b241c0380d..a4c94845b8 100644
index b241c038..a4c94845 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -242,4 +242,9 @@ public class PaperWorldConfig {
@ -25,7 +25,7 @@ index b241c0380d..a4c94845b8 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/CommandScoreboard.java b/src/main/java/net/minecraft/server/CommandScoreboard.java
index ec9a87239a..b08274d933 100644
index ec9a8723..b08274d9 100644
--- a/src/main/java/net/minecraft/server/CommandScoreboard.java
+++ b/src/main/java/net/minecraft/server/CommandScoreboard.java
@@ -492,6 +492,7 @@ public class CommandScoreboard extends CommandAbstract {
@ -37,10 +37,10 @@ index ec9a87239a..b08274d933 100644
if (scoreboard.addPlayerToTeam(s2, s)) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9d6e684d26..a03a809d61 100644
index 6ee359e1..2e01cef8 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2128,6 +2128,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2131,6 +2131,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@Nullable
public ScoreboardTeamBase aY() {
@ -49,5 +49,5 @@ index 9d6e684d26..a03a809d61 100644
}
--
2.18.0
2.19.1

View file

@ -1,14 +1,14 @@
From 6d5516f22451507fd10a9d2c8d2717f9f6a560f0 Mon Sep 17 00:00:00 2001
From 2cc03fda9ab1582faf46d09746a90e70a67a6b6f Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 4 Apr 2015 23:17:52 -0400
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
index 060301da6..d23fe82db 100644
index 44a3776e..9f6f93ee 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1067,7 +1067,12 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1069,7 +1069,12 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit start
public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {
PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.x());
@ -23,7 +23,7 @@ index 060301da6..d23fe82db 100644
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 18a481f2f..ff4512060 100644
index 18a481f2..ff451206 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -88,6 +88,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -71,5 +71,5 @@ index 18a481f2f..ff4512060 100644
private final Player.Spigot spigot = new Player.Spigot()
{
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From bc3a702f71fbd98ac83d02992c8df88a9207e765 Mon Sep 17 00:00:00 2001
From 98431cfef4644e54f94e1379dce74e6648c497b9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 4 Mar 2013 23:46:10 -0500
Subject: [PATCH] Chunk Save Reattempt
@ -6,7 +6,7 @@ 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.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 4c3faa201..12bd558a7 100644
index 4c3faa20..12bd558a 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -194,11 +194,16 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@ -28,10 +28,10 @@ index 4c3faa201..12bd558a7 100644
synchronized (lock) { if (this.b.get(chunkcoordintpair) == chunk.compoundSupplier) { this.b.remove(chunkcoordintpair); } }// Paper - This will not equal if a newer version is still pending
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 6a92b5af8..5bcbd718f 100644
index d2f08802..c3424a35 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -210,8 +210,7 @@ public class RegionFile {
@@ -248,8 +248,7 @@ public class RegionFile {
this.b(i, j, (int) (MinecraftServer.aw() / 1000L));
} catch (IOException ioexception) {
@ -42,5 +42,5 @@ index 6a92b5af8..5bcbd718f 100644
}
--
2.18.0
2.20.1

View file

@ -1,4 +1,4 @@
From 92be596a29c450456eb1ff4aba0306aa090999ff Mon Sep 17 00:00:00 2001
From da24ab81746b90d16975a35a9be70516fa0da6c9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 22 Mar 2016 00:55:23 -0400
Subject: [PATCH] Don't teleport dead entities
@ -7,10 +7,10 @@ Had some issue with this in past, and this is the vanilla logic.
Potentially an old CB change that's no longer needed.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ff854e1ab9..fd193bbece 100644
index 44e037e7..a3d4da98 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2417,7 +2417,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2420,7 +2420,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
public Entity teleportTo(Location exit, boolean portal) {
@ -20,5 +20,5 @@ index ff854e1ab9..fd193bbece 100644
WorldServer worldserver1 = ((CraftWorld) exit.getWorld()).getHandle();
int i = worldserver1.dimension;
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From b4237ef0e075d98a14b87bfd673d34b96cb1d966 Mon Sep 17 00:00:00 2001
From 65277bb5c79ac221f24ca1bded6e71b69f559815 Mon Sep 17 00:00:00 2001
From: Antony Riley <antony@cyberiantiger.org>
Date: Tue, 29 Mar 2016 06:56:23 +0300
Subject: [PATCH] Reduce IO ops opening a new region file.
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 5bcbd718f..2bd85e2d1 100644
index c3424a35..eac8b22b 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -8,9 +8,12 @@ import java.io.ByteArrayInputStream;
@ -21,7 +21,7 @@ index 5bcbd718f..2bd85e2d1 100644
import java.util.List;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.GZIPInputStream;
@@ -67,8 +70,16 @@ public class RegionFile {
@@ -72,8 +75,16 @@ public class RegionFile {
int k;
@ -37,9 +37,9 @@ index 5bcbd718f..2bd85e2d1 100644
- k = this.c.readInt();
+ k = headerAsInts.get(); // Paper
this.d[j] = k;
if (k != 0 && (k >> 8) + (k & 255) <= this.f.size()) {
for (int l = 0; l < (k & 255); ++l) {
@@ -78,7 +89,7 @@ public class RegionFile {
// Spigot start
int length = k & 255;
@@ -99,7 +110,7 @@ public class RegionFile {
}
for (j = 0; j < 1024; ++j) {
@ -49,5 +49,5 @@ index 5bcbd718f..2bd85e2d1 100644
}
} catch (IOException ioexception) {
--
2.18.0
2.20.1

View file

@ -1,11 +1,11 @@
From 7ab10243bd61164ab6a53c0753019ad649d244ce Mon Sep 17 00:00:00 2001
From 7f8b073f31114e50f4270dd03042b5f37019fb3c Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 2 Apr 2016 05:09:16 -0400
Subject: [PATCH] Add PlayerUseUnknownEntityEvent
diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
index c67cb54a3..521f46262 100644
index c67cb54a..521f4626 100644
--- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
+++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java
@@ -5,7 +5,7 @@ import javax.annotation.Nullable;
@ -18,10 +18,10 @@ index c67cb54a3..521f46262 100644
private Vec3D c;
private EnumHand d;
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e1b85ebae..7c708a0de 100644
index 9f6f93ee..abb7caa8 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1657,6 +1657,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1659,6 +1659,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
}
}
@ -39,5 +39,5 @@ index e1b85ebae..7c708a0de 100644
}
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From e460a38fa7693771218e49ab68a7de69492de0e9 Mon Sep 17 00:00:00 2001
From 46295cf34cd1bef4e4fd5ac70f3f33b714149af3 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 6 Apr 2016 01:04:23 -0500
Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index abc1aabdd8..6ea608ba9a 100644
index abc1aabd..6ea608ba 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -288,4 +288,9 @@ public class PaperWorldConfig {
@ -19,10 +19,10 @@ index abc1aabdd8..6ea608ba9a 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index fd193bbece..89e42c0a46 100644
index a3d4da98..61d2d91c 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2140,6 +2140,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2143,6 +2143,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
return this.getFlag(5);
}
@ -31,10 +31,10 @@ index fd193bbece..89e42c0a46 100644
public ScoreboardTeamBase aY() {
if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index ba1cc267e6..2b81629170 100644
index abb7caa8..70b59ee9 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1390,7 +1390,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1392,7 +1392,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
return;
}
@ -51,5 +51,5 @@ index ba1cc267e6..2b81629170 100644
if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
for (Object recipient : minecraftServer.getPlayerList().players) {
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From e834b8fc7de6fc3a3460176d2c23e77d3c5afce3 Mon Sep 17 00:00:00 2001
From 553d60de49239338485f8c345535b4855e14d276 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 18:20:05 -0500
Subject: [PATCH] Vehicle Event Cancellation Changes
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 89e42c0a46..86b783e73b 100644
index 61d2d91c..f82c0546 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -83,7 +83,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -17,7 +17,7 @@ index 89e42c0a46..86b783e73b 100644
public boolean attachedToPlayer;
public World world;
public double lastX;
@@ -2022,6 +2022,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2025,6 +2025,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
// CraftBukkit start
@ -25,7 +25,7 @@ index 89e42c0a46..86b783e73b 100644
CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
Entity orig = craft == null ? null : craft.getHandle();
if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
@@ -2037,7 +2038,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2040,7 +2041,13 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
}
// CraftBukkit end
@ -41,5 +41,5 @@ index 89e42c0a46..86b783e73b 100644
entity.j = 60;
}
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From e390dbccabd0c678c953bc4769e771a54e4c38bb Mon Sep 17 00:00:00 2001
From 884fab422d699408349283afb783f45eaa11b701 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 1 May 2016 21:19:14 -0400
Subject: [PATCH] LootTable API & Replenishable Lootables Feature
@ -11,7 +11,7 @@ This feature is good for long term worlds so that newer players
do not suffer with "Every chest has been looted"
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d96311f6b..067cb233e 100644
index d96311f6..067cb233 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -303,4 +303,26 @@ public class PaperWorldConfig {
@ -43,7 +43,7 @@ index d96311f6b..067cb233e 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootable.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootable.java
new file mode 100644
index 000000000..36c36d158
index 00000000..36c36d15
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootable.java
@@ -0,0 +1,12 @@
@ -61,7 +61,7 @@ index 000000000..36c36d158
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableBlockInventory.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableBlockInventory.java
new file mode 100644
index 000000000..20d236c45
index 00000000..20d236c4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableBlockInventory.java
@@ -0,0 +1,33 @@
@ -100,7 +100,7 @@ index 000000000..20d236c45
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableEntityInventory.java
new file mode 100644
index 000000000..1150dee01
index 00000000..1150dee0
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableEntityInventory.java
@@ -0,0 +1,31 @@
@ -137,7 +137,7 @@ index 000000000..1150dee01
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventory.java
new file mode 100644
index 000000000..668097620
index 00000000..66809762
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventory.java
@@ -0,0 +1,88 @@
@ -231,7 +231,7 @@ index 000000000..668097620
+}
diff --git a/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java
new file mode 100644
index 000000000..de2eff17e
index 00000000..be4b53b4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/loottable/CraftLootableInventoryData.java
@@ -0,0 +1,182 @@
@ -287,8 +287,8 @@ index 000000000..de2eff17e
+ return false;
+ }
+
+ // ALWAYS process the first fill
+ if (this.lastFill == -1) {
+ // ALWAYS process the first fill or if the feature is disabled
+ if (this.lastFill == -1 || !this.lootable.getNMSWorld().paperConfig.autoReplenishLootables) {
+ return true;
+ }
+
@ -418,7 +418,7 @@ index 000000000..de2eff17e
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
index d6afa4aa6..50d7d34b8 100644
index d6afa4aa..50d7d34b 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
@@ -6,17 +6,21 @@ import javax.annotation.Nullable;
@ -540,8 +540,28 @@ index d6afa4aa6..50d7d34b8 100644
+ }
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 5047a57e..eae31653 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -229,6 +229,15 @@ public final class ItemStack {
enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement
// PAIL: Remove this when MC-99075 fixed
placeEvent.getPlayer().updateInventory();
+
+ // Paper start
+ for (Map.Entry<BlockPosition, TileEntity> e : world.capturedTileEntities.entrySet()) {
+ if (e.getValue() instanceof TileEntityLootable) {
+ ((TileEntityLootable) e.getValue()).clearLootTable();
+ }
+ }
+ // Paper end
+
// revert back all captured blocks
for (BlockState blockstate : blocks) {
blockstate.update(true, false);
diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java
index a97ad2037..618521304 100644
index a97ad203..61852130 100644
--- a/src/main/java/net/minecraft/server/TileEntityLootable.java
+++ b/src/main/java/net/minecraft/server/TileEntityLootable.java
@@ -1,44 +1,50 @@
@ -658,7 +678,7 @@ index a97ad2037..618521304 100644
+
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 8328ed005..266f87d7f 100644
index 8328ed00..266f87d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -60,7 +60,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
@ -671,7 +691,7 @@ index 8328ed005..266f87d7f 100644
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
index 85f3bb272..733c04ef7 100644
index 85f3bb27..733c04ef 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
@@ -1,5 +1,6 @@
@ -691,7 +711,7 @@ index 85f3bb272..733c04ef7 100644
public CraftChest(final Block block) {
super(block, TileEntityChest.class);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
index 1dc8bfecd..bfcf9b6c4 100644
index 1dc8bfec..bfcf9b6c 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java
@@ -1,5 +1,6 @@
@ -711,7 +731,7 @@ index 1dc8bfecd..bfcf9b6c4 100644
public CraftDispenser(final Block block) {
super(block, TileEntityDispenser.class);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
index 6566554ab..df156d0d9 100644
index 6566554a..df156d0d 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java
@@ -1,5 +1,6 @@
@ -731,7 +751,7 @@ index 6566554ab..df156d0d9 100644
public CraftHopper(final Block block) {
super(block, TileEntityHopper.class);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
index c029a1244..c26f0b5af 100644
index c029a124..c26f0b5a 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
@@ -1,5 +1,6 @@
@ -751,7 +771,7 @@ index c029a1244..c26f0b5af 100644
public CraftShulkerBox(final Block block) {
super(block, TileEntityShulkerBox.class);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
index 69435c457..4291edf25 100644
index 69435c45..4291edf2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java
@@ -1,5 +1,6 @@
@ -771,7 +791,7 @@ index 69435c457..4291edf25 100644
public CraftMinecartChest(CraftServer server, EntityMinecartChest entity) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
index e9963e21c..acb4dee04 100644
index e9963e21..acb4dee0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
@@ -1,5 +1,6 @@
@ -791,5 +811,5 @@ index e9963e21c..acb4dee04 100644
CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) {
--
2.18.0
2.20.1

View file

@ -1,11 +1,11 @@
From c75aa93b1c1e98ce0d1f87d73720311182848d68 Mon Sep 17 00:00:00 2001
From 2f2a111c6c9d153926439214dd99d853f17bc87a Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 22 May 2016 20:20:55 -0500
Subject: [PATCH] Optional TNT doesn't move in water
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 067cb233e4..06acdaaf04 100644
index 067cb233..06acdaaf 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -2,7 +2,6 @@ package com.destroystokyo.paper;
@ -32,10 +32,10 @@ index 067cb233e4..06acdaaf04 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0456cda937..2fbe17ce9d 100644
index 360ac7b3..7284539f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1127,6 +1127,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1129,6 +1129,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
public boolean aq() {
@ -47,7 +47,7 @@ index 0456cda937..2fbe17ce9d 100644
if (this.bJ() instanceof EntityBoat) {
this.inWater = false;
} else if (this.world.a(this.getBoundingBox().grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D), Material.WATER, this)) {
@@ -2605,6 +2610,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2608,6 +2613,11 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
public boolean bo() {
@ -60,7 +60,7 @@ index 0456cda937..2fbe17ce9d 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index bb0904f865..50811852a3 100644
index bb0904f8..50811852 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -147,4 +147,49 @@ public class EntityTNTPrimed extends Entity {
@ -114,5 +114,5 @@ index bb0904f865..50811852a3 100644
+ // Paper end
}
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From 7d692b1b168fdc8a7d3d1394bb6d58f59de98053 Mon Sep 17 00:00:00 2001
From f9bb45ae0c2d1b8a8dbc7c6b8068e055e479b375 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 28 Jul 2016 17:58:53 -0500
Subject: [PATCH] More informative vehicle moved wrongly message
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 9eb7b012f..e66584deb 100644
index 70b59ee9..f4df7902 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -357,7 +357,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -15,8 +15,8 @@ index 9eb7b012f..e66584deb 100644
- PlayerConnection.LOGGER.warn("{} moved wrongly!", entity.getName());
+ PlayerConnection.LOGGER.warn(entity.getName() + " (vehicle of " + this.player.getName() + ") moved wrongly!"); // Paper - More informative
}
Location curPos = this.getPlayer().getLocation(); // Spigot
entity.setLocation(d3, d4, d5, f, f1);
--
2.18.0
2.19.1

View file

@ -1,14 +1,14 @@
From ccc20dcc8957311e38f8f1d350e01e9f3ec46d9f Mon Sep 17 00:00:00 2001
From c13cb79830f413ab41f9fa83dd8b7501cb592420 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Sun, 4 Sep 2016 16:35:43 -0500
Subject: [PATCH] Fix AIOOBE in inventory handling
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e66584deb..f5fb86414 100644
index f4df7902..bace6717 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1849,7 +1849,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1851,7 +1851,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
case CLONE:
if (packetplayinwindowclick.c() == 2) {
click = ClickType.MIDDLE;
@ -18,5 +18,5 @@ index e66584deb..f5fb86414 100644
} else {
Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.b());
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From fc0280fe1ab9b4a8eff7c35bb03792e00440b736 Mon Sep 17 00:00:00 2001
From 23f7a0764c4d1b7fda2cfe35a2048eca08ac37b6 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 11 Sep 2016 14:30:57 -0500
Subject: [PATCH] Configurable packet in spam threshold
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index cf06f8ac3..2001175bf 100644
index cf06f8ac..2001175b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -235,4 +235,13 @@ public class PaperConfig {
@ -23,10 +23,10 @@ index cf06f8ac3..2001175bf 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index f5fb86414..16c343b54 100644
index bace6717..50183365 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -909,13 +909,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -911,13 +911,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// Spigot start - limit place/interactions
private int limitedPackets;
private long lastLimitedPacket = -1;
@ -44,5 +44,5 @@ index f5fb86414..16c343b54 100644
limitedPackets = 0;
return true;
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 95eb029855720de4240a9a73831f7c7ded796d98 Mon Sep 17 00:00:00 2001
From 4eaf34c47c00a6f0f7fc04ae8e8d01f5855deb52 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 23 Jun 2016 23:33:57 -0400
Subject: [PATCH] IllegalPacketEvent
@ -6,7 +6,7 @@ Subject: [PATCH] IllegalPacketEvent
Fired for invalid data from players that represents hacking attempts
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 09f1ef560..cca1c6aa3 100644
index 79343537..b7a09bb5 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -56,6 +56,7 @@ import org.bukkit.inventory.CraftingInventory;
@ -17,7 +17,7 @@ index 09f1ef560..cca1c6aa3 100644
import co.aikar.timings.MinecraftTimings; // Paper
// CraftBukkit end
@@ -2287,8 +2288,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2289,8 +2290,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
}
} catch (Exception exception) {
@ -27,7 +27,7 @@ index 09f1ef560..cca1c6aa3 100644
}
} else {
String s1;
@@ -2337,8 +2337,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2339,8 +2339,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
CraftEventFactory.handleEditBookEvent(player, itemstack2); // CraftBukkit
}
} catch (Exception exception1) {
@ -37,7 +37,7 @@ index 09f1ef560..cca1c6aa3 100644
}
} else if ("MC|TrSel".equals(s)) {
try {
@@ -2349,8 +2348,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2351,8 +2350,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
((ContainerMerchant) container).d(j);
}
} catch (Exception exception2) {
@ -47,7 +47,7 @@ index 09f1ef560..cca1c6aa3 100644
}
} else {
TileEntity tileentity;
@@ -2491,8 +2489,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2493,8 +2491,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
iinventory.update();
}
} catch (Exception exception5) {
@ -57,7 +57,7 @@ index 09f1ef560..cca1c6aa3 100644
}
}
} else if ("MC|ItemName".equals(s)) {
@@ -2591,8 +2588,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2593,8 +2590,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-2, k, this.player.inventory.getItem(k)));
this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex));
} catch (Exception exception7) {
@ -68,5 +68,5 @@ index 09f1ef560..cca1c6aa3 100644
}
// CraftBukkit start
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From bc04820d56bdc51cd13c3a880d50dbac3850c65f Mon Sep 17 00:00:00 2001
From acbaf8fcb592b2f1002d110b0271ee4031c4cf7d Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Tue, 27 Dec 2016 01:57:57 +0000
Subject: [PATCH] Properly fix item duplication bug
@ -6,7 +6,7 @@ Subject: [PATCH] Properly fix item duplication bug
Credit to prplz for figuring out the real issue
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index f8e289475..cce3f98da 100644
index f8e28947..cce3f98d 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1500,7 +1500,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -19,10 +19,10 @@ index f8e289475..cce3f98da 100644
@Override
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index cca1c6aa3..3f9e60171 100644
index b7a09bb5..a6be6fb5 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2631,6 +2631,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2633,6 +2633,6 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit start - Add "isDisconnected" method
public final boolean isDisconnected() {
@ -31,5 +31,5 @@ index cca1c6aa3..3f9e60171 100644
}
}
--
2.18.0
2.19.1

View file

@ -1,14 +1,14 @@
From 8b87011bb2c827251749bcd3bb5df2f48244a212 Mon Sep 17 00:00:00 2001
From 075c1a27679d68e9fa7552be9baf241b136aa74c Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Sun, 8 Jan 2017 04:31:36 +0000
Subject: [PATCH] Don't allow entities to ride themselves - #572
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 26a76ec972..d156563b08 100644
index 9bb7b0d8..2fada247 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1999,6 +1999,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2002,6 +2002,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
protected void o(Entity entity) {
@ -17,5 +17,5 @@ index 26a76ec972..d156563b08 100644
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
} else {
--
2.18.0
2.19.1

View file

@ -1,14 +1,14 @@
From 6b0a93e2ddfdb13b7aff806e071e79173d20b13b Mon Sep 17 00:00:00 2001
From 4ba4f36afc7374b85dc3b6c4dac442dd3fb05d2c Mon Sep 17 00:00:00 2001
From: Michael Himing <mhiming@gmail.com>
Date: Sun, 8 Jan 2017 18:50:35 +1100
Subject: [PATCH] Fix block break desync
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 4f8865d61..802008b4e 100644
index a6be6fb5..a89fd79b 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -868,6 +868,8 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -870,6 +870,8 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 > 36.0D) {
@ -18,5 +18,5 @@ index 4f8865d61..802008b4e 100644
} else if (blockposition.getY() >= this.minecraftServer.getMaxBuildHeight()) {
return;
--
2.17.1
2.19.1

View file

@ -1,4 +1,4 @@
From 0ceac86ec4bac512cd1adfa907020fe976e96fff Mon Sep 17 00:00:00 2001
From 7c7805f56b85e679f7bb826b9826d2ac6aec352f Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 16 May 2017 21:29:08 -0500
Subject: [PATCH] Add option to make parrots stay on shoulders despite movement
@ -11,7 +11,7 @@ I suspect Mojang may switch to this behavior before full release.
To be converted into a Paper-API event at some point in the future?
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 29b4bdb47..31aad03c2 100644
index 29b4bdb4..31aad03c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -419,4 +419,10 @@ public class PaperWorldConfig {
@ -26,7 +26,7 @@ index 29b4bdb47..31aad03c2 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 0f1d99636..9cda8a177 100644
index 0f1d9963..9cda8a17 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -399,7 +399,7 @@ public abstract class EntityHuman extends EntityLiving {
@ -39,10 +39,10 @@ index 0f1d99636..9cda8a177 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 802008b4e..6d733e153 100644
index a89fd79b..ff62ba88 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1515,6 +1515,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1517,6 +1517,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
switch (packetplayinentityaction.b()) {
case START_SNEAKING:
this.player.setSneaking(true);
@ -57,5 +57,5 @@ index 802008b4e..6d733e153 100644
case STOP_SNEAKING:
--
2.17.1
2.19.1

View file

@ -1,11 +1,11 @@
From 69193e9240f2c55715208ca6341f085a2b1cabca Mon Sep 17 00:00:00 2001
From 60689f54404f25002089240d599fe144e38f4675 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 18 Jun 2017 18:17:05 -0500
Subject: [PATCH] Entity#fromMobSpawner()
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 5a4de30fe..2dbb88f2d 100644
index fe6e4435..f71c2862 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -183,6 +183,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -16,7 +16,7 @@ index 5a4de30fe..2dbb88f2d 100644
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end
@@ -1603,6 +1604,10 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1606,6 +1607,10 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
if (origin != null) {
nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ()));
}
@ -27,7 +27,7 @@ index 5a4de30fe..2dbb88f2d 100644
// Paper end
return nbttagcompound;
} catch (Throwable throwable) {
@@ -1752,6 +1757,8 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1755,6 +1760,8 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
if (!originTag.isEmpty()) {
origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
}
@ -37,7 +37,7 @@ index 5a4de30fe..2dbb88f2d 100644
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index a5261d70b..1ed0def1e 100644
index a5261d70..1ed0def1 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -107,6 +107,7 @@ public abstract class MobSpawnerAbstract {
@ -49,7 +49,7 @@ index a5261d70b..1ed0def1e 100644
if ( entity.world.spigotConfig.nerfSpawnerMobs )
{
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 3b25b8b73..bf7e6ed3f 100644
index 3b25b8b7..bf7e6ed3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -800,5 +800,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -64,5 +64,5 @@ index 3b25b8b73..bf7e6ed3f 100644
// Paper end
}
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From cc816d3a76029cb78e56a85a0d040a2789f7a91e Mon Sep 17 00:00:00 2001
From 43881865d6d00ffa28c426548fb6f4ff0a0839b4 Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com>
Date: Thu, 21 Sep 2017 00:38:47 +0200
Subject: [PATCH] Anti-Xray
@ -91,13 +91,15 @@ index 0000000000..6833cfad25
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
new file mode 100644
index 0000000000..2dc0655a93
index 0000000000..558188fa1d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +1,640 @@
@@ -0,0 +1,647 @@
+package com.destroystokyo.paper.antixray;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ExecutorService;
@ -153,7 +155,10 @@ index 0000000000..2dc0655a93
+ executorService = null;
+ }
+
+ List<Object> toObfuscate;
+
+ if (engineMode == EngineMode.HIDE) {
+ toObfuscate = paperWorldConfig.hiddenBlocks;
+ predefinedBlockData = null;
+ predefinedBlockDataStone = new IBlockData[] {Blocks.STONE.getBlockData()};
+ predefinedBlockDataNetherrack = new IBlockData[] {Blocks.NETHERRACK.getBlockData()};
@ -164,12 +169,14 @@ index 0000000000..2dc0655a93
+ predefinedBlockDataBitsNetherrackGlobal = new int[] {Block.REGISTRY_ID.getId(Blocks.NETHERRACK.getBlockData())};
+ predefinedBlockDataBitsEndStoneGlobal = new int[] {Block.REGISTRY_ID.getId(Blocks.END_STONE.getBlockData())};
+ } else {
+ toObfuscate = new ArrayList<>(paperWorldConfig.replacementBlocks);
+ Set<IBlockData> predefinedBlockDataSet = new HashSet<IBlockData>();
+
+ for (Object id : paperWorldConfig.hiddenBlocks) {
+ Block block = Block.getByName(String.valueOf(id));
+
+ if (block != null && !block.isTileEntity()) {
+ toObfuscate.add(id);
+ predefinedBlockDataSet.add(block.getBlockData());
+ }
+ }
@ -192,7 +199,7 @@ index 0000000000..2dc0655a93
+ predefinedBlockDataBitsEndStoneGlobal = null;
+ }
+
+ for (Object id : (engineMode == EngineMode.HIDE) ? paperWorldConfig.hiddenBlocks : paperWorldConfig.replacementBlocks) {
+ for (Object id : toObfuscate) {
+ Block block = Block.getByName(String.valueOf(id));
+
+ if (block != null) {
@ -1008,7 +1015,7 @@ index 0000000000..8ea2beb597
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 663a41e9e7..0226b96f30 100644
index 663a41e9e7..0226b96f30 100755
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -158,7 +158,7 @@ public class Chunk {
@ -1039,7 +1046,7 @@ index 663a41e9e7..0226b96f30 100644
this.initLighting();
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 14f88e91db..bcce5e8b7e 100644
index 14f88e91db..bcce5e8b7e 100755
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -416,7 +416,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@ -1052,7 +1059,7 @@ index 14f88e91db..bcce5e8b7e 100644
NibbleArray nibblearray = new NibbleArray(nbttagcompound1.getByteArray("Data"));
NibbleArray nibblearray1 = nbttagcompound1.hasKeyOfType("Add", 7) ? new NibbleArray(nbttagcompound1.getByteArray("Add")) : null;
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index afdc4a779a..aae227fdb0 100644
index afdc4a779a..aae227fdb0 100755
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -9,9 +9,15 @@ public class ChunkSection {
@ -1092,7 +1099,7 @@ index afdc4a779a..aae227fdb0 100644
int xx = i & 15;
int yy = (i >> 8) & 15;
diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java
index fa0fd8a9c8..401dc7cdc5 100644
index fa0fd8a9c8..401dc7cdc5 100755
--- a/src/main/java/net/minecraft/server/DataBits.java
+++ b/src/main/java/net/minecraft/server/DataBits.java
@@ -51,6 +51,7 @@ public class DataBits {
@ -1104,7 +1111,7 @@ index fa0fd8a9c8..401dc7cdc5 100644
return this.a;
}
diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java
index 5765b25888..d522611ecb 100644
index 5765b25888..d522611ecb 100755
--- a/src/main/java/net/minecraft/server/DataPalette.java
+++ b/src/main/java/net/minecraft/server/DataPalette.java
@@ -4,8 +4,10 @@ import javax.annotation.Nullable;
@ -1119,7 +1126,7 @@ index 5765b25888..d522611ecb 100644
IBlockData a(int i);
diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
index 2cb462b8e3..67784b4a67 100644
index 2cb462b8e3..67784b4a67 100755
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
@@ -2,22 +2,55 @@ package net.minecraft.server;
@ -1227,7 +1234,7 @@ index 2cb462b8e3..67784b4a67 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index d0b67d8fd6..eeaa625d2f 100644
index d0b67d8fd6..eeaa625d2f 100755
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -74,6 +74,7 @@ public class EntityFallingBlock extends Entity {
@ -1247,7 +1254,7 @@ index d0b67d8fd6..eeaa625d2f 100644
if (block instanceof BlockFalling) {
((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata);
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index e148901e53..61fbdeb6ac 100644
index e148901e53..61fbdeb6ac 100755
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -228,6 +228,7 @@ public class Explosion {
@ -1259,7 +1266,7 @@ index e148901e53..61fbdeb6ac 100644
if (flag) {
double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat());
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index d583cced66..2eddb68d7b 100644
index d583cced66..2eddb68d7b 100755
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -62,7 +62,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@ -1358,7 +1365,7 @@ index d583cced66..2eddb68d7b 100644
public QueuedPacket(Packet<?> packet, GenericFutureListener<? extends Future<? super Void>>... agenericfuturelistener) {
this.a = packet;
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
index c1273e988e..d71734df81 100644
index c1273e988e..d71734df81 100755
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
@@ -33,6 +33,7 @@ public class PacketDataSerializer extends ByteBuf {
@ -1370,7 +1377,7 @@ index c1273e988e..d71734df81 100644
for (int j = 1; j < 5; ++j) {
if ((i & -1 << j * 7) == 0) {
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
index d16669bcc3..306a6b7cd3 100644
index d16669bcc3..306a6b7cd3 100755
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -8,6 +8,10 @@ import java.util.Iterator;
@ -1463,7 +1470,7 @@ index d16669bcc3..306a6b7cd3 100644
if (flag) {
packetdataserializer.writeBytes(chunksection.getSkyLightArray().asBytes());
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 48a008e0a7..395386f295 100644
index 48a008e0a7..395386f295 100755
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -134,6 +134,8 @@ public class PlayerChunk {
@ -1493,7 +1500,7 @@ index 48a008e0a7..395386f295 100644
} else {
this.a((Packet) (new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, this.chunk)));
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index a49b5c81a8..5ec7f5819f 100644
index a49b5c81a8..5ec7f5819f 100755
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -200,6 +200,8 @@ public class PlayerInteractManager {
@ -1506,7 +1513,7 @@ index a49b5c81a8..5ec7f5819f 100644
public void a(BlockPosition blockposition) {
diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java
index 03894df54c..76f6f35bb9 100644
index 03894df54c..76f6f35bb9 100755
--- a/src/main/java/net/minecraft/server/RegistryBlockID.java
+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java
@@ -47,6 +47,7 @@ public class RegistryBlockID<T> implements Registry<T> {
@ -1518,7 +1525,7 @@ index 03894df54c..76f6f35bb9 100644
return this.a.size();
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 90f946e57a..ea67b61b2b 100644
index 90f946e57a..ea67b61b2b 100755
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -35,6 +35,8 @@ import org.bukkit.generator.ChunkGenerator;
@ -1595,5 +1602,5 @@ index 9942f0c750..2da6edc63e 100644
}
}
--
2.18.0
2.21.0

View file

@ -1,11 +1,11 @@
From 1ada468a04f4567237b4180c750ed48915b44997 Mon Sep 17 00:00:00 2001
From 48e6748437a736a6566b09f36fc818ae4c80e74a Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 28 Sep 2017 17:21:44 -0400
Subject: [PATCH] Add PlayerJumpEvent
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index deb0f4a9c..579996d1e 100644
index deb0f4a9..579996d1 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1399,6 +1399,7 @@ public abstract class EntityHuman extends EntityLiving {
@ -17,7 +17,7 @@ index deb0f4a9c..579996d1e 100644
super.cu();
this.b(StatisticList.w);
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 3104fc0ea..aa57ff8ed 100644
index ff62ba88..abce0b6e 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -57,6 +57,7 @@ import org.bukkit.inventory.EquipmentSlot;
@ -28,7 +28,7 @@ index 3104fc0ea..aa57ff8ed 100644
import co.aikar.timings.MinecraftTimings; // Paper
// CraftBukkit end
@@ -584,7 +585,34 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -586,7 +587,34 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
d8 = d5 - this.p;
d9 = d6 - this.q;
if (this.player.onGround && !packetplayinflying.a() && d8 > 0.0D) {
@ -65,5 +65,5 @@ index 3104fc0ea..aa57ff8ed 100644
this.player.move(EnumMoveType.PLAYER, d7, d8, d9);
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From cab4c50ff2db0b82c32afadb8075dc5e5b3b5bad Mon Sep 17 00:00:00 2001
From eced421f5f42625ee8f8d1087cbf773ac680f894 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Thu, 5 Oct 2017 01:54:07 +0100
Subject: [PATCH] handle PacketPlayInKeepAlive async
@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 08211a54c..72474a88e 100644
index abce0b6e..b6d94816 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2231,14 +2231,20 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2233,14 +2233,20 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
@ -42,5 +42,5 @@ index 08211a54c..72474a88e 100644
}
--
2.17.1
2.19.1

View file

@ -20,7 +20,7 @@ index 44335fd2d..9adcabd4f 100644
if (!ItemStack.matches(itemstack1, itemstack)) {
+ // Paper start - PlayerArmorChangeEvent
+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR && !itemstack.getItem().equals(itemstack1.getItem())) {
+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1);
+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();

View file

@ -1,4 +1,4 @@
From 36595d8506ce4cb19d6e56d941f824b75bb190b7 Mon Sep 17 00:00:00 2001
From 57a61075e611d4c87c44424c7b8ef23b2a4dcb49 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 26 Nov 2017 13:19:58 -0500
Subject: [PATCH] AsyncTabCompleteEvent
@ -14,7 +14,7 @@ completion, such as offline players.
Also adds isCommand and getLocation to the sync TabCompleteEvent
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 89071db952..2ed59b4088 100644
index 44eb8ba6..3fa146ae 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -10,6 +10,7 @@ import java.io.IOException;
@ -25,7 +25,7 @@ index 89071db952..2ed59b4088 100644
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
@@ -2277,24 +2278,45 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2279,24 +2280,45 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit end
}
@ -82,7 +82,7 @@ index 89071db952..2ed59b4088 100644
public void a(PacketPlayInSettings packetplayinsettings) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5b1aae5587..d6676074e6 100644
index 5b1aae55..d6676074 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1643,8 +1643,8 @@ public final class CraftServer implements Server {
@ -97,7 +97,7 @@ index 5b1aae5587..d6676074e6 100644
return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions();
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
index 1e3aae3b8f..95d13c146b 100644
index 1e3aae3b..95d13c14 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
@@ -28,6 +28,39 @@ public class ConsoleCommandCompleter implements Completer {
@ -141,5 +141,5 @@ index 1e3aae3b8f..95d13c146b 100644
Waitable<List<String>> waitable = new Waitable<List<String>>() {
@Override
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 5a07c0ee8d6b1ae0143448473c2e081ec6517412 Mon Sep 17 00:00:00 2001
From 0b0b6356ab5bbf4da29e883baa4181223fae8584 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 20 Dec 2017 17:36:49 -0500
Subject: [PATCH] Ability to apply mending to XP API
@ -52,7 +52,7 @@ index ff5cc74ba..1c59fd966 100644
return i * 2;
}
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index d666088f2..f6b802dc8 100644
index 2dc428552..7be588176 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -29,7 +29,7 @@ public final class ItemStack {
@ -64,7 +64,7 @@ index d666088f2..f6b802dc8 100644
private EntityItemFrame i;
private Block j;
private boolean k;
@@ -350,10 +350,12 @@ public final class ItemStack {
@@ -359,10 +359,12 @@ public final class ItemStack {
return this.getItem().k();
}
@ -123,5 +123,5 @@ index d69784386..77c50ba14 100644
}
--
2.18.0
2.19.0

View file

@ -1,4 +1,4 @@
From 7de0f8add5f32e662c9354154f52a63942cb1274 Mon Sep 17 00:00:00 2001
From bb3e56dcc9c689402ea30a5cdd9e009a84022109 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 2 Jan 2018 00:31:26 -0500
Subject: [PATCH] Fill Profile Property Events
@ -11,7 +11,7 @@ If Mojang API does need to be hit, event fire so you can get the results.
This is useful for implementing a ProfileCache for Player Skulls
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
index 4b2a67423..f83aa5ef0 100644
index 4b2a67423f..61cfdf73c8 100644
--- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@@ -1,5 +1,7 @@
@ -22,12 +22,14 @@ index 4b2a67423..f83aa5ef0 100644
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
@@ -19,7 +21,13 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi
@@ -19,7 +21,15 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi
@Override
public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) {
- return super.fillProfileProperties(profile, requireSecure);
+ new PreFillProfileEvent(CraftPlayerProfile.asBukkitMirror(profile)).callEvent();
+ CraftPlayerProfile playerProfile = (CraftPlayerProfile) CraftPlayerProfile.asBukkitMirror(profile);
+ new PreFillProfileEvent(playerProfile).callEvent();
+ profile = playerProfile.getGameProfile();
+ if (profile.isComplete() && profile.getProperties().containsKey("textures")) {
+ return profile;
+ }
@ -38,5 +40,5 @@ index 4b2a67423..f83aa5ef0 100644
@Override
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 25ff513d84565b3f16325cd6e338d2837fcad079 Mon Sep 17 00:00:00 2001
From b46e189801a09043a8b19db57db7ff8a84fa08a5 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Wed, 11 Oct 2017 15:56:26 +0200
Subject: [PATCH] Implement extended PaperServerListPingEvent
@ -60,7 +60,7 @@ index 000000000..a2a409e63
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
new file mode 100644
index 000000000..350410527
index 000000000..a85466bc7
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
@@ -0,0 +1,112 @@
@ -90,8 +90,8 @@ index 000000000..350410527
+ private GameProfile[] originalSample;
+
+ private StandardPaperServerListPingEventImpl(MinecraftServer server, NetworkManager networkManager, ServerPing ping) {
+ super(server, new PaperStatusClient(networkManager), ping.getServerData().getProtocolVersion(), server.server.getServerIcon());
+ this.originalSample = ping.getPlayers().getSample();
+ super(server, new PaperStatusClient(networkManager), ping.getServerData() != null ? ping.getServerData().getProtocolVersion() : -1, server.server.getServerIcon());
+ this.originalSample = ping.getPlayers() == null ? null : ping.getPlayers().getSample(); // GH-1473 - pre-tick race condition NPE
+ }
+
+ @Nonnull
@ -264,5 +264,5 @@ index cc1f3ac96..4f9fd4bc6 100644
}
--
2.18.0
2.21.0

View file

@ -1,14 +1,14 @@
From 79475dad6199107ffc2266fcf17ec6ebaffa7193 Mon Sep 17 00:00:00 2001
From e1f03de002a4025ff5128a375ff0edd392e04176 Mon Sep 17 00:00:00 2001
From: 0x22 <0x22@futureclient.net>
Date: Thu, 26 Apr 2018 04:41:11 -0400
Subject: [PATCH] Fix exploit that allowed colored signs to be created
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 2ed59b4088..08191e9059 100644
index 3fa146ae..06256662 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2222,7 +2222,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2224,7 +2224,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
String[] lines = new String[4];
for (int i = 0; i < astring.length; ++i) {
@ -18,5 +18,5 @@ index 2ed59b4088..08191e9059 100644
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
this.server.getPluginManager().callEvent(event);
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From addea0ca53003e381887f658b0a8bbd823c8c921 Mon Sep 17 00:00:00 2001
From 753ba2d406cf3ebeae11485b9c77c24d47835397 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Jun 2018 23:00:29 -0400
Subject: [PATCH] ItemStack#getMaxItemUseDuration
@ -6,10 +6,10 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration
Allows you to determine how long it takes to use a usable/consumable item
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index f6b802dc8..6521bb508 100644
index 7be588176..99f4b6aac 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -561,6 +561,7 @@ public final class ItemStack {
@@ -570,6 +570,7 @@ public final class ItemStack {
this.getItem().b(this, world, entityhuman);
}
@ -18,7 +18,7 @@ index f6b802dc8..6521bb508 100644
return this.getItem().e(this);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index aa99254ff..be6589dbf 100644
index 49576e665..decdccdc7 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -180,6 +180,13 @@ public final class CraftItemStack extends ItemStack {
@ -36,5 +36,5 @@ index aa99254ff..be6589dbf 100644
public void addUnsafeEnchantment(Enchantment ench, int level) {
Validate.notNull(ench, "Cannot add null enchantment");
--
2.18.0
2.19.0

View file

@ -1,4 +1,4 @@
From e1b60705c11cb4eedbe9ea30504df1012cb58dd9 Mon Sep 17 00:00:00 2001
From a74d2af6315643fd7eaf2bea943adb90c728d63f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 10 Jun 2018 20:04:42 -0400
Subject: [PATCH] Properly remove entities on dimension teleport
@ -22,10 +22,10 @@ requirement, but plugins (such as my own) use this method to
trigger a "reload" of the entity on the client.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ea2502409d..71da8e1e7d 100644
index f71c2862..6eab1ef8 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2467,7 +2467,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2470,7 +2470,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
// CraftBukkit end */
@ -35,7 +35,7 @@ index ea2502409d..71da8e1e7d 100644
this.world.methodProfiler.a("reposition");
/* CraftBukkit start - Handled in calculateTarget
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 49019d54d5..bba2e164f2 100644
index 49019d54..bba2e164 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1205,6 +1205,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -47,5 +47,5 @@ index 49019d54d5..bba2e164f2 100644
this.entitiesById.d(entity.getId());
this.entitiesByUUID.remove(entity.getUniqueID());
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 288bb047a292f3c3fdab66a5f7d40ca413536770 Mon Sep 17 00:00:00 2001
From 9b5c39be96d08690ed8897ec56ea6055b30f2dad Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 3 Jul 2018 21:56:23 -0400
Subject: [PATCH] InventoryCloseEvent Reason API
@ -7,7 +7,7 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 97485cf89e..d24d45fdd3 100644
index 2705361a..57addeca 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -869,7 +869,7 @@ public class Chunk {
@ -29,7 +29,7 @@ index 97485cf89e..d24d45fdd3 100644
}
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 0b51903e23..aa0b27f0e1 100644
index 0b51903e..aa0b27f0 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -145,7 +145,7 @@ public abstract class EntityHuman extends EntityLiving {
@ -56,7 +56,7 @@ index 0b51903e23..aa0b27f0e1 100644
this.activeContainer = this.defaultContainer;
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index cce3f98dac..4ff505cfa3 100644
index cce3f98d..4ff505cf 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -287,7 +287,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -110,10 +110,10 @@ index cce3f98dac..4ff505cfa3 100644
this.r();
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 08191e9059..d5dda1f595 100644
index 06256662..3aa50885 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1760,7 +1760,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1762,7 +1762,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x());
if (this.player.isFrozen()) return; // CraftBukkit
@ -123,7 +123,7 @@ index 08191e9059..d5dda1f595 100644
this.player.r();
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index b478f385a4..eaaa54acd4 100644
index b478f385..eaaa54ac 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -423,7 +423,7 @@ public abstract class PlayerList {
@ -136,7 +136,7 @@ index b478f385a4..eaaa54acd4 100644
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game");
cserver.getPluginManager().callEvent(playerQuitEvent);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index d85b5defca..05ca403e82 100644
index d85b5def..05ca403e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -401,8 +401,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@ -155,7 +155,7 @@ index d85b5defca..05ca403e82 100644
public boolean isBlocking() {
return getHandle().isBlocking();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1874c15ab9..5f480ac06f 100644
index 1874c15a..5f480ac0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -644,7 +644,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -168,7 +168,7 @@ index 1874c15ab9..5f480ac06f 100644
// Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 248873fb4c..cce4acc0bb 100644
index 248873fb..cce4acc0 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -927,8 +927,19 @@ public class CraftEventFactory {
@ -193,5 +193,5 @@ index 248873fb4c..cce4acc0bb 100644
human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity());
}
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 81be84c666aaf4d1d6aa22d0dbe36f148f6f27a6 Mon Sep 17 00:00:00 2001
From 02857fd7ffe425a671e4923cab170e40c6ff2296 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 13 Jul 2018 14:54:43 +0200
Subject: [PATCH] Refresh player inventory when cancelling
@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d5dda1f595..521c466093 100644
index 3aa50885..0ba182b1 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1674,6 +1674,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1676,6 +1676,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
if (event.isCancelled()) {
@ -28,5 +28,5 @@ index d5dda1f595..521c466093 100644
}
// CraftBukkit end
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 1f2212fa5986435d4cd3bb3f4cd62821d7246d66 Mon Sep 17 00:00:00 2001
From 7c38b1aa8033f63465aca838f5dad2cb26ee42e1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 19 Jul 2018 01:13:28 -0400
Subject: [PATCH] add more information to Entity.toString()
@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString()
UUID, ticks lived, valid, dead
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 71da8e1e7d..28713f045d 100644
index 6eab1ef8..0197f5ee 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2366,7 +2366,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2369,7 +2369,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
}
public String toString() {
@ -19,5 +19,5 @@ index 71da8e1e7d..28713f045d 100644
public boolean isInvulnerable(DamageSource damagesource) {
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From 03f5b3714e9388890e9261da44070032119ae5ad Mon Sep 17 00:00:00 2001
From 278d18093d088586a50ef35a69393e8266091de9 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Tue, 17 Jul 2018 16:42:17 +0200
Subject: [PATCH] Use asynchronous Log4j 2 loggers
diff --git a/pom.xml b/pom.xml
index 7fa70efe8..132843880 100644
index 7fa70efe80..132843880a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,6 +110,14 @@
@ -23,13 +23,34 @@ index 7fa70efe8..132843880 100644
<!-- testing -->
<dependency>
<groupId>junit</groupId>
diff --git a/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java b/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java
new file mode 100644
index 0000000000..dceb121bcc
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java
@@ -0,0 +1,13 @@
+package com.destroystokyo.paper.log;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.async.AsyncQueueFullPolicy;
+import org.apache.logging.log4j.core.async.EventRoute;
+
+public final class LogFullPolicy implements AsyncQueueFullPolicy {
+
+ @Override
+ public EventRoute getRoute(final long backgroundThreadId, final Level level) {
+ return EventRoute.ENQUEUE;
+ }
+}
diff --git a/src/main/resources/log4j2.component.properties b/src/main/resources/log4j2.component.properties
new file mode 100644
index 000000000..ee7c90784
index 0000000000..ee683079c1
--- /dev/null
+++ b/src/main/resources/log4j2.component.properties
@@ -0,0 +1 @@
@@ -0,0 +1,2 @@
+Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
+log4j2.AsyncQueueFullPolicy=com.destroystokyo.paper.log.LogFullPolicy
\ No newline at end of file
--
2.18.0
2.22.0

View file

@ -1,4 +1,4 @@
From 74c33cb76523595192fe9ad81eec4f582dcdcd68 Mon Sep 17 00:00:00 2001
From fc570ba0b54177e36c1450fddb1e1a97eca04a00 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 21 Jul 2018 14:27:34 -0400
Subject: [PATCH] Duplicate UUID Resolve Option
@ -33,7 +33,7 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 14c8edeffc..c3bd82692d 100644
index 14c8edef..c3bd8269 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -541,4 +541,47 @@ public class PaperWorldConfig {
@ -85,7 +85,7 @@ index 14c8edeffc..c3bd82692d 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 4757081090..d29aec7149 100644
index 0c811805..71d86175 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,10 @@
@ -168,10 +168,10 @@ index 4757081090..d29aec7149 100644
this.world.a((Collection) entityslice);
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 7b856cad91..eb8904a728 100644
index 67967c4e..b761524f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2619,6 +2619,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -2622,6 +2622,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
});
}
@ -180,7 +180,7 @@ index 7b856cad91..eb8904a728 100644
this.uniqueID = uuid;
this.ar = this.uniqueID.toString();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index d96126bcf2..5257db1e00 100644
index d96126bc..5257db1e 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -70,7 +70,7 @@ public abstract class World implements IBlockAccess {
@ -193,7 +193,7 @@ index d96126bcf2..5257db1e00 100644
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
private final List<TileEntity> b = Lists.newArrayList();
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 994d4bbb84..1244baf45a 100644
index 994d4bbb..1244baf4 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -42,7 +42,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -239,5 +239,5 @@ index 994d4bbb84..1244baf45a 100644
logger.error("Overwrote an existing entity " + old + " with " + entity);
if (DEBUG_ENTITIES) {
--
2.18.0
2.19.1

View file

@ -1,18 +1,18 @@
From cb60a9794593e7752a415d3f558e8b789054c2eb Mon Sep 17 00:00:00 2001
From 3e0934988343ec1ba1f5950d8302636c306ebc0d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 22:44:23 -0400
Subject: [PATCH] Add some Debug to Chunk Entity slices
Subject: [PATCH] Monitor and detect illegal Entity slice state
If we detect unexpected state, log and try to recover
If we detect unexpected state, try to recover
This should hopefully avoid duplicate entities ever being created
if the entity was to end up in 2 different chunk slices
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index ce66bb780d..2a5d1c90b4 100644
index e5c900a85..e4d5e65c8 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -681,8 +681,34 @@ public class Chunk {
@@ -681,8 +681,27 @@ public class Chunk {
entity.ab = this.locX;
entity.ac = k;
entity.ad = this.locZ;
@ -22,24 +22,17 @@ index ce66bb780d..2a5d1c90b4 100644
+ List<Entity> entitySlice = this.entitySlices[k];
+ boolean inThis = entitySlice.contains(entity);
+ List<Entity> currentSlice = entity.entitySlice;
+ if ((currentSlice != null && currentSlice.contains(entity)) || inThis) {
+ if (inThis || (currentSlice != null && currentSlice.contains(entity))) {
+ if (currentSlice == entitySlice || inThis) {
+ LogManager.getLogger().warn(entity + " was already in this chunk section! Report this to https://github.com/PaperMC/Paper/issues/1302");
+ new Throwable().printStackTrace();
+ return;
+ } else {
+ LogManager.getLogger().warn(entity + " is still in another ChunkSection! Report this to https://github.com/PaperMC/Paper/issues/1302");
+
+ Chunk chunk = entity.getCurrentChunk();
+ if (chunk != null) {
+ if (chunk != this) {
+ LogManager.getLogger().warn(entity + " was in another chunk at that! " + chunk.locX + "," + chunk.locZ);
+ }
+ chunk.removeEntity(entity);
+ } else {
+ removeEntity(entity);
+ }
+ new Throwable().printStackTrace();
+ currentSlice.remove(entity); // Just incase the above did not remove from this target slice
+ }
+ }
+ entity.entitySlice = entitySlice;
@ -48,20 +41,17 @@ index ce66bb780d..2a5d1c90b4 100644
this.markDirty();
entity.setCurrentChunk(this);
entityCounts.increment(entity.getMinecraftKeyString());
@@ -725,6 +751,12 @@ public class Chunk {
@@ -725,6 +744,9 @@ public class Chunk {
}
// Paper start
+ if (entity.entitySlice == null || !entity.entitySlice.contains(entity) || entitySlices[i] == entity.entitySlice) {
+ entity.entitySlice = null;
+ } else {
+ LogManager.getLogger().warn(entity + " was removed from a entitySlice we did not expect. Report this to https://github.com/PaperMC/Paper/issues/1302");
+ new Throwable().printStackTrace();
+ }
if (!this.entitySlices[i].remove(entity)) { return; }
this.markDirty();
entity.setCurrentChunk(null);
@@ -955,6 +987,7 @@ public class Chunk {
@@ -955,6 +977,7 @@ public class Chunk {
}
// Spigot End
entity.setCurrentChunk(null); // Paper
@ -70,7 +60,7 @@ index ce66bb780d..2a5d1c90b4 100644
// Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index eb8904a728..86b0b84335 100644
index b761524f0..a2654690f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -59,6 +59,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -82,5 +72,5 @@ index eb8904a728..86b0b84335 100644
static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
--
2.18.0
2.21.0

View file

@ -1,67 +0,0 @@
From e7b5ab4f8db7b8af7de3f0f2cd3bc23fa2a2c83a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 29 Jul 2018 11:58:05 -0400
Subject: [PATCH] Always process chunk registration after moving
This will help guarantee that entities are always in the
chunk that they are currently located at.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 45e149f4a..fce677f9f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -341,6 +341,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
this.locX = d0;
this.locY = d1;
this.locZ = d2;
+ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk
float f = this.width / 2.0F;
float f1 = this.length;
@@ -986,6 +987,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
this.locX = (axisalignedbb.a + axisalignedbb.d) / 2.0D;
this.locY = axisalignedbb.b;
this.locZ = (axisalignedbb.c + axisalignedbb.f) / 2.0D;
+ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk
}
protected SoundEffect ae() {
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 8a9e16ad6..0b1d7a086 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -360,6 +360,7 @@ public abstract class EntityArrow extends Entity implements IProjectile {
this.inGround = true;
this.shake = 7;
this.setCritical(false);
+ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk
if (iblockdata.getMaterial() != Material.AIR) {
this.av.a(this.world, blockposition, iblockdata, (Entity) this);
}
diff --git a/src/main/java/net/minecraft/server/EntityLeash.java b/src/main/java/net/minecraft/server/EntityLeash.java
index 7bd1c73bf..10a507595 100644
--- a/src/main/java/net/minecraft/server/EntityLeash.java
+++ b/src/main/java/net/minecraft/server/EntityLeash.java
@@ -31,6 +31,7 @@ public class EntityLeash extends EntityHanging {
this.locX = (double) this.blockPosition.getX() + 0.5D;
this.locY = (double) this.blockPosition.getY() + 0.5D;
this.locZ = (double) this.blockPosition.getZ() + 0.5D;
+ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk
}
public void setDirection(EnumDirection enumdirection) {}
diff --git a/src/main/java/net/minecraft/server/EntityShulker.java b/src/main/java/net/minecraft/server/EntityShulker.java
index 3ce843199..ad7c95924 100644
--- a/src/main/java/net/minecraft/server/EntityShulker.java
+++ b/src/main/java/net/minecraft/server/EntityShulker.java
@@ -390,6 +390,7 @@ public class EntityShulker extends EntityGolem implements IMonster {
this.locX = (double) blockposition.getX() + 0.5D;
this.locY = (double) blockposition.getY();
this.locZ = (double) blockposition.getZ() + 0.5D;
+ if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
--
2.18.0

View file

@ -1,4 +1,4 @@
From b65086b45edfb15a357b918552a2d8284cce6c88 Mon Sep 17 00:00:00 2001
From 996d5012be524c6833e6834a0fe7e530993ef648 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 29 Jul 2018 22:58:47 -0400
Subject: [PATCH] MC-111480: Start Entity ID's at 1
@ -7,7 +7,7 @@ DataWatchers that store Entity ID's treat 0 as special,
and can break things such as Elytra Fireworks.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index fce677f9f6..9b5f7fcf72 100644
index d2dbaaf2..3a2ff25e 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -81,7 +81,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -20,5 +20,5 @@ index fce677f9f6..9b5f7fcf72 100644
public boolean i; public boolean blocksEntitySpawning() { return i; } // Paper - OBFHELPER
public final List<Entity> passengers;
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 438859b071118528c6cc6c8f2411ef055ad58cf6 Mon Sep 17 00:00:00 2001
From 536a1753d23653447298f60a4dfd3c8467b2cfd2 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 29 Jul 2018 05:02:15 +0100
Subject: [PATCH] Break up and make tab spam limits configurable
@ -22,7 +22,7 @@ to take the burden of this into their own hand without having to rely on
plugins doing unsafe things.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 5a17ce3d22..a5ff014e33 100644
index 5a17ce3d..a5ff014e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -303,4 +303,11 @@ public class PaperConfig {
@ -38,7 +38,7 @@ index 5a17ce3d22..a5ff014e33 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 521c466093..7b12d17a4c 100644
index 0ba182b1..398f2fdf 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -75,6 +75,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -57,7 +57,7 @@ index 521c466093..7b12d17a4c 100644
/* Use thread-safe field access instead
if (this.chatThrottle > 0) {
--this.chatThrottle;
@@ -2282,7 +2284,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2284,7 +2286,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// Paper start - async tab completion
public void a(PacketPlayInTabComplete packet) {
// CraftBukkit start
@ -67,5 +67,5 @@ index 521c466093..7b12d17a4c 100644
return;
}
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From ac00b144ea5c59904530bae2a8697b9f05892649 Mon Sep 17 00:00:00 2001
From a5c88cadb6c4db888c8ad46701adb5dc9b4a0ed6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 3 Aug 2018 00:04:54 -0400
Subject: [PATCH] MC-135506: Experience should save as Integers
@ -26,5 +26,5 @@ index 1c59fd96..becb102c 100644
}
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 7c862f1ffd126fdece882da529400f7b090dd19a Mon Sep 17 00:00:00 2001
From 006c7fd9553064cea0bc6a4d4dc0afb7535e6de5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 3 Aug 2018 22:47:46 -0400
Subject: [PATCH] Entity add to world fixes
@ -14,10 +14,10 @@ Fix this by differing entity add to world for all entities at the same time
the original entity is dead, overwrite it as the logic does for unloaod queued entities.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 2a5d1c90b4..1d2673a7b3 100644
index e4d5e65c8..0a3f00c3b 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -889,6 +889,7 @@ public class Chunk {
@@ -879,6 +879,7 @@ public class Chunk {
this.world.b(this.tileEntities.values());
List[] aentityslice = this.entitySlices; // Spigot
int i = aentityslice.length;
@ -25,7 +25,7 @@ index 2a5d1c90b4..1d2673a7b3 100644
for (int j = 0; j < i; ++j) {
List entityslice = aentityslice[j]; // Spigot
@@ -936,10 +937,12 @@ public class Chunk {
@@ -926,10 +927,12 @@ public class Chunk {
thisChunk.put(entity.uniqueID, entity);
}
}
@ -41,7 +41,7 @@ index 2a5d1c90b4..1d2673a7b3 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 4a16f7ac71..04d0fa1df9 100644
index 4a16f7ac7..04d0fa1df 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1204,6 +1204,7 @@ public abstract class World implements IBlockAccess {
@ -70,7 +70,7 @@ index 4a16f7ac71..04d0fa1df9 100644
}
this.entityList.add(entity);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 1244baf45a..a14b5e0618 100644
index 1244baf45..a14b5e061 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1173,7 +1173,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -83,5 +83,5 @@ index 1244baf45a..a14b5e0618 100644
} else {
if (!(entity instanceof EntityHuman)) {
--
2.18.0
2.21.0

View file

@ -1,4 +1,4 @@
From 5ed114bb47c66db7798442d43bc8914ccea4cd5d Mon Sep 17 00:00:00 2001
From 2b8c504b605b5cad94dc78011c29becfeb6c62fa Mon Sep 17 00:00:00 2001
From: miclebrick <miclebrick@outlook.com>
Date: Wed, 8 Aug 2018 15:30:52 -0400
Subject: [PATCH] Add Early Warning Feature to WatchDog
@ -9,7 +9,7 @@ thread dumps at an interval until the point of crash.
This will help diagnose what was going on in that time before the crash.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index a5ff014e3..332e90f86 100644
index a5ff014e..332e90f8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -23,6 +23,8 @@ import org.bukkit.configuration.InvalidConfigurationException;
@ -37,7 +37,7 @@ index a5ff014e3..332e90f86 100644
public static int tabSpamLimit = 500;
private static void tabSpamLimiters() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0399a48e1..e0546e3dd 100644
index 0399a48e..e0546e3d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -622,6 +622,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@ -49,7 +49,7 @@ index 0399a48e1..e0546e3dd 100644
long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; // Paper - Further improve server tick loop
while (this.isRunning) {
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 4f9fd4bc6..2cdd9aaf8 100644
index 4f9fd4bc..2cdd9aaf 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -223,7 +223,7 @@ public class SpigotConfig
@ -62,7 +62,7 @@ index 4f9fd4bc6..2cdd9aaf8 100644
public static boolean bungee;
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 57a4748a3..93dc69835 100644
index 57a4748a..93dc6983 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -5,6 +5,7 @@ import java.lang.management.MonitorInfo;
@ -163,5 +163,5 @@ index 57a4748a3..93dc69835 100644
{
interrupt();
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 72e3adc2cacaffcbfc61561568f1ae6d0a02069d Mon Sep 17 00:00:00 2001
From 86e6c74f8d45803881b609b6b1451fe44ccf1ad0 Mon Sep 17 00:00:00 2001
From: egg82 <phantom_zero@ymail.com>
Date: Tue, 7 Aug 2018 01:24:23 -0600
Subject: [PATCH] Use ConcurrentHashMap in JsonList
@ -25,7 +25,7 @@ The point of this is readability, but does have a side-benefit of a small microp
Finally, added a couple obfhelpers for the modified code
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
index 0859c7eb2b..93111cc240 100644
index 0859c7eb..93111cc2 100644
--- a/src/main/java/net/minecraft/server/JsonList.java
+++ b/src/main/java/net/minecraft/server/JsonList.java
@@ -26,6 +26,7 @@ import java.util.Collection;
@ -110,5 +110,5 @@ index 0859c7eb2b..93111cc240 100644
String s = this.b.toJson(collection);
BufferedWriter bufferedwriter = null;
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From a606668643e32d55ab47567a218b7c522526db84 Mon Sep 17 00:00:00 2001
From d8ae95e1197458e374253152f54a1df259068bb2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 12 Aug 2018 02:33:39 -0400
Subject: [PATCH] Use a Queue for Queueing Commands
@ -6,7 +6,7 @@ Subject: [PATCH] Use a Queue for Queueing Commands
Lists are bad as Queues mmmkay.
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 2922915927..6a8292ce45 100644
index 29229159..6a8292ce 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -34,7 +34,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@ -32,5 +32,5 @@ index 2922915927..6a8292ce45 100644
// CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command);
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From 8e587147671ae4291c03ddbec1a4687639db87e9 Mon Sep 17 00:00:00 2001
From 6b1beefbc59949532cb4e66f634583d3fadc42a7 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 15 Aug 2018 01:26:09 -0700
Subject: [PATCH] Allow disabling armour stand ticking
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index c3bd82692..ed1475351 100644
index c3bd8269..ed147535 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -584,4 +584,10 @@ public class PaperWorldConfig {
@ -20,7 +20,7 @@ index c3bd82692..ed1475351 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index df0d66ad0..dca497072 100644
index df0d66ad..c7215888 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -51,6 +51,7 @@ public class EntityArmorStand extends EntityLiving {
@ -39,7 +39,26 @@ index df0d66ad0..dca497072 100644
}
public EntityArmorStand(World world, double d0, double d1, double d2) {
@@ -568,6 +570,7 @@ public class EntityArmorStand extends EntityLiving {
@@ -211,6 +213,7 @@ public class EntityArmorStand extends EntityLiving {
}
nbttagcompound.set("Pose", this.C());
+ nbttagcompound.setBoolean("Paper.CanTick", this.canTick); // Paper - persist no tick setting
}
public void a(NBTTagCompound nbttagcompound) {
@@ -242,6 +245,10 @@ public class EntityArmorStand extends EntityLiving {
this.setMarker(nbttagcompound.getBoolean("Marker"));
this.bC = !this.isMarker();
this.noclip = this.isNoGravity();
+ // Paper - persist no tick
+ if (nbttagcompound.hasKey("Paper.CanTick")) {
+ this.canTick = nbttagcompound.getBoolean("Paper.CanTick");
+ }
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Pose");
this.g(nbttagcompound1);
@@ -568,6 +575,7 @@ public class EntityArmorStand extends EntityLiving {
}
public void B_() {
@ -48,7 +67,7 @@ index df0d66ad0..dca497072 100644
Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.b);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 8a06cb165..91b7bc2ed 100644
index 8a06cb16..91b7bc2e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -221,4 +221,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
@ -69,5 +88,5 @@ index 8a06cb165..91b7bc2ed 100644
+ // Paper end
}
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From a304de0b4dc2adb5aac09bec3c5211da2ce8e469 Mon Sep 17 00:00:00 2001
From 50c8dbe5270b79e57877effa262eb430d0e00fad Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Wed, 15 Aug 2018 12:05:12 -0700
Subject: [PATCH] Optimize BlockPosition helper methods
@ -6,7 +6,7 @@ Subject: [PATCH] Optimize BlockPosition helper methods
Resolves #1338
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 38a7af58c..4849fcbc8 100644
index 38a7af58..4849fcbc 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -60,59 +60,96 @@ public class BlockPosition extends BaseBlockPosition {
@ -121,5 +121,5 @@ index 38a7af58c..4849fcbc8 100644
public BlockPosition a(EnumBlockRotation enumblockrotation) {
--
2.18.0
2.19.1

View file

@ -1,33 +0,0 @@
From ee5f7b1451005f94292b283fa1bc9e21cacb05c2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 16 Aug 2018 17:36:41 -0400
Subject: [PATCH] Ensure chunks are always loaded on hard position sets
Player Movement, Entity Creation and Teleportation move
entities with a very "You are here, no debate" change, making
the server register them as there, regardless if that chunk was
loaded or not.
It appears possible that with hack clients and lag, a player
may be able to move fast enough to move into an unloaded
chunk and get into a buggy state.
To prevent this, we will ensure a chunk is always loaded,
guaranteeing that the entity will be properly registered
into its new home comfortably.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9b5f7fcf72..48c9fbd9b3 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1309,6 +1309,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
this.lastYaw -= 360.0F;
}
+ world.getChunkAt((int) Math.floor(this.locX) >> 4, (int) Math.floor(this.locZ) >> 4); // Paper - ensure chunk is always loaded
this.setPosition(this.locX, this.locY, this.locZ);
this.setYawPitch(f, f1);
}
--
2.18.0

View file

@ -1,11 +1,11 @@
From f1a4565a54f292f668f94ac2ff6f3f56937209c0 Mon Sep 17 00:00:00 2001
From 15f184e4c071455a3b3576910f4763c29dac126c Mon Sep 17 00:00:00 2001
From: Mystiflow <mystiflow@gmail.com>
Date: Fri, 6 Jul 2018 13:21:30 +0100
Subject: [PATCH] Send nearby packets from world player list not server list
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index eaaa54acd..44ced604a 100644
index eaaa54ac..44ced604 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1239,8 +1239,25 @@ public abstract class PlayerList {
@ -46,7 +46,7 @@ index eaaa54acd..44ced604a 100644
double d5 = d1 - entityplayer.locY;
double d6 = d2 - entityplayer.locZ;
diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java
index 2c8fb705d..bfe003f60 100644
index 2c8fb705..bfe003f6 100644
--- a/src/main/java/net/minecraft/server/WorldManager.java
+++ b/src/main/java/net/minecraft/server/WorldManager.java
@@ -35,8 +35,8 @@ public class WorldManager implements IWorldAccess {
@ -95,7 +95,7 @@ index 2c8fb705d..bfe003f60 100644
if (entityplayer != null && entityplayer.world == this.world && entityplayer.getId() != i) {
double d0 = (double) blockposition.getX() - entityplayer.locX;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index a14b5e061..b19942e0f 100644
index a14b5e06..b19942e0 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1267,7 +1267,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@ -119,7 +119,7 @@ index a14b5e061..b19942e0f 100644
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index ccff6fd05..567e9acb1 100644
index ccff6fd0..567e9acb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1500,7 +1500,7 @@ public class CraftWorld implements World {
@ -132,5 +132,5 @@ index ccff6fd05..567e9acb1 100644
public String getGameRuleValue(String rule) {
--
2.18.0
2.19.1

View file

@ -1,4 +1,4 @@
From 61dddacb42c358d24f53ae3a28e5a49eca53d271 Mon Sep 17 00:00:00 2001
From 2e5245ebec442569e203bd86dcc65a67539ad223 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Tue, 21 Aug 2018 01:39:35 +0100
Subject: [PATCH] Improve death events
@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using
internal code.
diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java
index 7a076f3e4..bddd66e79 100644
index 7a076f3e..bddd66e7 100644
--- a/src/main/java/net/minecraft/server/CombatTracker.java
+++ b/src/main/java/net/minecraft/server/CombatTracker.java
@@ -175,6 +175,7 @@ public class CombatTracker {
@ -27,7 +27,7 @@ index 7a076f3e4..bddd66e79 100644
int i = this.f ? 300 : 100;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index b0b49f4ff..d0dcce945 100644
index 3a2ff25e..d44c55d8 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1471,6 +1471,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@ -55,10 +55,10 @@ index b0b49f4ff..d0dcce945 100644
return SoundCategory.NEUTRAL;
}
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index dca497072..454c1e7d0 100644
index c7215888..90749924 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -641,7 +641,8 @@ public class EntityArmorStand extends EntityLiving {
@@ -646,7 +646,8 @@ public class EntityArmorStand extends EntityLiving {
}
public void killEntity() {
@ -69,7 +69,7 @@ index dca497072..454c1e7d0 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 14637be49..5ccd3ea6f 100644
index 14637be4..ed5bb2d3 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -75,14 +75,14 @@ public abstract class EntityLiving extends Entity {
@ -207,7 +207,7 @@ index 14637be49..5ccd3ea6f 100644
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 4ff505cfa..6afb6cf7b 100644
index 4ff505cf..6afb6cf7 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -79,6 +79,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -271,7 +271,7 @@ index 4ff505cfa..6afb6cf7b 100644
}
}
diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java
index d26abb419..aaedbc3b7 100644
index d26abb41..aaedbc3b 100644
--- a/src/main/java/net/minecraft/server/RegistryMaterials.java
+++ b/src/main/java/net/minecraft/server/RegistryMaterials.java
@@ -29,6 +29,7 @@ public class RegistryMaterials<K, V> extends RegistrySimple<K, V> implements Reg
@ -283,7 +283,7 @@ index d26abb419..aaedbc3b7 100644
public K b(V v0) {
return this.b.get(v0);
diff --git a/src/main/java/net/minecraft/server/SoundEffect.java b/src/main/java/net/minecraft/server/SoundEffect.java
index ec37e237f..8e0da7bd7 100644
index ec37e237..8e0da7bd 100644
--- a/src/main/java/net/minecraft/server/SoundEffect.java
+++ b/src/main/java/net/minecraft/server/SoundEffect.java
@@ -2,7 +2,7 @@ package net.minecraft.server;
@ -296,7 +296,7 @@ index ec37e237f..8e0da7bd7 100644
private static int c;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
index 8871c6f3a..84f4cb91e 100644
index 8871c6f3..84f4cb91 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
@@ -560,6 +560,22 @@ public enum CraftSound {
@ -323,7 +323,7 @@ index 8871c6f3a..84f4cb91e 100644
this.minecraftKey = minecraftKey;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5f480ac06..d59d86efc 100644
index 5f480ac0..d59d86ef 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1612,7 +1612,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -344,7 +344,7 @@ index 5f480ac06..d59d86efc 100644
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index cce4acc0b..f1a3ca950 100644
index cce4acc0..f1a3ca95 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -392,9 +392,16 @@ public class CraftEventFactory {
@ -413,5 +413,5 @@ index cce4acc0b..f1a3ca950 100644
* Server methods
*/
--
2.19.0
2.19.1

View file

@ -1,4 +1,4 @@
From a1591adb339b39f104073b0e8c1294671a2ebf25 Mon Sep 17 00:00:00 2001
From 7746107816c3e6e29f7c5175591ce4642c35949f Mon Sep 17 00:00:00 2001
From: cswhite2000 <18whitechristop@gmail.com>
Date: Tue, 21 Aug 2018 19:44:10 -0700
Subject: [PATCH] isChunkGenerated API
@ -6,7 +6,7 @@ Subject: [PATCH] isChunkGenerated API
Resolves #1329
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 0eba3df571..ad5485908d 100644
index 0eba3df5..ad548590 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -85,6 +85,12 @@ public class ChunkProviderServer implements IChunkProvider {
@ -23,7 +23,7 @@ index 0eba3df571..ad5485908d 100644
public Chunk getLoadedChunkAt(int i, int j) {
long k = ChunkCoordIntPair.a(i, j);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 567e9acb13..afb141c629 100644
index 567e9acb..afb141c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -630,6 +630,12 @@ public class CraftWorld implements World {
@ -40,5 +40,5 @@ index 567e9acb13..afb141c629 100644
return generator;
}
--
2.18.0
2.19.1

View file

@ -1,11 +1,11 @@
From 1f57f866821be74be996417e22f59eb70b77df8a Mon Sep 17 00:00:00 2001
From efd444d51f821d324f1aaf4c0e5f19ce17067a8b Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Thu, 23 Aug 2018 16:14:12 +0800
Subject: [PATCH] Add source block to BlockPhysicsEvent
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 04d0fa1df9..64d75934bc 100644
index 04d0fa1d..64d75934 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -590,7 +590,7 @@ public abstract class World implements IBlockAccess {
@ -18,5 +18,5 @@ index 04d0fa1df9..64d75934bc 100644
if (event.isCancelled()) {
--
2.18.0
2.19.1

View file

@ -0,0 +1,67 @@
From 7ee8a85aea5d25dfa91eaf98b66a3243e414c250 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 23 Jul 2018 23:40:04 -0400
Subject: [PATCH] Optimize Region File Cache
CraftBukkit added synchronization to read and write methods. This adds
much more contention on this object for accessing region files, as
the entire read and write of NBT data is now a blocking operation.
This causes issues when something then simply needs to check if a chunk exists
on the main thread, causing a block...
However, this synchronization was unnecessary, because there is already
enough synchronization done to keep things safe
1) Obtaining a Region File: Those methods are still static synchronized.
Meaning we can safely obtain a Region File concurrently.
2) RegionFile data access: Methods reading and manipulating data from
a region file are also marked synchronized, ensuring that no 2 processes
are reading or writing data at the same time.
3) Checking a region file for chunkExists: getOffset is also synchronized
ensuring that even if a chunk is currently being written, it will be safe.
By removing these synchronizations, we reduce the locking to only
when data is being write or read.
GZIP compression and NBT Buffer creation will no longer be part of the
synchronized context, reducing lock times.
Ultimately: This brings us back to Vanilla, which has had no indication of region file loss.
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index 7e756580..15a09ab3 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -95,7 +95,7 @@ public class RegionFileCache {
}
// CraftBukkit start - call sites hoisted for synchronization
- public static synchronized NBTTagCompound d(File file, int i, int j) throws IOException {
+ public static NBTTagCompound d(File file, int i, int j) throws IOException { // Paper - remove synchronization
RegionFile regionfile = a(file, i, j);
DataInputStream datainputstream = regionfile.a(i & 31, j & 31);
@@ -107,7 +107,7 @@ public class RegionFileCache {
return NBTCompressedStreamTools.a(datainputstream);
}
- public static synchronized void e(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException {
+ public static void e(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException { // Paper - remove synchronization
RegionFile regionfile = a(file, i, j);
DataOutputStream dataoutputstream = regionfile.b(i & 31, j & 31);
@@ -116,7 +116,7 @@ public class RegionFileCache {
}
// CraftBukkit end
- public static synchronized boolean chunkExists(File file, int i, int j) {
+ public static boolean chunkExists(File file, int i, int j) { // Paper - remove synchronization
RegionFile regionfile = b(file, i, j);
return regionfile != null ? regionfile.c(i & 31, j & 31) : false;
--
2.19.1

View file

@ -0,0 +1,44 @@
From c7d283d94f373fb0890e9cef9185cd0b79a95cc0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 27 Sep 2018 23:46:03 -0400
Subject: [PATCH] Fix issues with entity loss due to unloaded chunks
Vanilla has risk of losing entities by causing them to be
removed from all chunks if they try to move into an unloaded chunk.
This pretty much means high chance this entity will be lost in this scenario.
There is another case that adding an enttiy to the world can fail if
the chunk isn't loaded.
Lots of the server is designed around addEntity never expecting to fail for these reasons,
nor is it really logical.
This change ensures the chunks are always loaded when entities are
added to the world, or a valid entity moves between chunks.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 64d75934..bcbdadbd 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1181,7 +1181,7 @@ public abstract class World implements IBlockAccess {
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
- boolean flag = entity.attachedToPlayer;
+ boolean flag = true; // Paper - always load chunks
// Paper start - Set origin location when the entity is being added to the world
if (entity.origin == null) {
@@ -1826,7 +1826,7 @@ public abstract class World implements IBlockAccess {
this.getChunkAt(entity.ab, entity.ad).a(entity, entity.ac);
}
- if (!entity.bD() && !this.isChunkLoaded(i, k, true)) {
+ if (!entity.valid && !entity.bD() && !this.isChunkLoaded(i, k, true)) { // Paper - always load to new chunk if valid
entity.aa = false;
} else {
this.getChunkAt(i, k).a(entity);
--
2.19.1

View file

@ -0,0 +1,48 @@
From b9d9bdcfe732d18f11e991dbe6cd98b901fa2889 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 29 Sep 2018 12:13:23 -0400
Subject: [PATCH] Backport Village Door fix from 1.13
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
index 9f1867dd..6536e5fb 100644
--- a/src/main/java/net/minecraft/server/Village.java
+++ b/src/main/java/net/minecraft/server/Village.java
@@ -14,7 +14,7 @@ public class Village {
private World a;
private final List<VillageDoor> b = Lists.newArrayList();
private BlockPosition c;
- private BlockPosition d;
+ private BlockPosition d; private BlockPosition getCenter() { return d; } // Paper - OBFHELPER
private int e;
private int f;
private int g;
@@ -44,6 +44,12 @@ public class Village {
}
public void a(int i) {
+ // Paper - don't tick village if chunk isn't loaded
+ Chunk chunk = this.a.getChunkIfLoaded(getCenter());
+ if (chunk == null || !chunk.areNeighborsLoaded(1)) {
+ return;
+ }
+ // Paper end
this.g = i;
this.m();
this.l();
@@ -307,6 +313,12 @@ public class Village {
while (iterator.hasNext()) {
VillageDoor villagedoor = (VillageDoor) iterator.next();
+ // Paper start- don't remove doors from unloaded chunks
+ if (!this.a.isLoaded(villagedoor.d())) {
+ villagedoor.a(villagedoor.h() + 1);
+ continue;
+ }
+ // Paper end
if (flag1) {
villagedoor.a();
--
2.19.1

View file

@ -0,0 +1,111 @@
From bb903acf7693529a64663a38dbf589ca324f0677 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 23 Sep 2018 20:44:52 -0400
Subject: [PATCH] Backport light queue changes from 1.13
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 523d10e8..6541f5af 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -274,14 +274,7 @@ public class Chunk {
private void h(boolean flag) {
this.world.methodProfiler.a("recheckGaps");
- if (this.world.areChunksLoaded(new BlockPosition(this.locX * 16 + 8, 0, this.locZ * 16 + 8), 16)) {
- this.runOrQueueLightUpdate(() -> recheckGaps(flag)); // Paper - Queue light update
- }
- }
-
- private void recheckGaps(boolean flag) {
- if (true) {
- // Paper end
+ if (this.areNeighborsLoaded(1)) { // Paper
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
if (this.i[i + j * 16]) {
@@ -332,7 +325,7 @@ public class Chunk {
}
private void a(int i, int j, int k, int l) {
- if (l > k && this.world.areChunksLoaded(new BlockPosition(i, 0, j), 16)) {
+ if (l > k && this.areNeighborsLoaded(1)) { // Paper
for (int i1 = k; i1 < l; ++i1) {
this.world.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j));
}
diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java
index 345cd582..f1c01311 100644
--- a/src/main/java/net/minecraft/server/PaperLightingQueue.java
+++ b/src/main/java/net/minecraft/server/PaperLightingQueue.java
@@ -6,16 +6,16 @@ import it.unimi.dsi.fastutil.objects.ObjectCollection;
import java.util.ArrayDeque;
class PaperLightingQueue {
- private static final long MAX_TIME = (long) (1000000000 / 20 * .95);
- private static int updatesThisTick;
-
+ private static final long MAX_TIME = (long) (1000000000 / 20 * 1.15);
static void processQueue(long curTime) {
- updatesThisTick = 0;
-
final long startTime = System.nanoTime();
final long maxTickTime = MAX_TIME - (startTime - curTime);
+ if (maxTickTime <= 0) {
+ return;
+ }
+
START:
for (World world : MinecraftServer.getServer().worlds) {
if (!world.paperConfig.queueLightUpdates) {
@@ -23,7 +23,7 @@ class PaperLightingQueue {
}
ObjectCollection<Chunk> loadedChunks = ((WorldServer) world).getChunkProviderServer().chunks.values();
- for (Chunk chunk : loadedChunks.toArray(new Chunk[loadedChunks.size()])) {
+ for (Chunk chunk : loadedChunks.toArray(new Chunk[0])) {
if (chunk.lightingQueue.processQueue(startTime, maxTickTime)) {
break START;
}
@@ -50,14 +50,15 @@ class PaperLightingQueue {
if (this.isEmpty()) {
return false;
}
+ if (isOutOfTime(maxTickTime, startTime)) {
+ return true;
+ }
try (Timing ignored = chunk.world.timings.lightingQueueTimer.startTiming()) {
Runnable lightUpdate;
while ((lightUpdate = this.poll()) != null) {
lightUpdate.run();
- if (startTime > 0 && ++PaperLightingQueue.updatesThisTick % 10 == 0 && PaperLightingQueue.updatesThisTick > 10) {
- if (System.nanoTime() - startTime > maxTickTime) {
- return true;
- }
+ if (isOutOfTime(maxTickTime, startTime)) {
+ return true;
}
}
}
@@ -74,7 +75,7 @@ class PaperLightingQueue {
}
processQueue(0, 0); // No timeout
- final int radius = 1; // TODO: bitflip, why should this ever be 2?
+ final int radius = 1;
for (int x = chunk.locX - radius; x <= chunk.locX + radius; ++x) {
for (int z = chunk.locZ - radius; z <= chunk.locZ + radius; ++z) {
if (x == chunk.locX && z == chunk.locZ) {
@@ -89,4 +90,8 @@ class PaperLightingQueue {
}
}
}
+
+ private static boolean isOutOfTime(long maxTickTime, long startTime) {
+ return startTime > 0 && System.nanoTime() - startTime > maxTickTime;
+ }
}
--
2.19.1

View file

@ -0,0 +1,130 @@
From f3a8522fa637866a209e3af4b2c47412008c4b94 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 6 Oct 2018 01:10:21 -0400
Subject: [PATCH] Backport Water Activation Range
Adds Entity Activation Range for water mobs
and no longer gives immunity to mobs (squid) that know how to
pathfind in water.
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 33ae7389..4c8d94c8 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -19,6 +19,7 @@ import net.minecraft.server.EntityFallingBlock;
import net.minecraft.server.EntityFireball;
import net.minecraft.server.EntityFireworks;
import net.minecraft.server.EntityHuman;
+import net.minecraft.server.EntityInsentient;
import net.minecraft.server.EntityLiving;
import net.minecraft.server.EntityLlama;
import net.minecraft.server.EntityMonster;
@@ -27,11 +28,13 @@ import net.minecraft.server.EntitySheep;
import net.minecraft.server.EntitySlime;
import net.minecraft.server.EntityTNTPrimed;
import net.minecraft.server.EntityVillager;
+import net.minecraft.server.EntityWaterAnimal;
import net.minecraft.server.EntityWeather;
import net.minecraft.server.EntityWither;
import net.minecraft.server.MCUtil;
import net.minecraft.server.MathHelper;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.NavigationGuardian;
import net.minecraft.server.World;
public class ActivationRange
@@ -40,6 +43,7 @@ public class ActivationRange
static AxisAlignedBB maxBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
static AxisAlignedBB miscBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
static AxisAlignedBB animalBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
+ static AxisAlignedBB waterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); // Paper
static AxisAlignedBB monsterBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 );
/**
@@ -51,6 +55,7 @@ public class ActivationRange
*/
public static byte initializeEntityActivationType(Entity entity)
{
+ if (entity instanceof EntityWaterAnimal) { return 4; } // Paper
if ( entity instanceof EntityMonster || entity instanceof EntitySlime )
{
return 1; // Monster
@@ -75,6 +80,7 @@ public class ActivationRange
if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
|| ( entity.activationType == 2 && config.animalActivationRange == 0 )
|| ( entity.activationType == 1 && config.monsterActivationRange == 0 )
+ || ( entity.activationType == 4 && config.waterActivationRange == 0 ) // Paper
|| entity instanceof EntityHuman
|| entity instanceof EntityProjectile
|| entity instanceof EntityEnderDragon
@@ -105,6 +111,7 @@ public class ActivationRange
final int miscActivationRange = world.spigotConfig.miscActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
final int monsterActivationRange = world.spigotConfig.monsterActivationRange;
+ final int waterActivationRange = world.spigotConfig.waterActivationRange; // Paper
int maxRange = Math.max( monsterActivationRange, animalActivationRange );
maxRange = Math.max( maxRange, miscActivationRange );
@@ -118,6 +125,7 @@ public class ActivationRange
maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange );
miscBB = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange );
animalBB = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange );
+ waterBB = player.getBoundingBox().grow( waterActivationRange, 256, waterActivationRange ); // Paper
monsterBB = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange );
int i = MathHelper.floor( maxBB.a / 16.0D );
@@ -171,6 +179,14 @@ public class ActivationRange
entity.activatedTick = MinecraftServer.currentTick;
}
break;
+ // Paper start
+ case 4:
+ if ( waterBB.c( entity.getBoundingBox() ) )
+ {
+ entity.activatedTick = MinecraftServer.currentTick;
+ }
+ break;
+ // Paper end
case 3:
default:
if ( miscBB.c( entity.getBoundingBox() ) )
@@ -192,11 +208,14 @@ public class ActivationRange
*/
public static boolean checkEntityImmunities(Entity entity)
{
- // quick checks.
- if ( entity.inWater || entity.fireTicks > 0 )
- {
+ // Paper start - optimize Water cases
+ if ((entity.inWater && (!(entity instanceof EntityInsentient) || !(((EntityInsentient) entity).getNavigation() instanceof NavigationGuardian)))) {
+ return true;
+ }
+ if (entity.fireTicks > 0) {
return true;
}
+ // Paper end
if ( !( entity instanceof EntityArrow ) )
{
if ( !entity.onGround || !entity.passengers.isEmpty() || entity.isPassenger() )
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 66c399a2..f872c155 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -144,12 +144,14 @@ public class SpigotWorldConfig
public int animalActivationRange = 32;
public int monsterActivationRange = 32;
public int miscActivationRange = 16;
+ public int waterActivationRange = 16; // Paper
public boolean tickInactiveVillagers = true;
private void activationRange()
{
animalActivationRange = getInt( "entity-activation-range.animals", animalActivationRange );
monsterActivationRange = getInt( "entity-activation-range.monsters", monsterActivationRange );
miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange );
+ waterActivationRange = getInt( "entity-activation-range.water", waterActivationRange ); // Paper
tickInactiveVillagers = getBoolean( "entity-activation-range.tick-inactive-villagers", tickInactiveVillagers );
log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange + " / Tiv " + tickInactiveVillagers );
}
--
2.19.1

View file

@ -0,0 +1,34 @@
From 1a9b0d21e27dd93bd48f483b2336201f6ba110c1 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 8 Oct 2018 17:51:52 +0100
Subject: [PATCH] Backport: Prevent mob spawning from loading/generating chunks
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 11e69a05..5c5bed03 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -158,9 +158,9 @@ public final class SpawnerCreature {
int i2 = blockposition1.getX();
int j2 = blockposition1.getY();
int k2 = blockposition1.getZ();
- IBlockData iblockdata = worldserver.getType(blockposition1);
+ IBlockData iblockdata = worldserver.getWorldBorder().isInBounds(blockposition1) ? worldserver.getTypeIfLoaded(blockposition1) : null; // Paper
- if (!iblockdata.l()) {
+ if (iblockdata != null && !iblockdata.l()) { // Paper
int l2 = 0;
int i3 = 0;
@@ -184,7 +184,7 @@ public final class SpawnerCreature {
float f = (float) j3 + 0.5F;
float f1 = (float) l3 + 0.5F;
- if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) {
+ if (worldserver.getWorldBorder().isInBounds(blockposition_mutableblockposition) && worldserver.getChunkIfLoaded(blockposition_mutableblockposition) != null && !worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { // Paper - Prevent mob spawning from loading/generating chunks
if (biomebase_biomemeta == null) {
biomebase_biomemeta = worldserver.a(enumcreaturetype, (BlockPosition) blockposition_mutableblockposition);
if (biomebase_biomemeta == null) {
--
2.19.1

View file

@ -0,0 +1,132 @@
From 25f06715b685a629d93544f7a05d99c243b6d56e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 11 Aug 2018 00:49:20 -0400
Subject: [PATCH] Detect and repair corrupt Region Files
If the file has partial data written but not the full 8192 bytes,
then the server will be unable to load that region file...
I don't know why mojang only checks for 4096, when anything less than 8192 is a crash.
But to be safe, it will attempt to back up the file.
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index eac8b22b..d58cda9a 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -28,10 +28,10 @@ public class RegionFile {
private static final boolean ENABLE_EXTENDED_SAVE = Boolean.parseBoolean(System.getProperty("net.minecraft.server.RegionFile.enableExtendedSave", "true"));
// Spigot end
private static final byte[] a = new byte[4096];
- private final File b;
- private RandomAccessFile c;
- private final int[] d = new int[1024];
- private final int[] e = new int[1024];
+ private final File b;private File getFile() { return b; } // Paper - OBFHELPER
+ private RandomAccessFile c;private RandomAccessFile getDataFile() { return c; } // Paper - OBFHELPER
+ private final int[] d = new int[1024];private int[] offsets = d; // Paper - OBFHELPER
+ private final int[] e = new int[1024];private int[] timestamps = e; // Paper - OBFHELPER
private List<Boolean> f;
private int g;
private long h;
@@ -45,10 +45,11 @@ public class RegionFile {
this.h = file.lastModified();
}
+
this.c = new RandomAccessFile(file, "rw");
- if (this.c.length() < 4096L) {
- this.c.write(RegionFile.a);
- this.c.write(RegionFile.a);
+ if (this.c.length() < 8192L) { // Paper - headers should be 8192
+ this.c.write(a);
+ this.c.write(a);
this.g += 8192;
}
@@ -96,22 +97,23 @@ public class RegionFile {
this.c.seek(j * 4 + 4); // Go back to where we were
}
}
- if (k != 0 && (k >> 8) + (length) <= this.f.size()) {
+ if (k > 0 && (k >> 8) > 1 && (k >> 8) + (length) <= this.f.size()) { // Paper >= 1 as 0/1 are the headers, and negative isnt valid
for (int l = 0; l < (length); ++l) {
// Spigot end
this.f.set((k >> 8) + l, Boolean.valueOf(false));
}
}
// Spigot start
- else if (length > 0) {
+ else if (k != 0) { // Paper
org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Invalid chunk: ({0}, {1}) Offset: {2} Length: {3} runs off end file. {4}", new Object[]{j % 32, (int) (j / 32), k >> 8, length, file});
+ deleteChunk(j); // Paper
}
// Spigot end
}
for (j = 0; j < 1024; ++j) {
k = headerAsInts.get(); // Paper
- this.e[j] = k;
+ if (offsets[j] != 0) this.timestamps[j] = k; // Paper - don't set timestamp if it got 0'd above due to corruption
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
@@ -302,6 +304,55 @@ public class RegionFile {
}
+ // Paper start
+ public synchronized void deleteChunk(int j1) {
+ backup();
+ int k = offsets[j1];
+ int x = j1 & 1024;
+ int z = j1 >> 2;
+ int offset = (k >> 8);
+ int len = (k & 255);
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger();
+ String debug = "idx:" + + j1 + " - " + x + "," + z + " - offset: " + offset + " - len: " + len;
+ try {
+ RandomAccessFile file = getDataFile();
+ file.seek(j1 * 4);
+ file.writeInt(0);
+ // clear the timestamp
+ file.seek(4096 + j1 * 4);
+ file.writeInt(0);
+ timestamps[j1] = 0;
+ offsets[j1] = 0;
+ logger.error("Deleted corrupt chunk (" + debug + ") " + getFile().getAbsolutePath(), e);
+ } catch (IOException e) {
+
+ logger.error("Error deleting corrupt chunk (" + debug + ") " + getFile().getAbsolutePath(), e);
+ }
+ }
+ private boolean backedUp = false;
+ private synchronized void backup() {
+ if (backedUp) {
+ return;
+ }
+ backedUp = true;
+ File file = this.getFile();
+ java.text.DateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd");
+ java.util.Date today = new java.util.Date();
+ File corrupt = new File(file.getParentFile(), file.getName() + "." + formatter.format(today) + ".corrupt");
+ if (corrupt.exists()) {
+ return;
+ }
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger();
+ logger.error("Region file " + file.getAbsolutePath() + " was corrupt. Backing up to " + corrupt.getAbsolutePath() + " and repairing");
+ try {
+ java.nio.file.Files.copy(file.toPath(), corrupt.toPath());
+
+ } catch (IOException e) {
+ logger.error("Error backing up corrupt file" + file.getAbsolutePath(), e);
+ }
+ }
+ // Paper end
+
class ChunkBuffer extends ByteArrayOutputStream {
private final int b;
--
2.20.1

View file

@ -0,0 +1,144 @@
From eb1f52537e3d7166a3d72850715cd6ec8d6c8160 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 12 Oct 2018 01:37:54 -0400
Subject: [PATCH] Backport the dupe uuid and entity log changes
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index ed1475351..ba299afc4 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -543,7 +543,7 @@ public class PaperWorldConfig {
}
public enum DuplicateUUIDMode {
- SAFE_REGEN, REGEN, DELETE, NOTHING, WARN
+ SAFE_REGEN, DELETE, NOTHING, WARN
}
public DuplicateUUIDMode duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN;
public int duplicateUUIDDeleteRange = 32;
@@ -553,13 +553,10 @@ public class PaperWorldConfig {
switch (desiredMode.toLowerCase()) {
case "saferegen":
case "saferegenerate":
- duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN;
- log("Duplicate UUID Resolve: Safer Regenerate New UUID (Delete likely duplicates within " + duplicateUUIDDeleteRange + " blocks)");
- break;
case "regen":
case "regenerate":
- duplicateUUIDMode = DuplicateUUIDMode.REGEN;
- log("Duplicate UUID Resolve: Regenerate New UUID");
+ duplicateUUIDMode = DuplicateUUIDMode.SAFE_REGEN;
+ log("Duplicate UUID Resolve: Safer Regenerate New UUID (Delete likely duplicates within " + duplicateUUIDDeleteRange + " blocks)");
break;
case "remove":
case "delete":
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 4f88db79a..4060fd274 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -878,7 +878,7 @@ public class Chunk {
List entityslice = aentityslice[j]; // Spigot
// Paper start
DuplicateUUIDMode mode = world.paperConfig.duplicateUUIDMode;
- if (mode == DuplicateUUIDMode.WARN || mode == DuplicateUUIDMode.DELETE || mode == DuplicateUUIDMode.REGEN || mode == DuplicateUUIDMode.SAFE_REGEN) {
+ if (mode == DuplicateUUIDMode.WARN || mode == DuplicateUUIDMode.DELETE || mode == DuplicateUUIDMode.SAFE_REGEN) {
Map<UUID, Entity> thisChunk = new HashMap<>();
for (Iterator<Entity> iterator = ((List<Entity>) entityslice).iterator(); iterator.hasNext(); ) {
Entity entity = iterator.next();
@@ -893,27 +893,26 @@ public class Chunk {
&& java.util.Objects.equals(other.getSaveID(), entity.getSaveID())
&& entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < world.paperConfig.duplicateUUIDDeleteRange
) {
- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
entity.die();
iterator.remove();
continue;
}
if (other != null && !other.dead) {
switch (mode) {
- case SAFE_REGEN:
- case REGEN: {
+ case SAFE_REGEN: {
entity.setUUID(UUID.randomUUID());
- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
break;
}
case DELETE: {
- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
entity.die();
iterator.remove();
break;
}
default:
- logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ if (World.DEBUG_ENTITIES) logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
break;
}
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index bcbdadbd3..7633a6134 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -45,6 +45,7 @@ public abstract class World implements IBlockAccess {
private int a = 63;
protected boolean d;
// Spigot start - guard entity list from removals
+ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper
public final List<Entity> entityList = new java.util.ArrayList<Entity>()
{
@Override
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index b19942e0f..d29420dd4 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -54,7 +54,6 @@ public class WorldServer extends World implements IAsyncTaskHandler {
private final List<NextTickListEntry> W = Lists.newArrayList();
// CraftBukkit start
- private static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper
private static Throwable getAddToWorldStackTrace(Entity entity) {
return new Throwable(entity + " Added to world at " + new Date());
}
@@ -1164,8 +1163,10 @@ public class WorldServer extends World implements IAsyncTaskHandler {
private boolean j(Entity entity) {
if (entity.dead) {
- WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit // Paper
- if (DEBUG_ENTITIES) getAddToWorldStackTrace(entity).printStackTrace();
+ if (DEBUG_ENTITIES) {
+ WorldServer.a.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.a(entity)); // CraftBukkit // Paper
+ getAddToWorldStackTrace(entity).printStackTrace();
+ }
return false;
} else {
UUID uuid = entity.getUniqueID();
@@ -1178,9 +1179,10 @@ public class WorldServer extends World implements IAsyncTaskHandler {
} else {
if (!(entity instanceof EntityHuman)) {
if (entity.world.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) {
- WorldServer.a.error("Keeping entity {} that already exists with UUID {}", entity1, uuid.toString()); // CraftBukkit // Paper
- WorldServer.a.error("Duplicate entity {} will not be added to the world. See paper.yml duplicate-uuid-resolver and set this to either regen, delete or nothing to get rid of this message", entity); // Paper
if (DEBUG_ENTITIES) {
+ WorldServer.a.error("Keeping entity {} that already exists with UUID {}", entity1, uuid.toString()); // CraftBukkit // Paper
+ WorldServer.a.error("Duplicate entity {} will not be added to the world. See paper.yml duplicate-uuid-resolver and set this to either regen, delete or nothing to get rid of this message", entity); // Paper
+
if (entity1.addedToWorldStack != null) {
entity1.addedToWorldStack.printStackTrace();
}
@@ -1211,8 +1213,8 @@ public class WorldServer extends World implements IAsyncTaskHandler {
Entity old = this.entitiesByUUID.put(entity.getUniqueID(), entity);
if (old != null && old.getId() != entity.getId() && old.valid && entity.world.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) {
Logger logger = LogManager.getLogger();
- logger.error("Overwrote an existing entity " + old + " with " + entity);
if (DEBUG_ENTITIES) {
+ logger.error("Overwrote an existing entity " + old + " with " + entity);
if (old.addedToWorldStack != null) {
old.addedToWorldStack.printStackTrace();
} else {
--
2.21.0

View file

@ -0,0 +1,21 @@
From 120ded7b1d9144d338d1aa4b3d769dbe498f5f5e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 12 Oct 2018 22:41:29 -0400
Subject: [PATCH] MC-54026: Backport 1.13 client desync fix on fast tools
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index fcb64666..3d867982 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -197,6 +197,7 @@ public class PlayerInteractManager {
int i = (int) (f * 10.0F);
this.world.c(this.player.getId(), blockposition, i);
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // Paper - MC-54026 - backport from 1.13
this.k = i;
}
--
2.19.1

View file

@ -0,0 +1,40 @@
From 652ddff89bc697d79803e1fc33b767bc5af0c1a8 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Tue, 23 Oct 2018 22:03:37 -0400
Subject: [PATCH] Do not let the server load chunks from newer versions
If the server attempts to load a chunk generated by a newer version of
the game, immediately stop the server to prevent data corruption.
You can override this functionality at your own peril.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index bad287fca..e6906effb 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -90,8 +90,22 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
return nbttagcompound != null ? true : RegionFileCache.chunkExists(this.d, i, j);
}
+ // Paper start
+ private static final int CURRENT_DATA_VERSION = 1343; // Paper
+ private static final boolean JUST_CORRUPT_IT = Boolean.valueOf("Paper.ignoreWorldDataVersion");
+ // Paper end
+
@Nullable
protected Object[] a(World world, int i, int j, NBTTagCompound nbttagcompound) { // CraftBukkit - return Chunk -> Object[]
+ // Paper start - Do NOT attempt to load chunks saved with newer versions
+ if (nbttagcompound.hasKeyOfType("DataVersion", 3)) {
+ int dataVersion = nbttagcompound.getInt("DataVersion");
+ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) {
+ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace();
+ System.exit(1);
+ }
+ }
+ // Paper end
if (!nbttagcompound.hasKeyOfType("Level", 10)) {
ChunkRegionLoader.a.error("Chunk file at {},{} is missing level data, skipping", Integer.valueOf(i), Integer.valueOf(j));
return null;
--
2.19.1

View file

@ -0,0 +1,36 @@
From 88f7737821901b4291d56f94b497b50068cda9d0 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Mon, 5 Nov 2018 21:50:13 -0500
Subject: [PATCH] Fix server icon encoding to show properly on 1.13 clients as
well
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e0546e3d..3b982f99 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -735,7 +735,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
/*ByteBuf */ bytebuf1 = Base64.encode(bytebuf); // Paper - cleanup favicon bytebuf
- serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(StandardCharsets.UTF_8));
+ serverping.setFavicon("data:image/png;base64," + bytebuf1.toString(StandardCharsets.UTF_8).replace("\n", "")); // Paper - Fix encoding for 1.13+ clients, still compat w/ 1.12 clients
} catch (Exception exception) {
MinecraftServer.LOGGER.error("Couldn\'t load server icon", exception);
} finally {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9fe55598..7c82e18b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1778,7 +1778,7 @@ public final class CraftServer implements Server {
ImageIO.write(image, "PNG", new ByteBufOutputStream(bytebuf));
ByteBuf bytebuf1 = Base64.encode(bytebuf);
- return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8));
+ return new CraftIconCache("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8).replace("\n", "")); // Paper - Fix encoding for 1.13+ clients, still compat w/ 1.12 clients
}
@Override
--
2.19.2

View file

@ -0,0 +1,98 @@
From cb5abe5576e8400081e6a1a552178d3f14bf7604 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 17 Nov 2018 00:08:54 -0500
Subject: [PATCH] Limit Book Sizes
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 332e90f8..27203eea 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -320,4 +320,18 @@ public class PaperConfig {
tabSpamIncrement = getInt("settings.spam-limiter.tab-spam-increment", tabSpamIncrement);
tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
}
+
+
+ public static int maxBookPageSize = 2560;
+ public static double maxBookTotalSizeMultiplier = 0.98D;
+ private static void maxBookSize() {
+ maxBookPageSize = getInt("settings.book-size.page-max", maxBookPageSize);
+ maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier);
+ if (maxBookPageSize == 1024 && maxBookTotalSizeMultiplier == 0.90D) {
+ config.set("settings.book-size.page-max", 2560);
+ config.set("settings.book-size.total-multiplier", 0.98D);
+ maxBookPageSize = 2560;
+ maxBookTotalSizeMultiplier = 0.98D;
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d6d2010d..de62c3b7 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2329,6 +2329,45 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
this.player.a(packetplayinsettings);
}
+ // Paper start
+ private boolean validateBook(ItemStack testStack) {
+ NBTTagList pageList = testStack.getTag().getList("pages", 8);
+ long byteTotal = 0;
+ int maxBookPageSize = com.destroystokyo.paper.PaperConfig.maxBookPageSize;
+ double multiplier = Math.max(0.3D, Math.min(1D, com.destroystokyo.paper.PaperConfig.maxBookTotalSizeMultiplier));
+ long byteAllowed = maxBookPageSize;
+ for (int i = 0; i < pageList.size(); ++i) {
+ String testString = pageList.getString(i);
+ int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
+ byteTotal += byteLength;
+
+ int length = testString.length();
+ int multibytes = 0;
+ if (length != byteLength) {
+ for (char c : testString.toCharArray()) {
+ if (c > 127) {
+ multibytes++;
+ }
+ }
+ }
+ byteAllowed += (maxBookPageSize * Math.min(1, Math.max(0.1D, (double) length / 255D))) * multiplier;
+
+ if (multibytes > 1) {
+ // penalize MB
+ byteAllowed -= multibytes;
+ }
+ }
+
+ if (byteTotal > byteAllowed) {
+ PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
+ minecraftServer.postToMainThread(() -> this.disconnect("Book too large!"));
+ return false;
+ }
+
+ return true;
+ }
+ // Paper end
+
public void a(PacketPlayInCustomPayload packetplayincustompayload) {
PlayerConnectionUtils.ensureMainThread(packetplayincustompayload, this, this.player.x());
String s = packetplayincustompayload.a();
@@ -2362,6 +2401,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
+ if (!validateBook(itemstack)) return; // Paper
itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
}
@@ -2397,6 +2437,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
+ if (!validateBook(itemstack)) return; // Paper
ItemStack itemstack2 = new ItemStack(Items.WRITTEN_BOOK);
itemstack2.a("author", (NBTBase) (new NBTTagString(this.player.getName())));
--
2.20.1

View file

@ -0,0 +1,35 @@
From a55fa31b0d23301861e55b4c70ebee7ad66c519d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 26 Nov 2018 19:44:01 -0500
Subject: [PATCH] Prevent rayTrace from loading chunks
ray tracing into an unloaded chunk should be treated as a miss
this saves a ton of lag for when AI tries to raytrace near unloaded chunks.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7633a613..bc231c7f 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -932,7 +932,8 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(vec3d.y);
int j1 = MathHelper.floor(vec3d.z);
BlockPosition blockposition = new BlockPosition(l, i1, j1);
- IBlockData iblockdata = this.getType(blockposition);
+ IBlockData iblockdata = this.getTypeIfLoaded(blockposition); // Paper
+ if (iblockdata == null) return null; // Paper
Block block = iblockdata.getBlock();
if ((!flag1 || iblockdata.d(this, blockposition) != Block.k) && block.a(iblockdata, flag)) {
@@ -1034,7 +1035,8 @@ public abstract class World implements IBlockAccess {
i1 = MathHelper.floor(vec3d.y) - (enumdirection == EnumDirection.UP ? 1 : 0);
j1 = MathHelper.floor(vec3d.z) - (enumdirection == EnumDirection.SOUTH ? 1 : 0);
blockposition = new BlockPosition(l, i1, j1);
- IBlockData iblockdata1 = this.getType(blockposition);
+ IBlockData iblockdata1 = this.getTypeIfLoaded(blockposition); // Paper
+ if (iblockdata1 == null) return null; // Paper
Block block1 = iblockdata1.getBlock();
if (!flag1 || iblockdata1.getMaterial() == Material.PORTAL || iblockdata1.d(this, blockposition) != Block.k) {
--
2.19.2

View file

@ -0,0 +1,104 @@
From 68670b9f2491fd93af0b802272f6d9f08ed75474 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 27 Nov 2018 21:18:06 -0500
Subject: [PATCH] Handle Large Packets disconnecting client
If a players inventory is too big to send in a single packet,
split the inventory set into multiple packets instead.
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 3d32e005..a7fcc14f 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -112,6 +112,15 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) throws Exception {
+ // Paper start
+ if (throwable instanceof io.netty.handler.codec.EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException) {
+ if (((PacketEncoder.PacketTooLargeException) throwable.getCause()).getPacket().packetTooLarge(this)) {
+ return;
+ } else {
+ throwable = throwable.getCause();
+ }
+ }
+ // Paper end
ChatMessage chatmessage;
if (throwable instanceof TimeoutException) {
diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java
index fdc142b7..b283e155 100644
--- a/src/main/java/net/minecraft/server/Packet.java
+++ b/src/main/java/net/minecraft/server/Packet.java
@@ -8,5 +8,10 @@ public interface Packet<T extends PacketListener> {
void b(PacketDataSerializer packetdataserializer) throws IOException;
+ // Paper start
+ default boolean packetTooLarge(NetworkManager manager) {
+ return false;
+ }
+ // Paper end
void a(T t0);
}
diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java
index a6da6f5c..4e263aa8 100644
--- a/src/main/java/net/minecraft/server/PacketEncoder.java
+++ b/src/main/java/net/minecraft/server/PacketEncoder.java
@@ -44,11 +44,32 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
PacketEncoder.a.error(throwable);
}
+ // Paper start
+ int packetLength = bytebuf.readableBytes();
+ if (packetLength > MAX_PACKET_SIZE) {
+ throw new PacketTooLargeException(packet, packetLength);
+ }
+ // Paper end
}
}
}
- protected void encode(ChannelHandlerContext channelhandlercontext, Object object, ByteBuf bytebuf) throws Exception {
+ // Paper start
+ private static int MAX_PACKET_SIZE = 2097152;
+ public static class PacketTooLargeException extends RuntimeException {
+ private final Packet<?> packet;
+ PacketTooLargeException(Packet<?> packet, int packetLength) {
+ super("PacketTooLarge - " + packet.getClass().getSimpleName() + " is " + packetLength +". Max is " + MAX_PACKET_SIZE);
+ this.packet = packet;
+ }
+
+ public Packet<?> getPacket() {
+ return packet;
+ }
+ }
+ // Paper end
+
+ protected void encode(ChannelHandlerContext channelhandlercontext, Packet<?> object, ByteBuf bytebuf) throws Exception { // Paper - decompile fix
this.a(channelhandlercontext, (Packet) object, bytebuf);
}
}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java
index bf47c824..e054757d 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java
@@ -9,6 +9,15 @@ public class PacketPlayOutWindowItems implements Packet<PacketListenerPlayOut> {
private int a;
private List<ItemStack> b;
+ //Paper start
+ @Override
+ public boolean packetTooLarge(NetworkManager manager) {
+ for (int i = 0 ; i < this.b.size() ; i++) {
+ manager.sendPacket(new PacketPlayOutSetSlot(this.a, i, this.b.get(i)));
+ }
+ return true;
+ }
+ // Paper end
public PacketPlayOutWindowItems() {}
public PacketPlayOutWindowItems(int i, NonNullList<ItemStack> nonnulllist) {
--
2.19.2

View file

@ -0,0 +1,72 @@
From ae78e5026972a2c6190432b90775db89adab66da Mon Sep 17 00:00:00 2001
From: Amosar <maxi.cass11@gmail.com>
Date: Sat, 1 Dec 2018 20:00:22 +0000
Subject: [PATCH] backport: SPIGOT-2719: Comparator and Observer don't trigger
BlockRedstoneEvent
diff --git a/src/main/java/net/minecraft/server/BlockObserver.java b/src/main/java/net/minecraft/server/BlockObserver.java
index 59e93e6f..5836a763 100644
--- a/src/main/java/net/minecraft/server/BlockObserver.java
+++ b/src/main/java/net/minecraft/server/BlockObserver.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import java.util.Random;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // Paper
public class BlockObserver extends BlockDirectional {
@@ -26,8 +27,18 @@ public class BlockObserver extends BlockDirectional {
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (((Boolean) iblockdata.get(BlockObserver.a)).booleanValue()) {
+ // Paper start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // Paper end
world.setTypeAndData(blockposition, iblockdata.set(BlockObserver.a, Boolean.valueOf(false)), 2);
} else {
+ // Paper start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // Paper end
world.setTypeAndData(blockposition, iblockdata.set(BlockObserver.a, Boolean.valueOf(true)), 2);
world.a(blockposition, (Block) this, 2);
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneComparator.java b/src/main/java/net/minecraft/server/BlockRedstoneComparator.java
index 78ad3374..04d973d9 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneComparator.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneComparator.java
@@ -4,6 +4,7 @@ import com.google.common.base.Predicate;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; //Paper
public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
@@ -164,8 +165,18 @@ public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITile
boolean flag1 = this.A(iblockdata);
if (flag1 && !flag) {
+ // Paper start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // Paper end
world.setTypeAndData(blockposition, iblockdata.set(BlockRedstoneComparator.POWERED, Boolean.valueOf(false)), 2);
} else if (!flag1 && flag) {
+ // Paper start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // Paper end
world.setTypeAndData(blockposition, iblockdata.set(BlockRedstoneComparator.POWERED, Boolean.valueOf(true)), 2);
}
--
2.19.2

View file

@ -0,0 +1,40 @@
From 45f2b8707a23911141a1c20a4f9176060014091e Mon Sep 17 00:00:00 2001
From: connorhartley <vectrixu+gh@gmail.com>
Date: Mon, 31 Dec 2018 18:54:23 +1300
Subject: [PATCH] Fix an issue where the vehicle doesn't track the passenger
when they disconnect
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d44c55d84..74bbba011 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2958,6 +2958,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
return entity instanceof EntityHuman ? ((EntityHuman) entity).cZ() : !this.world.isClientSide;
}
+ @Nullable Entity getVehicleDirect() { return this.bJ(); } // Paper - OBFHELPER
@Nullable
public Entity bJ() {
return this.au;
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 6afb6cf7b..c1a2ddcf5 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1088,6 +1088,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void s() {
this.cu = true;
this.ejectPassengers();
+
+ // Paper start - "Fixes" an issue where the vehicle doesn't track the passenger disconnection dismount.
+ if (this.isPassenger() && this.getVehicleDirect() instanceof EntityPlayer) {
+ this.stopRiding();
+ }
+ // Paper end
+
if (this.sleeping) {
this.a(true, false, false);
}
--
2.20.1

View file

@ -0,0 +1,433 @@
From bd0b04c85e7127c741ae442a8183085f7a1d1d72 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 15 Feb 2019 01:08:19 -0500
Subject: [PATCH] Allow Saving of Oversized Chunks
The Minecraft World Region File format has a hard cap of 1MB per chunk.
This is due to the fact that the header of the file format only allocates
a single byte for sector count, meaning a maximum of 256 sectors, at 4k per sector.
This limit can be reached fairly easily with books, resulting in the chunk being unable
to save to the world. Worse off, is that nothing printed when this occured, and silently
performed a chunk rollback on next load.
This leads to security risk with duplication and is being actively exploited.
This patch catches the too large scenario, falls back and moves any large Entity
or Tile Entity into a new compound, and this compound is saved into a different file.
On Chunk Load, we check for oversized status, and if so, we load the extra file and
merge the Entities and Tile Entities from the oversized chunk back into the level to
then be loaded as normal.
Once a chunk is returned back to normal size, the oversized flag will clear, and no
extra data file will exist.
This fix maintains compatability with all existing Anvil Region Format tools as it
does not alter the save format. They will just not know about the extra entities.
This fix also maintains compatability if someone switches server jars to one without
this fix, as the data will remain in the oversized file. Once the server returns
to a jar with this fix, the data will be restored.
diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
index 2162d3ad3..8b5aeb1b0 100644
--- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
@@ -39,6 +39,7 @@ public class NBTCompressedStreamTools {
}
+ public static NBTTagCompound readNBT(DataInputStream datainputstream) throws IOException { return a(datainputstream); } // Paper - OBFHELPER
public static NBTTagCompound a(DataInputStream datainputstream) throws IOException {
return a((DataInput) datainputstream, NBTReadLimiter.a);
}
@@ -59,6 +60,7 @@ public class NBTCompressedStreamTools {
}
}
+ public static void writeNBT(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { a(nbttagcompound, dataoutput); } // Paper - OBFHELPER
public static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException {
a((NBTBase) nbttagcompound, dataoutput);
}
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index d58cda9aa..542a35d13 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -83,6 +83,7 @@ public class RegionFile {
}
header.clear();
IntBuffer headerAsInts = header.asIntBuffer();
+ initOversizedState();
// Paper End
for (j = 0; j < 1024; ++j) {
k = headerAsInts.get(); // Paper
@@ -123,7 +124,7 @@ public class RegionFile {
}
@Nullable
- public synchronized DataInputStream a(int i, int j) {
+ public synchronized DataInputStream getReadStream(int i, int j) { return a(i, j); } @Nullable public synchronized DataInputStream a(int i, int j) { // Paper - OBFHELPER
if (this.d(i, j)) {
return null;
} else {
@@ -179,8 +180,8 @@ public class RegionFile {
}
@Nullable
- public DataOutputStream b(int i, int j) {
- return this.d(i, j) ? null : new DataOutputStream(new BufferedOutputStream(new DeflaterOutputStream(new RegionFile.ChunkBuffer(i, j))));
+ public DataOutputStream getWriteStream(int i, int j) { return b(i, j); } @Nullable public DataOutputStream b(int i, int j) { // Paper - OBFHELPER
+ return this.d(i, j) ? null : new DataOutputStream(new RegionFile.ChunkBuffer(i, j)); // Paper - remove middleware, move deflate to .close() for dynamic levels
}
protected synchronized void a(int i, int j, byte[] abyte, int k) {
@@ -198,8 +199,9 @@ public class RegionFile {
if (k1 >= 256) {
// Spigot start
- if (!ENABLE_EXTENDED_SAVE) return;
+ if (!USE_SPIGOT_OVERSIZED_METHOD && !RegionFileCache.isOverzealous()) throw new ChunkTooLargeException(i, j, k1); // Paper - throw error instead
org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING,"Large Chunk Detected: ({0}, {1}) Size: {2} {3}", new Object[]{i, j, k1, this.b});
+ if (!ENABLE_EXTENDED_SAVE) return;
// Spigot end
}
@@ -351,6 +353,110 @@ public class RegionFile {
logger.error("Error backing up corrupt file" + file.getAbsolutePath(), e);
}
}
+
+ private final byte[] oversized = new byte[1024];
+ private int oversizedCount = 0;
+
+ private synchronized void initOversizedState() throws IOException {
+ File metaFile = getOversizedMetaFile();
+ if (metaFile.exists()) {
+ final byte[] read = java.nio.file.Files.readAllBytes(metaFile.toPath());
+ System.arraycopy(read, 0, oversized, 0, oversized.length);
+ for (byte temp : oversized) {
+ oversizedCount += temp;
+ }
+ }
+ }
+
+ private static int getChunkIndex(int x, int z) {
+ return (x & 31) + (z & 31) * 32;
+ }
+ synchronized boolean isOversized(int x, int z) {
+ return this.oversized[getChunkIndex(x, z)] == 1;
+ }
+ synchronized void setOversized(int x, int z, boolean oversized) throws IOException {
+ final int offset = getChunkIndex(x, z);
+ boolean previous = this.oversized[offset] == 1;
+ this.oversized[offset] = (byte) (oversized ? 1 : 0);
+ if (!previous && oversized) {
+ oversizedCount++;
+ } else if (!oversized && previous) {
+ oversizedCount--;
+ }
+ if (previous && !oversized) {
+ File oversizedFile = getOversizedFile(x, z);
+ if (oversizedFile.exists()) {
+ oversizedFile.delete();
+ }
+ }
+ if (oversizedCount > 0) {
+ if (previous != oversized) {
+ writeOversizedMeta();
+ }
+ } else if (previous) {
+ File oversizedMetaFile = getOversizedMetaFile();
+ if (oversizedMetaFile.exists()) {
+ oversizedMetaFile.delete();
+ }
+ }
+ }
+
+ private void writeOversizedMeta() throws IOException {
+ java.nio.file.Files.write(getOversizedMetaFile().toPath(), oversized);
+ }
+
+ private File getOversizedMetaFile() {
+ return new File(getFile().getParentFile(), getFile().getName().replaceAll("\\.mca$", "") + ".oversized.nbt");
+ }
+
+ private File getOversizedFile(int x, int z) {
+ return new File(this.getFile().getParentFile(), this.getFile().getName().replaceAll("\\.mca$", "") + "_oversized_" + x + "_" + z + ".nbt");
+ }
+
+ void writeOversizedData(int x, int z, NBTTagCompound oversizedData) throws IOException {
+ File file = getOversizedFile(x, z);
+ try (DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new DeflaterOutputStream(new java.io.FileOutputStream(file), new java.util.zip.Deflater(java.util.zip.Deflater.BEST_COMPRESSION), 32 * 1024), 32 * 1024))) {
+ NBTCompressedStreamTools.writeNBT(oversizedData, out);
+ }
+ this.setOversized(x, z, true);
+
+ }
+
+ synchronized NBTTagCompound getOversizedData(int x, int z) throws IOException {
+ File file = getOversizedFile(x, z);
+ try (DataInputStream out = new DataInputStream(new BufferedInputStream(new InflaterInputStream(new java.io.FileInputStream(file))))) {
+ return NBTCompressedStreamTools.readNBT(out);
+ }
+
+ }
+
+ private static final boolean USE_SPIGOT_OVERSIZED_METHOD = Boolean.getBoolean("Paper.useSpigotExtendedSaveMethod"); // Paper
+ static {
+ if (USE_SPIGOT_OVERSIZED_METHOD) {
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "====================================");
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "Using Spigot Oversized Chunk save method. Warning this will result in extremely fragmented chunks, as well as making the entire region file unable to be to used in any other software but Forge or Spigot (not usable in Vanilla or CraftBukkit). Paper's method is highly recommended.");
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "====================================");
+ }
+ }
+
+ public class ChunkTooLargeException extends RuntimeException {
+ public ChunkTooLargeException(int x, int z, int sectors) {
+ super("Chunk " + x + "," + z + " of " + getFile().toString() + " is too large (" + sectors + "/256)");
+ }
+ }
+ private static class DirectByteArrayOutputStream extends ByteArrayOutputStream {
+ public DirectByteArrayOutputStream() {
+ super();
+ }
+
+ public DirectByteArrayOutputStream(int size) {
+ super(size);
+ }
+
+ public byte[] getBuffer() {
+ return this.buf;
+ }
+ }
// Paper end
class ChunkBuffer extends ByteArrayOutputStream {
@@ -364,8 +470,36 @@ public class RegionFile {
this.c = j;
}
- public void close() {
- RegionFile.this.a(this.b, this.c, this.buf, this.count);
+ public void close() throws IOException {
+ // Paper start - apply dynamic compression
+ int origLength = this.count;
+ byte[] buf = this.buf;
+ DirectByteArrayOutputStream out = compressData(buf, origLength);
+ byte[] bytes = out.getBuffer();
+ int length = out.size();
+
+ RegionFile.this.a(this.b, this.c, bytes, length); // Paper - change to bytes/length
}
}
+
+ private static final byte[] compressionBuffer = new byte[1024 * 64]; // 64k fits most standard chunks input size even, ideally 1 pass through zlib
+ private static final java.util.zip.Deflater deflater = new java.util.zip.Deflater();
+ // since file IO is single threaded, no benefit to using per-region file buffers/synchronization, we can change that later if it becomes viable.
+ private static DirectByteArrayOutputStream compressData(byte[] buf, int length) throws IOException {
+ synchronized (deflater) {
+ deflater.setInput(buf, 0, length);
+ deflater.finish();
+
+
+ DirectByteArrayOutputStream out = new DirectByteArrayOutputStream(length);
+ while (!deflater.finished()) {
+ out.write(compressionBuffer, 0, deflater.deflate(compressionBuffer));
+ }
+ out.close();
+ deflater.reset();
+ return out;
+ }
+ }
+ // Paper end
+
}
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index 15a09ab36..daa7e997a 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -15,6 +15,7 @@ public class RegionFileCache {
public static final Map<File, RegionFile> a = new LinkedHashMap(PaperConfig.regionFileCacheSize, 0.75f, true); // Spigot - private -> public, Paper - HashMap -> LinkedHashMap
+ public static synchronized RegionFile getRegionFile(File file, int i, int j) { return a(file, i, j); } // Paper - OBFHELPER
public static synchronized RegionFile a(File file, int i, int j) {
File file1 = new File(file, "region");
File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca");
@@ -73,6 +74,139 @@ public class RegionFileCache {
itr.remove();
}
}
+ private static void printOversizedLog(String msg, File file, int x, int z) {
+ org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.");
+ }
+
+ private static final int DEFAULT_SIZE_THRESHOLD = 1024 * 8;
+ private static final int OVERZEALOUS_TOTAL_THRESHOLD = 1024 * 64;
+ private static final int OVERZEALOUS_THRESHOLD = 1024;
+ private static int SIZE_THRESHOLD = DEFAULT_SIZE_THRESHOLD;
+ private static void resetFilterThresholds() {
+ SIZE_THRESHOLD = Math.max(1024 * 4, Integer.getInteger("Paper.FilterThreshhold", DEFAULT_SIZE_THRESHOLD));
+ }
+ static {
+ resetFilterThresholds();
+ }
+
+ static boolean isOverzealous() {
+ return SIZE_THRESHOLD == OVERZEALOUS_THRESHOLD;
+ }
+
+ private static void writeRegion(File file, int x, int z, NBTTagCompound nbttagcompound) throws IOException {
+ RegionFile regionfile = getRegionFile(file, x, z);
+
+ DataOutputStream out = regionfile.getWriteStream(x & 31, z & 31);
+ try {
+ NBTCompressedStreamTools.writeNBT(nbttagcompound, out);
+ out.close();
+ regionfile.setOversized(x, z, false);
+ } catch (RegionFile.ChunkTooLargeException ignored) {
+ printOversizedLog("ChunkTooLarge! Someone is trying to duplicate.", file, x, z);
+ // Clone as we are now modifying it, don't want to corrupt the pending save state
+ nbttagcompound = (NBTTagCompound) nbttagcompound.clone();
+ // Filter out TileEntities and Entities
+ NBTTagCompound oversizedData = filterChunkData(nbttagcompound);
+ //noinspection SynchronizationOnLocalVariableOrMethodParameter
+ synchronized (regionfile) {
+ out = regionfile.getWriteStream(x & 31, z & 31);
+ NBTCompressedStreamTools.writeNBT(nbttagcompound, out);
+ try {
+ out.close();
+ // 2048 is below the min allowed, so it means we enter overzealous mode below
+ if (SIZE_THRESHOLD == OVERZEALOUS_THRESHOLD) {
+ resetFilterThresholds();
+ }
+ } catch (RegionFile.ChunkTooLargeException e) {
+ printOversizedLog("ChunkTooLarge even after reduction. Trying in overzealous mode.", file, x, z);
+ // Eek, major fail. We have retry logic, so reduce threshholds and fall back
+ SIZE_THRESHOLD = OVERZEALOUS_THRESHOLD;
+ throw e;
+ }
+
+ regionfile.writeOversizedData(x, z, oversizedData);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
+
+ }
+
+ private static NBTTagCompound filterChunkData(NBTTagCompound chunk) {
+ NBTTagCompound oversizedLevel = new NBTTagCompound();
+ NBTTagCompound level = chunk.getCompound("Level");
+ filterChunkList(level, oversizedLevel, "Entities");
+ filterChunkList(level, oversizedLevel, "TileEntities");
+ NBTTagCompound oversized = new NBTTagCompound();
+ oversized.set("Level", oversizedLevel);
+ return oversized;
+ }
+
+ private static void filterChunkList(NBTTagCompound level, NBTTagCompound extra, String key) {
+ NBTTagList list = level.getList(key, 10);
+ NBTTagList newList = extra.getList(key, 10);
+ int totalSize = 0;
+ for (Iterator<NBTBase> iterator = list.list.iterator(); iterator.hasNext(); ) {
+ NBTBase object = iterator.next();
+ int nbtSize = getNBTSize(object);
+ if (nbtSize > SIZE_THRESHOLD || (SIZE_THRESHOLD == OVERZEALOUS_THRESHOLD && totalSize > OVERZEALOUS_TOTAL_THRESHOLD)) {
+ newList.add(object);
+ iterator.remove();
+ } else {
+ totalSize += nbtSize;
+ }
+ }
+ level.set(key, list);
+ extra.set(key, newList);
+ }
+
+
+ private static NBTTagCompound readOversizedChunk(RegionFile regionfile, int i, int j) throws IOException {
+ synchronized (regionfile) {
+ try (DataInputStream datainputstream = regionfile.getReadStream(i & 31, j & 31)) {
+ NBTTagCompound oversizedData = regionfile.getOversizedData(i, j);
+ NBTTagCompound chunk = NBTCompressedStreamTools.readNBT(datainputstream);
+ if (oversizedData == null) {
+ return chunk;
+ }
+ NBTTagCompound oversizedLevel = oversizedData.getCompound("Level");
+ NBTTagCompound level = chunk.getCompound("Level");
+
+ mergeChunkList(level, oversizedLevel, "Entities");
+ mergeChunkList(level, oversizedLevel, "TileEntities");
+
+ chunk.set("Level", level);
+
+ return chunk;
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ throw throwable;
+ }
+ }
+ }
+
+ private static void mergeChunkList(NBTTagCompound level, NBTTagCompound oversizedLevel, String key) {
+ NBTTagList levelList = level.getList(key, 10);
+ NBTTagList oversizedList = oversizedLevel.getList(key, 10);
+
+ if (!oversizedList.isEmpty()) {
+ oversizedList.list.forEach(levelList::add);
+ level.set(key, levelList);
+ }
+ }
+
+ private static int getNBTSize(NBTBase nbtBase) {
+ DataOutputStream test = new DataOutputStream(new org.apache.commons.io.output.NullOutputStream());
+ try {
+ nbtBase.write(test);
+ return test.size();
+ } catch (IOException e) {
+ e.printStackTrace();
+ return 0;
+ }
+ }
+
// Paper End
public static synchronized void a() {
@@ -97,6 +231,12 @@ public class RegionFileCache {
// CraftBukkit start - call sites hoisted for synchronization
public static NBTTagCompound d(File file, int i, int j) throws IOException { // Paper - remove synchronization
RegionFile regionfile = a(file, i, j);
+ // Paper start
+ if (regionfile.isOversized(i, j)) {
+ printOversizedLog("Loading Oversized Chunk!", file, i, j);
+ return readOversizedChunk(regionfile, i, j);
+ }
+ // Paper end
DataInputStream datainputstream = regionfile.a(i & 31, j & 31);
@@ -108,11 +248,14 @@ public class RegionFileCache {
}
public static void e(File file, int i, int j, NBTTagCompound nbttagcompound) throws IOException { // Paper - remove synchronization
- RegionFile regionfile = a(file, i, j);
-
- DataOutputStream dataoutputstream = regionfile.b(i & 31, j & 31);
- NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream);
- dataoutputstream.close();
+ writeRegion(file, i, j, nbttagcompound); // Paper - moved to own method
+ // Paper start
+// RegionFile regionfile = a(file, i, j);
+//
+// DataOutputStream dataoutputstream = regionfile.b(i & 31, j & 31);
+// NBTCompressedStreamTools.a(nbttagcompound, (java.io.DataOutput) dataoutputstream);
+// dataoutputstream.close();
+ // Paper end
}
// CraftBukkit end
--
2.21.0

View file

@ -0,0 +1,55 @@
From 5f53285851beaedf12b297903c55b69e200b08e5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 27 Feb 2019 22:18:40 -0500
Subject: [PATCH] Add Stricter Client Sign limits
modified clients can send abnormally large data from the client
to the server and it would get stored on the sign as sent.
the client can barely render around 16 characters as-is, but formatting
codes can get it to be more than 16 actual length.
Set a limit of 80 which should give an average of 16 characters 2
sets of legacy formatting codes which should be plenty for all uses.
This does not strip any existing data from the NBT as plugins
may use this for storing data out of the rendered area.
it only impacts data sent to and from client to extend mojangs limit.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index de62c3b76..64520f174 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2227,6 +2227,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
String[] lines = new String[4];
for (int i = 0; i < astring.length; ++i) {
+ // Paper start - cap line length - modified clients can send longer data than normal
+ if (astring[i].length() > TileEntitySign.MAX_SIGN_LINE_LENGTH && TileEntitySign.MAX_SIGN_LINE_LENGTH > 0) {
+ int offset = astring[i].codePoints().limit(TileEntitySign.MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum();
+ if (offset > astring.length) {
+ astring[i] = astring[i].substring(0, offset);
+ }
+ }
+ // Paper end
lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
}
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 67bd3bcbe..81f74c56b 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -9,6 +9,7 @@ public class TileEntitySign extends TileEntity {
public boolean isEditable = true;
private EntityHuman h;
private final CommandObjectiveExecutor i = new CommandObjectiveExecutor();
+ public static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper
public TileEntitySign() {}
--
2.21.0

View file

@ -0,0 +1,47 @@
From 695d16c229fc12b625aaadb92150e044fa9872f3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 28 Feb 2019 00:15:28 -0500
Subject: [PATCH] Fix sign edit memory leak
when a player edits a sign, a reference to their Entity is never cleand up.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 64520f174..e837a553e 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2211,7 +2211,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
- if (!tileentitysign.a() || tileentitysign.e() != this.player) {
+ if (!tileentitysign.a() || tileentitysign.signEditor == null || !tileentitysign.signEditor.equals(this.player.getUniqueID())) { // Paper
this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit
return;
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 81f74c56b..4ff2c8480 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -10,6 +10,7 @@ public class TileEntitySign extends TileEntity {
private EntityHuman h;
private final CommandObjectiveExecutor i = new CommandObjectiveExecutor();
public static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper
+ public java.util.UUID signEditor; // Paper
public TileEntitySign() {}
@@ -118,7 +119,10 @@ public class TileEntitySign extends TileEntity {
}
public void a(EntityHuman entityhuman) {
- this.h = entityhuman;
+ // Paper start
+ //this.h = entityhuman;
+ signEditor = entityhuman != null ? entityhuman.getUniqueID() : null;
+ // Paper end
}
public EntityHuman e() {
--
2.21.0

View file

@ -0,0 +1,32 @@
From 1c6d78c9728258f137fab6a15efaf16a01429b73 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 2 Mar 2019 11:11:29 -0500
Subject: [PATCH] Don't check ConvertSigns boolean every sign save
property lookups arent super cheap. they synchronize, validate
and check security managers.
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 4ff2c8480..95de8b055 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -10,6 +10,7 @@ public class TileEntitySign extends TileEntity {
private EntityHuman h;
private final CommandObjectiveExecutor i = new CommandObjectiveExecutor();
public static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper
+ private static final boolean CONVERT_LEGACY_SIGNS = Boolean.getBoolean("convertLegacySigns");
public java.util.UUID signEditor; // Paper
public TileEntitySign() {}
@@ -24,7 +25,7 @@ public class TileEntitySign extends TileEntity {
}
// CraftBukkit start
- if (Boolean.getBoolean("convertLegacySigns")) {
+ if (CONVERT_LEGACY_SIGNS) { // Paper
nbttagcompound.setBoolean("Bukkit.isConverted", true);
}
// CraftBukkit end
--
2.21.0

View file

@ -0,0 +1,88 @@
From c73ffdd999a7b85cabc341b0a721f1ab10a55a11 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 2 Mar 2019 14:55:01 -0500
Subject: [PATCH] Handle Excessive Signs in Chunks creating too large of
packets
Also adds a limit to stop sending Sign data to client after 500
signs per chunk to limit client lag.
Use -DPaper.excessiveSignsLimit=500 to configure that limit, or -1
to disable the limit and let your players be abused.
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index a7fcc14f2..95c7eba96 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -223,6 +223,15 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
});
}
+ // Paper start
+ java.util.List<Packet> extraPackets = packet.getExtraPackets();
+ if (extraPackets != null && !extraPackets.isEmpty()) {
+ for (Packet extraPacket : extraPackets) {
+ this.dispatchPacket(extraPacket, agenericfuturelistener);
+ }
+ }
+ // Paper end
+
}
// Paper start - Async-Anti-Xray - Stop dispatching further packets and return false if the peeked packet is a chunk packet which is not ready
diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java
index b283e1557..668d47089 100644
--- a/src/main/java/net/minecraft/server/Packet.java
+++ b/src/main/java/net/minecraft/server/Packet.java
@@ -9,6 +9,7 @@ public interface Packet<T extends PacketListener> {
void b(PacketDataSerializer packetdataserializer) throws IOException;
// Paper start
+ default java.util.List<Packet> getExtraPackets() { return null; }
default boolean packetTooLarge(NetworkManager manager) {
return false;
}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
index 306a6b7cd..4fe7c9956 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -28,6 +28,13 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
}
// Paper end
+ // Paper start
+ private final java.util.List<Packet> extraPackets = new java.util.ArrayList<>();
+ private static final int SKIP_EXCESSIVE_SIGNS_LIMIT = Integer.getInteger("Paper.excessiveSignsLimit", 500);
+ public java.util.List<Packet> getExtraPackets() {
+ return extraPackets;
+ }
+ // Paper end
public PacketPlayOutMapChunk(Chunk chunk, int i) {
PacketPlayOutMapChunkInfo packetPlayOutMapChunkInfo = chunk.world.chunkPacketBlockController.getPacketPlayOutMapChunkInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info
this.a = chunk.locX;
@@ -46,6 +53,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
this.c = this.writeChunk(new PacketDataSerializer(this.g()), chunk, flag, i, packetPlayOutMapChunkInfo); // Paper - Anti-Xray - Add chunk packet info
this.e = Lists.newArrayList();
Iterator iterator = chunk.getTileEntities().entrySet().iterator();
+ int totalSigns = 0; // Paper
while (iterator.hasNext()) {
Entry entry = (Entry) iterator.next();
@@ -54,6 +62,14 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
int j = blockposition.getY() >> 4;
if (this.e() || (i & 1 << j) != 0) {
+ // Paper start - send signs separately
+ if (tileentity instanceof TileEntitySign) {
+ if (SKIP_EXCESSIVE_SIGNS_LIMIT < 0 || ++totalSigns < SKIP_EXCESSIVE_SIGNS_LIMIT) {
+ extraPackets.add(tileentity.getUpdatePacket());
+ }
+ continue;
+ }
+ // Paper end
NBTTagCompound nbttagcompound = tileentity.d();
this.e.add(nbttagcompound);
--
2.21.0

View file

@ -0,0 +1,66 @@
From 6370a90529e458d939522ed6a66f2d04f6b49e9c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 2 Mar 2019 16:12:35 -0500
Subject: [PATCH] MC-145260: Fix Whitelist On/Off inconsistency
mojang stored whitelist state in 2 places (Whitelist Object, PlayerList)
some things checked PlayerList, some checked object. This moves
everything to the Whitelist object.
https://github.com/PaperMC/Paper/issues/1880
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
index 93111cc24..2a259758b 100644
--- a/src/main/java/net/minecraft/server/JsonList.java
+++ b/src/main/java/net/minecraft/server/JsonList.java
@@ -65,6 +65,7 @@ public class JsonList<K, V extends JsonListEntry<K>> {
return this.e;
}
+ public void setEnabled(boolean flag) { a(flag); } // Paper - OBFHeLPER
public void a(boolean flag) {
this.e = flag;
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 44ced604a..80e9c9200 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -64,7 +64,7 @@ public abstract class PlayerList {
// private final Map<UUID, AdvancementDataPlayer> p;
// CraftBukkit end
public IPlayerFileData playerFileData;
- private boolean hasWhitelist;
+ //private boolean hasWhitelist; // Paper - moved to whitelist object so not duplicated
protected int maxPlayers;
private int s;
private EnumGamemode t;
@@ -1215,9 +1215,9 @@ public abstract class PlayerList {
}
public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) {
boolean isOp = this.operators.d(gameprofile);
- boolean isWhitelisted = !this.hasWhitelist || isOp || this.whitelist.d(gameprofile);
+ boolean isWhitelisted = !this.getHasWhitelist() || isOp || this.whitelist.d(gameprofile);
final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event;
- event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.hasWhitelist, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
+ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(MCUtil.toBukkit(gameprofile), this.getHasWhitelist(), isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage);
event.callEvent();
if (!event.isWhitelisted()) {
if (loginEvent != null) {
@@ -1366,11 +1366,11 @@ public abstract class PlayerList {
}
public boolean getHasWhitelist() {
- return this.hasWhitelist;
+ return this.whitelist.isEnabled(); // Paper
}
public void setHasWhitelist(boolean flag) {
- this.hasWhitelist = flag;
+ this.whitelist.setEnabled(flag); // Paper
}
public List<EntityPlayer> b(String s) {
--
2.21.0

View file

@ -0,0 +1,22 @@
From 2a1cb415c509d8a702897d35f3f67ca359dd5412 Mon Sep 17 00:00:00 2001
From: AgentTroll <woodyc40@gmail.com>
Date: Sun, 24 Mar 2019 17:44:01 -0400
Subject: [PATCH] Update entity Metadata for all tracked players
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e837a553e..8c20bcd14 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1674,7 +1674,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) {
// Refresh the current entity metadata
- this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true));
+ entity.tracker.broadcast(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); // Paper - update entity for all players
}
if (event.isCancelled()) {
--
2.21.0

View file

@ -0,0 +1,30 @@
From d63702b300dcb1f907edaee82655c70bac81910e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 24 Mar 2019 18:08:36 -0400
Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items
vanilla checks for == 0
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 099bc7551..4fafb4977 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -72,6 +72,7 @@ public class EntityItem extends Entity implements HopperPusher {
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
+ this.pickupDelay = Math.max(0, this.pickupDelay); // Paper - don't go below 0
if (this.age != -32768) this.age += elapsedTicks;
this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end
@@ -160,6 +161,7 @@ public class EntityItem extends Entity implements HopperPusher {
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
+ this.pickupDelay = Math.max(0, this.pickupDelay); // Paper - don't go below 0
if (this.age != -32768) this.age += elapsedTicks;
this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end
--
2.21.0

View file

@ -0,0 +1,37 @@
From e7ec410152443120d21bc738121f9ccea800518b Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Sun, 7 Apr 2019 06:22:54 -0400
Subject: [PATCH] Allow disabling village sieges
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index ba299afc..319b5b95 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -587,4 +587,10 @@ public class PaperWorldConfig {
this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick);
log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default");
}
+
+ public boolean villageSiegesEnabled = true;
+ private void villageSiegesEnabled() {
+ this.villageSiegesEnabled = getBoolean("game-mechanics.village-sieges-enabled", this.villageSiegesEnabled);
+ log("Village sieges are " + (this.villageSiegesEnabled ? "enabled" : "disabled"));
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index d29420dd..e545e976 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -334,7 +334,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.methodProfiler.c("village");
timings.doVillages.startTiming(); // Spigot
this.villages.tick();
- this.siegeManager.a();
+ if (paperConfig.villageSiegesEnabled) { this.siegeManager.a(); } // Paper - Allow disabling village sieges
timings.doVillages.stopTiming(); // Spigot
this.methodProfiler.c("portalForcer");
timings.doPortalForcer.startTiming(); // Spigot
--
2.21.0

View file

@ -0,0 +1,38 @@
From f560ea0c9401e8a2d36c3d01bf9a7084c867bf70 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 14 Apr 2019 20:59:16 +0100
Subject: [PATCH] Don't drop items into the world if BlockPlaceEvent is
cancelled
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 53e0688d96..c5f5fa4e74 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -187,12 +187,15 @@ public final class ItemStack {
}
}
}
+ world.captureDrops = new java.util.ArrayList<>(); // Paper - Don't drop items if block place is cancelled
EnumInteractionResult enuminteractionresult = this.getItem().a(entityhuman, world, blockposition, enumhand, enumdirection, f, f1, f2);
int newData = this.getData();
int newCount = this.getCount();
this.setCount(oldCount);
this.setData(oldData);
world.captureBlockStates = false;
+ List<EntityItem> drops = world.captureDrops; // Paper - Don't drop items if block place is cancelled
+ world.captureDrops = null; // Paper - Don't drop items if block place is cancelled
if (enuminteractionresult == EnumInteractionResult.SUCCESS && world.captureTreeGeneration && world.capturedBlockStates.size() > 0) {
world.captureTreeGeneration = false;
Location location = new Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ());
@@ -254,6 +257,7 @@ public final class ItemStack {
this.setData(newData);
this.setCount(newCount);
}
+ if (drops != null) drops.forEach(world::addEntity); // Paper - Don't drop items if block place is cancelled
for (Map.Entry<BlockPosition, TileEntity> e : world.capturedTileEntities.entrySet()) {
world.setTileEntity(e.getKey(), e.getValue());
--
2.21.0

View file

@ -0,0 +1,26 @@
From b2d8b2c49ad9f2ba6155e0d668c9dab0e446138c Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 2 Jun 2019 21:12:42 -0500
Subject: [PATCH] MC-114618 - Fix EntityAreaEffectCloud from going negative
diff --git a/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java
index ec579e7f..836d368b 100644
--- a/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java
+++ b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java
@@ -174,6 +174,12 @@ public class EntityAreaEffectCloud extends Entity {
super.B_();
boolean flag = this.q();
float f = this.getRadius();
+ // Paper start - fix MC-114618
+ if (f < 0.0F) {
+ this.die();
+ return;
+ }
+ // Paper end
if (this.world.isClientSide) {
EnumParticle enumparticle = this.getParticle();
--
2.22.0

Some files were not shown because too many files have changed in this diff Show more