More 1.14 work

This commit is contained in:
Spottedleaf 2019-04-26 23:26:04 -07:00 committed by Zach Brown
parent 36873bf2d6
commit b4b181a1fb
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76
73 changed files with 936 additions and 936 deletions

View File

@ -1,4 +1,4 @@
From 59ae19524b32260191e1daaa772623d3c08255d1 Mon Sep 17 00:00:00 2001
From 73882b98ebeec264ffcbd3e0d396e85b9d7dfba0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 16:28:32 -0500
Subject: [PATCH] ExperienceOrbs API for Reason/Source/Triggering player
@ -8,7 +8,7 @@ Adds lots of information about why this orb exists.
Replaces isFromBottle() with logic that persists entity reloads too.
diff --git a/src/main/java/org/bukkit/entity/ExperienceOrb.java b/src/main/java/org/bukkit/entity/ExperienceOrb.java
index c286edfd..57029d9b 100644
index c286edfd..dec70bbf 100644
--- a/src/main/java/org/bukkit/entity/ExperienceOrb.java
+++ b/src/main/java/org/bukkit/entity/ExperienceOrb.java
@@ -1,5 +1,8 @@
@ -20,7 +20,7 @@ index c286edfd..57029d9b 100644
/**
* Represents an Experience Orb.
*/
@@ -18,4 +21,95 @@ public interface ExperienceOrb extends Entity {
@@ -18,4 +21,99 @@ public interface ExperienceOrb extends Entity {
* @param value Amount of experience
*/
public void setExperience(int value);
@ -78,6 +78,10 @@ index c286edfd..57029d9b 100644
+ */
+ EXP_BOTTLE,
+ /**
+ * Spawned by a player using a grindstone
+ */
+ GRINDSTONE,
+ /**
+ * We do not know why it was spawned
+ */
+ UNKNOWN

View File

@ -1,4 +1,4 @@
From fad39d84f9fedb2d3b8d1484417472592904368e Mon Sep 17 00:00:00 2001
From 245f3f088315c482ace01add5ac71d7876577d44 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 16 May 2016 20:47:41 -0400
Subject: [PATCH] Optimize UserCache / Thread Safe
@ -10,10 +10,10 @@ Additionally, move Saving of the User cache to be done async, incase
the user never changed the default setting for Spigot's save on stop only.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 78b60d0e35..7ffb061414 100644
index cddb4311a..c41adf441 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -687,7 +687,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@@ -727,7 +727,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Spigot start
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
LOGGER.info("Saving usercache.json");
@ -23,7 +23,7 @@ index 78b60d0e35..7ffb061414 100644
// Spigot end
}
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index f782ecb82f..65d230d45f 100644
index 41be5bf64..cd8a652eb 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -108,7 +108,7 @@ public class UserCache {

View File

@ -1,4 +1,4 @@
From aec8613d66d263badbe8bd4354198135d8b08cb8 Mon Sep 17 00:00:00 2001
From fe618c45f0b134731b12c0ad6ca90eff15dea5ce Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 16 May 2016 23:19:16 -0400
Subject: [PATCH] Avoid blocking on Network Manager creation
@ -6,7 +6,7 @@ Subject: [PATCH] Avoid blocking on Network Manager creation
Per Paper issue 294
diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java
index 41ff55e9e2..baabcd19c4 100644
index 42c654a1d..e7ed6af9c 100644
--- a/src/main/java/net/minecraft/server/ServerConnection.java
+++ b/src/main/java/net/minecraft/server/ServerConnection.java
@@ -39,6 +39,15 @@ public class ServerConnection {

View File

@ -1,11 +1,11 @@
From 63ff9250af978a4b43ee5463b0efd46a67e530eb Mon Sep 17 00:00:00 2001
From d9d785e3118eb7f30611eca9330f0c5aab6ae80e Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 22 May 2016 20:20:55 -0500
Subject: [PATCH] Optional TNT doesn't move in water
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 720b87a5ec..bcc2ecaa3a 100644
index 805aa5699..92ab55182 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -2,7 +2,6 @@ package com.destroystokyo.paper;
@ -16,7 +16,7 @@ index 720b87a5ec..bcc2ecaa3a 100644
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -301,4 +300,14 @@ public class PaperWorldConfig {
@@ -287,4 +286,14 @@ public class PaperWorldConfig {
);
}
}
@ -32,26 +32,27 @@ index 720b87a5ec..bcc2ecaa3a 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 462f94ed18..113264981e 100644
index 3dcd93e5e..b68e2fc04 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1190,6 +1190,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1094,6 +1094,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public boolean aq() {
public boolean au() {
+ // Paper start
+ return this.doWaterMovement();
+ }
+
+ public boolean doWaterMovement() {
+ // Paper end
return this.isInWater() || this.q();
return this.isInWater() || this.l();
}
@@ -2741,6 +2747,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -2620,6 +2626,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public boolean bw() {
public boolean bD() {
+ // Paper start
+ return this.pushedByWater();
+ }
+
@ -61,12 +62,12 @@ index 462f94ed18..113264981e 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 7f4b68dcc0..7a8670323c 100644
index e0535604b..91e332c3a 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -146,4 +146,49 @@ public class EntityTNTPrimed extends Entity {
public int getFuseTicks() {
return this.c;
@@ -149,4 +149,49 @@ public class EntityTNTPrimed extends Entity {
public Packet<?> N() {
return new PacketPlayOutSpawnEntity(this);
}
+
+ // Paper start - Optional prevent TNT from moving in water

View File

@ -1,4 +1,4 @@
From 724e26451f8b6dedc7b7013fcbc0aded8efd85a7 Mon Sep 17 00:00:00 2001
From 1d7fc3c3ce80240e99ea57a6c854b515b3880f3a Mon Sep 17 00:00:00 2001
From: Martin Panzer <postremus1996@googlemail.com>
Date: Mon, 23 May 2016 12:12:37 +0200
Subject: [PATCH] Faster redstone torch rapid clock removal
@ -6,10 +6,10 @@ Subject: [PATCH] Faster redstone torch rapid clock removal
Only resize the the redstone torch list once, since resizing arrays / lists is costly
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
index d8a0b73c31..74b63fe1d1 100644
index a99f979ef..a79484e3e 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -63,9 +63,17 @@ public class BlockRedstoneTorch extends BlockTorch {
@@ -68,9 +68,17 @@ public class BlockRedstoneTorch extends BlockTorch {
public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random, boolean flag) {
List list = (List) BlockRedstoneTorch.b.get(world);
@ -29,7 +29,7 @@ index d8a0b73c31..74b63fe1d1 100644
// CraftBukkit start
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
@@ -169,7 +177,7 @@ public class BlockRedstoneTorch extends BlockTorch {
@@ -167,7 +175,7 @@ public class BlockRedstoneTorch extends BlockTorch {
public static class RedstoneUpdateInfo {
private final BlockPosition a;

View File

@ -1,14 +1,14 @@
From 254da8d94b3a51da9dedea35952ab380fecdd3ad Mon Sep 17 00:00:00 2001
From 1b2bce1bc325f0feb676e7d86a35588a9a598278 Mon Sep 17 00:00:00 2001
From: Martin Panzer <postremus1996@googlemail.com>
Date: Sat, 28 May 2016 16:54:03 +0200
Subject: [PATCH] Add server-name parameter
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index c85a9bfb91..472a8070e7 100644
index a96c144fc..5203e781e 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -136,6 +136,14 @@ public class Main {
@@ -135,6 +135,14 @@ public class Main {
.defaultsTo(new File("paper.yml"))
.describedAs("Yml file");
// Paper end

View File

@ -1,4 +1,4 @@
From 3d9e07b20844b8039fe250c34ff50cf330622471 Mon Sep 17 00:00:00 2001
From 20610473d3c678f6e38715f7f1c094873a86c5e9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 31 May 2016 22:53:50 -0400
Subject: [PATCH] Only send Dragon/Wither Death sounds to same world
@ -6,39 +6,37 @@ Subject: [PATCH] Only send Dragon/Wither Death sounds to same world
Also fix view distance lookup
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 967aae838e..b3fbc8249e 100644
index 245b1d100..bfdb63094 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -573,8 +573,12 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
if (this.bO == 1) {
@@ -558,8 +558,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
if (this.bL == 1) {
// CraftBukkit start - Use relative location for far away sounds
// this.world.a(1028, new BlockPosition(this), 0);
// this.world.b(1028, new BlockPosition(this), 0);
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
+ // Paper start
+ //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
+ for (EntityHuman human : world.players) {
+ EntityPlayer player = (EntityPlayer) human;
+ int viewDistance = player.getViewDistance();
+ for (EntityPlayer player : ((WorldServer)world).getPlayers()) {
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
+ // Paper end
double deltaX = this.locX - player.locX;
double deltaZ = this.locZ - player.locZ;
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index c43a90333b..ed4ca8abb2 100644
index f23f09430..48b22894a 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -200,8 +200,12 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
@@ -207,8 +207,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
// CraftBukkit start - Use relative location for far away sounds
// this.world.a(1023, new BlockPosition(this), 0);
// this.world.b(1023, new BlockPosition(this), 0);
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
+ // Paper start
+ //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
+ for (EntityHuman human : world.players) {
+ EntityPlayer player = (EntityPlayer) human;
+ int viewDistance = player.getViewDistance();
+ for (EntityPlayer player : ((WorldServer)world).getPlayers()) {
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
+ // Paper end
double deltaX = this.locX - player.locX;
double deltaZ = this.locZ - player.locZ;

View File

@ -0,0 +1,24 @@
From baaddf7e045aa037211e6721e02193fd49d933f2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 21 Jun 2016 22:54:34 -0400
Subject: [PATCH] Fix Double World Add issues
Vanilla will double add Spider Jockeys to the world, so ignore already added.
Also add debug if something else tries to, and abort before world gets bad state
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 1e718e4db..464a132a3 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -935,6 +935,7 @@ public class WorldServer extends World {
// CraftBukkit start
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot
+ if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); return true; } // Paper
if (entity.dead) {
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
return false;
--
2.21.0

View File

@ -1,4 +1,4 @@
From 049ceb1e1da52d7580d5f05bff70a4d9955f589b Mon Sep 17 00:00:00 2001
From 8199add0f4a50441fb4a954f46f98486a36f8d75 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 17 Jun 2016 20:50:11 -0400
Subject: [PATCH] Fix Old Sign Conversion
@ -9,38 +9,38 @@ Subject: [PATCH] Fix Old Sign Conversion
This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures
diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java
index 83db94c4ab..dd635292ec 100644
index dabfb8067..f80ba567f 100644
--- a/src/main/java/net/minecraft/server/DefinedStructure.java
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java
@@ -215,9 +215,11 @@ public class DefinedStructure {
definedstructure_blockinfo1.c.setInt("x", blockposition1.getX());
definedstructure_blockinfo1.c.setInt("y", blockposition1.getY());
definedstructure_blockinfo1.c.setInt("z", blockposition1.getZ());
+ tileentity.isLoadingStructure = true; // Paper
tileentity.load(definedstructure_blockinfo1.c);
tileentity.a(definedstructureinfo.b());
tileentity.a(definedstructureinfo.c());
+ tileentity.isLoadingStructure = false; // Paper
}
@@ -203,9 +203,11 @@ public class DefinedStructure {
definedstructure_blockinfo.c.setInt("x", blockposition1.getX());
definedstructure_blockinfo.c.setInt("y", blockposition1.getY());
definedstructure_blockinfo.c.setInt("z", blockposition1.getZ());
+ tileentity.isLoadingStructure = true; // Paper
tileentity.load(definedstructure_blockinfo.c);
tileentity.a(definedstructureinfo.c());
tileentity.a(definedstructureinfo.d());
+ tileentity.isLoadingStructure = false; // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index c5212417c6..b3c5766a27 100644
index 85a1c5666..d8cc35352 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -11,6 +11,7 @@ import org.bukkit.inventory.InventoryHolder; // CraftBukkit
public abstract class TileEntity implements KeyedObject { // Paper
@@ -12,6 +12,7 @@ public abstract class TileEntity implements KeyedObject { // Paper
public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper
private static final Logger LOGGER = LogManager.getLogger();
+ boolean isLoadingStructure = false; // Paper
private static final Logger a = LogManager.getLogger();
private final TileEntityTypes<?> e; public TileEntityTypes getTileEntityType() { return e; } // Paper - OBFHELPER
private final TileEntityTypes<?> b; public TileEntityTypes getTileEntityType() { return b; } // Paper - OBFHELPER
@Nullable
protected World world;
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index 31a9d45727..458d1561d0 100644
index 86505f25c..9de03a24c 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -50,13 +50,14 @@ public class TileEntitySign extends TileEntity implements ICommandListener {
@@ -58,13 +58,14 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
}
try {

View File

@ -1,11 +1,11 @@
From 3453dbe4b3b797d14ea8dfdb6e2c010e47335fcb Mon Sep 17 00:00:00 2001
From 503c53decf8c3e502927a285808f3449b5535be0 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 16 Jul 2016 19:11:17 -0500
Subject: [PATCH] Don't lookup game profiles that have no UUID and no name
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 65d230d45f..9bf2521be6 100644
index cd8a652eb..409bc6da9 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -86,7 +86,7 @@ public class UserCache {

View File

@ -1,14 +1,14 @@
From d62a0a28a9163ccd576919761253e42ae6b97097 Mon Sep 17 00:00:00 2001
From 5519add5355658a7cf972992a598a442e340a47f Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 28 Jul 2016 17:58:53 -0500
Subject: [PATCH] More informative vehicle moved wrongly message
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 66aa3bde64..73907b4f0e 100644
index 42eac6b71..57ef91a43 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -355,7 +355,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -363,7 +363,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot
flag1 = true;

View File

@ -1,14 +1,14 @@
From a0c08cd775b6d772d818a8571d388d6746320fa3 Mon Sep 17 00:00:00 2001
From 5b9cdf4cc017b2fd5336a16d5463a014d8a1d02a Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 31 Jul 2016 16:33:03 -0500
Subject: [PATCH] Re-track players that dismount from other players
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 7ed9903a8c..621e79bc53 100644
index 6b6c14567..c1ba294ec 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -760,6 +760,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -959,6 +959,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (entity1 != entity && this.playerConnection != null) {
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
}

View File

@ -1,11 +1,11 @@
From 2dc12219463415aebdee8014771aeced2951e9ef Mon Sep 17 00:00:00 2001
From 67285c293c5b07083146b9c3b1c06efe8c7ca294 Mon Sep 17 00:00:00 2001
From: Gabriele C <sgdc3.mail@gmail.com>
Date: Fri, 5 Aug 2016 01:03:08 +0200
Subject: [PATCH] Add setting for proxy online mode status
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index c6d2c30339..b7b28591e4 100644
index a89a9bfcb..1089be17d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -22,6 +22,7 @@ import org.bukkit.configuration.InvalidConfigurationException;
@ -16,7 +16,7 @@ index c6d2c30339..b7b28591e4 100644
public class PaperConfig {
@@ -243,4 +244,13 @@ public class PaperConfig {
@@ -230,4 +231,13 @@ public class PaperConfig {
private static void saveEmptyScoreboardTeams() {
saveEmptyScoreboardTeams = getBoolean("settings.save-empty-scoreboard-teams", false);
}
@ -31,7 +31,7 @@ index c6d2c30339..b7b28591e4 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
index bf67dbf54a..dcaba3c401 100644
index 61ea2818b..26c786106 100644
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
@@ -58,7 +58,8 @@ public class NameReferencingFileConverter {
@ -45,16 +45,16 @@ index bf67dbf54a..dcaba3c401 100644
} else {
String[] astring1 = astring;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b0ae0365e0..c26da09849 100644
index cf9594ea2..46f902073 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1413,7 +1413,8 @@ public final class CraftServer implements Server {
@@ -1349,7 +1349,8 @@ public final class CraftServer implements Server {
// Spigot Start
GameProfile profile = null;
// Only fetch an online UUID in online mode
- if ( MinecraftServer.getServer().getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
+ if ( MinecraftServer.getServer().getOnlineMode()
+ || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) // Paper - Handle via setting
- if ( getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
+ if ( getOnlineMode()
+ || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() ) // Paper - Handle via setting
{
profile = console.getUserCache().getProfile( name );
}

View File

@ -1,4 +1,4 @@
From c9f0709ef168a8c27dc55d0238e9519489c42dba Mon Sep 17 00:00:00 2001
From 111e6d81ee7f75c570d33392fb174aaeabdd5f54 Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Fri, 19 Aug 2016 01:52:56 +0100
Subject: [PATCH] Optimise BlockState's hashCode/equals
@ -9,10 +9,10 @@ object identity checks safely.
Use a simpler optimized hashcode
diff --git a/src/main/java/net/minecraft/server/BlockState.java b/src/main/java/net/minecraft/server/BlockState.java
index d95c0955a9..ea0e0ff4fe 100644
index 77b25317a..be7e10d85 100644
--- a/src/main/java/net/minecraft/server/BlockState.java
+++ b/src/main/java/net/minecraft/server/BlockState.java
@@ -26,23 +26,13 @@ public abstract class BlockState<T extends Comparable<T>> implements IBlockState
@@ -28,23 +28,13 @@ public abstract class BlockState<T extends Comparable<T>> implements IBlockState
}
public boolean equals(Object object) {
@ -28,7 +28,7 @@ index d95c0955a9..ea0e0ff4fe 100644
+ return this == object; // Paper - only one instance per configuration
}
+ private static java.util.concurrent.atomic.AtomicInteger hashId = new java.util.concurrent.atomic.AtomicInteger(1);// Paper - only one instance per configuration
+ private static final java.util.concurrent.atomic.AtomicInteger hashId = new java.util.concurrent.atomic.AtomicInteger(1); // Paper - only one instance per configuration
+ private final int hashCode = 92821 * hashId.getAndIncrement(); // Paper - only one instance per configuration
public final int hashCode() {
- if (this.c == null) {
@ -36,44 +36,47 @@ index d95c0955a9..ea0e0ff4fe 100644
- }
-
- return this.c;
+ return hashCode; // Paper - only one instance per configuration
+ return this.hashCode; // Paper - only one instance per configuration
}
public int c() {
diff --git a/src/main/java/net/minecraft/server/BlockStateBoolean.java b/src/main/java/net/minecraft/server/BlockStateBoolean.java
index 4c1d39d67c..71d2ad9703 100644
index 31cb8ac84..3f085c7d6 100644
--- a/src/main/java/net/minecraft/server/BlockStateBoolean.java
+++ b/src/main/java/net/minecraft/server/BlockStateBoolean.java
@@ -28,7 +28,7 @@ public class BlockStateBoolean extends BlockState<Boolean> {
@@ -30,8 +30,7 @@ public class BlockStateBoolean extends BlockState<Boolean> {
return obool.toString();
}
- @Override
- public boolean equals(Object object) {
+ public boolean equals_unused(Object object) { // Paper
if (this == object) {
return true;
} else if (object instanceof BlockStateBoolean && super.equals(object)) {
diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java
index 986b9ccea8..facbf30b4e 100644
index 59d86fc66..82a1fac6f 100644
--- a/src/main/java/net/minecraft/server/BlockStateEnum.java
+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java
@@ -47,7 +47,7 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
@@ -49,8 +49,7 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
return ((INamable) t0).getName();
}
- @Override
- public boolean equals(Object object) {
+ public boolean equals_unused(Object object) { // Paper
if (this == object) {
return true;
} else if (object instanceof BlockStateEnum && super.equals(object)) {
diff --git a/src/main/java/net/minecraft/server/BlockStateInteger.java b/src/main/java/net/minecraft/server/BlockStateInteger.java
index 2f12e15e07..613cd0bce2 100644
index 6861c2b05..74ef69952 100644
--- a/src/main/java/net/minecraft/server/BlockStateInteger.java
+++ b/src/main/java/net/minecraft/server/BlockStateInteger.java
@@ -37,7 +37,7 @@ public class BlockStateInteger extends BlockState<Integer> {
@@ -38,8 +38,7 @@ public class BlockStateInteger extends BlockState<Integer> {
return this.a;
}
- @Override
- public boolean equals(Object object) {
+ public boolean equals_unused(Object object) { // Paper
if (this == object) {

View File

@ -1,14 +1,14 @@
From b347ba0ec3484271a1a45b3c628032e2ebfb5410 Mon Sep 17 00:00:00 2001
From 5570566531af5978d5fe573b05b3e6fe43119a77 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sun, 11 Sep 2016 14:30:57 -0500
Subject: [PATCH] Configurable packet in spam threshold
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index b7b28591e4..6562cf54b7 100644
index 1089be17d..a2e204014 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -253,4 +253,13 @@ public class PaperConfig {
@@ -240,4 +240,13 @@ public class PaperConfig {
public static boolean isProxyOnlineMode() {
return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode);
}
@ -23,10 +23,10 @@ index b7b28591e4..6562cf54b7 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 73907b4f0e..b29a1f340f 100644
index 57ef91a43..cb6199603 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1177,13 +1177,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1217,13 +1217,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
// Spigot start - limit place/interactions
private int limitedPackets;
private long lastLimitedPacket = -1;

View File

@ -1,14 +1,14 @@
From 5e25d2de180bcf44040d6b17e0b15109bf3fb194 Mon Sep 17 00:00:00 2001
From 4f280e6c0438b87dafa7a464285978a00c2f362b Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Tue, 20 Sep 2016 00:58:01 +0000
Subject: [PATCH] Configurable flying kick messages
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 6562cf54b7..fb7ada8139 100644
index a2e204014..7ce370e92 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -262,4 +262,11 @@ public class PaperConfig {
@@ -249,4 +249,11 @@ public class PaperConfig {
}
packetInSpamThreshold = getInt("settings.incoming-packet-spam-threshold", 300);
}
@ -21,10 +21,10 @@ index 6562cf54b7..fb7ada8139 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index b29a1f340f..4a06527b6f 100644
index cb6199603..982b15dec 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -144,7 +144,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -146,7 +146,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
if (this.B) {
if (++this.C > 80) {
PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getDisplayName().getString());
@ -33,8 +33,8 @@ index b29a1f340f..4a06527b6f 100644
return;
}
} else {
@@ -163,7 +163,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
if (this.D && this.player.getRootVehicle().bO() == this.player) {
@@ -165,7 +165,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
if (this.D && this.player.getRootVehicle().getRidingPassenger() == this.player) {
if (++this.E > 80) {
PlayerConnection.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getDisplayName().getString());
- this.disconnect(new ChatMessage("multiplayer.disconnect.flying", new Object[0]));

View File

@ -0,0 +1,25 @@
From f355773996d96cee145d4cd5e257b0273fb37927 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 22:54:28 -0400
Subject: [PATCH] Chunk registration fixes
World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is treated
Keep them consistent
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 464a132a3..bbf676958 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -631,7 +631,7 @@ public class WorldServer extends World {
public void chunkCheck(Entity entity) {
this.getMethodProfiler().enter("chunkCheck");
int i = MathHelper.floor(entity.locX / 16.0D);
- int j = MathHelper.floor(entity.locY / 16.0D);
+ int j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY / 16.0D))); // Paper - stay consistent with chunk add/remove behavior
int k = MathHelper.floor(entity.locZ / 16.0D);
if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {
--
2.21.0

View File

@ -1,14 +1,14 @@
From 7e64d04da6a50ad54160001dd38f093058c925ff Mon Sep 17 00:00:00 2001
From 3a18bc30e3b1330325004d59524861dfe4769ba8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 16 Jun 2016 00:17:23 -0400
Subject: [PATCH] Remove FishingHook reference on Craft Entity removal
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
index 8392b16b3b..752b56435d 100644
index 75aae03b6..fea7ca9db 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
@@ -62,4 +62,15 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
@@ -61,4 +61,15 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
Validate.isTrue(chance >= 0 && chance <= 1, "The bite chance must be between 0 and 1.");
this.biteChance = chance;
}

View File

@ -1,4 +1,4 @@
From 656019b7f95b56cca236de20cb9940e6f438769a Mon Sep 17 00:00:00 2001
From f86a4c50936dac9d4370480b8ffacf603b5c1543 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 23:48:39 -0400
Subject: [PATCH] Auto fix bad Y levels on player login
@ -6,17 +6,17 @@ Subject: [PATCH] Auto fix bad Y levels on player login
Bring down to a saner Y level if super high, as this can cause the server to crash
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 260fa3e678..fcb5f590df 100644
index c1ba294ec..5610c539a 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -187,6 +187,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -190,6 +190,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@Override
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
+ if (this.locY > 300) this.locY = 257; // Paper - bring down to a saner Y level if out of world
if (nbttagcompound.hasKeyOfType("playerGameType", 99)) {
if (this.bK().getForceGamemode()) {
this.playerInteractManager.setGameMode(this.bK().getGamemode());
if (this.getMinecraftServer().getForceGamemode()) {
this.playerInteractManager.setGameMode(this.getMinecraftServer().getGamemode());
--
2.21.0

View File

@ -1,16 +1,16 @@
From 6a37f4af427998aa81105d6a80cca73b74427ee7 Mon Sep 17 00:00:00 2001
From 1320b81faa9a9bbf0aaebbab509c6b6fb579afc7 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 5 Oct 2016 16:27:36 -0500
Subject: [PATCH] Option to remove corrupt tile entities
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6e28410c37..7e847af00b 100644
index 92ab55182..eed454bf4 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -340,4 +340,9 @@ public class PaperWorldConfig {
private void maxAutoSaveChunksPerTick() {
maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24);
@@ -296,4 +296,9 @@ public class PaperWorldConfig {
preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
}
+
+ public boolean removeCorruptTEs = false;
@ -19,11 +19,11 @@ index 6e28410c37..7e847af00b 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0bf614ce57..a6cacd7da9 100644
index a413dc73b..54bb7f551 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -844,6 +844,12 @@ public class Chunk implements IChunkAccess {
"Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
@@ -550,6 +550,12 @@ public class Chunk implements IChunkAccess {
"Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
e.printStackTrace();
ServerInternalException.reportInternalException(e);
+
@ -35,14 +35,6 @@ index 0bf614ce57..a6cacd7da9 100644
// Paper end
// CraftBukkit end
}
@@ -853,6 +859,7 @@ public class Chunk implements IChunkAccess {
this.h.put(new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")), nbttagcompound);
}
+ public void removeTileEntity(BlockPosition blockposition) { this.d(blockposition); } // Paper - OBFHELPER
public void d(BlockPosition blockposition) {
if (this.i) {
TileEntity tileentity = (TileEntity) this.tileEntities.remove(blockposition);
--
2.21.0

View File

@ -1,48 +1,48 @@
From b179aa6184990023731937ba9669775897cae5a5 Mon Sep 17 00:00:00 2001
From beab69d9648328eeebe81983434ee0f661a7b31a Mon Sep 17 00:00:00 2001
From: AlphaBlend <whizkid3000@hotmail.com>
Date: Sun, 16 Oct 2016 23:19:30 -0700
Subject: [PATCH] Add EntityZapEvent
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index 7ef67350a5..9dc2d8be27 100644
index 01202e4d5..616075569 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -163,6 +163,12 @@ public class EntityPig extends EntityAnimal {
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible());
}
@@ -168,6 +168,12 @@ public class EntityPig extends EntityAnimal {
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible());
}
+ // Paper start
+ if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
+ return;
+ }
+ // Paper end
+ // Paper start
+ if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
+ return;
+ }
+ // Paper end
+
// CraftBukkit start
if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
return;
// CraftBukkit start
if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
return;
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index f8e05b75de..213d0b18c9 100644
index cc66f565c..c34868324 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -606,6 +606,12 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
if (!this.world.isClientSide && !this.dead) {
EntityWitch entitywitch = new EntityWitch(this.world);
@@ -573,6 +573,12 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
public void onLightningStrike(EntityLightning entitylightning) {
EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a(this.world);
+ // Paper start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) {
+ return;
+ }
+ // Paper end
+ // Paper start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) {
+ return;
+ }
+ // Paper end
+
entitywitch.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitywitch.prepare(this.world.getDamageScaler(new BlockPosition(entitywitch)), (GroupDataEntity) null, (NBTTagCompound) null);
entitywitch.setNoAI(this.isNoAI());
entitywitch.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitywitch.prepare(this.world, this.world.getDamageScaler(new BlockPosition(entitywitch)), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null);
entitywitch.setNoAI(this.isNoAI());
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 4d2fdfe286..fa0eb2ebeb 100644
index 9f592d2fc..0d16d1430 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -875,6 +875,14 @@ public class CraftEventFactory {
@@ -980,6 +980,14 @@ public class CraftEventFactory {
return event;
}

View File

@ -1,4 +1,4 @@
From 12c6e1557233d240f7f5ef44e6b5dcd93c19c097 Mon Sep 17 00:00:00 2001
From 8b7b6d6567969fde109ee4cc9ff7f4cd95823fa3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Nov 2016 20:28:12 -0400
Subject: [PATCH] Don't load Chunks from Hoppers and other things
@ -13,22 +13,22 @@ This of course is undesirable, so just return the loaded side as "primary"
and treat it as a single chest if the other sides are unloaded
diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java
index e94786138e..c61721bc3d 100644
index ee9d91a8c..e71178ac1 100644
--- a/src/main/java/net/minecraft/server/BlockChest.java
+++ b/src/main/java/net/minecraft/server/BlockChest.java
@@ -193,7 +193,12 @@ public class BlockChest extends BlockTileEntity implements IFluidSource, IFluidC
return (ITileInventory) object;
@@ -227,7 +227,12 @@ public class BlockChest extends BlockTileEntity implements IBlockWaterlogged {
return blockchest_chestfinder.b(tileentitychest);
} else {
BlockPosition blockposition1 = blockposition.shift(k(iblockdata));
- IBlockData iblockdata1 = world.getType(blockposition1);
BlockPosition blockposition1 = blockposition.shift(j(iblockdata));
- IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
+ // Paper start - don't load chunks if the other side of the chest is in unloaded chunk
+ final IBlockData iblockdata1 = world.getTypeIfLoaded(blockposition1); // Paper
+ if (iblockdata1 == null) {
+ IBlockData iblockdata1 = generatoraccess.getTypeIfLoaded(blockposition1);
+ if (iblockdata1 == null) {
+ return null;
+ }
+ // Paper end
if (iblockdata1.getBlock() == this) {
if (iblockdata1.getBlock() == iblockdata.getBlock()) {
BlockPropertyChestType blockpropertychesttype1 = (BlockPropertyChestType) iblockdata1.get(BlockChest.b);
--
2.21.0

View File

@ -1,22 +1,22 @@
From 2c4fa5b98bf65f05b2aa3bfbd8fc3582f4d1b441 Mon Sep 17 00:00:00 2001
From 6a535c23280839bd1920db5c8cdb6c2c1200c017 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 12 Nov 2016 23:25:22 -0600
Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 9829b3b64b..104a3acf31 100644
index eed454bf4..4892113a1 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -3,6 +3,7 @@ package com.destroystokyo.paper;
@@ -2,6 +2,7 @@ package com.destroystokyo.paper;
import java.util.List;
import net.minecraft.server.MinecraftServer;
+import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.spigotmc.SpigotWorldConfig;
@@ -350,4 +351,12 @@ public class PaperWorldConfig {
@@ -301,4 +302,12 @@ public class PaperWorldConfig {
private void removeCorruptTEs() {
removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false);
}
@ -30,11 +30,11 @@ index 9829b3b64b..104a3acf31 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 489dd861d2..3eaee8d890 100644
index 90becdfde..f54887e5e 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -228,6 +228,15 @@ public class EntityFallingBlock extends Entity {
@@ -224,6 +224,15 @@ public class EntityFallingBlock extends Entity {
@Override
protected void a(NBTTagCompound nbttagcompound) {
this.block = GameProfileSerializer.d(nbttagcompound.getCompound("BlockState"));
+

View File

@ -1,37 +0,0 @@
From 61e6eb2cca1a5dc3e4a514af80353eaa98cd7bd9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 21 Jun 2016 22:54:34 -0400
Subject: [PATCH] Fix Double World Add issues
Vanilla will double add Spider Jockeys to the world, so ignore already added.
Also add debug if something else tries to, and abort before world gets bad state
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 21ee154a57..a144118f66 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -1041,7 +1041,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
public static void a(Entity entity, GeneratorAccess generatoraccess, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
- if (generatoraccess.addEntity(entity, reason) && entity.isVehicle()) {
+ if (!entity.valid && generatoraccess.addEntity(entity, reason) && entity.isVehicle()) { // Paper
// CraftBukkit end
Iterator iterator = entity.bP().iterator();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index dcff6c8d8a..336e6aeef6 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -992,6 +992,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason
org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot
+ if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); return true; } // Paper
if (!CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
return false;
}
--
2.21.0

View File

@ -1,14 +1,14 @@
From 4432738f08d935dd5677b7ea6fe78be700ee1c95 Mon Sep 17 00:00:00 2001
From ff8aab9bd4f2d75aff418f3c73d4fa45fa2805d3 Mon Sep 17 00:00:00 2001
From: vemacs <d@nkmem.es>
Date: Wed, 23 Nov 2016 08:31:45 -0500
Subject: [PATCH] Cache user authenticator threads
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 0f6ac493f6..e901c066ac 100644
index b85b048ac..22d5c7d20 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -92,6 +92,12 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -92,6 +92,12 @@ public class LoginListener implements PacketLoginInListener {
}
@ -21,8 +21,8 @@ index 0f6ac493f6..e901c066ac 100644
// Spigot start
public void initUUID()
{
@@ -168,8 +174,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.E().getPublic(), this.e));
@@ -170,8 +176,8 @@ public class LoginListener implements PacketLoginInListener {
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic(), this.e));
} else {
// Spigot start
- new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) {
@ -32,7 +32,7 @@ index 0f6ac493f6..e901c066ac 100644
@Override
public void run() {
try {
@@ -180,7 +186,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -182,7 +188,8 @@ public class LoginListener implements PacketLoginInListener {
server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
}
}
@ -42,7 +42,7 @@ index 0f6ac493f6..e901c066ac 100644
// Spigot end
}
@@ -196,7 +203,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -199,7 +206,8 @@ public class LoginListener implements PacketLoginInListener {
this.loginKey = packetlogininencryptionbegin.a(privatekey);
this.g = LoginListener.EnumProtocolState.AUTHENTICATING;
this.networkManager.a(this.loginKey);
@ -52,13 +52,13 @@ index 0f6ac493f6..e901c066ac 100644
public void run() {
GameProfile gameprofile = LoginListener.this.i;
@@ -243,10 +251,8 @@ public class LoginListener implements PacketLoginInListener, ITickable {
@@ -246,10 +254,8 @@ public class LoginListener implements PacketLoginInListener {
return LoginListener.this.server.S() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
return LoginListener.this.server.T() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
}
- };
-
- thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LoginListener.c));
- thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LoginListener.LOGGER));
- thread.start();
+ });
+ // Paper end

View File

@ -1,33 +1,33 @@
From 12d9e3e33da074a495df49f3e4c97181f69b4bce Mon Sep 17 00:00:00 2001
From d0badaff2fdf04edf104e78702414937df7af010 Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Fri, 25 Nov 2016 13:22:40 +0000
Subject: [PATCH] Optimise removeQueue
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index fcb5f590df..6b9bbc77c0 100644
index 5610c539a..ecdfd306b 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -4,7 +4,9 @@ import com.google.common.collect.Lists;
import com.mojang.authlib.GameProfile;
import io.netty.buffer.Unpooled;
import com.mojang.datafixers.util.Either;
import io.netty.util.concurrent.Future;
+import java.util.ArrayDeque; // Paper
import java.util.Collection;
+import java.util.Deque; // Paper
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.OptionalInt;
@@ -40,7 +42,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public PlayerConnection playerConnection;
public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager;
public double d;
public double e;
- public final List<Integer> removeQueue = Lists.newLinkedList();
+ public final Deque<Integer> removeQueue = new ArrayDeque<>(); // Paper
private final AdvancementDataPlayer cf;
private final ServerStatisticManager cg;
private float ch = Float.MIN_VALUE;
@@ -349,13 +351,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private final AdvancementDataPlayer advancementDataPlayer;
private final ServerStatisticManager serverStatisticManager;
private float lastHealthScored = Float.MIN_VALUE;
@@ -364,13 +366,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
while (!this.removeQueue.isEmpty()) {
int i = Math.min(this.removeQueue.size(), Integer.MAX_VALUE);
int[] aint = new int[i];
@ -50,7 +50,7 @@ index fcb5f590df..6b9bbc77c0 100644
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(aint));
}
@@ -1153,7 +1162,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1298,7 +1307,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
// this.recipeBook.a((RecipeBook) entityplayer.recipeBook); // CraftBukkit
@ -63,8 +63,8 @@ index fcb5f590df..6b9bbc77c0 100644
+ this.removeQueue.addAll(entityplayer.removeQueue);
+ }
+ // Paper end
this.cx = entityplayer.cx;
this.cC = entityplayer.cC;
this.cp = entityplayer.cp;
this.cu = entityplayer.cu;
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
--
2.21.0

View File

@ -1,4 +1,4 @@
From 43cf6218919f25f7750453574512b30ba1c579a0 Mon Sep 17 00:00:00 2001
From f6b2bcea328754fe2f0c853fedd20742ea002443 Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Mon, 28 Nov 2016 10:21:52 -0500
Subject: [PATCH] Allow Reloading of Command Aliases
@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c26da09849..bb7792ce2a 100644
index 46f902073..bc1de9d9e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2122,5 +2122,24 @@ public final class CraftServer implements Server {
@@ -2058,5 +2058,24 @@ public final class CraftServer implements Server {
DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions();
}

View File

@ -1,14 +1,14 @@
From 276826e62696d8d63e0f05d41ea8613873b04dfd Mon Sep 17 00:00:00 2001
From f72c891cbff8397c4fa29c971acffa84c971a860 Mon Sep 17 00:00:00 2001
From: AlphaBlend <whizkid3000@hotmail.com>
Date: Thu, 8 Sep 2016 08:48:33 -0700
Subject: [PATCH] Add source to PlayerExpChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index 808d1a120a..3030dd9c31 100644
index b20813be6..bfba08fb2 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -185,7 +185,7 @@ public class EntityExperienceOrb extends Entity {
@@ -190,7 +190,7 @@ public class EntityExperienceOrb extends Entity {
}
if (this.value > 0) {
@ -18,18 +18,18 @@ index 808d1a120a..3030dd9c31 100644
this.die();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index fa0eb2ebeb..3785d4f096 100644
index 0d16d1430..f22319d78 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -52,6 +52,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
@@ -99,6 +99,7 @@ import org.bukkit.entity.Projectile;
import org.bukkit.entity.ThrownExpBottle;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.Vehicle;
+import org.bukkit.entity.ExperienceOrb; // Paper
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Result;
@@ -838,6 +839,17 @@ public class CraftEventFactory {
@@ -943,6 +944,17 @@ public class CraftEventFactory {
return event;
}

View File

@ -1,4 +1,4 @@
From ee914b4b6a1aa8140e7f599cfab6dfe1bc78e995 Mon Sep 17 00:00:00 2001
From 40572ae9162a641bd6cea6dd281a7ef4faf25f38 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 2 Dec 2016 00:11:43 -0500
Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
@ -6,11 +6,11 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 282d6ae84c..5e1ab431dc 100644
index 5637c3872..1286703bf 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -268,6 +268,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return this.getType(blockposition).isAir();
@@ -208,6 +208,10 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
return i < 0 || i >= 256;
}
+ public boolean isLoaded(BlockPosition blockposition) {

View File

@ -1,29 +1,29 @@
From 5b2757104d7ef336e2b64ced2a0d0662eae91cc6 Mon Sep 17 00:00:00 2001
From 8fd0513571c259e78452131eb90b5ce32a8e212d Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 16 Dec 2016 16:03:19 -0600
Subject: [PATCH] Don't let fishinghooks use portals
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 113264981e..b6ed9082fd 100644
index b68e2fc04..cbdc267fa 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -156,7 +156,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public boolean ak;
@@ -153,7 +153,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public boolean af;
public boolean impulse;
public int portalCooldown;
- protected boolean an;
+ protected boolean an; public boolean inPortal() { return an; } // Paper - OBFHELPER
protected int ao;
- protected boolean ai;
+ protected boolean ai; public final boolean inPortal() { return this.ai; } // Paper - OBFHELPER
protected int aj;
public DimensionManager dimension;
protected BlockPosition aq;
protected BlockPosition al;
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 118b974d76..861fc6fd5c 100644
index b082d0a82..15a686cb2 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -190,6 +190,12 @@ public class EntityFishingHook extends Entity {
this.motY *= 0.92D;
this.motZ *= 0.92D;
@@ -163,6 +163,12 @@ public class EntityFishingHook extends Entity {
this.setMot(this.getMot().a(0.92D));
this.setPosition(this.locX, this.locY, this.locZ);
+
+ // Paper start - These shouldn't be going through portals

View File

@ -1,103 +1,108 @@
From 4628e67615e80fef7ba4ee589dcf418b16014a6e Mon Sep 17 00:00:00 2001
From 65dc485716c009ae92fda5358ad3b8615a30c9d0 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Fri, 16 Dec 2016 21:25:39 -0600
Subject: [PATCH] Add ProjectileCollideEvent
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index feafb82dd3..6aa518f17f 100644
index b5b569ef9..43ece829f 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -194,6 +194,16 @@ public abstract class EntityArrow extends Entity implements IProjectile {
@@ -184,6 +184,16 @@ public abstract class EntityArrow extends Entity implements IProjectile {
}
}
}
+ // Paper start - Call ProjectileCollideEvent
+ // TODO: flag - noclip - call cancelled?
+ if (movingobjectposition != null && movingobjectposition.entity != null) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, movingobjectposition);
+ if (event.isCancelled()) {
+ movingobjectposition = null;
+ // Paper start - Call ProjectileCollideEvent
+ // TODO: flag - noclip - call cancelled?
+ if (object instanceof MovingObjectPositionEntity) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)object);
+ if (event.isCancelled()) {
+ object = null;
+ }
+ }
+ }
+ // Paper end
+ // Paper end
+
if (movingobjectposition != null && !flag) {
this.a(movingobjectposition);
this.impulse = true;
if (object != null && !flag) {
this.a((MovingObjectPosition) object);
this.impulse = true;
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
index 3e3619d79f..58cc4824cf 100644
index 739e48ec7..192ee928f 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -68,6 +68,15 @@ public abstract class EntityFireball extends Entity {
++this.f;
MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, true, this.f >= 25, this.shooter);
@@ -67,7 +67,16 @@ public abstract class EntityFireball extends Entity {
++this.g;
MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, true, this.g >= 25, this.shooter, RayTrace.BlockCollisionOption.COLLIDER);
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
+ // Paper start - Call ProjectileCollideEvent
+ if (movingobjectposition != null && movingobjectposition.entity != null) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = CraftEventFactory.callProjectileCollideEvent(this, movingobjectposition);
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
+ if (event.isCancelled()) {
+ movingobjectposition = null;
+ }
+ }
+ // Paper end
+
if (movingobjectposition != null) {
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
this.a(movingobjectposition);
// CraftBukkit start - Fire ProjectileHitEvent
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 861fc6fd5c..202b8d2158 100644
index 15a686cb2..78527f350 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -245,6 +245,16 @@ public class EntityFishingHook extends Entity {
@@ -217,7 +217,16 @@ public class EntityFishingHook extends Entity {
return !entity.t() && (entity.isInteractable() || entity instanceof EntityItem) && (entity != this.owner || this.g >= 5);
}, RayTrace.BlockCollisionOption.COLLIDER, true);
vec3d = new Vec3D(this.locX, this.locY, this.locZ);
vec3d1 = new Vec3D(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
+
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
+ // Paper start - Call ProjectileCollideEvent
+ if (movingobjectposition != null && movingobjectposition.entity != null) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, movingobjectposition);
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
+ if (event.isCancelled()) {
+ movingobjectposition = null;
+ }
+ }
+ // Paper end
+
if (movingobjectposition != null) {
vec3d1 = new Vec3D(movingobjectposition.pos.x, movingobjectposition.pos.y, movingobjectposition.pos.z);
}
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // Craftbukkit - Call event
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
this.hooked = ((MovingObjectPositionEntity) movingobjectposition).getEntity();
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 751ea456b9..bab5b89fe9 100644
index ac62f836d..bb4679cf7 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -144,6 +144,15 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
movingobjectposition = new MovingObjectPosition(entity);
@@ -102,7 +102,16 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.as = null;
}
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
+ // Paper start - Call ProjectileCollideEvent
+ if (movingobjectposition != null && movingobjectposition.entity != null) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, movingobjectposition);
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
+ if (event.isCancelled()) {
+ movingobjectposition = null;
+ }
+ }
+ // Paper end
+
if (movingobjectposition != null) {
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.getBlockPosition()).getBlock() == Blocks.NETHER_PORTAL) {
this.e(movingobjectposition.getBlockPosition());
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition()).getBlock() == Blocks.NETHER_PORTAL) {
this.c(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition());
} else {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 3785d4f096..9cbbfed4fe 100644
index f22319d78..b75369275 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -979,6 +979,16 @@ public class CraftEventFactory {
@@ -1084,6 +1084,16 @@ public class CraftEventFactory {
return CraftItemStack.asNMSCopy(bitem);
}
+ // Paper start
+ public static com.destroystokyo.paper.event.entity.ProjectileCollideEvent callProjectileCollideEvent(Entity entity, MovingObjectPosition position) {
+ public static com.destroystokyo.paper.event.entity.ProjectileCollideEvent callProjectileCollideEvent(Entity entity, MovingObjectPositionEntity position) {
+ Projectile projectile = (Projectile) entity.getBukkitEntity();
+ org.bukkit.entity.Entity collided = position.entity.getBukkitEntity();
+ org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity();
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided);
+ Bukkit.getPluginManager().callEvent(event);
+ return event;

View File

@ -1,29 +0,0 @@
From 196af651b80059962f3a70483626f52c60df29b9 Mon Sep 17 00:00:00 2001
From: killme <killme-git@ibts.me>
Date: Tue, 30 Aug 2016 16:39:48 +0200
Subject: [PATCH] Disable ticking of snow blocks
diff --git a/src/main/java/net/minecraft/server/BlockSnowBlock.java b/src/main/java/net/minecraft/server/BlockSnowBlock.java
index 0c8f9d37fd..44ed656263 100644
--- a/src/main/java/net/minecraft/server/BlockSnowBlock.java
+++ b/src/main/java/net/minecraft/server/BlockSnowBlock.java
@@ -16,6 +16,8 @@ public class BlockSnowBlock extends Block {
return 4;
}
+ // Paper start - snow blocks don't need to tick
+ /*
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
if (world.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
// CraftBukkit start
@@ -28,4 +30,6 @@ public class BlockSnowBlock extends Block {
}
}
+ */
+ //Paper end
}
--
2.21.0

View File

@ -1,4 +1,4 @@
From 2ffd8e341776fa64537f3474cdd35f18ee5ca681 Mon Sep 17 00:00:00 2001
From d11a8e763b8d40afcfb60ecbda4c3c53a111b005 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 19 Dec 2016 23:07:42 -0500
Subject: [PATCH] Prevent Pathfinding out of World Border
@ -6,28 +6,19 @@ Subject: [PATCH] Prevent Pathfinding out of World Border
This prevents Entities from trying to run outside of the World Border
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 716d00afb1..c55aadb536 100644
index 2a391be28..0586597e7 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -75,6 +75,7 @@ public abstract class NavigationAbstract {
@@ -100,6 +100,7 @@ public abstract class NavigationAbstract {
@Nullable
public PathEntity b(BlockPosition blockposition) {
protected PathEntity a(BlockPosition blockposition, Entity target, double d0, double d1, double d2, int i, boolean flag) {
// Paper end
+ if (!getEntity().getWorld().getWorldBorder().isInBounds(blockposition)) return null; // Paper - don't path out of world border
if (!this.b()) {
if (!this.a()) {
return null;
} else if (this.c != null && !this.c.b() && blockposition.equals(this.q)) {
@@ -101,7 +102,7 @@ public abstract class NavigationAbstract {
return null;
} else {
BlockPosition blockposition = new BlockPosition(entity);
-
+ if (!getEntity().getWorld().getWorldBorder().isInBounds(blockposition)) return null; // Paper - don't path out of world border
if (this.c != null && !this.c.b() && blockposition.equals(this.q)) {
return this.c;
} else {
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
index beac8ac0b9..86ada40a10 100644
index 94d1c2be1..51739e254 100644
--- a/src/main/java/net/minecraft/server/WorldBorder.java
+++ b/src/main/java/net/minecraft/server/WorldBorder.java
@@ -19,7 +19,7 @@ public class WorldBorder {
@ -35,8 +26,8 @@ index beac8ac0b9..86ada40a10 100644
public WorldBorder() {}
- public boolean a(BlockPosition blockposition) {
+ public boolean isInBounds(BlockPosition blockposition) { return a(blockposition); }public boolean a(BlockPosition blockposition) { // Paper - OBFHELPER
return (double) (blockposition.getX() + 1) > this.b() && (double) blockposition.getX() < this.d() && (double) (blockposition.getZ() + 1) > this.c() && (double) blockposition.getZ() < this.e();
+ public final boolean isInBounds(BlockPosition blockposition) { return this.a(blockposition); } public boolean a(BlockPosition blockposition) { // Paper - OBFHELPER
return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f();
}
--

View File

@ -1,4 +1,4 @@
From 1d5387e7ec06f4e21d06d383cc57a3f957b3d1c0 Mon Sep 17 00:00:00 2001
From 405c98bc83a1719e73b831630e22620e39d0d307 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 20 Dec 2016 15:15:11 -0500
Subject: [PATCH] Bound Treasure Maps to World Border
@ -11,39 +11,39 @@ that is outside happens to be closer, but unreachable, yet another reachable
one is in border that would of been missed.
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index 7194c048c9..2ea5ac3161 100644
index 464e1e101..7b2eace75 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -122,6 +122,7 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
@@ -103,6 +103,7 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
if (flag1 || flag2) {
ChunkCoordIntPair chunkcoordintpair = this.a(chunkgenerator, seededrandom, j, k, i1, j1);
+ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
StructureStart structurestart = this.a(world, chunkgenerator, seededrandom, chunkcoordintpair.a());
StructureStart structurestart = world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS).a(this.b());
if (structurestart != StructureGenerator.a) {
if (structurestart != null && structurestart.e()) {
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
index 86ada40a10..a2e856952e 100644
index 51739e254..2b5c09c62 100644
--- a/src/main/java/net/minecraft/server/WorldBorder.java
+++ b/src/main/java/net/minecraft/server/WorldBorder.java
@@ -23,6 +23,18 @@ public class WorldBorder {
return (double) (blockposition.getX() + 1) > this.b() && (double) blockposition.getX() < this.d() && (double) (blockposition.getZ() + 1) > this.c() && (double) blockposition.getZ() < this.e();
return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f();
}
+ // Paper start
+ private final BlockPosition.MutableBlockPosition mutPos = new BlockPosition.MutableBlockPosition();
+ public boolean isBlockInBounds(int chunkX, int chunkZ) {
+ mutPos.setValues(chunkX, 64, chunkZ);
+ return isInBounds(mutPos);
+ this.mutPos.setValues(chunkX, 64, chunkZ);
+ return this.isInBounds(this.mutPos);
+ }
+ public boolean isChunkInBounds(int chunkX, int chunkZ) {
+ mutPos.setValues(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
+ return isInBounds(mutPos);
+ this.mutPos.setValues(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
+ return this.isInBounds(this.mutPos);
+ }
+ // Paper end
+
public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) {
return (double) chunkcoordintpair.f() > this.b() && (double) chunkcoordintpair.d() < this.d() && (double) chunkcoordintpair.g() > this.c() && (double) chunkcoordintpair.e() < this.e();
return (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e() && (double) chunkcoordintpair.g() > this.d() && (double) chunkcoordintpair.e() < this.f();
}
--
2.21.0

View File

@ -0,0 +1,60 @@
From a77af2c91e5f163c00454d5decf54d9c36aea050 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 20 Dec 2016 15:26:27 -0500
Subject: [PATCH] Configurable Cartographer Treasure Maps
Allow configuring for cartographers to return the same map location
Also allow turning off treasure maps all together as they can eat up Map ID's
which are limited in quantity.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 4892113a1..406bc611c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -310,4 +310,14 @@ public class PaperWorldConfig {
Bukkit.getLogger().warning("Spawn Egg and Armor Stand NBT filtering disabled, this is a potential security risk");
}
}
+
+ public boolean enableTreasureMaps = true;
+ public boolean treasureMapsAlreadyDiscovered = false;
+ private void treasureMapsAlreadyDiscovered() {
+ enableTreasureMaps = getBoolean("enable-treasure-maps", true);
+ treasureMapsAlreadyDiscovered = getBoolean("treasure-maps-return-already-discovered", false);
+ if (treasureMapsAlreadyDiscovered) {
+ log("Treasure Maps will return already discovered locations");
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java
index 1df86e3bb..83bf9bea2 100644
--- a/src/main/java/net/minecraft/server/VillagerTrades.java
+++ b/src/main/java/net/minecraft/server/VillagerTrades.java
@@ -15,12 +15,12 @@ import javax.annotation.Nullable;
public class VillagerTrades {
- public static final Map<VillagerProfession, Int2ObjectMap<VillagerTrades.IMerchantRecipeOption[]>> a = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
+ public static final Map<VillagerProfession, Int2ObjectMap<VillagerTrades.IMerchantRecipeOption[]>> a = SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // Paper - decompile fix
hashmap.put(VillagerProfession.FARMER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.WHEAT, 20, 8, 2), new VillagerTrades.b(Items.POTATO, 26, 8, 2), new VillagerTrades.b(Items.CARROT, 22, 8, 2), new VillagerTrades.b(Items.BEETROOT, 15, 8, 2), new VillagerTrades.h(Items.BREAD, 1, 6, 8, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Blocks.PUMPKIN, 6, 6, 10), new VillagerTrades.h(Items.PUMPKIN_PIE, 1, 4, 5), new VillagerTrades.h(Items.APPLE, 1, 4, 8, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.COOKIE, 3, 18, 10), new VillagerTrades.b(Blocks.MELON, 4, 6, 20)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Blocks.CAKE, 1, 1, 6, 15), new VillagerTrades.i(MobEffects.FASTER_MOVEMENT, 160, 15), new VillagerTrades.i(MobEffects.JUMP, 160, 15), new VillagerTrades.i(MobEffects.WEAKNESS, 140, 15), new VillagerTrades.i(MobEffects.BLINDNESS, 120, 15), new VillagerTrades.i(MobEffects.POISON, 280, 15), new VillagerTrades.i(MobEffects.SATURATION, 7, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.GOLDEN_CARROT, 3, 3, 30), new VillagerTrades.h(Items.GLISTERING_MELON_SLICE, 4, 3, 30)})));
- hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.STRING, 20, 8, 2), new VillagerTrades.b(Items.COAL, 10, 8, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 8, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 8, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.COD, 15, 8, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 8, 5), new VillagerTrades.h(Items.pS, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.SALMON, 13, 8, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 2, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.TROPICAL_FISH, 6, 6, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.PUFFERFISH, 4, 6, 30), new VillagerTrades.c(1, 6, 30, ImmutableMap.builder().put(VillagerType.c, Items.OAK_BOAT).put(VillagerType.g, Items.SPRUCE_BOAT).put(VillagerType.e, Items.SPRUCE_BOAT).put(VillagerType.a, Items.JUNGLE_BOAT).put(VillagerType.b, Items.JUNGLE_BOAT).put(VillagerType.d, Items.ACACIA_BOAT).put(VillagerType.f, Items.DARK_OAK_BOAT).build())})));
+ hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.STRING, 20, 8, 2), new VillagerTrades.b(Items.COAL, 10, 8, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 8, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 8, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.COD, 15, 8, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 8, 5), new VillagerTrades.h(Items.pS, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.SALMON, 13, 8, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 2, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.TROPICAL_FISH, 6, 6, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.PUFFERFISH, 4, 6, 30), new VillagerTrades.c(1, 6, 30, ImmutableMap.<VillagerType, Item>builder().put(VillagerType.c, Items.OAK_BOAT).put(VillagerType.g, Items.SPRUCE_BOAT).put(VillagerType.e, Items.SPRUCE_BOAT).put(VillagerType.a, Items.JUNGLE_BOAT).put(VillagerType.b, Items.JUNGLE_BOAT).put(VillagerType.d, Items.ACACIA_BOAT).put(VillagerType.f, Items.DARK_OAK_BOAT).build())}))); // Paper - decompile fix
hashmap.put(VillagerProfession.SHEPHERD, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Blocks.WHITE_WOOL, 18, 8, 2), new VillagerTrades.b(Blocks.BROWN_WOOL, 18, 8, 2), new VillagerTrades.b(Blocks.BLACK_WOOL, 18, 8, 2), new VillagerTrades.b(Blocks.GRAY_WOOL, 18, 8, 2), new VillagerTrades.h(Items.SHEARS, 2, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.WHITE_DYE, 12, 8, 10), new VillagerTrades.b(Items.GRAY_DYE, 12, 8, 10), new VillagerTrades.b(Items.BLACK_DYE, 12, 8, 10), new VillagerTrades.b(Items.LIGHT_BLUE_DYE, 12, 8, 10), new VillagerTrades.b(Items.LIME_DYE, 12, 8, 10), new VillagerTrades.h(Blocks.WHITE_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.ORANGE_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.MAGENTA_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.YELLOW_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.LIME_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.PINK_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.GRAY_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.CYAN_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.PURPLE_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.BLUE_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.BROWN_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.GREEN_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.RED_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.BLACK_WOOL, 1, 1, 8, 5), new VillagerTrades.h(Blocks.WHITE_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.ORANGE_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.MAGENTA_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.YELLOW_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.LIME_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.PINK_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.GRAY_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.CYAN_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.PURPLE_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.BLUE_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.BROWN_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.GREEN_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.RED_CARPET, 1, 4, 8, 5), new VillagerTrades.h(Blocks.BLACK_CARPET, 1, 4, 8, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.YELLOW_DYE, 12, 8, 20), new VillagerTrades.b(Items.LIGHT_GRAY_DYE, 12, 8, 20), new VillagerTrades.b(Items.ORANGE_DYE, 12, 8, 20), new VillagerTrades.b(Items.RED_DYE, 12, 8, 20), new VillagerTrades.b(Items.PINK_DYE, 12, 8, 20), new VillagerTrades.h(Blocks.WHITE_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.YELLOW_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.RED_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.BLACK_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.BLUE_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.BROWN_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.CYAN_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.GRAY_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.GREEN_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.LIGHT_BLUE_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.LIGHT_GRAY_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.LIME_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.MAGENTA_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.ORANGE_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.PINK_BED, 3, 1, 6, 10), new VillagerTrades.h(Blocks.PURPLE_BED, 3, 1, 6, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.BROWN_DYE, 12, 8, 30), new VillagerTrades.b(Items.PURPLE_DYE, 12, 8, 30), new VillagerTrades.b(Items.BLUE_DYE, 12, 8, 30), new VillagerTrades.b(Items.GREEN_DYE, 12, 8, 30), new VillagerTrades.b(Items.MAGENTA_DYE, 12, 8, 30), new VillagerTrades.b(Items.CYAN_DYE, 12, 8, 30), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 6, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 6, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.PAINTING, 2, 3, 30)})));
hashmap.put(VillagerProfession.FLETCHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.STICK, 32, 8, 2), new VillagerTrades.h(Items.ARROW, 1, 16, 1), new VillagerTrades.g(Blocks.GRAVEL, 10, Items.FLINT, 10, 6, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.FLINT, 26, 6, 10), new VillagerTrades.h(Items.BOW, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.STRING, 14, 8, 20), new VillagerTrades.h(Items.CROSSBOW, 3, 1, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.FEATHER, 24, 8, 30), new VillagerTrades.e(Items.BOW, 2, 2, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.dE, 8, 6, 30), new VillagerTrades.e(Items.CROSSBOW, 3, 2, 15), new VillagerTrades.j(Items.ARROW, 5, Items.TIPPED_ARROW, 5, 2, 6, 30)})));
- hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.PAPER, 24, 8, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 6, 3, 6, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.BOOK, 4, 6, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.pQ, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.INK_SAC, 5, 6, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.am, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 6, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build()));
+ hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.<Integer, VillagerTrades.IMerchantRecipeOption[]>builder().put(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.PAPER, 24, 8, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 6, 3, 6, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.BOOK, 4, 6, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.pQ, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.INK_SAC, 5, 6, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.am, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 6, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); // Paper - decompile fix
hashmap.put(VillagerProfession.CARTOGRAPHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.PAPER, 24, 8, 2), new VillagerTrades.h(Items.MAP, 7, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.df, 10, 8, 10), new VillagerTrades.k(13, "Monument", MapIcon.Type.MONUMENT, 6, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.COMPASS, 1, 6, 20), new VillagerTrades.k(14, "Mansion", MapIcon.Type.MANSION, 6, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.ITEM_FRAME, 7, 1, 15), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.h(Items.GLOBE_BANNER_PATTERN, 8, 1, 30)})));
hashmap.put(VillagerProfession.CLERIC, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.ROTTEN_FLESH, 32, 8, 2), new VillagerTrades.h(Items.REDSTONE, 1, 2, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.GOLD_INGOT, 3, 6, 10), new VillagerTrades.h(Items.LAPIS_LAZULI, 1, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.RABBIT_FOOT, 2, 6, 20), new VillagerTrades.h(Blocks.GLOWSTONE, 4, 1, 6, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.SCUTE, 4, 6, 30), new VillagerTrades.b(Items.GLASS_BOTTLE, 9, 6, 30), new VillagerTrades.h(Items.ENDER_PEARL, 5, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.NETHER_WART, 22, 6, 30), new VillagerTrades.h(Items.EXPERIENCE_BOTTLE, 3, 1, 30)})));
hashmap.put(VillagerProfession.ARMORER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.COAL, 15, 8, 2), new VillagerTrades.h(new ItemStack(Items.IRON_LEGGINGS), 7, 1, 6, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_BOOTS), 4, 1, 6, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_HELMET), 5, 1, 6, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_CHESTPLATE), 9, 1, 6, 1, 0.2F)}, 2, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.IRON_INGOT, 4, 6, 10), new VillagerTrades.h(new ItemStack(Items.pP), 36, 1, 6, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_BOOTS), 1, 1, 6, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_LEGGINGS), 3, 1, 6, 5, 0.2F)}, 3, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.b(Items.LAVA_BUCKET, 1, 6, 20), new VillagerTrades.b(Items.DIAMOND, 1, 6, 20), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_HELMET), 1, 1, 6, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_CHESTPLATE), 4, 1, 6, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.SHIELD), 5, 1, 6, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.e(Items.DIAMOND_LEGGINGS, 14, 2, 15, 0.2F), new VillagerTrades.e(Items.DIAMOND_BOOTS, 8, 2, 15, 0.2F)}, 5, new VillagerTrades.IMerchantRecipeOption[] { new VillagerTrades.e(Items.DIAMOND_HELMET, 8, 2, 30, 0.2F), new VillagerTrades.e(Items.DIAMOND_CHESTPLATE, 16, 2, 30, 0.2F)})));
@@ -89,6 +89,7 @@ public class VillagerTrades {
@Override
public MerchantRecipe a(Entity entity, Random random) {
World world = entity.world;
+ if (!world.paperConfig.enableTreasureMaps) return null; //Paper
BlockPosition blockposition = world.a(this.b, new BlockPosition(entity), 100, true);
if (blockposition != null) {
--
2.21.0

View File

@ -1,25 +0,0 @@
From 3b58205c29904e995b9ea750ec5d41de9427897b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 22:54:28 -0400
Subject: [PATCH] Chunk registration fixes
World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is treated
Keep them consistent
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 336e6aeef6..282d6ae84c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1473,7 +1473,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
i = MathHelper.floor(entity.locX / 16.0D);
- j = MathHelper.floor(entity.locY / 16.0D);
+ j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY / 16.0D))); // Paper - stay consistent with chunk add/remove behavior
int k = MathHelper.floor(entity.locZ / 16.0D);
if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {
--
2.21.0

View File

@ -1,4 +1,4 @@
From 853a5b33b53b85bff4fe55e2b8f50e68b1d044e2 Mon Sep 17 00:00:00 2001
From 1d88861a7a12606b16577ab0926d5a0df1e17af4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Dec 2016 03:48:29 -0500
Subject: [PATCH] Optimize ItemStack.isEmpty()
@ -6,10 +6,10 @@ Subject: [PATCH] Optimize ItemStack.isEmpty()
Remove hashMap lookup every check, simplify code to remove ternary
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 37d37f1f64..927394333a 100644
index b643a4123..b7d327211 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -151,7 +151,7 @@ public final class ItemStack {
@@ -145,7 +145,7 @@ public final class ItemStack {
}
public boolean isEmpty() {

View File

@ -1,37 +1,37 @@
From 80e8e20cd171794077cc488a21f686a4e586fbd3 Mon Sep 17 00:00:00 2001
From 63c3ad6f835f1e17f8cc069274d67b20ef43ec86 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 21 Dec 2016 11:47:25 -0600
Subject: [PATCH] Add API methods to control if armour stands can move
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index cdbc82bf9e..b570882340 100644
index 823041f06..8c6a9ec68 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -44,6 +44,7 @@ public class EntityArmorStand extends EntityLiving {
@@ -43,6 +43,7 @@ public class EntityArmorStand extends EntityLiving {
public Vector3f rightArmPose;
public Vector3f leftLegPose;
public Vector3f rightLegPose;
+ public boolean canMove = true; // Paper
public EntityArmorStand(World world) {
super(EntityTypes.ARMOR_STAND, world);
@@ -754,4 +755,13 @@ public class EntityArmorStand extends EntityLiving {
public boolean df() {
return false;
public EntityArmorStand(EntityTypes<? extends EntityArmorStand> entitytypes, World world) {
super(entitytypes, world);
@@ -788,4 +789,13 @@ public class EntityArmorStand extends EntityLiving {
return this.getEntityType().j().a(f);
}
+
+ // Paper start
+ @Override
+ public void move(EnumMoveType moveType, double x, double y, double z) {
+ public void move(EnumMoveType moveType, Vec3D vec3d) {
+ if (this.canMove) {
+ super.move(moveType, x, y, z);
+ super.move(moveType, vec3d);
+ }
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 2b66a08ade..124c3185bc 100644
index 2b66a08ad..124c3185b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -211,4 +211,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {

View File

@ -1,4 +1,4 @@
From cc45f36d257d5838e9293dd0bd31353bf3950949 Mon Sep 17 00:00:00 2001
From 7e001c26638d91d2ec6eb0e510684b4284e0181f Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Tue, 27 Dec 2016 01:57:57 +0000
Subject: [PATCH] Properly fix item duplication bug
@ -6,10 +6,10 @@ Subject: [PATCH] Properly fix item duplication bug
Credit to prplz for figuring out the real issue
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 6b9bbc77c0..e4e1d999e9 100644
index ecdfd306b..27ade8d7d 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1567,7 +1567,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1769,7 +1769,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@Override
protected boolean isFrozen() {
@ -19,10 +19,10 @@ index 6b9bbc77c0..e4e1d999e9 100644
@Override
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 4a06527b6f..1c4842a263 100644
index 982b15dec..6874563e4 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2485,7 +2485,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2541,7 +2541,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
public final boolean isDisconnected() {
@ -30,7 +30,7 @@ index 4a06527b6f..1c4842a263 100644
+ return (!this.player.joining && !this.networkManager.isConnected()) || this.processedDisconnect; // Paper
}
// CraftBukkit end
}
--
2.21.0

View File

@ -1,11 +1,11 @@
From d4a4bb2f503564a74e49d7640f1273c1977cd253 Mon Sep 17 00:00:00 2001
From f333f65aab67ab8c458cf23bdf17639f475fce50 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 27 Dec 2016 15:02:42 -0500
Subject: [PATCH] String based Action Bar API
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index c97e116aaf..e1af5c4885 100644
index c97e116aa..e1af5c488 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
@ -42,10 +42,10 @@ index c97e116aaf..e1af5c4885 100644
public static boolean isMainThread() {
return MinecraftServer.getServer().isMainThread();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 59bfcce68d..c5f2284553 100644
index 4e12b6406..0b0053207 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -207,6 +207,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -212,6 +212,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper start

View File

@ -1,116 +1,120 @@
From 9432bcdfe213cdd8fa3b301413db8e7b0bae3b3b Mon Sep 17 00:00:00 2001
From 98eddee130ce845f97aadda24a463864fa004b97 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 28 Dec 2016 01:18:33 -0500
Subject: [PATCH] Firework API's
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
index 9b6d217df8..9764c76fba 100644
index d6bde129e..5cee161b6 100644
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -2,6 +2,8 @@ package net.minecraft.server;
@@ -3,6 +3,8 @@ package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
import java.util.OptionalInt;
+import java.util.UUID;
+
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityFireworks extends Entity {
@@ -10,7 +12,8 @@ public class EntityFireworks extends Entity {
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.b);
public class EntityFireworks extends Entity implements IProjectile {
@@ -12,7 +14,8 @@ public class EntityFireworks extends Entity implements IProjectile {
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i);
private int ticksFlown;
public int expectedLifespan;
- private EntityLiving e;
- private EntityLiving ridingEntity;
+ private EntityLiving ridingEntity; public final EntityLiving getBoostedEntity() { return this.ridingEntity; } // Paper - OBFHELPER
+ public UUID spawningEntity; // Paper
+ private EntityLiving e;public EntityLiving getBoostedEntity() { return e; } // Paper - OBFHELPER
public EntityFireworks(World world) {
super(EntityTypes.FIREWORK_ROCKET, world);
@@ -197,6 +200,12 @@ public class EntityFireworks extends Entity {
nbttagcompound.set("FireworksItem", itemstack.save(new NBTTagCompound()));
public EntityFireworks(EntityTypes<? extends EntityFireworks> entitytypes, World world) {
super(entitytypes, world);
@@ -255,6 +258,11 @@ public class EntityFireworks extends Entity implements IProjectile {
}
nbttagcompound.setBoolean("ShotAtAngle", (Boolean) this.datawatcher.get(EntityFireworks.d));
+ // Paper start
+ if (spawningEntity != null) {
+ nbttagcompound.setUUID("SpawningEntity", spawningEntity);
+ if (this.spawningEntity != null) {
+ nbttagcompound.setUUID("SpawningEntity", this.spawningEntity);
+ }
+ // Paper end
+
}
public void a(NBTTagCompound nbttagcompound) {
@@ -207,7 +216,11 @@ public class EntityFireworks extends Entity {
if (!itemstack.isEmpty()) {
this.datawatcher.set(EntityFireworks.FIREWORK_ITEM, itemstack);
@Override
@@ -270,7 +278,11 @@ public class EntityFireworks extends Entity implements IProjectile {
if (nbttagcompound.hasKey("ShotAtAngle")) {
this.datawatcher.set(EntityFireworks.d, nbttagcompound.getBoolean("ShotAtAngle"));
}
-
+ // Paper start
+ if (nbttagcompound.hasUUID("SpawningEntity")) {
+ spawningEntity = nbttagcompound.getUUID("SpawningEntity");
+ this.spawningEntity = nbttagcompound.getUUID("SpawningEntity");
+ }
+ // Paper end
}
public boolean bk() {
@Override
diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java
index 68bd2af261..dbb422e9da 100644
index 37caa79cb..aea46ffae 100644
--- a/src/main/java/net/minecraft/server/ItemFireworks.java
+++ b/src/main/java/net/minecraft/server/ItemFireworks.java
@@ -16,6 +16,7 @@ public class ItemFireworks extends Item {
BlockPosition blockposition = itemactioncontext.getClickPosition();
@@ -17,6 +17,7 @@ public class ItemFireworks extends Item {
ItemStack itemstack = itemactioncontext.getItemStack();
EntityFireworks entityfireworks = new EntityFireworks(world, (double) ((float) blockposition.getX() + itemactioncontext.m()), (double) ((float) blockposition.getY() + itemactioncontext.n()), (double) ((float) blockposition.getZ() + itemactioncontext.o()), itemstack);
+ entityfireworks.spawningEntity = itemactioncontext.b.getUniqueID(); // Paper
Vec3D vec3d = itemactioncontext.j();
EntityFireworks entityfireworks = new EntityFireworks(world, vec3d.x, vec3d.y, vec3d.z, itemstack);
+ entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper
world.addEntity(entityfireworks);
itemstack.subtract(1);
@@ -30,6 +31,7 @@ public class ItemFireworks extends Item {
@@ -31,7 +32,11 @@ public class ItemFireworks extends Item {
ItemStack itemstack = entityhuman.b(enumhand);
if (!world.isClientSide) {
EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman);
+ entityfireworks.spawningEntity = entityhuman.getUniqueID(); // Paper
world.addEntity(entityfireworks);
- world.addEntity(new EntityFireworks(world, itemstack, entityhuman));
+ // Paper start
+ final EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman);
+ entityfireworks.spawningEntity = entityhuman.getUniqueID();
+ world.addEntity(entityfireworks);
+ // Paper end
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack.subtract(1);
}
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index 8c5d6c1d38..d4165f7e44 100644
index 3f6d2676e..b1fd18151 100644
--- a/src/main/java/net/minecraft/server/NBTTagCompound.java
+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java
@@ -107,7 +107,7 @@ public class NBTTagCompound implements NBTBase {
@@ -112,7 +112,7 @@ public class NBTTagCompound implements NBTBase {
return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least"));
}
- public boolean b(String s) {
+ public boolean hasUUID(String s) { return b(s); } public boolean b(String s) { // Paper - OBFHELPER
+ public final boolean hasUUID(String s) { return this.b(s); } public boolean b(String s) { // Paper - OBFHELPER
return this.hasKeyOfType(s + "Most", 99) && this.hasKeyOfType(s + "Least", 99);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
index 7b3b206823..b39e33f4f0 100644
index 6b69be742..37374ae5b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.entity;
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity;
import java.util.Random;
import net.minecraft.server.EntityFireworks;
+import net.minecraft.server.EntityLiving;
import net.minecraft.server.ItemStack;
import net.minecraft.server.Items;
@@ -9,9 +10,11 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.Material;
@@ -9,8 +10,11 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
+import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.meta.FireworkMeta;
import java.util.Random;
+import java.util.UUID;
+
public class CraftFirework extends CraftEntity implements Firework {
@@ -70,4 +73,18 @@ public class CraftFirework extends CraftEntity implements Firework {
private final Random random = new Random();
@@ -68,4 +72,18 @@ public class CraftFirework extends CraftEntity implements Firework {
public void detonate() {
getHandle().expectedLifespan = 0;
}

View File

@ -1,4 +1,4 @@
From 656d256bb375706e0843d0c2ddf0843c7c9a358a Mon Sep 17 00:00:00 2001
From 0bb363ae5e65babf767f8a9229010c5681c11568 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 31 Dec 2016 21:44:50 -0500
Subject: [PATCH] PlayerTeleportEndGatewayEvent
@ -6,10 +6,10 @@ Subject: [PATCH] PlayerTeleportEndGatewayEvent
Allows you to access the Gateway being used in a teleport event
diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
index a7efe5664a..d2b29ecbe0 100644
index bfc147059..5dd670615 100644
--- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java
+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
@@ -126,7 +126,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
@@ -132,7 +132,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
location.setPitch(player.getLocation().getPitch());
location.setYaw(player.getLocation().getYaw());

View File

@ -1,4 +1,4 @@
From c2d5c09d75edae0d2352770fcbd4cb9ca21cf714 Mon Sep 17 00:00:00 2001
From 0e3a58ce27f0f4622708b7a49ce885158b9420f2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 7 Jan 2017 15:24:46 -0500
Subject: [PATCH] Provide E/TE/Chunk count stat methods
@ -7,12 +7,12 @@ Provides counts without the ineffeciency of using .getEntities().size()
which creates copy of the collections.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f7883e7085..010c5fc731 100644
index 90b87bb01..3c7f62fc5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -88,6 +88,29 @@ public class CraftWorld implements World {
private int chunkLoadCount = 0;
private int chunkGCTickCount;
@@ -264,6 +264,29 @@ public class CraftWorld implements World {
private int waterAnimalSpawn = -1;
private int ambientSpawn = -1;
+ // Paper start - Provide fast information methods
+ public int getEntityCount() {

View File

@ -1,4 +1,4 @@
From 6dac784f4401b784add8dd0703128ff13c4ae288 Mon Sep 17 00:00:00 2001
From 7775e6a4b54fa6fed95237091b82abbb736158c0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 7 Jan 2017 15:41:58 -0500
Subject: [PATCH] Enforce Sync Player Saves
@ -7,25 +7,23 @@ Saving players async is extremely dangerous. This will force it to main
the same way we handle async chunk loads.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index fe6649224a..9570a8800b 100644
index 7003c4a93..a1659e6a2 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1214,6 +1214,7 @@ public abstract class PlayerList {
@@ -927,11 +927,13 @@ public abstract class PlayerList {
}
public void savePlayers(Integer interval) {
+ MCUtil.ensureMain("Save Players", () -> { // Paper - ensure main
long now = MinecraftServer.currentTick;
public void savePlayers() {
+ MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
MinecraftTimings.savePlayers.startTiming(); // Paper
int numSaved = 0; // Paper
@@ -1225,6 +1226,7 @@ public abstract class PlayerList {
}
for (int i = 0; i < this.players.size(); ++i) {
this.savePlayerFile((EntityPlayer) this.players.get(i));
}
MinecraftTimings.savePlayers.stopTiming(); // Paper
+ return null; }); // Paper - ensure main
}
// Paper end
public WhiteList getWhitelist() {
--
2.21.0

View File

@ -1,14 +1,14 @@
From 9e46153783206330175be6c33c41155fbd865d16 Mon Sep 17 00:00:00 2001
From ef810037b85957693112a707cc2c2983c4678a46 Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Sun, 8 Jan 2017 04:31:36 +0000
Subject: [PATCH] Don't allow entities to ride themselves - #572
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index b6ed9082fd..80ff428656 100644
index cbdc267fa..3fd560027 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2094,6 +2094,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1980,6 +1980,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
protected boolean addPassenger(Entity entity) { // CraftBukkit

View File

@ -1,14 +1,14 @@
From 5ae8df3009225b24837b764e02db1f24fd6ad265 Mon Sep 17 00:00:00 2001
From ac742bd2ace2f239eefa33afb4f7cced59f3680e Mon Sep 17 00:00:00 2001
From: Michael Himing <mhiming@gmail.com>
Date: Sun, 8 Jan 2017 18:50:35 +1100
Subject: [PATCH] Fix block break desync
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 1c4842a263..05cc5afea6 100644
index 6874563e4..37caa2a70 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1136,6 +1136,8 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1176,6 +1176,8 @@ public class PlayerConnection implements PacketListenerPlayIn {
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 > 36.0D) {

View File

@ -1,4 +1,4 @@
From 8ca07b6a51fa3b4c31456f4a0363422607a712d5 Mon Sep 17 00:00:00 2001
From 9716d2455797ed8b3dad7d75f7b6e0cd3c0d1f98 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 16:31:46 -0500
Subject: [PATCH] ExperienceOrbs API for Reason/Source/Triggering player
@ -8,10 +8,10 @@ Adds lots of information about why this orb exists.
Replaces isFromBottle() with logic that persists entity reloads too.
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 1dc13fcc30..c674aa13d8 100644
index fd23d4534..69e65ea6c 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -450,13 +450,13 @@ public class Block implements IMaterial {
@@ -504,13 +504,13 @@ public class Block implements IMaterial {
}
}
@ -27,11 +27,24 @@ index 1dc13fcc30..c674aa13d8 100644
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java
index 2e4f81ebe..88b9655bb 100644
--- a/src/main/java/net/minecraft/server/ContainerGrindstone.java
+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java
@@ -81,7 +81,7 @@ public class ContainerGrindstone extends Container {
int k = EntityExperienceOrb.getOrbValue(j);
j -= k;
- world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k));
+ world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k, org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, entityhuman)); // Paper
}
world.triggerEffect(1042, blockposition, 0);
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index b3fbc8249e..79d8be8d46 100644
index bfdb63094..3a6ae654c 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -618,7 +618,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
@@ -602,7 +602,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
int j = EntityExperienceOrb.getOrbValue(i);
i -= j;
@ -41,10 +54,10 @@ index b3fbc8249e..79d8be8d46 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index 3030dd9c31..404a222b45 100644
index bfba08fb2..49668f2c2 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -15,9 +15,59 @@ public class EntityExperienceOrb extends Entity {
@@ -16,9 +16,59 @@ public class EntityExperienceOrb extends Entity {
public int value;
private EntityHuman targetPlayer;
private int targetTime;
@ -67,7 +80,7 @@ index 3030dd9c31..404a222b45 100644
+ if (comp.hasKey("reason")) {
+ String reason = comp.getString("reason");
+ try {
+ spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.valueOf(reason);
+ this.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.valueOf(reason);
+ } catch (Exception e) {
+ this.world.getServer().getLogger().warning("Invalid spawnReason set for experience orb: " + e.getMessage() + " - " + reason);
+ }
@ -75,14 +88,14 @@ index 3030dd9c31..404a222b45 100644
+ }
+ private void savePaperNBT(NBTTagCompound nbttagcompound) {
+ NBTTagCompound comp = new NBTTagCompound();
+ if (sourceEntityId != null) {
+ comp.setUUID("source", sourceEntityId);
+ if (this.sourceEntityId != null) {
+ comp.setUUID("source", this.sourceEntityId);
+ }
+ if (triggerEntityId != null) {
+ if (this.triggerEntityId != null) {
+ comp.setUUID("trigger", triggerEntityId);
+ }
+ if (spawnReason != null && spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) {
+ comp.setString("reason", spawnReason.name());
+ if (this.spawnReason != null && this.spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) {
+ comp.setString("reason", this.spawnReason.name());
+ }
+ nbttagcompound.set("Paper.ExpData", comp);
+ }
@ -96,34 +109,35 @@ index 3030dd9c31..404a222b45 100644
+ }
+
+ public EntityExperienceOrb(World world, double d0, double d1, double d2, int i, org.bukkit.entity.ExperienceOrb.SpawnReason reason, Entity triggerId, Entity sourceId) {
super(EntityTypes.EXPERIENCE_ORB, world);
this(EntityTypes.EXPERIENCE_ORB, world);
+ this.sourceEntityId = sourceId != null ? sourceId.getUniqueID() : null;
+ this.triggerEntityId = triggerId != null ? triggerId.getUniqueID() : null;
+ this.spawnReason = reason != null ? reason : org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN;
+ // Paper end
this.setSize(0.5F, 0.5F);
this.setPosition(d0, d1, d2);
this.yaw = (float) (Math.random() * 360.0D);
@@ -156,12 +206,14 @@ public class EntityExperienceOrb extends Entity {
nbttagcompound.setShort("Health", (short) this.d);
nbttagcompound.setShort("Age", (short) this.b);
this.yaw = (float) (this.random.nextDouble() * 360.0D);
this.setMot((this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D, this.random.nextDouble() * 0.2D * 2.0D, (this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D);
@@ -155,6 +205,7 @@ public class EntityExperienceOrb extends Entity {
nbttagcompound.setShort("Health", (short) this.e);
nbttagcompound.setShort("Age", (short) this.c);
nbttagcompound.setShort("Value", (short) this.value);
+ savePaperNBT(nbttagcompound); // Paper
+ this.savePaperNBT(nbttagcompound); // Paper
}
public void a(NBTTagCompound nbttagcompound) {
this.d = nbttagcompound.getShort("Health");
this.b = nbttagcompound.getShort("Age");
@Override
@@ -162,6 +213,7 @@ public class EntityExperienceOrb extends Entity {
this.e = nbttagcompound.getShort("Health");
this.c = nbttagcompound.getShort("Age");
this.value = nbttagcompound.getShort("Value");
+ loadPaperNBT(nbttagcompound); // Paper
+ this.loadPaperNBT(nbttagcompound); // Paper
}
public void d(EntityHuman entityhuman) {
@Override
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 202b8d2158..ee71c326ae 100644
index 78527f350..03f782d4b 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -468,7 +468,7 @@ public class EntityFishingHook extends Entity {
@@ -404,7 +404,7 @@ public class EntityFishingHook extends Entity {
this.world.addEntity(entityitem);
// CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
if (playerFishEvent.getExpToDrop() > 0) {
@ -133,10 +147,10 @@ index 202b8d2158..ee71c326ae 100644
// CraftBukkit end
if (itemstack1.getItem().a(TagsItem.FISHES)) {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index c0ef0c51f1..3bc1f8f9b5 100644
index 780287f91..014404ade 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -354,7 +354,8 @@ public abstract class EntityLiving extends Entity {
@@ -381,7 +381,8 @@ public abstract class EntityLiving extends Entity {
int j = EntityExperienceOrb.getOrbValue(i);
i -= j;
@ -147,10 +161,10 @@ index c0ef0c51f1..3bc1f8f9b5 100644
this.expToDrop = 0;
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
index a5e1939e05..e73dba09a6 100644
index 77dd4c99a..398b499bb 100644
--- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
@@ -36,7 +36,7 @@ public class EntityThrownExpBottle extends EntityProjectile {
@@ -43,7 +43,7 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable {
int j = EntityExperienceOrb.getOrbValue(i);
i -= j;
@ -159,24 +173,50 @@ index a5e1939e05..e73dba09a6 100644
}
this.die();
diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java
index 7c6506a91..1b4933c07 100644
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
@@ -512,7 +512,7 @@ public class EntityTurtle extends EntityAnimal {
Random random = this.animal.getRandom();
if (this.b.getGameRules().getBoolean("doMobLoot")) {
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, random.nextInt(7) + 1));
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, random.nextInt(7) + 1, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer)); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index ebe397b15a..78acac4ca7 100644
index c34868324..bc04086d7 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -412,7 +412,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
@@ -421,7 +421,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
}
if (merchantrecipe.j()) {
if (merchantrecipe.q()) {
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY + 0.5D, this.locZ, i));
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY + 0.5D, this.locZ, i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, tradingPlayer, this)); // Paper
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY + 0.5D, this.locZ, i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.getTrader(), this)); // Paper
}
if (this.tradingPlayer instanceof EntityPlayer) {
}
diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java
index 1d612d828..002ff8880 100644
--- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java
+++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java
@@ -147,7 +147,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract {
if (merchantrecipe.q()) {
int i = 3 + this.random.nextInt(4);
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY + 0.5D, this.locZ, i));
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY + 0.5D, this.locZ, i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.getTrader(), this)); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
index bf061cf064..55f9787680 100644
index d25a05736..9d0b1ffef 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
@@ -122,7 +122,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
@@ -117,7 +117,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
if (this.b.getGameRules().getBoolean("doMobLoot")) {
// CraftBukkit start - use event experience
if (experience > 0) {
@ -186,10 +226,10 @@ index bf061cf064..55f9787680 100644
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index 0baf0100c9..6ae6afa339 100644
index 6e90f21ea..a7411c75a 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -391,7 +391,7 @@ public class PlayerInteractManager {
@@ -367,7 +367,7 @@ public class PlayerInteractManager {
// CraftBukkit start - Drop event experience
if (flag && event != null) {
@ -199,42 +239,46 @@ index 0baf0100c9..6ae6afa339 100644
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/SlotFurnaceResult.java b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
index 5ac554d65e..d70c4dda5a 100644
index d2698e847..edc4a5c34 100644
--- a/src/main/java/net/minecraft/server/SlotFurnaceResult.java
+++ b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
@@ -9,7 +9,7 @@ import org.bukkit.event.inventory.FurnaceExtractEvent;
@@ -2,7 +2,7 @@ package net.minecraft.server;
public class SlotFurnaceResult extends Slot {
- private final EntityHuman a;
+ private final EntityHuman a;public EntityHuman getPlayer() { return a; } // Paper OBFHELPER
+ private final EntityHuman a; public final EntityHuman getPlayer() { return this.a; } // Paper OBFHELPER
private int b;
public SlotFurnaceResult(EntityHuman entityhuman, IInventory iinventory, int i, int j, int k) {
@@ -85,7 +85,7 @@ public class SlotFurnaceResult extends Slot {
while (i > 0) {
j = EntityExperienceOrb.getOrbValue(i);
i -= j;
- this.a.world.addEntity(new EntityExperienceOrb(this.a.world, this.a.locX, this.a.locY + 0.5D, this.a.locZ + 0.5D, j));
+ this.a.world.addEntity(new EntityExperienceOrb(this.a.world, this.a.locX, this.a.locY + 0.5D, this.a.locZ + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, getPlayer())); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index adb1a0913..be16fe9a9 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -554,7 +554,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
while (i > 0) {
j = EntityExperienceOrb.getOrbValue(i);
i -= j;
- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX, entityhuman.locY + 0.5D, entityhuman.locZ + 0.5D, j));
+ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX, entityhuman.locY + 0.5D, entityhuman.locZ + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, entityhuman)); // Paper
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 6718028190..d72f393a75 100644
index 3c7f62fc5..3fbc48150 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1354,7 +1354,7 @@ public class CraftWorld implements World {
@@ -1540,7 +1540,7 @@ public class CraftWorld implements World {
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
entity = new EntityTNTPrimed(world, x, y, z, null);
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
- entity = new EntityExperienceOrb(world, x, y, z, 0);
+ entity = new EntityExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
} else if (Weather.class.isAssignableFrom(clazz)) {
// not sure what this can do
if (LightningStrike.class.isAssignableFrom(clazz)) {
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
entity = new EntityLightning(world, x, y, z, false);
} else if (Firework.class.isAssignableFrom(clazz)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
index 3a09cab3d4..3302af0e45 100644
index 3a09cab3d..3302af0e4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
@@ -18,6 +18,18 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {

View File

@ -1,4 +1,4 @@
From fcb228cc399c4d659994a49376ae0a7bebe6a61d Mon Sep 17 00:00:00 2001
From ff7027977adf0a4d6114e34fd1d7dc19fcdb2169 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,10 +12,10 @@ 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 13f54e05ab..72eb530d7e 100644
index 406bc611c..58fe5a8c4 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -369,4 +369,10 @@ public class PaperWorldConfig {
@@ -320,4 +320,10 @@ public class PaperWorldConfig {
log("Treasure Maps will return already discovered locations");
}
}
@ -27,10 +27,10 @@ index 13f54e05ab..72eb530d7e 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 80ff428656..291a304172 100644
index 3fd560027..ee7fe30c7 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -182,6 +182,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -181,6 +181,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 80ff428656..291a304172 100644
// Spigot end
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 3bc1f8f9b5..34fbf83621 100644
index 014404ade..b0c9eda48 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2355,8 +2355,11 @@ public abstract class EntityLiving extends Entity {
@@ -2553,8 +2553,11 @@ public abstract class EntityLiving extends Entity {
}
}
@ -53,7 +53,7 @@ index 3bc1f8f9b5..34fbf83621 100644
+ entity.numCollisions++; // Paper
+ numCollisions++; // Paper
this.C(entity);
this.D(entity);
}
--
2.21.0

View File

@ -1,4 +1,4 @@
From db940aa3927da56a0d8eb595198bd9c9341379cf Mon Sep 17 00:00:00 2001
From 551d84659a7b941c757445155a784a02238d7122 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
@ -9,10 +9,10 @@ One report of a suspected memory leak with the system.
This adds additional overhead to asynchronous task dispatching
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 0e9d5fe3a7..3ef79e3e94 100644
index 86a5ee8aa..36eecb670 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -412,7 +412,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -411,7 +411,7 @@ public class CraftScheduler implements BukkitScheduler {
}
parsePending();
} else {
@ -21,7 +21,7 @@ index 0e9d5fe3a7..3ef79e3e94 100644
executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
@@ -429,7 +429,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -428,7 +428,7 @@ public class CraftScheduler implements BukkitScheduler {
pending.addAll(temp);
temp.clear();
MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming();
@ -30,7 +30,7 @@ index 0e9d5fe3a7..3ef79e3e94 100644
}
private void addTask(final CraftTask task) {
@@ -489,10 +489,15 @@ public class CraftScheduler implements BukkitScheduler {
@@ -488,10 +488,15 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public String toString() {

View File

@ -0,0 +1,22 @@
From ee00b8612da19fa628bc39473263d4bb4a124bf2 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/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index be903252b..89a00ff8d 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -314,7 +314,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// Spigot start
org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant;
activityAccountant.startActivity(0.5);
- int targetSize = (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR);
+ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
// Spigot end
while (longiterator.hasNext()) { // Spigot
long j = longiterator.nextLong();
--
2.21.0

View File

@ -1,15 +1,15 @@
From acb04e7af931a4ae09b5ac254c3e29220e1976fd Mon Sep 17 00:00:00 2001
From 2cf238ab74719beb6cb72b9e8826bb4a387a820d 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 b570882340..694df9e185 100644
index 8c6a9ec68..f8cd62199 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -763,5 +763,10 @@ public class EntityArmorStand extends EntityLiving {
super.move(moveType, x, y, z);
@@ -797,5 +797,10 @@ public class EntityArmorStand extends EntityLiving {
super.move(moveType, vec3d);
}
}
+
@ -20,22 +20,22 @@ index b570882340..694df9e185 100644
// Paper end
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 34fbf83621..138a224e04 100644
index b0c9eda48..121925046 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -202,6 +202,7 @@ public abstract class EntityLiving extends Entity {
@@ -223,6 +223,7 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag, iblockdata, blockposition);
}
+ public boolean canBreatheUnderwater() { return this.ca(); } // Paper - OBFHELPER
public boolean ca() {
+ public boolean canBreatheUnderwater() { return this.cl(); } // Paper - OBFHELPER
public boolean cl() {
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
@@ -236,7 +237,7 @@ public abstract class EntityLiving extends Entity {
@@ -258,7 +259,7 @@ public abstract class EntityLiving extends Entity {
if (this.isAlive()) {
if (this.a(TagsFluid.WATER) && this.world.getType(new BlockPosition(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ)).getBlock() != Blocks.BUBBLE_COLUMN) {
- if (!this.ca() && !MobEffectUtil.c(this) && !flag1) {
- if (!this.cl() && !MobEffectUtil.c(this) && !flag1) {
+ if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden
this.setAirTicks(this.k(this.getAirTicks()));
if (this.getAirTicks() == -20) {

View File

@ -1,4 +1,4 @@
From b7ea92e1f8098d7899cc53e97cbb602b9f2f24e5 Mon Sep 17 00:00:00 2001
From a5592be696baf2e08fb817f8d29c2a90a559c241 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,57 +30,62 @@ 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 6283c774d6..db511c1fe8 100644
index c41adf441..2d5e340ee 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -85,6 +85,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@@ -80,6 +80,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public final Map<DimensionManager, WorldServer> worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods
private PlayerList playerList;
private boolean isRunning = true;
+ private boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
private volatile boolean isRunning = true;
+ private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
private boolean isStopped;
private int ticks;
protected final Proxy c;
@@ -655,7 +656,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
protected final Proxy proxy;
@@ -690,7 +691,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (this.playerList != null) {
MinecraftServer.LOGGER.info("Saving players");
this.playerList.savePlayers();
- this.playerList.u();
+ this.playerList.u(isRestarting); // Paper
- this.playerList.shutdown();
+ this.playerList.shutdown(this.isRestarting); // Paper
try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
@@ -705,9 +706,16 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@@ -744,8 +745,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
return this.isRunning;
}
+ // Paper start - allow passing of the intent to restart
public void safeShutdown() {
+ safeShutdown(false);
public void safeShutdown(boolean flag) {
+ this.safeShutdown(flag, false);
+ }
+
+ public void safeShutdown(boolean isRestarting) {
+ public void safeShutdown(boolean flag, boolean isRestarting) {
this.isRunning = false;
+ this.isRestarting = isRestarting;
if (flag) {
try {
this.serverThread.join();
@@ -755,6 +761,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
}
+ // Paper end
private boolean canSleepForTick() {
return System.nanoTime() - lastTick + catchupTime < TICK_TIME; // Paper - improved "are we lagging" check to match our own
// Spigot Start
private static double calcTps(double avg, double exp, double tps)
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 9570a8800b..9d44dcb3b2 100644
index a1659e6a2..46a3f0751 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1336,10 +1336,15 @@ public abstract class PlayerList {
@@ -1038,10 +1038,15 @@ public abstract class PlayerList {
entityplayer.playerInteractManager.b(generatoraccess.getWorldData().getGameType());
}
+ // Paper start - Extract method to allow for restarting flag
public void u() {
+ u(false);
public void shutdown() {
+ this.shutdown(false);
+ }
+
+ public void u(boolean isRestarting) {
+ public void shutdown(boolean isRestarting) {
// CraftBukkit start - disconnect safely
for (EntityPlayer player : this.players) {
- player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
@ -88,7 +93,7 @@ index 9570a8800b..9d44dcb3b2 100644
}
// CraftBukkit end
// Paper start - Remove collideRule team if it exists
@@ -1350,6 +1355,7 @@ public abstract class PlayerList {
@@ -1052,6 +1057,7 @@ public abstract class PlayerList {
}
// Paper end
}
@ -97,55 +102,37 @@ index 9570a8800b..9d44dcb3b2 100644
// CraftBukkit start
public void sendMessage(IChatBaseComponent[] iChatBaseComponents) {
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
index 944151d140..061cbe7fcf 100644
index ccea803f5..aefea3a9a 100644
--- a/src/main/java/org/spigotmc/RestartCommand.java
+++ b/src/main/java/org/spigotmc/RestartCommand.java
@@ -46,86 +46,123 @@ public class RestartCommand extends Command
@@ -46,86 +46,134 @@ public class RestartCommand extends Command
org.spigotmc.AsyncCatcher.shuttingDown = true; // Paper
try
{
- String[] split = restartScript.split( " " );
- if ( split.length > 0 && new File( split[0] ).isFile() )
+ // Paper - extract method and cleanup
+ boolean isRestarting = addShutdownHook(restartScript);
+ if (isRestarting) {
+ System.out.println("Attempting to restart with " + SpigotConfig.restartScript);
+ } else {
+ boolean isRestarting = addShutdownHook( restartScript );
+ if ( isRestarting )
{
- System.out.println( "Attempting to restart with " + restartScript );
+ System.out.println( "Attempting to restart with " + SpigotConfig.restartScript );
+ } else
+ {
+ System.out.println( "Startup script '" + SpigotConfig.restartScript + "' does not exist! Stopping server." );
+ }
+
+ // Stop the watchdog
+ WatchdogThread.doStop();
+
+ shutdownServer(isRestarting);
- // Disable Watchdog
- WatchdogThread.doStop();
+ shutdownServer( isRestarting );
+ // Paper end
+ } catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ // Paper start - sync copied from above with minor changes, async added
+ private static void shutdownServer(boolean isRestarting)
+ {
+ if (MinecraftServer.getServer().isMainThread())
+ {
+ // Kick all players
+ for ( EntityPlayer p : com.google.common.collect.ImmutableList.copyOf( MinecraftServer.getServer().getPlayerList().players ) )
{
- System.out.println( "Attempting to restart with " + restartScript );
+ p.playerConnection.disconnect(SpigotConfig.restartMessage);
+ }
+ // Give the socket a chance to send the packets
+ try
+ {
+ Thread.sleep( 100 );
+ } catch ( InterruptedException ex )
+ {
+ }
- // Disable Watchdog
- WatchdogThread.doStop();
+ closeSocket();
- // Kick all players
- for ( EntityPlayer p : (List< EntityPlayer>) MinecraftServer.getServer().getPlayerList().players )
@ -161,11 +148,21 @@ index 944151d140..061cbe7fcf 100644
- }
- // Close the socket so we can rebind with the new process
- MinecraftServer.getServer().getServerConnection().b();
+ // Actually shutdown
+ // Paper start - sync copied from above with minor changes, async added
+ private static void shutdownServer(boolean isRestarting)
+ {
+ if ( MinecraftServer.getServer().isMainThread() )
+ {
+ // Kick all players
+ for ( EntityPlayer p : com.google.common.collect.ImmutableList.copyOf( MinecraftServer.getServer().getPlayerList().players ) )
+ {
+ p.playerConnection.disconnect(SpigotConfig.restartMessage);
+ }
+ // Give the socket a chance to send the packets
+ try
+ {
+ MinecraftServer.getServer().stop();
+ } catch ( Throwable t )
+ Thread.sleep( 100 );
+ } catch ( InterruptedException ex )
+ {
+ }
@ -176,29 +173,88 @@ index 944151d140..061cbe7fcf 100644
- } catch ( InterruptedException ex )
- {
- }
+ // Actually stop the JVM
+ System.exit(0);
+ closeSocket();
- // Actually shutdown
- try
- {
- MinecraftServer.getServer().stop();
- MinecraftServer.getServer().close();
- } catch ( Throwable t )
- {
- }
+ } else
+ {
+ // Mark the server to shutdown at the end of the tick
+ MinecraftServer.getServer().safeShutdown(isRestarting);
+ // Actually shutdown
+ try
+ {
+ MinecraftServer.getServer().close(); // calls stop()
+ } catch ( Throwable t )
+ {
+ }
+
+ // Actually stop the JVM
+ System.exit( 0 );
- // This will be done AFTER the server has completely halted
- Thread shutdownHook = new Thread()
- {
+ } else
+ {
+ // Mark the server to shutdown at the end of the tick
+ MinecraftServer.getServer().safeShutdown( false, isRestarting );
+
+ // wait 10 seconds to see if we're actually going to try shutdown
+ try
+ {
+ Thread.sleep( 10000 );
+ }
+ catch (InterruptedException ignored)
+ {
+ }
+
+ // Check if we've actually hit a state where the server is going to safely shutdown
+ // if we have, let the server stop as usual
+ if (MinecraftServer.getServer().isStopped()) return;
+
+ // If the server hasn't stopped by now, assume worse case and kill
+ closeSocket();
+ System.exit( 0 );
+ }
+ }
+ // Paper end
+
+ // Paper - Split from moved code
+ private static void closeSocket()
+ {
+ // Close the socket so we can rebind with the new process
+ MinecraftServer.getServer().getServerConnection().b();
+
+ // Give time for it to kick in
+ try
+ {
+ Thread.sleep( 100 );
+ } catch ( InterruptedException ex )
+ {
+ }
+ }
+ // Paper end
+
+ // Paper start - copied from above and modified to return if the hook registered
+ private static boolean addShutdownHook(String restartScript)
+ {
+ String[] split = restartScript.split( " " );
+ if ( split.length > 0 && new File( split[0] ).isFile() )
+ {
+ Thread shutdownHook = new Thread()
+ {
+ @Override
+ public void run()
{
- @Override
- public void run()
- {
+ try
{
- try
- {
+ String os = System.getProperty( "os.name" ).toLowerCase(java.util.Locale.ENGLISH);
+ if ( os.contains( "win" ) )
{
- String os = System.getProperty( "os.name" ).toLowerCase(java.util.Locale.ENGLISH);
- if ( os.contains( "win" ) )
- {
@ -208,90 +264,47 @@ index 944151d140..061cbe7fcf 100644
- Runtime.getRuntime().exec( "sh " + restartScript );
- }
- } catch ( Exception e )
- {
+ Runtime.getRuntime().exec( "cmd /c start " + restartScript );
+ } else
{
- e.printStackTrace();
- }
- }
+ Runtime.getRuntime().exec( "sh " + restartScript );
}
+ } catch ( Exception e )
+ {
+ e.printStackTrace();
}
- };
-
- shutdownHook.setDaemon( true );
- Runtime.getRuntime().addShutdownHook( shutdownHook );
- } else
- {
- System.out.println( "Startup script '" + SpigotConfig.restartScript + "' does not exist! Stopping server." );
-
- // Actually shutdown
- try
- {
- MinecraftServer.getServer().stop();
- MinecraftServer.getServer().close();
- } catch ( Throwable t )
- {
- }
+ // wait 10 seconds to see if we're actually going to try shutdown
+ try
+ {
+ Thread.sleep(10000);
+ }
+ catch (InterruptedException ignored)
+ {
}
+
+ // Check if we've actually hit a state where the server is going to safely shutdown
+ // if we have, let the server stop as usual
+ if (MinecraftServer.getServer().isStopped()) return;
+
+ // If the server hasn't stopped by now, assume worse case and kill
+ closeSocket();
System.exit( 0 );
}
- }
- System.exit( 0 );
- } catch ( Exception ex )
+ }
+ }
+
+ // Paper - Split from moved code
+ private static void closeSocket() {
+ // Close the socket so we can rebind with the new process
+ MinecraftServer.getServer().getServerConnection().b();
+
+ // Give time for it to kick in
+ try
{
- ex.printStackTrace();
+ Thread.sleep( 100 );
+ } catch ( InterruptedException ex )
+ {
+ }
+ }
+ // Paper end
+
+ // Paper - copied from above and modified to return if the hook registered
+ private static boolean addShutdownHook(final String restartScript) {
+
+ String[] split = restartScript.split( " " );
+ if ( split.length > 0 && new File( split[0] ).isFile() )
+ {
+ Thread shutdownHook = new Thread() {
+ @Override
+ public void run() {
+ try {
+ String os = System.getProperty("os.name").toLowerCase(java.util.Locale.ENGLISH);
+ if (os.contains("win")) {
+ Runtime.getRuntime().exec("cmd /c start " + restartScript);
+ } else {
+ Runtime.getRuntime().exec( "sh " + restartScript );
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ shutdownHook.setDaemon(true);
+ Runtime.getRuntime().addShutdownHook(shutdownHook);
+ shutdownHook.setDaemon( true );
+ Runtime.getRuntime().addShutdownHook( shutdownHook );
+ return true;
+ } else {
+ } else
{
- ex.printStackTrace();
+ return false;
}
}
+ // Paper end
+
}
--
2.21.0

View File

@ -1,4 +1,4 @@
From e5c716622f3a6f09eb0d1977ba6eebcf0d296973 Mon Sep 17 00:00:00 2001
From 8b8bf29963073a01cab38ed94ca062b0621fb85a 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,10 +11,10 @@ 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 a23ec1461d..20cddd5065 100644
index 0291ff194..49c93b75c 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 {
@@ -36,6 +36,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
static final int MAX_PAGES = 50;
static final int MAX_PAGE_LENGTH = 320; // 256 limit + 64 characters to allow for psuedo colour codes
static final int MAX_TITLE_LENGTH = 32;
@ -22,7 +22,7 @@ index a23ec1461d..20cddd5065 100644
protected String title;
protected String author;
@@ -196,7 +197,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
@@ -192,7 +193,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
if (title == null) {
this.title = null;
return true;
@ -31,7 +31,7 @@ index a23ec1461d..20cddd5065 100644
return false;
}
@@ -232,7 +233,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
@@ -228,7 +229,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
throw new IllegalArgumentException("Invalid page number " + page + "/" + pages.size());
}
@ -40,7 +40,7 @@ index a23ec1461d..20cddd5065 100644
pages.set(page - 1, CraftChatMessage.fromString(newText, true)[0]);
}
@@ -244,13 +245,13 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
@@ -240,13 +241,13 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
public void addPage(final String... pages) {
for (String page : pages) {

View File

@ -1,4 +1,4 @@
From 9fa77cfb17de18c16aaa9f1bf8a73f2a841c3ef8 Mon Sep 17 00:00:00 2001
From 57c8f5b53873eb694f6cd8bf78808bbdcab3ca48 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 72eb530d7e..8ff454e259 100644
index 58fe5a8c4..a34121495 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -375,4 +375,10 @@ public class PaperWorldConfig {
@@ -326,4 +326,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 72eb530d7e..8ff454e259 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 5e5a747e9f..23e7cdfe88 100644
index 8a6f8e875..5df763d92 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -465,7 +465,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -436,7 +436,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,10 +39,10 @@ index 5e5a747e9f..23e7cdfe88 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 05cc5afea6..ac64fcfb31 100644
index 37caa2a70..69a786e8d 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1736,6 +1736,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1784,6 +1784,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
switch (packetplayinentityaction.c()) {
case START_SNEAKING:
this.player.setSneaking(true);

View File

@ -1,4 +1,4 @@
From 382faa5dd1c013c3dab3034934534a8fcbe2ea0b Mon Sep 17 00:00:00 2001
From 5a583fb24c0c02301aa12e9bdae2c64344868a4f 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
@ -6,12 +6,12 @@ Subject: [PATCH] Add configuration option to prevent player names from being
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 17b4e01aa4..d10d60921b 100644
index 7ce370e92..1adbb2480 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -280,4 +280,9 @@ public class PaperConfig {
maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
}
@@ -256,4 +256,9 @@ public class PaperConfig {
flyingKickPlayerMessage = getString("messages.kick.flying-player", flyingKickPlayerMessage);
flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage);
}
+
+ public static boolean suggestPlayersWhenNullTabCompletions = true;
@ -20,10 +20,10 @@ index 17b4e01aa4..d10d60921b 100644
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bb7792ce2a..962170cd3f 100644
index bc1de9d9e..b2aee24e5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2141,5 +2141,10 @@ public final class CraftServer implements Server {
@@ -2077,5 +2077,10 @@ public final class CraftServer implements Server {
commandMap.registerServerAliases();
return true;
}

View File

@ -1,44 +0,0 @@
From 924ca775f5c4e2ecbc9fd05cff40e22687ebedc5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 20 Dec 2016 15:26:27 -0500
Subject: [PATCH] Configurable Cartographer Treasure Maps
Allow configuring for cartographers to return the same map location
Also allow turning off treasure maps all together as they can eat up Map ID's
which are limited in quantity.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 104a3acf31..13f54e05ab 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -359,4 +359,14 @@ public class PaperWorldConfig {
Bukkit.getLogger().warning("Spawn Egg and Armor Stand NBT filtering disabled, this is a potential security risk");
}
}
+
+ public boolean enableTreasureMaps = true;
+ public boolean treasureMapsAlreadyDiscovered = false;
+ private void treasureMapsAlreadyDiscovered() {
+ enableTreasureMaps = getBoolean("enable-treasure-maps", true);
+ treasureMapsAlreadyDiscovered = getBoolean("treasure-maps-return-already-discovered", false);
+ if (treasureMapsAlreadyDiscovered) {
+ log("Treasure Maps will return already discovered locations");
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 213d0b18c9..ebe397b15a 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -752,6 +752,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
public void a(IMerchant imerchant, MerchantRecipeList merchantrecipelist, Random random) {
int i = this.a.a(random);
World world = imerchant.getWorld();
+ if (!world.paperConfig.enableTreasureMaps) return; //Paper
BlockPosition blockposition = world.a(this.b, imerchant.getPosition(), 100, true);
if (blockposition != null) {
--
2.21.0

View File

@ -1,4 +1,4 @@
From b6d424028e3980f33b12cf8b24fc51eaf7f3a613 Mon Sep 17 00:00:00 2001
From ee5622690e3f68cb3c8e31a3b30763994b3f4371 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
@ -19,7 +19,7 @@ Other changes:
configuration
diff --git a/pom.xml b/pom.xml
index 51cefc0a1b..2b73ec28a1 100644
index 099d7218c..108c8c05e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,10 +41,27 @@
@ -54,7 +54,7 @@ index 51cefc0a1b..2b73ec28a1 100644
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
@@ -207,10 +224,18 @@
@@ -230,10 +247,18 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/java.sql.Driver</resource>
</transformer>
@ -75,7 +75,7 @@ index 51cefc0a1b..2b73ec28a1 100644
<groupId>org.apache.maven.plugins</groupId>
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
new file mode 100644
index 0000000000..688b4715eb
index 000000000..688b4715e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -0,0 +1,40 @@
@ -121,7 +121,7 @@ index 0000000000..688b4715eb
+}
diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
new file mode 100644
index 0000000000..685deaa0e5
index 000000000..685deaa0e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
@@ -0,0 +1,17 @@
@ -143,10 +143,10 @@ index 0000000000..685deaa0e5
+
+}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 4e9ef43b45..5bb1ea880a 100644
index 19e2df309..3d0cb874d 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -79,6 +79,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -83,6 +83,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
if (!org.bukkit.craftbukkit.Main.useConsole) {
return;
}
@ -156,7 +156,7 @@ index 4e9ef43b45..5bb1ea880a 100644
jline.console.ConsoleReader bufferedreader = reader;
// CraftBukkit end
@@ -101,6 +104,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -105,6 +108,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
}
@ -165,7 +165,7 @@ index 4e9ef43b45..5bb1ea880a 100644
}
};
@@ -112,6 +117,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -116,6 +121,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler());
@ -175,38 +175,39 @@ index 4e9ef43b45..5bb1ea880a 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) {
@@ -120,6 +128,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -124,6 +132,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
new Thread(new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader)).start();
new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader).start();
+ */
+ // Paper end
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 db511c1fe8..c6ecdf6e8e 100644
index 2d5e340ee..dc6d7b3a2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -56,7 +56,6 @@ import org.apache.commons.lang3.Validate;
@@ -50,7 +50,7 @@ import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
// CraftBukkit start
-import jline.console.ConsoleReader;
import joptsimple.OptionSet;
+import joptsimple.OptionSet;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.CraftServer;
@@ -142,7 +141,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
import org.bukkit.craftbukkit.Main;
@@ -151,7 +151,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public OptionSet options;
public org.bukkit.command.ConsoleCommandSender console;
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
- public ConsoleReader reader;
+ //public ConsoleReader reader; // Paper
public static int currentTick = 0; // Paper - Further improve tick loop
public boolean serverAutoSave = false; // Paper
public final Thread primaryThread;
@@ -188,7 +187,9 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.ac.a((IResourcePackListener) this.al);
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
@@ -199,7 +199,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.K = s;
// CraftBukkit start
this.options = options;
+ // Paper start - Handled by TerminalConsoleAppender
@ -215,16 +216,16 @@ index db511c1fe8..c6ecdf6e8e 100644
if (System.console() == null && System.getProperty("jline.terminal") == null) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
Main.useJline = false;
@@ -209,6 +210,8 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
@@ -220,6 +222,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
LOGGER.warn((String) null, ex);
}
}
+ */
+ // Paper end
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
this.serverThread = primaryThread = new Thread(this, "Server thread"); // Moved from main
@@ -873,7 +876,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
}
// CraftBukkit end
@@ -928,7 +932,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} finally {
// CraftBukkit start - Restore terminal to original settings
try {
@ -233,23 +234,23 @@ index db511c1fe8..c6ecdf6e8e 100644
} catch (Exception ignored) {
}
// CraftBukkit end
@@ -1362,7 +1365,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
}
@@ -1402,7 +1406,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Override
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
- 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 KeyPair E() {
public KeyPair getKeyPair() {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 9d44dcb3b2..8bb3fef21e 100644
index 46a3f0751..52b2f4874 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -77,8 +77,7 @@ public abstract class PlayerList {
@@ -76,8 +76,7 @@ public abstract class PlayerList {
public PlayerList(MinecraftServer minecraftserver) {
this.cserver = minecraftserver.server = new CraftServer(minecraftserver, this);
public PlayerList(MinecraftServer minecraftserver, int i) {
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
- minecraftserver.console = org.bukkit.craftbukkit.command.ColouredConsoleSender.getInstance();
- minecraftserver.reader.addCompleter(new org.bukkit.craftbukkit.command.ConsoleCommandCompleter(minecraftserver.server));
+ minecraftserver.console = new com.destroystokyo.paper.console.TerminalConsoleCommandSender(); // Paper
@ -257,20 +258,18 @@ index 9d44dcb3b2..8bb3fef21e 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 962170cd3f..7e4f42b3f4 100644
index b2aee24e5..2bdbc939e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -146,8 +146,8 @@ import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
@@ -41,7 +41,6 @@ import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
-import jline.console.ConsoleReader;
import org.bukkit.Keyed;
+import org.apache.commons.lang.StringUtils;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
@@ -1155,9 +1155,13 @@ public final class CraftServer implements Server {
import net.minecraft.server.Advancement;
import net.minecraft.server.ArgumentEntity;
import net.minecraft.server.Block;
@@ -1084,9 +1083,13 @@ public final class CraftServer implements Server {
return logger;
}
@ -285,10 +284,10 @@ index 962170cd3f..7e4f42b3f4 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 472a8070e7..4102e19700 100644
index 5203e781e..e3d163ac4 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;
@@ -13,7 +13,7 @@ import java.util.logging.Logger;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import net.minecraft.server.MinecraftServer;
@ -297,7 +296,7 @@ index 472a8070e7..4102e19700 100644
public class Main {
public static boolean useJline = true;
@@ -178,6 +178,8 @@ public class Main {
@@ -177,6 +177,8 @@ public class Main {
}
try {
@ -306,7 +305,7 @@ index 472a8070e7..4102e19700 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'});
@@ -195,10 +197,18 @@ public class Main {
@@ -194,10 +196,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());
}
@ -324,26 +323,24 @@ index 472a8070e7..4102e19700 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 26a2fb8942..0000000000
index fdf2f075e..000000000
--- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
+++ /dev/null
@@ -1,74 +0,0 @@
@@ -1,72 +0,0 @@
-package org.bukkit.craftbukkit.command;
-
-import java.util.EnumMap;
-import java.util.Map;
-
-import org.fusesource.jansi.Ansi;
-import org.fusesource.jansi.Ansi.Attribute;
-import jline.Terminal;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.command.ConsoleCommandSender;
-import org.bukkit.craftbukkit.CraftServer;
-import org.fusesource.jansi.Ansi;
-import org.fusesource.jansi.Ansi.Attribute;
-
-public class ColouredConsoleSender extends CraftConsoleCommandSender {
- private final Terminal terminal;
@ -406,14 +403,17 @@ index 26a2fb8942..0000000000
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
index 33e8ea02c4..1e3aae3b8f 100644
index 48d4dc7e2..24f4a16a6 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
@@ -8,17 +8,27 @@ import java.util.logging.Level;
@@ -4,19 +4,30 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
-import jline.console.completer.Completer;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.util.Waitable;
-import jline.console.completer.Completer;
+
+// Paper start - JLine update
+import net.minecraft.server.DedicatedServer; // Paper
+import org.jline.reader.Candidate;
@ -441,7 +441,7 @@ index 33e8ea02c4..1e3aae3b8f 100644
Waitable<List<String>> waitable = new Waitable<List<String>>() {
@Override
protected List<String> evaluate() {
@@ -30,25 +40,37 @@ public class ConsoleCommandCompleter implements Completer {
@@ -28,25 +39,37 @@ public class ConsoleCommandCompleter implements Completer {
return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions();
}
};
@ -452,9 +452,8 @@ index 33e8ea02c4..1e3aae3b8f 100644
if (offers == null) {
- return cursor;
+ return; // Paper - Method returns void
}
- candidates.addAll(offers);
+ }
+
+ // Paper start - JLine update
+ for (String completion : offers) {
+ if (completion.isEmpty()) {
@ -462,9 +461,10 @@ index 33e8ea02c4..1e3aae3b8f 100644
+ }
+
+ candidates.add(new Candidate(completion));
+ }
}
- candidates.addAll(offers);
+ // Paper end
+
+ // Paper start - JLine handles cursor now
+ /*
final int lastSpace = buffer.lastIndexOf(' ');
@ -485,11 +485,11 @@ index 33e8ea02c4..1e3aae3b8f 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
index 984df4083d..bbb5a84f36 100644
index 70f8d4299..449e99d1b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
@@ -20,7 +20,7 @@ public class ServerShutdownThread extends Thread {
ex.printStackTrace();
@@ -17,7 +17,7 @@ public class ServerShutdownThread extends Thread {
server.close();
} finally {
try {
- server.reader.getTerminal().restore();
@ -499,29 +499,31 @@ index 984df4083d..bbb5a84f36 100644
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
deleted file mode 100644
index b640971130..0000000000
index f239cd623..000000000
--- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
+++ /dev/null
@@ -1,54 +0,0 @@
@@ -1,56 +0,0 @@
-package org.bukkit.craftbukkit.util;
-
-import com.mojang.util.QueueLogAppender;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import jline.console.ConsoleReader;
-import com.mojang.util.QueueLogAppender;
-import org.bukkit.craftbukkit.Main;
-import org.fusesource.jansi.Ansi;
-import org.fusesource.jansi.Ansi.Erase;
-
-public class TerminalConsoleWriterThread implements Runnable {
- final private ConsoleReader reader;
- final private OutputStream output;
-public class TerminalConsoleWriterThread extends Thread {
- private final ConsoleReader reader;
- private final OutputStream output;
-
- public TerminalConsoleWriterThread(OutputStream output, ConsoleReader reader) {
- this.output = output;
- this.reader = reader;
-
- this.setDaemon(true);
- }
-
- public void run() {
@ -558,7 +560,7 @@ index b640971130..0000000000
- }
-}
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 5cee8f00ef..08b6bb7f97 100644
index 490a9acc7..08b6bb7f9 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -1,12 +1,11 @@
@ -568,7 +570,7 @@ index 5cee8f00ef..08b6bb7f97 100644
<Appenders>
- <Console name="WINDOWS_COMPAT" target="SYSTEM_OUT"></Console>
- <Queue name="TerminalConsole">
- <PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" />
- <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
- </Queue>
+ <TerminalConsole name="TerminalConsole">
+ <PatternLayout pattern="%highlightError{[%d{HH:mm:ss} %level]: %minecraftFormatting{%msg}%n%xEx}" />

View File

@ -1,4 +1,4 @@
From 23d7e81210b0cf3e58cfaeb0a8362a20b1cf8c38 Mon Sep 17 00:00:00 2001
From e79896a5e06f75fb67c7c3a3506da1332b7abb26 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 8ff454e259..3baf0380c0 100644
index a34121495..abc967d3f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -381,4 +381,10 @@ public class PaperWorldConfig {
@@ -332,4 +332,10 @@ public class PaperWorldConfig {
parrotsHangOnBetter = getBoolean("parrots-are-unaffected-by-player-movement", false);
log("Parrots are unaffected by player movement: " + parrotsHangOnBetter);
}
@ -21,10 +21,10 @@ index 8ff454e259..3baf0380c0 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index 81e602d1b9..b6af429044 100644
index 13ddc00d6..9f03d0337 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -214,7 +214,7 @@ public class EntityCreeper extends EntityMonster {
@@ -225,7 +225,7 @@ public class EntityCreeper extends EntityMonster {
private void createEffectCloud() {
Collection<MobEffect> collection = this.getEffects();

View File

@ -1,14 +1,14 @@
From 1853596fcd97ca2e82211602010b3c14e08ffbf7 Mon Sep 17 00:00:00 2001
From e165a8a956f42b823b6cf6597b5ed62d6fb9e404 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 c530824596..98e214cdd6 100644
index 5d830b245..f1621a9e9 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -530,6 +530,11 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -510,6 +510,11 @@ public abstract class EntityInsentient extends EntityLiving {
EntityItem entityitem = (EntityItem) iterator.next();
if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.q()) {
@ -21,22 +21,22 @@ index c530824596..98e214cdd6 100644
}
}
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 9b854d64fb..39a804b7cb 100644
index fe70a3a8b..36b5fb537 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -13,6 +13,7 @@ public class EntityItem extends Entity {
private static final DataWatcherObject<ItemStack> b = DataWatcher.a(EntityItem.class, DataWatcherRegistry.g);
public int age; // PAIL
public int pickupDelay;
@@ -19,6 +19,7 @@ public class EntityItem extends Entity {
private UUID owner;
public final float b;
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
+ public boolean canMobPickup = true; // Paper
private int e;
private UUID f;
private UUID g;
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
super(entitytypes, world);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index 55d6bacf77..6036592f76 100644
index 0dbca8f00..65b23f511 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -45,6 +45,16 @@ public class CraftItem extends CraftEntity implements Item {
@@ -44,6 +44,16 @@ public class CraftItem extends CraftEntity implements Item {
item.age = value;
}

View File

@ -1,14 +1,14 @@
From 7146ff6a0122d0a286b5bda25234c78a43bbb4bd Mon Sep 17 00:00:00 2001
From a901f50b7ca1bb20b0587dad07e4affc10fb35fa 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 39a804b7cb..921a56c312 100644
index 36b5fb537..e02df8987 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -308,6 +308,7 @@ public class EntityItem extends Entity {
@@ -316,6 +316,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 39a804b7cb..921a56c312 100644
if (this.pickupDelay <= 0 && canHold > 0) {
itemstack.setCount(canHold);
@@ -315,7 +316,13 @@ public class EntityItem extends Entity {
@@ -323,7 +324,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,10 +30,10 @@ index 39a804b7cb..921a56c312 100644
return;
}
@@ -335,7 +342,11 @@ public class EntityItem extends Entity {
@@ -343,7 +350,11 @@ public class EntityItem extends Entity {
// CraftBukkit end
if (this.pickupDelay == 0 && (this.g == null || 6000 - this.age <= 200 || this.g.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
if (this.pickupDelay == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
- entityhuman.receive(this, i);
+ // Paper Start
+ if (flyAtPlayer) {

View File

@ -1,14 +1,14 @@
From a52801098de2cc54251d3838c161e80c207f0277 Mon Sep 17 00:00:00 2001
From 8559585ae4946733a3fd8d088a3509f9348ac663 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 921a56c312..e9986420c2 100644
index e02df8987..c582c6711 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -7,6 +7,7 @@ import javax.annotation.Nullable;
@@ -8,6 +8,7 @@ import javax.annotation.Nullable;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
// CraftBukkit end
@ -16,7 +16,7 @@ index 921a56c312..e9986420c2 100644
public class EntityItem extends Entity {
@@ -310,6 +311,22 @@ public class EntityItem extends Entity {
@@ -318,6 +319,22 @@ public class EntityItem extends Entity {
int remaining = i - canHold;
boolean flyAtPlayer = false; // Paper

View File

@ -1,14 +1,14 @@
From 000033b190d3ae3628da53a244ebda476e91e045 Mon Sep 17 00:00:00 2001
From 024f41d77e9e1bf1d59b70e41b1a72e47205c216 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 7e4f42b3f4..e8991ce1c9 100644
index 2bdbc939e..4e5e2d109 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -83,6 +83,7 @@ import org.bukkit.craftbukkit.util.Versioning;
@@ -148,6 +148,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,7 +16,7 @@ index 7e4f42b3f4..e8991ce1c9 100644
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
import org.bukkit.event.server.BroadcastMessageEvent;
@@ -732,7 +733,13 @@ public final class CraftServer implements Server {
@@ -734,7 +735,13 @@ public final class CraftServer implements Server {
// Spigot start
if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {

View File

@ -1,4 +1,4 @@
From 84287d566df3a35f5121f707f2801f9ca9d325b8 Mon Sep 17 00:00:00 2001
From 23cbe9f146fddcdc7b886f7d8951163dc89dddc7 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
@ -7,7 +7,7 @@ Establishes base extension of profile systems for future edits too
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
new file mode 100644
index 0000000000..b151a13c1b
index 000000000..b151a13c1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -0,0 +1,280 @@
@ -293,7 +293,7 @@ index 0000000000..b151a13c1b
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
new file mode 100644
index 0000000000..25836b975b
index 000000000..25836b975
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
@@ -0,0 +1,30 @@
@ -329,7 +329,7 @@ index 0000000000..25836b975b
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
new file mode 100644
index 0000000000..3bcdb8f93f
index 000000000..3bcdb8f93
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
@@ -0,0 +1,17 @@
@ -352,7 +352,7 @@ index 0000000000..3bcdb8f93f
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
new file mode 100644
index 0000000000..4b2a67423f
index 000000000..4b2a67423
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@@ -0,0 +1,29 @@
@ -387,7 +387,7 @@ index 0000000000..4b2a67423f
+}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java
new file mode 100644
index 0000000000..3aceb0ea8a
index 000000000..3aceb0ea8
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperUserAuthentication.java
@@ -0,0 +1,11 @@
@ -403,7 +403,7 @@ index 0000000000..3aceb0ea8a
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index e1af5c4885..0ef5ad1165 100644
index e1af5c488..0ef5ad116 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -1,7 +1,10 @@
@ -429,28 +429,28 @@ index e1af5c4885..0ef5ad1165 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 c6ecdf6e8e..5517c5fe81 100644
index dc6d7b3a2..27d0d818b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1186,7 +1186,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
*/ // CraftBukkit end
String s1 = "."; // PAIL?
@@ -1237,7 +1237,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
DispenserRegistry.init();
DispenserRegistry.c();
String s = "."; // PAIL?
- YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString());
+ YggdrasilAuthenticationService yggdrasilauthenticationservice = new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString()); // Paper
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(s1, MinecraftServer.a.getName()));
@@ -1635,6 +1635,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
this.G = i;
UserCache usercache = new UserCache(gameprofilerepository, new File(s, MinecraftServer.b.getName()));
@@ -1693,6 +1693,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.H = i;
}
+ public MinecraftSessionService getSessionService() { return ap(); } // Paper - OBFHELPER
public MinecraftSessionService ap() {
return this.V;
+ public final MinecraftSessionService getSessionService() { return this.getMinecraftSessionService(); } // Paper - OBFHELPER
public MinecraftSessionService getMinecraftSessionService() {
return this.minecraftSessionService;
}
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 9bf2521be6..0596658362 100644
index 409bc6da9..9eaf1539f 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -43,7 +43,7 @@ public class UserCache {
@ -486,33 +486,35 @@ index 9bf2521be6..0596658362 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 e8991ce1c9..1e8c4a85cb 100644
index 4e5e2d109..cfcb7a4fd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -164,6 +164,10 @@ import org.bukkit.event.server.ServerLoadEvent;
import org.bukkit.event.server.TabCompleteEvent;
import net.md_5.bungee.api.chat.BaseComponent;
@@ -195,6 +195,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
import net.md_5.bungee.api.chat.BaseComponent; // Spigot
+import javax.annotation.Nullable; // Paper
+import javax.annotation.Nonnull; // Paper
+
+
public final class CraftServer implements Server {
private final String serverName = "Paper"; // Paper
private final String serverVersion;
@@ -2157,5 +2161,21 @@ public final class CraftServer implements Server {
@@ -2092,5 +2095,24 @@ public final class CraftServer implements Server {
public boolean suggestPlayerNamesWhenNullTabCompletions() {
return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions;
}
+
+ @Override
+ public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull UUID uuid) {
+ return createProfile(uuid, null);
+ }
+
+ @Override
+ public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nonnull String name) {
+ return createProfile(null, name);
+ }
+
+ @Override
+ public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) {
+ Player player = uuid != null ? Bukkit.getPlayer(uuid) : (name != null ? Bukkit.getPlayerExact(name) : null);
+ if (player != null) {

View File

@ -1,31 +0,0 @@
From 07d5f44136276bd9b2e3faaf2454084a5fb16776 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 7 Jan 2017 16:06:44 -0500
Subject: [PATCH] Enforce Sync Chunk Unloads
Unloading Chunks async is extremely dangerous. This will force it to main
the same way we handle async chunk loads.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 010c5fc731..6718028190 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -236,6 +236,7 @@ public class CraftWorld implements World {
}
private boolean unloadChunk0(int x, int z, boolean save) {
+ Boolean result = MCUtil.ensureMain("Unload Chunk", () -> { // Paper - Ensure never async
net.minecraft.server.Chunk chunk = world.getChunkProvider().getChunkAt(x, z, false, false);
if (chunk == null) {
return true;
@@ -243,6 +244,7 @@ public class CraftWorld implements World {
// If chunk had previously been queued to save, must do save to avoid loss of that data
return world.getChunkProvider().unloadChunk(chunk, chunk.mustSave || save);
+ }); return result != null ? result : false; // Paper - Ensure never async
}
public boolean regenerateChunk(int x, int z) {
--
2.21.0

View File

@ -1,22 +0,0 @@
From 5d07c6b4f0e47adab15bb8f1ef878b92af6b715c 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 2997767282..41926a361b 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -313,7 +313,7 @@ public class ChunkProviderServer implements IChunkProvider {
// Spigot start
org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant;
activityAccountant.startActivity(0.5);
- int targetSize = (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR);
+ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
// Spigot end
Iterator<Long> iterator = this.unloadQueue.iterator();
--
2.21.0

View File

@ -1,4 +1,4 @@
From 5fe4df0be5a011f8ee6610a8fdf97b15fc8a4e1d Mon Sep 17 00:00:00 2001
From 2fbf2c556d7840198741959940696a14c7e3c26a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 18 Jun 2016 23:22:12 -0400
Subject: [PATCH] Delay Chunk Unloads based on Player Movement