NOT FINISHED! 1.13-pre7 - even more patches!

Patches, patches everywhere!
This commit is contained in:
Shane Freeder 2018-07-18 01:08:13 +01:00
parent 885edbdaf5
commit 130b9a0a36
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
57 changed files with 1571 additions and 620 deletions

View File

@ -1,4 +1,4 @@
From a30098615015d5b407960dfe74033d7545d7eb12 Mon Sep 17 00:00:00 2001
From a5b81e93f93c2ec4cb9b7ea55d5c20a40d3da2c4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 22 Jan 2017 18:07:56 -0500
Subject: [PATCH] Cap Entity Collisions
@ -12,12 +12,12 @@ just as it does in Vanilla, but entity pushing logic will be capped.
You can set this to 0 to disable collisions.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 5f06d4e5e..29b4bdb47 100644
index 5df8b1143..0b748d402 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -413,4 +413,10 @@ public class PaperWorldConfig {
private void armorStandEntityLookups() {
armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true);
@@ -343,4 +343,10 @@ public class PaperWorldConfig {
log("Treasure Maps will return already discovered locations");
}
}
+
+ public int maxCollisionsPerEntity;
@ -27,10 +27,10 @@ index 5f06d4e5e..29b4bdb47 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 20324deeb..b4233df5f 100644
index b47bf9738..db7e37aee 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -170,6 +170,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -168,6 +168,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE;
public boolean fromMobSpawner;
@ -39,10 +39,10 @@ index 20324deeb..b4233df5f 100644
// Spigot end
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 38c043375..c97ee68a5 100644
index 3a38f384e..8e45b557e 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2191,8 +2191,11 @@ public abstract class EntityLiving extends Entity {
@@ -2239,8 +2239,11 @@ public abstract class EntityLiving extends Entity {
}
}

View File

@ -1,4 +1,4 @@
From a962c34610bc172ff3076bf986b38c2c09c29c33 Mon Sep 17 00:00:00 2001
From cebe88d5b404e9e0e94b3fbec08b59bac8014975 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 5 Feb 2017 00:04:04 -0500
Subject: [PATCH] Remove CraftScheduler Async Task Debugger

View File

@ -0,0 +1,38 @@
From a4ff835aa4422f15ab43ff2474f6c8ae16088515 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 5 Feb 2017 19:17:28 -0500
Subject: [PATCH] Shame on you Mojang
Someone wrote some horrible code that throws a world accessing task
onto the HTTP DOWNLOADER Thread Pool, for an activity that is not even
heavy enough to warrant async operation.
This then triggers async chunk loads!
What in the hell were you thinking?
diff --git a/src/main/java/net/minecraft/server/BlockBeacon.java b/src/main/java/net/minecraft/server/BlockBeacon.java
index 1181d45fa..d081166d8 100644
--- a/src/main/java/net/minecraft/server/BlockBeacon.java
+++ b/src/main/java/net/minecraft/server/BlockBeacon.java
@@ -49,7 +49,7 @@ public class BlockBeacon extends BlockTileEntity {
}
public static void a(World world, BlockPosition blockposition) {
- HttpUtilities.a.submit(() -> {
+ //HttpUtilities.a.submit(() -> { // Paper
Chunk chunk = world.getChunkAtWorldCoords(blockposition);
for (int i = blockposition.getY() - 1; i >= 0; --i) {
@@ -73,7 +73,6 @@ public class BlockBeacon extends BlockTileEntity {
});
}
}
-
- });
+ // }); // Paper
}
}
--
2.18.0

View File

@ -1,14 +1,14 @@
From d8a8fcb78cfa437fb01080d88ac256a4dc490140 Mon Sep 17 00:00:00 2001
From cbb0e17bb9d0d316bb1c8caa8c28d13e1bf74b8e Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 7 Feb 2017 16:55:35 -0600
Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 66ff1adf6..de859ffd1 100644
index ef35eb7ec..70790386e 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -325,7 +325,7 @@ public class ChunkProviderServer implements IChunkProvider {
@@ -328,7 +328,7 @@ public class ChunkProviderServer implements IChunkProvider {
// Spigot start
org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant;
activityAccountant.startActivity(0.5);
@ -16,7 +16,7 @@ index 66ff1adf6..de859ffd1 100644
+ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
// Spigot end
Iterator iterator = this.unloadQueue.iterator();
LongIterator longiterator = this.unloadQueue.iterator();
--
2.18.0

View File

@ -1,14 +1,14 @@
From d93e6f8c98d66ccad03bb24a8f89c3af11a60422 Mon Sep 17 00:00:00 2001
From 1fb8166d8d2bc377f13189beda50e4b920635325 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 18 Feb 2017 19:29:58 -0600
Subject: [PATCH] Do not let armorstands drown
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index ee3d37a71..df0d66ad0 100644
index 52a1036fd..26171b343 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -779,5 +779,10 @@ public class EntityArmorStand extends EntityLiving {
@@ -764,5 +764,10 @@ public class EntityArmorStand extends EntityLiving {
super.move(moveType, x, y, z);
}
}
@ -20,24 +20,24 @@ index ee3d37a71..df0d66ad0 100644
// Paper end
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index c97ee68a5..44335fd2d 100644
index 8e45b557e..f4a766800 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -195,6 +195,7 @@ public abstract class EntityLiving extends Entity {
@@ -200,6 +200,7 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag, iblockdata, blockposition);
}
+ public boolean canBreatheUnderwater() { return this.bN(); } // Paper - OBFHELPER
public boolean bN() {
return false;
+ public boolean canBreatheUnderwater() { return this.bZ(); } // Paper - OBFHELPER
public boolean bZ() {
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
@@ -229,7 +230,7 @@ public abstract class EntityLiving extends Entity {
@@ -234,7 +235,7 @@ public abstract class EntityLiving extends Entity {
if (this.isAlive()) {
if (this.a(Material.WATER)) {
- if (!this.bN() && !this.hasEffect(MobEffects.WATER_BREATHING) && !flag1) {
+ if (!this.canBreatheUnderwater() && !this.hasEffect(MobEffects.WATER_BREATHING) && !flag1) {
this.setAirTicks(this.d(this.getAirTicks()));
if (this.a(TagsFluid.a) && this.world.getType(new BlockPosition(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ)).getBlock() != Blocks.BUBBLE_COLUMN) {
- if (!this.bZ() && !MobEffectUtil.c(this) && !flag1) {
+ if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER
this.setAirTicks(this.l(this.getAirTicks()));
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
--

View File

@ -1,4 +1,4 @@
From 46b3f0b41023c5857dd0af9997e4f44570c9bedc Mon Sep 17 00:00:00 2001
From a12f6eee7782c6895adb1a01063a7b0cb1fafa8c Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 12 May 2017 23:34:11 -0500
Subject: [PATCH] Properly handle async calls to restart the server
@ -30,27 +30,27 @@ will have plugins and worlds saving to the disk has a high potential to result
in corruption/dataloss.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 13c6b5ccd..908a5d273 100644
index f81ff5628..f679c6bc2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -71,6 +71,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -85,6 +85,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
public WorldServer[] worldServer;
private PlayerList v;
private PlayerList s;
private boolean isRunning = true;
+ private boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
private boolean isStopped;
private int ticks;
protected final Proxy e;
@@ -489,7 +490,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
if (this.v != null) {
protected final Proxy d;
@@ -590,7 +591,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
if (this.s != null) {
MinecraftServer.LOGGER.info("Saving players");
this.v.savePlayers();
- this.v.u();
+ this.v.u(isRestarting);
this.s.savePlayers();
- this.s.u();
+ this.s.u(isRestarting);;
try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
@@ -546,10 +547,18 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -649,10 +650,18 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
return this.isRunning;
}
@ -69,20 +69,20 @@ index 13c6b5ccd..908a5d273 100644
// Paper start - Further improve server tick loop
private static final int TPS = 20;
private static final long SEC_IN_NANO = 1000000000;
@@ -1615,6 +1624,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
return this.ab;
@@ -1607,6 +1616,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
return this.aa;
}
+ public final Thread getServerThread() { return this.aI(); } // Paper - OBFHELPER
public Thread aI() {
+ public final Thread getServerThread() { return this.aA(); } // Paper - OBFHELPER
public Thread aA() {
return this.serverThread;
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index c49711cad..85357a003 100644
index e41850742..5e833c378 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1378,10 +1378,15 @@ public abstract class PlayerList {
entityplayer.playerInteractManager.b(world.getWorldData().getGameType());
@@ -1344,10 +1344,15 @@ public abstract class PlayerList {
entityplayer.playerInteractManager.b(generatoraccess.getWorldData().getGameType());
}
+ // Paper start - Extract method to allow for restarting flag
@ -98,7 +98,7 @@ index c49711cad..85357a003 100644
}
// CraftBukkit end
// Paper start - Remove collideRule team if it exists
@@ -1392,6 +1397,7 @@ public abstract class PlayerList {
@@ -1358,6 +1363,7 @@ public abstract class PlayerList {
}
// Paper end
}

View File

@ -1,4 +1,4 @@
From bc0d96c47df073207c45a3ced55f99fc1e1b2381 Mon Sep 17 00:00:00 2001
From f5d754ba5f4de0b4a9f40cbccdf2f14201bf2058 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 13 May 2017 20:11:21 -0500
Subject: [PATCH] Add system property to disable book size limits
@ -11,7 +11,7 @@ to make books with as much data as they want. Do not use this without
limiting incoming data from packets in some other way.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
index a7e51d9f1..ffdb7ec82 100644
index 6ff1a2dcd..64a939952 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
@@ -40,6 +40,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {

View File

@ -1,4 +1,4 @@
From 0ceac86ec4bac512cd1adfa907020fe976e96fff Mon Sep 17 00:00:00 2001
From caddde982286e1f722cf4cd8a422b58159e96b31 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,10 +11,10 @@ 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 0b748d402..99fe720e8 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 {
@@ -349,4 +349,10 @@ public class PaperWorldConfig {
maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
log( "Max Entity Collisions: " + maxCollisionsPerEntity );
}
@ -26,10 +26,10 @@ 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 36a961cb7..0da76b268 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 {
@@ -460,7 +460,7 @@ public abstract class EntityHuman extends EntityLiving {
this.j(this.getShoulderEntityLeft());
this.j(this.getShoulderEntityRight());
if (!this.world.isClientSide && (this.fallDistance > 0.5F || this.isInWater() || this.isPassenger()) || this.abilities.isFlying) {
@ -39,11 +39,11 @@ 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 25e3d6423..128b2beb5 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 {
switch (packetplayinentityaction.b()) {
@@ -1746,6 +1746,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
switch (packetplayinentityaction.c()) {
case START_SNEAKING:
this.player.setSneaking(true);
+
@ -57,5 +57,5 @@ index 802008b4e..6d733e153 100644
case STOP_SNEAKING:
--
2.17.1
2.18.0

View File

@ -1,4 +1,4 @@
From fc82e20fac8adc748ef554d6de4eab73fb2e2a08 Mon Sep 17 00:00:00 2001
From 4da4707066e2b1a70a6406e205be0c072c10da99 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Fri, 9 Jun 2017 07:24:34 -0700
Subject: [PATCH] Add configuration option to prevent player names from being
@ -20,10 +20,10 @@ index ea6fcb39f..dbafef023 100644
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 41357cb0e..27c6caddc 100644
index f3dfd65d6..6c611c0df 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1908,5 +1908,10 @@ public final class CraftServer implements Server {
@@ -2004,5 +2004,10 @@ public final class CraftServer implements Server {
commandMap.registerServerAliases();
return true;
}

View File

@ -1,4 +1,4 @@
From 0140f0a679cb39eb069e0ea08f22775885ee9a16 Mon Sep 17 00:00:00 2001
From 161a4fa741fe2a3ac45c495a7966493116048201 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 9 Jun 2017 19:03:43 +0200
Subject: [PATCH] Use TerminalConsoleAppender for console improvements
@ -20,23 +20,29 @@ Other changes:
configuration
diff --git a/pom.xml b/pom.xml
index 9d273c6d9..26775156b 100644
index 17bc80776..4dd5fed25 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,12 +53,6 @@
<version>5.0.4</version>
@@ -41,15 +41,9 @@
<scope>compile</scope>
</dependency>
- <dependency>
<dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- <version>2.12.1</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm</artifactId>
- <version>6.2</version>
+ <groupId>net.sf.jopt-simple</groupId>
+ <artifactId>jopt-simple</artifactId>
+ <version>5.0.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
@@ -77,6 +71,32 @@
@@ -70,6 +64,32 @@
<version>3.0.3</version>
<scope>compile</scope>
</dependency>
@ -69,7 +75,7 @@ index 9d273c6d9..26775156b 100644
<!-- testing -->
<dependency>
<groupId>junit</groupId>
@@ -210,10 +230,18 @@
@@ -203,10 +223,18 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/java.sql.Driver</resource>
</transformer>
@ -179,10 +185,10 @@ index 000000000..626bfeec8
+
+}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 8f2afcc32..b3f1aa999 100644
index a3d58b5ce..069eb7d68 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -73,7 +73,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -79,7 +79,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
if (!org.bukkit.craftbukkit.Main.useConsole) {
return;
}
@ -194,10 +200,10 @@ index 8f2afcc32..b3f1aa999 100644
// CraftBukkit end
String s;
@@ -81,11 +84,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -87,11 +90,17 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
try {
// CraftBukkit start - JLine disabling compatibility
while (!isStopped() && isRunning()) {
while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning()) {
+ // Paper start - code is not used for jline
+ /*
if (org.bukkit.craftbukkit.Main.useJline) {
@ -210,9 +216,9 @@ index 8f2afcc32..b3f1aa999 100644
+ // Paper end
+
if (s != null && s.trim().length() > 0) { // Trim to filter lines which are just spaces
issueCommand(s, DedicatedServer.this);
DedicatedServer.this.issueCommand(s, DedicatedServer.this.getServerCommandListener());
}
@@ -106,6 +115,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -112,6 +121,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler());
@ -222,7 +228,7 @@ index 8f2afcc32..b3f1aa999 100644
final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger());
for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) {
if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) {
@@ -114,6 +126,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -120,6 +132,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
new Thread(new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader)).start();
@ -232,10 +238,10 @@ index 8f2afcc32..b3f1aa999 100644
System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 908a5d273..e8bddc171 100644
index f679c6bc2..39a8b1d69 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -42,7 +42,6 @@ import org.apache.commons.lang3.Validate;
@@ -57,7 +57,6 @@ import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
// CraftBukkit start
@ -243,7 +249,7 @@ index 908a5d273..e8bddc171 100644
import joptsimple.OptionSet;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.CraftServer;
@@ -115,7 +114,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -142,7 +141,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
public OptionSet options;
public org.bukkit.command.ConsoleCommandSender console;
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
@ -252,8 +258,8 @@ index 908a5d273..e8bddc171 100644
public static int currentTick = 0; // Paper - Further improve tick loop
public final Thread primaryThread;
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
@@ -141,7 +140,9 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.dataConverterManager = dataconvertermanager;
@@ -183,7 +182,9 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.ac.a((IResourcePackListener) this.al);
// CraftBukkit start
this.options = options;
+ // Paper start - Handled by TerminalConsoleAppender
@ -262,7 +268,7 @@ index 908a5d273..e8bddc171 100644
if (System.console() == null && System.getProperty("jline.terminal") == null) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
Main.useJline = false;
@@ -162,6 +163,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -204,6 +205,8 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
LOGGER.warn((String) null, ex);
}
}
@ -271,7 +277,7 @@ index 908a5d273..e8bddc171 100644
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
this.serverThread = primaryThread = new Thread(this, "Server thread"); // Moved from main
@@ -701,7 +704,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -804,7 +807,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
} finally {
// CraftBukkit start - Restore terminal to original settings
try {
@ -280,18 +286,17 @@ index 908a5d273..e8bddc171 100644
} catch (Exception ignored) {
}
// CraftBukkit end
@@ -1229,7 +1232,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -1285,7 +1288,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
}
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
- MinecraftServer.LOGGER.info(ichatbasecomponent.toPlainText());
+ // Paper - Log message with colors
+ MinecraftServer.LOGGER.info(org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(ichatbasecomponent, net.minecraft.server.EnumChatFormat.WHITE));
- MinecraftServer.LOGGER.info(ichatbasecomponent.getString());
+ MinecraftServer.LOGGER.info(org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(ichatbasecomponent, net.minecraft.server.EnumChatFormat.WHITE));// Paper - Log message with colors
}
public boolean a(int i, String s) {
public KeyPair G() {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 85357a003..3e5122486 100644
index 5e833c378..0f39fa49f 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -78,8 +78,7 @@ public abstract class PlayerList {
@ -305,18 +310,20 @@ index 85357a003..3e5122486 100644
this.k = new GameProfileBanList(PlayerList.a);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 27c6caddc..539f492e0 100644
index 6c611c0df..3b10c5e61 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -128,7 +128,6 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.base64.Base64;
@@ -137,8 +137,8 @@ import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
-import jline.console.ConsoleReader;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Keyed;
+import org.apache.commons.lang.StringUtils;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@@ -1094,9 +1093,13 @@ public final class CraftServer implements Server {
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@@ -1140,9 +1140,13 @@ public final class CraftServer implements Server {
return logger;
}
@ -331,7 +338,7 @@ index 27c6caddc..539f492e0 100644
@Override
public PluginCommand getPluginCommand(String name) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index d565a720f..c9e8a8737 100644
index aad208f47..ac38028d7 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -14,7 +14,7 @@ import java.util.logging.Logger;
@ -343,7 +350,7 @@ index d565a720f..c9e8a8737 100644
public class Main {
public static boolean useJline = true;
@@ -170,6 +170,8 @@ public class Main {
@@ -176,6 +176,8 @@ public class Main {
}
try {
@ -352,7 +359,7 @@ index d565a720f..c9e8a8737 100644
// This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals
String jline_UnsupportedTerminal = new String(new char[] {'j','l','i','n','e','.','U','n','s','u','p','p','o','r','t','e','d','T','e','r','m','i','n','a','l'});
String jline_terminal = new String(new char[] {'j','l','i','n','e','.','t','e','r','m','i','n','a','l'});
@@ -187,10 +189,18 @@ public class Main {
@@ -193,10 +195,18 @@ public class Main {
// This ensures the terminal literal will always match the jline implementation
System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName());
}
@ -370,7 +377,7 @@ index d565a720f..c9e8a8737 100644
+ System.setProperty(TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
}
if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
deleted file mode 100644
index 26a2fb894..000000000

View File

@ -1,4 +1,4 @@
From 1450cf36f8663affe1820aada01118156939d236 Mon Sep 17 00:00:00 2001
From cb3b9596a91e1f987ddd0a50ee318ae0d50daad0 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 11 Jun 2017 21:01:18 +0100
Subject: [PATCH] provide a configurable option to disable creeper lingering
@ -6,10 +6,10 @@ Subject: [PATCH] provide a configurable option to disable creeper lingering
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 31aad03c2..646620d0c 100644
index 99fe720e8..c80d84b9b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -425,4 +425,10 @@ public class PaperWorldConfig {
@@ -355,4 +355,10 @@ public class PaperWorldConfig {
parrotsHangOnBetter = getBoolean("parrots-are-unaffected-by-player-movement", false);
log("Parrots are unaffected by player movement: " + parrotsHangOnBetter);
}
@ -21,11 +21,11 @@ index 31aad03c2..646620d0c 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index c872607fc..8098d4d9f 100644
index f286b6286..f37169d73 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -222,7 +222,7 @@ public class EntityCreeper extends EntityMonster {
private void ds() {
@@ -214,7 +214,7 @@ public class EntityCreeper extends EntityMonster {
private void dF() {
Collection collection = this.getEffects();
- if (!collection.isEmpty()) {

View File

@ -1,38 +1,37 @@
From e4e98632b0628b4452d2b266506da9d200a62d4a Mon Sep 17 00:00:00 2001
From 3582ab1f823cdaaddfb902895911730387101c78 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 5 May 2017 03:57:17 -0500
Subject: [PATCH] Item#canEntityPickup
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 5ea9f3097..89e878365 100644
index d29364b01..9dc86e90d 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -514,6 +514,12 @@ public abstract class EntityInsentient extends EntityLiving {
while (iterator.hasNext()) {
@@ -512,6 +512,11 @@ public abstract class EntityInsentient extends EntityLiving {
EntityItem entityitem = (EntityItem) iterator.next();
+ // Paper Start
+ if (!entityitem.canMobPickup) {
+ continue;
+ }
+ // Paper End
+
if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.t()) {
if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.q()) {
+ // Paper Start
+ if (!entityitem.canMobPickup) {
+ continue;
+ }
+ // Paper End
this.a(entityitem);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 6593fc633..99dbb1393 100644
index 4af09f5cd..f2a4476c5 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -22,6 +22,7 @@ public class EntityItem extends Entity implements HopperPusher {
private static final DataWatcherObject<ItemStack> c = DataWatcher.a(EntityItem.class, DataWatcherRegistry.f);
@@ -13,6 +13,7 @@ public class EntityItem extends Entity {
private static final DataWatcherObject<ItemStack> b = DataWatcher.a(EntityItem.class, DataWatcherRegistry.g);
private int age;
public int pickupDelay;
+ public boolean canMobPickup = true; // Paper
private int f;
private String g;
private String h;
private int e;
private UUID f;
private UUID g;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index a17a537d6..1df17f09b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java

View File

@ -1,14 +1,14 @@
From e9e0c61c0ea8ce2ae7cbc21c3c2c6b0ea9932237 Mon Sep 17 00:00:00 2001
From 31fb189f19914490ec51f8e994f3f167540369e0 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 7 May 2017 06:26:09 -0500
Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 99dbb1393..ae4910b4b 100644
index f2a4476c5..62d1c3d11 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -332,6 +332,7 @@ public class EntityItem extends Entity implements HopperPusher {
@@ -308,6 +308,7 @@ public class EntityItem extends Entity {
// CraftBukkit start - fire PlayerPickupItemEvent
int canHold = entityhuman.inventory.canHold(itemstack);
int remaining = i - canHold;
@ -16,7 +16,7 @@ index 99dbb1393..ae4910b4b 100644
if (this.pickupDelay <= 0 && canHold > 0) {
itemstack.setCount(canHold);
@@ -339,7 +340,13 @@ public class EntityItem extends Entity implements HopperPusher {
@@ -315,7 +316,13 @@ public class EntityItem extends Entity {
PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
playerEvent.setCancelled(!entityhuman.canPickUpLoot);
this.world.getServer().getPluginManager().callEvent(playerEvent);
@ -30,11 +30,10 @@ index 99dbb1393..ae4910b4b 100644
return;
}
@@ -359,7 +366,11 @@ public class EntityItem extends Entity implements HopperPusher {
// CraftBukkit end
@@ -336,6 +343,11 @@ public class EntityItem extends Entity {
if (this.pickupDelay == 0 && (this.h == null || 6000 - this.age <= 200 || this.h.equals(entityhuman.getName())) && entityhuman.inventory.pickup(itemstack)) {
- entityhuman.receive(this, i);
if (this.pickupDelay == 0 && (this.g == null || 6000 - this.age <= 200 || this.g.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
entityhuman.receive(this, i);
+ // Paper Start
+ if (flyAtPlayer) {
+ entityhuman.receive(this, i);

View File

@ -1,22 +1,22 @@
From 45b4de7a63937ed0c9c58960e6be049d11b00a52 Mon Sep 17 00:00:00 2001
From 0caff079245dcf29a713e485c3062dcd45d28167 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 11 Jun 2017 16:30:30 -0500
Subject: [PATCH] PlayerAttemptPickupItemEvent
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index ae4910b4b..0b7fc327f 100644
index 62d1c3d11..d232bab74 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -8,6 +8,7 @@ import org.apache.logging.log4j.Logger;
@@ -7,6 +7,7 @@ import javax.annotation.Nullable;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
// CraftBukkit end
+import org.bukkit.event.player.PlayerAttemptPickupItemEvent; // Paper
import com.destroystokyo.paper.HopperPusher; // Paper
// Paper start - implement HopperPusher
@@ -334,6 +335,22 @@ public class EntityItem extends Entity implements HopperPusher {
public class EntityItem extends Entity {
@@ -310,6 +311,22 @@ public class EntityItem extends Entity {
int remaining = i - canHold;
boolean flyAtPlayer = false; // Paper

View File

@ -1,14 +1,14 @@
From 8b6a5b555082c1dd6de30aac296317869d9dcec9 Mon Sep 17 00:00:00 2001
From 9b1c57eced435652b0ab33f81636733bde8728b8 Mon Sep 17 00:00:00 2001
From: Sweepyoface <github@sweepy.pw>
Date: Sat, 17 Jun 2017 18:48:21 -0400
Subject: [PATCH] Add UnknownCommandEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 539f492e0..77c16fe2c 100644
index 3b10c5e61..46f86359c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -78,6 +78,7 @@ import org.bukkit.craftbukkit.util.Versioning;
@@ -79,6 +79,7 @@ import org.bukkit.craftbukkit.util.Versioning;
import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -16,10 +16,10 @@ index 539f492e0..77c16fe2c 100644
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
import org.bukkit.event.server.BroadcastMessageEvent;
@@ -675,7 +676,13 @@ public final class CraftServer implements Server {
@@ -719,7 +720,13 @@ public final class CraftServer implements Server {
// Spigot start
if (StringUtils.isNotEmpty(org.spigotmc.SpigotConfig.unknownCommandMessage)) {
if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {
- sender.sendMessage(org.spigotmc.SpigotConfig.unknownCommandMessage);
+ // Paper start
+ UnknownCommandEvent event = new UnknownCommandEvent(sender, commandLine, org.spigotmc.SpigotConfig.unknownCommandMessage);

View File

@ -1,4 +1,4 @@
From 67efca2ab5f2797aeceff4a62a7b777f2ea616d9 Mon Sep 17 00:00:00 2001
From 614281018d171ed41567a3abfaac9b589157a9dc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 15 Jan 2018 22:11:48 -0500
Subject: [PATCH] Basic PlayerProfile API
@ -429,10 +429,10 @@ index 02940d697..4539b5601 100644
* Calculates distance between 2 entities
* @param e1
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e8bddc171..fcf6bac08 100644
index 39a8b1d69..4654e22c8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1018,7 +1018,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@@ -1114,7 +1114,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
*/ // CraftBukkit end
String s1 = "."; // PAIL?
@ -441,16 +441,16 @@ index e8bddc171..fcf6bac08 100644
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(s1, MinecraftServer.a.getName()));
@@ -1538,6 +1538,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
this.H = i;
@@ -1562,6 +1562,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.G = i;
}
+ public MinecraftSessionService getSessionService() { return az(); } // Paper - OBFHELPER
public MinecraftSessionService az() {
return this.W;
+ public MinecraftSessionService getSessionService() { return ar(); } // Paper - OBFHELPER
public MinecraftSessionService ar() {
return this.V;
}
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 7ce08eb8b..6a750c25e 100644
index a47a51a41..4c476f757 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -44,7 +44,7 @@ public class UserCache {
@ -462,8 +462,8 @@ index 7ce08eb8b..6a750c25e 100644
private final Map<UUID, UserCache.UserCacheEntry> e = Maps.newHashMap();
private final Deque<GameProfile> f = new java.util.concurrent.LinkedBlockingDeque<GameProfile>(); // CraftBukkit
private final GameProfileRepository g;
@@ -173,6 +173,13 @@ public class UserCache {
return (String[]) arraylist.toArray(new String[arraylist.size()]);
@@ -166,6 +166,13 @@ public class UserCache {
return usercache_usercacheentry == null ? null : usercache_usercacheentry.a();
}
+ // Paper start
@ -476,7 +476,7 @@ index 7ce08eb8b..6a750c25e 100644
@Nullable public GameProfile getProfile(UUID uuid) { return a(uuid); } // Paper - OBFHELPER
@Nullable
public synchronized GameProfile a(UUID uuid) { // Paper - synchronize
@@ -282,7 +289,7 @@ public class UserCache {
@@ -275,7 +282,7 @@ public class UserCache {
class UserCacheEntry {
@ -486,10 +486,10 @@ index 7ce08eb8b..6a750c25e 100644
private UserCacheEntry(GameProfile gameprofile, Date date) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 77c16fe2c..2dd7ed96a 100644
index 46f86359c..26bbb0265 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -135,6 +135,10 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@@ -152,6 +152,10 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.event.server.TabCompleteEvent;
import net.md_5.bungee.api.chat.BaseComponent;
@ -498,9 +498,9 @@ index 77c16fe2c..2dd7ed96a 100644
+
+
public final class CraftServer implements Server {
private final String serverName = "Paper";
private final String serverName = "Paper"; // Paper
private final String serverVersion;
@@ -1923,5 +1927,21 @@ public final class CraftServer implements Server {
@@ -2020,5 +2024,21 @@ public final class CraftServer implements Server {
public boolean suggestPlayerNamesWhenNullTabCompletions() {
return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions;
}

View File

@ -1,14 +1,14 @@
From 6b016f7c3218f98e813b2bcd764943528f7be99e Mon Sep 17 00:00:00 2001
From ad7c9344e0fcb1d4b7ce6e78fab6be0b1b2f89b1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 17 Jun 2017 15:18:30 -0400
Subject: [PATCH] Shoulder Entities Release API
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 9cda8a177..deb0f4a9c 100644
index 0da76b268..85e617979 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1721,21 +1721,48 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1819,21 +1819,48 @@ public abstract class EntityHuman extends EntityLiving {
}
// CraftBukkit end
}
@ -62,10 +62,10 @@ index 9cda8a177..deb0f4a9c 100644
public abstract boolean isSpectator();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index a54548f02..a0128426f 100644
index 073c8acf2..9e2fc4947 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -444,6 +444,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -445,6 +445,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
getHandle().getCooldownTracker().a(CraftMagicNumbers.getItem(material), ticks);
}

View File

@ -1,4 +1,4 @@
From 994ec4bf48918d37128a4497da0c4048d80066c3 Mon Sep 17 00:00:00 2001
From 6564411af8c8e297d2045b8ad2cb4f9dff87c67c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 17 Jun 2017 17:00:32 -0400
Subject: [PATCH] Profile Lookup Events

View File

@ -1,17 +1,17 @@
From f36c3440727a1046b873964ca2c36b339cdf09a5 Mon Sep 17 00:00:00 2001
From 7a52f09bc7a5b4c1f06b5554eabd35d088ac98f6 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 2 Jul 2017 21:35:56 -0500
Subject: [PATCH] Block player logins during server shutdown
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 2158fcd32..c5434e6ba 100644
index 89a11a496..bab13a4fd 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -53,6 +53,12 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -50,6 +50,12 @@ public class LoginListener implements PacketLoginInListener, ITickable {
}
public void e() {
public void X_() {
+ // Paper start - Do not allow logins while the server is shutting down
+ if (!MinecraftServer.getServer().isRunning()) {
+ this.disconnect(new ChatMessage(org.spigotmc.SpigotConfig.restartMessage));

View File

@ -1,14 +1,14 @@
From 57ed55129a54deecee7292fd00036b45ac0bd6ed Mon Sep 17 00:00:00 2001
From 941e2d6ee2fddc3c265f37cc7868f4bcefd2c91b 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 b4233df5f..00791faf2 100644
index db7e37aee..cd1639e26 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -170,6 +170,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -168,6 +168,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE;
public boolean fromMobSpawner;
@ -16,7 +16,7 @@ index b4233df5f..00791faf2 100644
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end
@@ -1590,6 +1591,10 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1658,6 +1659,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (origin != null) {
nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ()));
}
@ -27,7 +27,7 @@ index b4233df5f..00791faf2 100644
// Paper end
return nbttagcompound;
} catch (Throwable throwable) {
@@ -1739,6 +1744,8 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
@@ -1806,6 +1811,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (!originTag.isEmpty()) {
origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
}
@ -37,22 +37,22 @@ index b4233df5f..00791faf2 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 61472a0eb..2b6b062c6 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 {
@@ -115,6 +115,7 @@ public abstract class MobSpawnerAbstract {
if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) {
((EntityInsentient) entity).prepare(world.D(new BlockPosition(entity)), (GroupDataEntity) null);
((EntityInsentient) entity).prepare(world.getDamageScaler(new BlockPosition(entity)), (GroupDataEntity) null, (NBTTagCompound) null);
}
+ entity.spawnedViaMobSpawner = true; // Paper
// Spigot Start
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 03a3328b0..6d4dc539c 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 {
@@ -816,5 +816,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Location origin = getHandle().origin;
return origin == null ? null : origin.clone();
}

View File

@ -1,4 +1,4 @@
From 217bbba50cbb6ecff5d10e4c02d4e0736121c4ed Mon Sep 17 00:00:00 2001
From 11cea7c95bac2bf2450c1c93246dad8416d796ce Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 11 Jul 2017 23:17:57 -0400
Subject: [PATCH] Fix Anvil Level sync to client
@ -10,10 +10,10 @@ Was done incorrectly and is now causing level desyncs to client.
Always send current level to the client, and instead make setWindowProperty set the level.
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
index 175753c5a..16ec67569 100644
index 845ec2250..c252ff6d5 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
@@ -376,9 +376,9 @@ public class ContainerAnvil extends Container {
@@ -377,9 +377,9 @@ public class ContainerAnvil extends Container {
for (int i = 0; i < this.listeners.size(); ++i) {
ICrafting icrafting = (ICrafting) this.listeners.get(i);
@ -26,10 +26,10 @@ index 175753c5a..16ec67569 100644
this.lastLevelCost = this.levelCost;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7ee17b254..f83b16bcd 100644
index 3c1f02c18..d7eb4af83 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1332,6 +1332,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1378,6 +1378,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (container.getBukkitView().getType() != prop.getType()) {
return false;
}

View File

@ -1,4 +1,4 @@
From 59b994221ae889c52cdbd1e7fd0be8f8109231e2 Mon Sep 17 00:00:00 2001
From ed98da62a8120c8914c77aa0cf02410343641fd5 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 22 Jul 2017 15:22:59 +0100
Subject: [PATCH] Add missing coverages for getTileEntity in order to attempt
@ -6,10 +6,10 @@ Subject: [PATCH] Add missing coverages for getTileEntity in order to attempt
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 737ade74d..c06158e02 100644
index e766e2536..c5da2cde3 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -238,6 +238,13 @@ public class WorldServer extends World implements IAsyncTaskHandler {
@@ -234,6 +234,13 @@ public class WorldServer extends World implements IAsyncTaskHandler {
result = fixTileEntity(pos, type, result);
}
}

View File

@ -1,4 +1,4 @@
From b648f2bd5daae8efe3272869f0e72f133aeeff01 Mon Sep 17 00:00:00 2001
From c9f1909700cbc7fef19be5167ecd178b35abef4e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 10 Dec 2016 16:24:06 -0500
Subject: [PATCH] Improve the Saddle API for Horses

View File

@ -1,4 +1,4 @@
From 85f648495e3ba44c78f3f4e31ab8d207baf9d236 Mon Sep 17 00:00:00 2001
From a267bc488bbe04958b64ce137b2a483737976473 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 May 2016 22:43:12 -0400
Subject: [PATCH] Implement ensureServerConversions API
@ -7,14 +7,13 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr
to ensure it meets latest minecraft expectations.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 49ebad22e..eb6987338 100644
index e305d663a..503dd5827 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -194,4 +194,11 @@ public final class CraftItemFactory implements ItemFactory {
public Color getDefaultLeatherColor() {
return DEFAULT_LEATHER_COLOR;
@@ -287,4 +287,10 @@ public final class CraftItemFactory implements ItemFactory {
public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException {
return ((CraftMetaItem) meta).updateMaterial(material);
}
+
+ // Paper start
+ @Override
+ public ItemStack ensureServerConversions(ItemStack item) {

View File

@ -1,4 +1,4 @@
From c4f9a656097efc7de9f9f5d001aac7fbcd5e7553 Mon Sep 17 00:00:00 2001
From c49c483e01b88e0baaf6e43ce5732dc16eb85c24 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 May 2016 23:59:38 -0400
Subject: [PATCH] Implement getI18NDisplayName
@ -8,10 +8,10 @@ Currently the server only supports the English language. To override this,
You must replace the language file embedded in the server jar.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index eb6987338..c2f26577c 100644
index 503dd5827..73785830f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -200,5 +200,18 @@ public final class CraftItemFactory implements ItemFactory {
@@ -292,5 +292,18 @@ public final class CraftItemFactory implements ItemFactory {
public ItemStack ensureServerConversions(ItemStack item) {
return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item));
}

View File

@ -1,59 +0,0 @@
From 0c21e9ed61fa981a86ad099aabfe67586e3900e6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 5 Feb 2017 19:17:28 -0500
Subject: [PATCH] Shame on you Mojang
Someone wrote some horrible code that throws a world accessing task
onto the HTTP DOWNLOADER Thread Pool, for an activity that is not even
heavy enough to warrant async operation.
This then triggers async chunk loads!
What in the hell were you thinking?
diff --git a/src/main/java/net/minecraft/server/BlockBeacon.java b/src/main/java/net/minecraft/server/BlockBeacon.java
index f07ac0186..21075974d 100644
--- a/src/main/java/net/minecraft/server/BlockBeacon.java
+++ b/src/main/java/net/minecraft/server/BlockBeacon.java
@@ -62,8 +62,8 @@ public class BlockBeacon extends BlockTileEntity {
}
public static void c(final World world, final BlockPosition blockposition) {
- HttpUtilities.a.submit(new Runnable() {
- public void run() {
+ /*HttpUtilities.a.submit(new Runnable() {
+ public void run() {*/ // Paper
Chunk chunk = world.getChunkAtWorldCoords(blockposition);
for (int i = blockposition.getY() - 1; i >= 0; --i) {
@@ -76,8 +76,8 @@ public class BlockBeacon extends BlockTileEntity {
IBlockData iblockdata = world.getType(blockposition1);
if (iblockdata.getBlock() == Blocks.BEACON) {
- ((WorldServer) world).postToMainThread(new Runnable() {
- public void run() {
+ /*((WorldServer) world).postToMainThread(new Runnable() {
+ public void run() {*/ // Paper
TileEntity tileentity = world.getTileEntity(blockposition);
if (tileentity instanceof TileEntityBeacon) {
@@ -85,12 +85,12 @@ public class BlockBeacon extends BlockTileEntity {
world.playBlockAction(blockposition, Blocks.BEACON, 1, 0);
}
- }
- });
+ /*}
+ });*/ // Paper
}
}
- }
- });
+ /*}
+ });*/ // Paper
}
}
--
2.18.0

View File

@ -1,4 +1,4 @@
From 356b716038e7b3ce158de43b3649518a23d50abd Mon Sep 17 00:00:00 2001
From 33770d32be91ffa84e65d5276198a5023117242c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 27 Jul 2017 00:06:43 -0400
Subject: [PATCH] GH-806: Respect saving disabled before unloading all chunks
@ -9,15 +9,15 @@ This behavior causes a save to occur even though saving was supposed to be turne
It's triggered when Hell/End worlds are empty of players.
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 0b10f1684..4af557321 100644
index cf5c76a78..bfe2d03a5 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -220,7 +220,7 @@ public class PlayerChunkMap {
@@ -194,7 +194,7 @@ public class PlayerChunkMap {
try (Timing ignored = world.timings.doChunkMapUnloadChunks.startTiming()) { // Paper
WorldProvider worldprovider = this.world.worldProvider;
- if (!worldprovider.e()) {
+ if (!worldprovider.e() && !this.world.savingDisabled) { // Paper - respect saving disabled setting
- if (!worldprovider.p()) {
+ if (!worldprovider.p() && !this.world.savingDisabled) { // Paper - respect saving disabled setting
this.world.getChunkProviderServer().b();
}
} // Paper timing

View File

@ -1,27 +1,27 @@
From 478ce7dd9077369efd3b2b8e90b8a537e3c0c576 Mon Sep 17 00:00:00 2001
From a25aa26eb6453f256ec025fd0f2bd4d7e9693dba Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 3 Jul 2017 18:11:10 -0500
Subject: [PATCH] ProfileWhitelistVerifyEvent
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 3e5122486..b478f385a 100644
index 0f39fa49f..c1de6564a 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -542,9 +542,9 @@ public abstract class PlayerList {
// return s;
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s); // Spigot
// return chatmessage;
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot
- } else if (!this.isWhitelisted(gameprofile)) {
+ } else if (!this.isWhitelisted(gameprofile, event)) { // Paper
// return "You are not white-listed on this server!";
chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted", new Object[0]);
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot
+ //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted
} else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
IpBanEntry ipbanentry = this.l.get(socketaddress);
@@ -1209,9 +1209,25 @@ public abstract class PlayerList {
@@ -1183,9 +1183,25 @@ public abstract class PlayerList {
this.server.getCommandDispatcher().a(entityplayer);
}
+ // Paper start
@ -46,7 +46,7 @@ index 3e5122486..b478f385a 100644
+ // Paper end
public boolean isOp(GameProfile gameprofile) {
return this.operators.d(gameprofile) || this.server.R() && this.server.worlds.get(0).getWorldData().u() && this.server.Q().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit
return this.operators.d(gameprofile) || this.server.J() && this.server.worlds.get(0).getWorldData().u() && this.server.I().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit
--
2.18.0

View File

@ -1,23 +0,0 @@
From 070cf38a5cd2ad6ee121d9b8cefff5c0365e62cb Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Sun, 9 Apr 2017 23:50:15 -0700
Subject: [PATCH] Fix NFE when attempting to read EMPTY ItemStack
Thanks @gabizou
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 736686bed..d666088f2 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -120,7 +120,7 @@ public final class ItemStack {
// CraftBukkit - break into own method
public void load(NBTTagCompound nbttagcompound) {
- this.item = Item.b(nbttagcompound.getString("id"));
+ this.item = nbttagcompound.hasKeyOfType("id", 8) ? Item.b(nbttagcompound.getString("id")) : Item.getItemOf(Blocks.AIR); // Paper - fix NumberFormatException caused by attempting to read an EMPTY ItemStack
this.count = nbttagcompound.getByte("Count");
// CraftBukkit start - Route through setData for filtering
// this.damage = Math.max(0, nbttagcompound.getShort("Damage"));
--
2.18.0

View File

@ -1,4 +1,4 @@
From 2a68cb4cbc3ea0c0286a664799ae43b26a3837be Mon Sep 17 00:00:00 2001
From 5a776bba23f0a2dbbaff057f807a79d773625065 Mon Sep 17 00:00:00 2001
From: DemonWav <demonwav@gmail.com>
Date: Sun, 6 Aug 2017 17:17:53 -0500
Subject: [PATCH] Fix this stupid bullshit
@ -9,12 +9,12 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa
and to provide some level of hint without being disruptive.
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index c9e8a8737..ae2c51f5d 100644
index ac38028d7..ad0635925 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -209,10 +209,12 @@ public class Main {
@@ -215,10 +215,12 @@ public class Main {
Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -14);
deadline.add(Calendar.DAY_OF_YEAR, -3);
if (buildDate.before(deadline.getTime())) {
- System.err.println("*** Error, this build is outdated ***");
+ // Paper start - This is some stupid bullshit

View File

@ -1,14 +1,14 @@
From cee3ee7d056d74ede8ec145e8028fdff1ba18ec4 Mon Sep 17 00:00:00 2001
From 2cf62bc719ebd8587ce2ec6971c34c82273e0e63 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:54:40 -0500
Subject: [PATCH] Ocelot despawns should honor nametags and leash
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index 5a76821ea..858bbef5b 100644
index 6ea276aa0..720e7bbf9 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -58,7 +58,7 @@ public class EntityOcelot extends EntityTameableAnimal {
@@ -61,7 +61,7 @@ public class EntityOcelot extends EntityTameableAnimal {
}
protected boolean isTypeNotPersistent() {

View File

@ -1,14 +1,14 @@
From b6470fed3dcdea14ff3995a385bef6588bcce713 Mon Sep 17 00:00:00 2001
From 7671826b2ecad3ea76c794af68e6b3c5af3413ce Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:45:19 -0500
Subject: [PATCH] Reset spawner timer when spawner event is cancelled
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 1ed0def1e..87fe4775f 100644
index 2b6b062c6..c76dbe74a 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -113,6 +113,9 @@ public abstract class MobSpawnerAbstract {
@@ -121,6 +121,9 @@ public abstract class MobSpawnerAbstract {
{
entity.fromMobSpawner = true;
}
@ -18,7 +18,7 @@ index 1ed0def1e..87fe4775f 100644
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
continue;
}
@@ -123,7 +126,7 @@ public abstract class MobSpawnerAbstract {
@@ -131,7 +134,7 @@ public abstract class MobSpawnerAbstract {
entityinsentient.doSpawnEffect();
}

View File

@ -1,14 +1,14 @@
From bf2acf1bc8d0a4281451a2bf074bfa3b0b9956ec Mon Sep 17 00:00:00 2001
From b69d46e941e9c3325ea3d85e3a0a667122ea3081 Mon Sep 17 00:00:00 2001
From: mezz <tehgeek@gmail.com>
Date: Wed, 9 Aug 2017 17:51:22 -0500
Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index b85c55168..90f946e57 100644
index 0ba99bcbc..49e7c1589 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1572,7 +1572,11 @@ public abstract class World implements IBlockAccess {
@@ -1275,7 +1275,11 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
this.methodProfiler.c("blockEntities");
timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) {

View File

@ -1,4 +1,4 @@
From abc6db5a95b3549c1203ace470c1e17cbb4a9ea3 Mon Sep 17 00:00:00 2001
From 86fe3712509d345c377af5fd44f3615fc02db11f Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Thu, 17 Aug 2017 16:08:20 -0700
Subject: [PATCH] Allow specifying a custom "authentication servers down" kick
@ -27,10 +27,10 @@ index dbafef023..ec89ecfca 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index c5434e6ba..75df92836 100644
index bab13a4fd..d0e719f44 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -250,6 +250,10 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -241,6 +241,10 @@ public class LoginListener implements PacketLoginInListener, ITickable {
LoginListener.this.i = LoginListener.this.a(gameprofile);
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else {

View File

@ -1,14 +1,14 @@
From 45af741aba1ed94d65871ea3b47cabac4184a8de Mon Sep 17 00:00:00 2001
From 19824800f84c6e52c474bff8108d627c3395afec Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:49:48 -0500
Subject: [PATCH] LivingEntity#setKiller
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index d4d51688c..a7b076377 100644
index 7e3a9eeb2..487bb9ece 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -252,6 +252,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -254,6 +254,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
From 8ea6c7c92ee771c81f1b19594919eda513a1c96e Mon Sep 17 00:00:00 2001
From 6cc7c93bda7908b2e6ae798ec6d95e8fc93aab97 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Mon, 18 Sep 2017 12:00:03 +0200
Subject: [PATCH] Use Log4j IOStreams to redirect System.out/err to logger
@ -12,10 +12,10 @@ results in a separate line, even though it should not result in
a line break. Log4j's implementation handles it correctly.
diff --git a/pom.xml b/pom.xml
index 26775156b..adf79de70 100644
index 4dd5fed25..1b4877868 100644
--- a/pom.xml
+++ b/pom.xml
@@ -97,6 +97,13 @@
@@ -90,6 +90,13 @@
<scope>runtime</scope>
</dependency>
@ -30,10 +30,10 @@ index 26775156b..adf79de70 100644
<dependency>
<groupId>junit</groupId>
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index b3f1aa999..854455711 100644
index 069eb7d68..7ff2fa535 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -129,8 +129,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -135,8 +135,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
*/
// Paper end

View File

@ -1,4 +1,4 @@
From 48096c9ea13e424b5a060679092bc4b7007dfa19 Mon Sep 17 00:00:00 2001
From 55ceed112f6f100a68cb3e3e57eedcdb352252ac Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Thu, 21 Sep 2017 16:14:55 +0200
Subject: [PATCH] Handle plugin prefixes using Log4J configuration
@ -15,10 +15,10 @@ This may cause additional prefixes to be disabled for plugins bypassing
the plugin logger.
diff --git a/pom.xml b/pom.xml
index adf79de70..1639621d7 100644
index 1b4877868..a98abca8e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -94,7 +94,7 @@
@@ -87,7 +87,7 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.1</version>
@ -28,10 +28,10 @@ index adf79de70..1639621d7 100644
<!-- Paper - Add additional Log4J dependencies -->
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 9ce3e1365..cc1f3ac96 100644
index 9a1ffed07..b39096f04 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -282,7 +282,7 @@ public class SpigotConfig
@@ -286,7 +286,7 @@ public class SpigotConfig
private static void playerSample()
{
playerSample = getInt( "settings.sample-count", 12 );

View File

@ -1,14 +1,14 @@
From e0bcbbb023b13d0dfcfd1ee15bb807617cd1973f Mon Sep 17 00:00:00 2001
From a42bf6eda3c9b215f4cd88153370471bcb7c1588 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Thu, 21 Sep 2017 16:33:35 +0200
Subject: [PATCH] Include Log4J2 SLF4J implementation
diff --git a/pom.xml b/pom.xml
index 1639621d7..bf04f6d12 100644
index a98abca8e..9354f6edf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -98,6 +98,12 @@
@@ -91,6 +91,12 @@
</dependency>
<!-- Paper - Add additional Log4J dependencies -->

View File

@ -1,4 +1,4 @@
From 5ffc7918dcf0fcd87916342ddb568352e56ba098 Mon Sep 17 00:00:00 2001
From b008d0b333f3e32534337fb21f75c9f69ee42298 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Sat, 23 Sep 2017 21:07:20 +0200
Subject: [PATCH] Disable logger prefix for various plugins bypassing the

View File

@ -1,38 +1,39 @@
From 1ada468a04f4567237b4180c750ed48915b44997 Mon Sep 17 00:00:00 2001
From a1241df8d09b0b85541b860c16da86cdd179ecf3 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 85e617979..8cf082d2e 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 {
@@ -1460,6 +1460,7 @@ public abstract class EntityHuman extends EntityLiving {
return 0;
}
public void b(List<IRecipe> list) {}
+ public void jump() { this.cu(); } // Paper - OBFHELPER
public void cu() {
super.cu();
this.b(StatisticList.w);
+ public void jump() { this.cG(); } // Paper - OBFHELPER
public void cG() {
super.cG();
this.a(StatisticList.JUMP);
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 128b2beb5..2255b8ccb 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;
@@ -57,6 +57,8 @@ import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryView;
import org.bukkit.util.NumberConversions;
import com.destroystokyo.paper.event.player.IllegalPacketEvent; // Paper
+import com.destroystokyo.paper.event.player.IllegalPacketEvent; // Paper
+import com.destroystokyo.paper.event.player.PlayerJumpEvent; // Paper
import co.aikar.timings.MinecraftTimings; // Paper
// CraftBukkit end
@@ -584,7 +585,34 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -860,7 +862,34 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
d8 = d5 - this.p;
d9 = d6 - this.q;
if (this.player.onGround && !packetplayinflying.a() && d8 > 0.0D) {
- this.player.cu();
if (this.player.onGround && !packetplayinflying.b() && d8 > 0.0D) {
- this.player.cG();
+ // Paper start - Add player jump event
+ Player player = this.getPlayer();
+ Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.

View File

@ -1,4 +1,4 @@
From cab4c50ff2db0b82c32afadb8075dc5e5b3b5bad Mon Sep 17 00:00:00 2001
From 178e48e8c8947d049eff7f417a7ad7bce60abcf3 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,25 +15,23 @@ 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 2255b8ccb..20bac8bc3 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 {
@@ -2465,14 +2465,18 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
- PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.x()); // CraftBukkit
+ //PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.x()); // CraftBukkit // Paper - This shouldn't be on the main thread
if (this.g && packetplayinkeepalive.a() == this.h) {
int i = (int) (this.d() - this.f);
- PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit
+ PlayerConnectionUtils.ensureMainThread(packetplayinkeepalive, this, this.player.getWorldServer()); // CraftBukkit // Paper - This shouldn't be on the main thread
if (this.g && packetplayinkeepalive.b() == this.h) {
int i = (int) (SystemUtils.b() - this.f);
this.player.ping = (this.player.ping * 3 + i) / 4;
this.g = false;
} else if (!this.player.getName().equals(this.minecraftServer.Q())) {
} else if (!this.player.getDisplayName().getString().equals(this.minecraftServer.I())) {
- this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
+ // Paper start - This needs to be handled on the main thread for plugins
+ PlayerConnection.LOGGER.warn("{} sent an invalid keepalive! pending keepalive: {} got id: {} expected id: {}",
+ this.player.getName(), this.isPendingPing(), packetplayinkeepalive.a(), this.getKeepAliveID());
+ minecraftServer.postToMainThread(() -> {
+ this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
+ });
@ -42,5 +40,5 @@ index 08211a54c..72474a88e 100644
}
--
2.17.1
2.18.0

View File

@ -1,4 +1,4 @@
From f50072ea408132ad91ddd246ba91c1b7417998ab Mon Sep 17 00:00:00 2001
From 5b0a2495dcd70a2f5d5930a2d2b77eb42476b696 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Tue, 10 Oct 2017 18:45:20 +0200
Subject: [PATCH] Expose client protocol version and virtual host
@ -61,7 +61,7 @@ index 000000000..5caca6439
+
+}
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index 309ab18df..c583ab7d9 100644
index 088ec198e..bc34cd687 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -15,6 +15,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
@ -73,7 +73,7 @@ index 309ab18df..c583ab7d9 100644
public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.a = minecraftserver;
@@ -130,6 +131,10 @@ public class HandshakeListener implements PacketHandshakingInListener {
throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.a());
throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.b());
}
+ // Paper start - NetworkClient implementation
@ -84,13 +84,13 @@ index 309ab18df..c583ab7d9 100644
public void a(IChatBaseComponent ichatbasecomponent) {}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 2eddb68d7..b93a26e8f 100644
index 5b0d83a1d..424464d09 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -75,6 +75,10 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
private IChatBaseComponent n;
private boolean o;
private boolean p;
@@ -63,6 +63,10 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
private float t;
private int u;
private boolean v;
+ // Paper start - NetworkClient implementation
+ public int protocolVersion;
+ public java.net.InetSocketAddress virtualHost;
@ -99,22 +99,22 @@ index 2eddb68d7..b93a26e8f 100644
public NetworkManager(EnumProtocolDirection enumprotocoldirection) {
this.h = enumprotocoldirection;
diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
index aececa39d..1d4ba3b3d 100644
index 7acdac55e..f1a3be69d 100644
--- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java
@@ -33,6 +33,7 @@ public class PacketHandshakingInSetProtocol implements Packet<PacketHandshakingI
return this.d;
}
+ public int getProtocolVersion() { return b(); } // Paper - OBFHELPER
public int b() {
+ public int getProtocolVersion() { return c(); } // Paper - OBFHELPER
public int c() {
return this.a;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 1269a02aa..428b208ae 100644
index d7eb4af83..9f9002dd8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -136,6 +136,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -175,6 +175,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}

View File

@ -1,4 +1,4 @@
From 69b083f70da6bf8655cb789af2af6d0fd8764065 Mon Sep 17 00:00:00 2001
From 0c1e2c1ae8251496de7141704807b7c6f7ee82fd Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 15 Oct 2017 00:29:07 +0100
Subject: [PATCH] revert serverside behavior of keepalives
@ -17,10 +17,10 @@ from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 869a2b402..284db9b9e 100644
index 20bac8bc3..4f9b4afdf 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -68,7 +68,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -69,7 +69,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
private final MinecraftServer minecraftServer;
public EntityPlayer player;
private int e;
@ -30,36 +30,35 @@ index 869a2b402..284db9b9e 100644
private long h; private void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; private long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER
// CraftBukkit start - multithreaded fields
@@ -100,6 +100,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
private int E;
private int receivedMovePackets;
private int processedMovePackets;
private AutoRecipe H = new AutoRecipe();
+ private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
@@ -179,18 +180,25 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -179,18 +180,26 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
this.minecraftServer.methodProfiler.a("keepAlive");
- long i = this.d();
- long i = SystemUtils.b();
-
- if (i - this.f >= 25000L) { // CraftBukkit
- if (this.g) {
- this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2
+ long currentTime = SystemUtils.b();
+ long elapsedTime = currentTime - this.getLastPing();
+
+ if (this.isPendingPing()) {
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
+ PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info
this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
- } else {
- this.g = true;
- this.f = i;
- this.h = i;
- this.sendPacket(new PacketPlayOutKeepAlive(this.h));
+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2
+ long currentTime = this.getCurrentMillis();
+ long elapsedTime = currentTime - this.getLastPing();
+ if (this.isPendingPing()) {
+ // We're pending a ping from the client
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
+ PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info
+ this.disconnect(new ChatMessage("disconnect.timeout"));
+ }
+ } else {
+ if (elapsedTime >= 15000L) { // 15 seconds
@ -67,11 +66,12 @@ index 869a2b402..284db9b9e 100644
+ this.setLastPing(currentTime);
+ this.setKeepAliveID(currentTime);
+ this.sendPacket(new PacketPlayOutKeepAlive(this.getKeepAliveID()));
+
}
}
+ // Paper end
this.minecraftServer.methodProfiler.b();
this.minecraftServer.methodProfiler.e();
// CraftBukkit start
--
2.18.0

View File

@ -1,4 +1,4 @@
From 5cfd4e4387b394d8f49204d8cba5b5f410fb2443 Mon Sep 17 00:00:00 2001
From e4db85ca803dca548540899a64b1a3cb998a9f34 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Fri, 20 Oct 2017 04:33:45 +0200
Subject: [PATCH] Replace HashSet with fastutil's ObjectOpenHashSet in

View File

@ -1,4 +1,4 @@
From 446ba2913490acc93574cbe8dab2ad241e3bdfc6 Mon Sep 17 00:00:00 2001
From 93f41c5654fff04e051aa2e2879a0dc47d58eb36 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 31 Oct 2017 03:26:18 +0100
Subject: [PATCH] Send attack SoundEffects only to players who can see the
@ -6,11 +6,11 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 579996d1e..347237055 100644
index 8cf082d2e..34e79e7ca 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -939,6 +939,15 @@ public abstract class EntityHuman extends EntityLiving {
this.j = 0;
@@ -981,6 +981,15 @@ public abstract class EntityHuman extends EntityLiving {
this.k = 0;
}
+ // Paper start - send SoundEffect to everyone who can see fromEntity
@ -23,59 +23,59 @@ index 579996d1e..347237055 100644
+ // Paper end
+
public void attack(Entity entity) {
if (entity.bd()) {
if (entity.bk()) {
if (!entity.t(this)) {
@@ -963,7 +972,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1005,7 +1014,7 @@ public abstract class EntityHuman extends EntityLiving {
int i = b0 + EnchantmentManager.b((EntityLiving) this);
if (this.isSprinting() && flag) {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fw, this.bK(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fw, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
++i;
flag1 = true;
}
@@ -1041,7 +1050,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1083,7 +1092,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fz, this.bK(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fz, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility
this.cX();
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
this.dk();
}
@@ -1071,15 +1080,15 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1113,15 +1122,15 @@ public abstract class EntityHuman extends EntityLiving {
}
if (flag2) {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fv, this.bK(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fv, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_CRIT, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_CRIT, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
this.a(entity);
}
if (!flag2 && !flag3) {
if (flag) {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fy, this.bK(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fy, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_STRONG, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_STRONG, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
} else {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fA, this.bK(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fA, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_WEAK, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_WEAK, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
}
}
@@ -1135,7 +1144,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1177,7 +1186,7 @@ public abstract class EntityHuman extends EntityLiving {
this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value
} else {
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fx, this.bK(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.fx, this.bK(), 1.0F, 1.0F); // Paper - send while respecting visibility
- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_NODAMAGE, this.bV(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_PLAYER_ATTACK_NODAMAGE, this.bV(), 1.0F, 1.0F); // Paper - send while respecting visibility
if (flag4) {
entity.extinguish();
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index ea67b61b2..29dffc3ac 100644
index 62fd2e503..b9472dddb 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1061,6 +1061,12 @@ public abstract class World implements IBlockAccess {
@@ -921,6 +921,12 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
this.a(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1);
}
@ -86,8 +86,8 @@ index ea67b61b2..29dffc3ac 100644
+ // Paper end
+
public void a(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, SoundEffect soundeffect, SoundCategory soundcategory, float f, float f1) {
for (int i = 0; i < this.u.size(); ++i) {
((IWorldAccess) this.u.get(i)).a(entityhuman, soundeffect, soundcategory, d0, d1, d2, f, f1);
for (int i = 0; i < this.v.size(); ++i) {
((IWorldAccess) this.v.get(i)).a(entityhuman, soundeffect, soundcategory, d0, d1, d2, f, f1);
--
2.18.0

View File

@ -1,14 +1,14 @@
From d3ad905c6a3156cbf9484834eea088efb106b4dd Mon Sep 17 00:00:00 2001
From c52d751e0ac64d6c3226967fade0c7f8a3477abb Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 10 Nov 2017 23:03:12 -0500
Subject: [PATCH] Option for maximum exp value when merging orbs
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 4d30cdbc8..535a8d3ed 100644
index 6344537ec..33743f8fd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -457,4 +457,10 @@ public class PaperWorldConfig {
@@ -387,4 +387,10 @@ public class PaperWorldConfig {
replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList((Object) "stone", "planks"));
log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
}
@ -20,10 +20,10 @@ index 4d30cdbc8..535a8d3ed 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 29dffc3ac..2c69ae748 100644
index b9472dddb..d28d4a9a7 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1143,16 +1143,30 @@ public abstract class World implements IBlockAccess {
@@ -999,16 +999,30 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
EntityExperienceOrb xp = (EntityExperienceOrb) entity;
double radius = spigotConfig.expMerge;
if (radius > 0) {

View File

@ -1,11 +1,11 @@
From 967b71010b6429abb9d4c8f2dbc62b2424d510d7 Mon Sep 17 00:00:00 2001
From 568b43a97065e32c9d26cf7c18f800f92ea1a2e6 Mon Sep 17 00:00:00 2001
From: pkt77 <parkerkt77@gmail.com>
Date: Fri, 10 Nov 2017 23:46:34 -0500
Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 44335fd2d..9adcabd4f 100644
index f4a766800..401410b87 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1,5 +1,6 @@
@ -15,7 +15,7 @@ index 44335fd2d..9adcabd4f 100644
import com.google.common.base.Objects;
import com.google.common.collect.Maps;
import java.util.Collection;
@@ -1932,6 +1933,13 @@ public abstract class EntityLiving extends Entity {
@@ -1968,6 +1969,13 @@ public abstract class EntityLiving extends Entity {
ItemStack itemstack1 = this.getEquipment(enumitemslot);
if (!ItemStack.matches(itemstack1, itemstack)) {

View File

@ -1,4 +1,4 @@
From b8d15e70c042d8aea4b93a01c127b6189dedde3b Mon Sep 17 00:00:00 2001
From 4f82679db4ed81dfc4163a485d432942cf91b666 Mon Sep 17 00:00:00 2001
From: killme <killme-git@ibts.me>
Date: Sun, 12 Nov 2017 19:40:01 +0100
Subject: [PATCH] Prevent logins from being processed when the player has
@ -6,10 +6,10 @@ Subject: [PATCH] Prevent logins from being processed when the player has
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 75df92836..eaac25dc3 100644
index d0e719f44..7dbc6f437 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -60,7 +60,11 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -57,7 +57,11 @@ public class LoginListener implements PacketLoginInListener, ITickable {
}
// Paper end
if (this.g == LoginListener.EnumProtocolState.READY_TO_ACCEPT) {

View File

@ -1,4 +1,4 @@
From 59316f81fc224550436b7d841068d234a68ab9ae Mon Sep 17 00:00:00 2001
From 2cd84e469938fb0e15b04c28eadcfeadb4c52116 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Thu, 16 Nov 2017 12:12:41 +0000
Subject: [PATCH] use CB BlockState implementations for captured blocks
@ -18,16 +18,15 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 2c69ae748..39b90fb4c 100644
index d28d4a9a7..069ba83db 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -393,7 +393,8 @@ public abstract class World implements IBlockAccess {
@@ -378,7 +378,7 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
// CraftBukkit start - capture blockstates
BlockState blockstate = null;
CraftBlockState blockstate = null;
if (this.captureBlockStates) {
- blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), i);
+ //blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), i); // Paper
+ blockstate = world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState(); // Paper - use CB getState to get a suitable snapshot
- blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition, i);
+ blockstate = (CraftBlockState) world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState(); // Paper - use CB getState to get a suitable snapshot
this.capturedBlockStates.add(blockstate);
}
// CraftBukkit end

View File

@ -1,4 +1,4 @@
From 955230d3e8ac631d5b64a60aab4c0c97dc0e95ba Mon Sep 17 00:00:00 2001
From f8f600aca85e9770c953f6264c789d368377cee3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 6 Nov 2017 21:08:22 -0500
Subject: [PATCH] API to get a BlockState without a snapshot
@ -13,10 +13,10 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
If Tile Entity was null, correct Sign to return empty lines instead of null
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 358c99227..5b5f102e2 100644
index 2cfe2202e..909432d51 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -285,7 +285,12 @@ public abstract class TileEntity implements KeyedObject {
@@ -203,7 +203,12 @@ public abstract class TileEntity implements KeyedObject {
}
// CraftBukkit start - add method
@ -29,7 +29,7 @@ index 358c99227..5b5f102e2 100644
if (world == null) return null;
// Spigot start
org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
@@ -294,7 +299,7 @@ public abstract class TileEntity implements KeyedObject {
@@ -212,7 +217,7 @@ public abstract class TileEntity implements KeyedObject {
return null;
}
// Spigot end
@ -38,28 +38,13 @@ index 358c99227..5b5f102e2 100644
if (state instanceof InventoryHolder) return (InventoryHolder) state;
return null;
}
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 54b719d91..3f2c5b2d5 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -60,7 +60,7 @@ public class TileEntitySign extends TileEntity {
}
public MinecraftServer C_() {
- return TileEntitySign.this.world.getMinecraftServer();
+ return MinecraftServer.getServer(); // Paper - world may be null
}
};
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 46670c346..a9d3f12bc 100644
index bfed2d988..d1eea2133 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -260,7 +260,22 @@ public class CraftBlock implements Block {
}
@@ -267,6 +267,20 @@ public class CraftBlock implements Block {
}
+
public BlockState getState() {
+ // Paper start - allow disabling the use of snapshots
+ return getState(true);
@ -79,10 +64,10 @@ index 46670c346..a9d3f12bc 100644
switch (material) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 266f87d7f..fe112812d 100644
index 0558cafe3..d4d9c5fc5 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -22,20 +22,40 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
@@ -23,20 +23,40 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
CraftWorld world = (CraftWorld) this.getWorld();
this.tileEntity = tileEntityClass.cast(world.getTileEntityAt(this.getX(), this.getY(), this.getZ()));
@ -91,10 +76,10 @@ index 266f87d7f..fe112812d 100644
+ if (DISABLE_SNAPSHOT) {
+ this.snapshot = this.tileEntity;
+ } else {
+ this.snapshot = this.createSnapshot(this.tileEntity);
+ this.snapshot = this.createSnapshot(this.tileEntity, world.getHandle());
+ }
// copy tile entity data:
- this.snapshot = this.createSnapshot(tileEntity);
- this.snapshot = this.createSnapshot(tileEntity, world.getHandle());
- this.load(snapshot);
+ if(this.snapshot != null) {
+ this.load(this.snapshot);
@ -116,10 +101,10 @@ index 266f87d7f..fe112812d 100644
+ if (DISABLE_SNAPSHOT) {
+ this.snapshot = this.tileEntity;
+ } else {
+ this.snapshot = this.createSnapshot(this.tileEntity);
+ this.snapshot = this.createSnapshot(this.tileEntity, null);
+ }
// copy tile entity data:
- this.snapshot = this.createSnapshot(tileEntity);
- this.snapshot = this.createSnapshot(tileEntity, null);
- this.load(snapshot);
+ if(this.snapshot != null) {
+ this.load(this.snapshot);
@ -127,7 +112,7 @@ index 266f87d7f..fe112812d 100644
+ // Paper end
}
private T createSnapshot(T tileEntity) {
private T createSnapshot(T tileEntity, World world) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
index 7a8d44529..97b4e6910 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java

View File

@ -1,143 +0,0 @@
From d6b423ce8aea858a4e606fd70e440b302706c6f5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 26 Nov 2017 13:19:58 -0500
Subject: [PATCH] AsyncTabCompleteEvent
Let plugins be able to control tab completion of commands and chat async.
This will be useful for frameworks like ACF so we can define async safe completion handlers,
and avoid going to main for tab completions.
Especially useful if you need to query a database in order to obtain the results for tab
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 e01013efd..74a665142 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2277,24 +2277,51 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
// CraftBukkit end
}
- public void a(PacketPlayInTabComplete packetplayintabcomplete) {
- PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.x());
+ // Paper start - async tab completion
+ public void a(PacketPlayInTabComplete packet) {
// CraftBukkit start
if (chatSpamField.addAndGet(this, 10) > 500 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) {
- this.disconnect(new ChatMessage("disconnect.spam", new Object[0]));
+ minecraftServer.postToMainThread(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0])));
return;
}
// CraftBukkit end
- ArrayList arraylist = Lists.newArrayList();
- Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator();
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
+ com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event;
+ java.util.List<String> completions = new ArrayList<>();
+ BlockPosition blockpos = packet.b();
+ String buffer = packet.a();
+ boolean isCommand = buffer.startsWith("/") || packet.c();
+ event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getPlayer(), completions,
+ buffer, isCommand, blockpos != null ? MCUtil.toLocation(player.world, blockpos) : null);
+ event.callEvent();
+ completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.getCompletions();
+ if (event.isCancelled() || event.isHandled()) {
+ // Still fire sync event with the provided completions, if someone is listening
+ if (!event.isCancelled() && org.bukkit.event.server.TabCompleteEvent.getHandlerList().getRegisteredListeners().length > 0) {
+ java.util.List<String> finalCompletions = completions;
+ Waitable<java.util.List<String>> syncCompletions = new Waitable<java.util.List<String>>() {
+ @Override
+ protected java.util.List<String> evaluate() {
+ org.bukkit.event.server.TabCompleteEvent syncEvent = new org.bukkit.event.server.TabCompleteEvent(PlayerConnection.this.getPlayer(), buffer, finalCompletions, isCommand, blockpos != null ? MCUtil.toLocation(player.world, blockpos) : null);
+ return syncEvent.callEvent() ? syncEvent.getCompletions() : com.google.common.collect.ImmutableList.of();
+ }
+ };
+ server.getServer().processQueue.add(syncCompletions);
+ try {
+ completions = syncCompletions.get();
+ } catch (InterruptedException | ExecutionException e1) {
+ e1.printStackTrace();
+ }
+ }
- arraylist.add(s);
+ this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete(completions.toArray(new String[completions.size()])));
+ return;
}
-
- this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete((String[]) arraylist.toArray(new String[arraylist.size()])));
+ minecraftServer.postToMainThread(() -> {
+ java.util.List<String> syncCompletions = this.minecraftServer.tabCompleteCommand(this.player, buffer, blockpos, isCommand);
+ this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete(syncCompletions.toArray(new String[syncCompletions.size()])));
+ });
+ // Paper end
}
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 2dd7ed96a..e86c16755 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 {
} else {
offers = tabCompleteChat(player, message);
}
-
- TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers);
+
+ TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? MCUtil.toLocation(((CraftWorld) player.getWorld()).getHandle(), pos) : null); // Paper
getPluginManager().callEvent(tabEvent);
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 1e3aae3b8..95d13c146 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 {
public void complete(LineReader reader, ParsedLine line, List<Candidate> candidates) {
final CraftServer server = this.server.server;
final String buffer = line.line();
+ // Async Tab Complete
+ com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event;
+ java.util.List<String> completions = new java.util.ArrayList<>();
+ event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(server.getConsoleSender(), completions,
+ buffer, true, null);
+ event.callEvent();
+ completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.getCompletions();
+
+ if (event.isCancelled() || event.isHandled()) {
+ // Still fire sync event with the provided completions, if someone is listening
+ if (!event.isCancelled() && TabCompleteEvent.getHandlerList().getRegisteredListeners().length > 0) {
+ List<String> finalCompletions = completions;
+ Waitable<List<String>> syncCompletions = new Waitable<List<String>>() {
+ @Override
+ protected List<String> evaluate() {
+ org.bukkit.event.server.TabCompleteEvent syncEvent = new org.bukkit.event.server.TabCompleteEvent(server.getConsoleSender(), buffer, finalCompletions);
+ return syncEvent.callEvent() ? syncEvent.getCompletions() : com.google.common.collect.ImmutableList.of();
+ }
+ };
+ server.getServer().processQueue.add(syncCompletions);
+ try {
+ completions = syncCompletions.get();
+ } catch (InterruptedException | ExecutionException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ if (!completions.isEmpty()) {
+ candidates.addAll(completions.stream().map(Candidate::new).collect(java.util.stream.Collectors.toList()));
+ }
+ return;
+ }
+
// Paper end
Waitable<List<String>> waitable = new Waitable<List<String>>() {
@Override
--
2.17.1

View File

@ -1,22 +0,0 @@
From 9879e7c10bb47f2cfaa41d001896592517a6b429 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 29 Nov 2017 22:18:54 -0500
Subject: [PATCH] Avoid NPE in PathfinderGoalTempt
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java
index 188825d19..8004f3a3f 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java
@@ -54,7 +54,7 @@ public class PathfinderGoalTempt extends PathfinderGoal {
}
this.target = (event.getTarget() == null) ? null : ((CraftLivingEntity) event.getTarget()).getHandle();
}
- return tempt;
+ return tempt && this.target != null; // Paper - must have target - plugin might of cancelled
// CraftBukkit end
}
}
--
2.18.0