even even more work

This commit is contained in:
Spottedleaf 2020-06-25 06:11:48 -07:00
parent 2bf5db6cc9
commit 8ac3123f9f
64 changed files with 486 additions and 469 deletions

View File

@ -5,7 +5,7 @@ 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 176af6c889fa29d5df7c822f888cdc26f81110e6..992d7bfb0fd26540fbdeaf8d7845e8c2c81d608b 100644
index 3571ef9ac1299702ad274aad43070abf959bf9d9..0232ffba7b18174e0ce44d91285541a9869d07b9 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -826,5 +826,10 @@ public class EntityArmorStand extends EntityLiving {
@ -20,22 +20,22 @@ index 176af6c889fa29d5df7c822f888cdc26f81110e6..992d7bfb0fd26540fbdeaf8d7845e8c2
// Paper end
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index f4d68a5f0a6d28f278596cb6787d070bacd792a4..28d873d8fe7bb79d2a84eb9bf234ac8ba0223813 100644
index 0799f3b025c25204fddfd818b314ec1452a1ba1a..34f2821a64c7893ff0a8c33ae4b77ce883227f0c 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -227,6 +227,7 @@ public abstract class EntityLiving extends Entity {
@@ -244,6 +244,7 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag, iblockdata, blockposition);
}
+ public boolean canBreatheUnderwater() { return this.cB(); } // Paper - OBFHELPER
public boolean cB() {
+ public boolean canBreatheUnderwater() { return this.cL(); } // Paper - OBFHELPER
public boolean cL() {
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
@@ -266,7 +267,7 @@ public abstract class EntityLiving extends Entity {
@@ -287,7 +288,7 @@ public abstract class EntityLiving extends Entity {
if (this.isAlive()) {
if (this.a(TagsFluid.WATER) && this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).getBlock() != Blocks.BUBBLE_COLUMN) {
- if (!this.cB() && !MobEffectUtil.c(this) && !flag1) {
if (this.a((Tag) TagsFluid.WATER) && !this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).a(Blocks.BUBBLE_COLUMN)) {
- 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.l(this.getAirTicks()));
if (this.getAirTicks() == -20) {

View File

@ -30,18 +30,18 @@ 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 629304c403c596bf81dd8de919f0fcb5c77bd403..80d8b0b0eac47b8d8e62db60da9daf0da8671fb3 100644
index 800ca2d57295c40853f5f1e58ce15e75f1a5afad..8e47f5f5dcf217169107913cc0c8332ce881c644 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -88,6 +88,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
@@ -90,6 +90,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public final Map<ResourceKey<World>, WorldServer> worldServer;
private PlayerList playerList;
private volatile boolean isRunning = true;
private volatile boolean isRunning;
+ private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
private boolean isStopped;
private int ticks;
protected final Proxy proxy;
@@ -723,7 +724,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -739,7 +740,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (this.playerList != null) {
MinecraftServer.LOGGER.info("Saving players");
this.playerList.savePlayers();
@ -50,7 +50,7 @@ index 629304c403c596bf81dd8de919f0fcb5c77bd403..80d8b0b0eac47b8d8e62db60da9daf0d
try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
@@ -780,8 +781,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -804,8 +805,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
return this.isRunning;
}
@ -64,7 +64,7 @@ index 629304c403c596bf81dd8de919f0fcb5c77bd403..80d8b0b0eac47b8d8e62db60da9daf0d
if (flag) {
try {
this.serverThread.join();
@@ -791,6 +797,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -815,6 +821,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
}
@ -73,11 +73,11 @@ index 629304c403c596bf81dd8de919f0fcb5c77bd403..80d8b0b0eac47b8d8e62db60da9daf0d
// 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 18c81bdcf206ecaa331cc5186a29ad321870b57f..d6af965c9d391ee802d0d65110fe62f1eacbac98 100644
index 414e23fc24e90829b71def39b186f1913ce8300d..c595d6e6126749a94e264acdb9e0ba609c72e6bc 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1031,10 +1031,15 @@ public abstract class PlayerList {
entityplayer.playerInteractManager.b(generatoraccess.getWorldData().getGameType());
@@ -1071,10 +1071,15 @@ public abstract class PlayerList {
entityplayer.playerInteractManager.b(worldserver.getMinecraftServer().getSaveData().getGameType());
}
+ // Paper start - Extract method to allow for restarting flag
@ -93,7 +93,7 @@ index 18c81bdcf206ecaa331cc5186a29ad321870b57f..d6af965c9d391ee802d0d65110fe62f1
}
// CraftBukkit end
@@ -1046,6 +1051,7 @@ public abstract class PlayerList {
@@ -1086,6 +1091,7 @@ public abstract class PlayerList {
}
// Paper end
}

View File

@ -26,10 +26,10 @@ index 751551f173338217f6682532a9a5e1a269415177..eae1690cc6db99b2f3af70a121f83b45
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 0e8ba05455161883c86df6606104fab3529c3c0c..ad79e4521cee699de86a94885b27356339bcb866 100644
index d1cf7602a0c47723593be11c030d3c819426d4d4..0dc2ffcfceeffed2cb949d31c4f976bce639f110 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -463,7 +463,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.abilities.isFlying || this.isSleeping()) {
@ -39,10 +39,10 @@ index 0e8ba05455161883c86df6606104fab3529c3c0c..ad79e4521cee699de86a94885b273563
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d6f5f176d4b5a39ddea4a9dc31a2322cc7d9d2d0..26f894c752d623ed082f97fdbffe5a6680a941b7 100644
index f802bcb386b67e6c59aee68d6bfa507461f522cf..ace3f3e30224c09bdb296e4ac2974fb0bd3e7dbc 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1773,6 +1773,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1817,6 +1817,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
switch (packetplayinentityaction.c()) {
case PRESS_SHIFT_KEY:
this.player.setSneaking(true);

View File

@ -20,10 +20,10 @@ index 5a83fc21cb6801d597a01fb4a83d30488f30bdb6..295b8390cbc31fc1fcb225f80ec2ff8f
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 3cb57c3b8ca8f29437bea52e9cf3512985f56eb5..9eb4acf93c65a1473e385be317e5d93cd4571d41 100644
index a0d1e57ff34dfb36913ff937575bb3c1ad444f54..2cbf143d1a01a34c67b75ab1f7cd35f4a3a2f751 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2137,5 +2137,10 @@ public final class CraftServer implements Server {
@@ -2188,5 +2188,10 @@ public final class CraftServer implements Server {
commandMap.registerServerAliases();
return true;
}

View File

@ -19,7 +19,7 @@ Other changes:
configuration
diff --git a/pom.xml b/pom.xml
index 3554314526b3f33ad02df2adfd42d45118d75526..aeaceac771644ece5365d07be77f4481ced2fe13 100644
index 7bc5bf271e435e1e0d85af133f1352f319f462b5..2acc2a98bd8df6d81b5865b768265a210597b57b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,10 +44,27 @@
@ -144,10 +144,10 @@ index 0000000000000000000000000000000000000000..685deaa0e5d1ddc13e3a7c0471b1cfcf
+
+}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa67934944 100644
index b091db5901d75769e406c454b205f102c82ca021..49b5c226dcbd4ef7d2a3418ef2c7e98bb689ccfb 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -86,6 +86,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -62,6 +62,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
if (!org.bukkit.craftbukkit.Main.useConsole) {
return;
}
@ -157,7 +157,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa
jline.console.ConsoleReader bufferedreader = reader;
// MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return
@@ -125,6 +128,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -101,6 +104,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
}
@ -166,7 +166,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa
}
};
@@ -136,6 +141,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -112,6 +117,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler());
@ -176,7 +176,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa
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) {
@@ -144,6 +152,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -120,6 +128,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader).start();
@ -186,7 +186,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa
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 80d8b0b0eac47b8d8e62db60da9daf0da8671fb3..ed32242bd169e9f28607942aa31aa48a5799b215 100644
index 8e47f5f5dcf217169107913cc0c8332ce881c644..f2cdf60fd96f94e09a17ad1bdec522d282ccf3e9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -57,7 +57,7 @@ import org.apache.commons.lang3.Validate;
@ -194,11 +194,11 @@ index 80d8b0b0eac47b8d8e62db60da9daf0da8671fb3..ed32242bd169e9f28607942aa31aa48a
import org.apache.logging.log4j.Logger;
// CraftBukkit start
-import jline.console.ConsoleReader;
+import joptsimple.OptionSet;
+// Paper
import joptsimple.OptionSet;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.Main;
@@ -161,7 +161,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -144,7 +144,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public OptionSet options;
public org.bukkit.command.ConsoleCommandSender console;
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
@ -207,17 +207,17 @@ index 80d8b0b0eac47b8d8e62db60da9daf0da8671fb3..ed32242bd169e9f28607942aa31aa48a
public static int currentTick = 0; // Paper - Further improve tick loop
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
@@ -212,7 +212,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.K = s;
// CraftBukkit start
@@ -214,7 +214,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.options = options;
this.datapackconfiguration = datapackconfiguration;
this.vanillaCommandDispatcher = datapackresources.commandDispatcher; // CraftBukkit
+ // Paper start - Handled by TerminalConsoleAppender
// Try to see if we're actually running in a terminal, disable jline if not
+ /*
if (System.console() == null && System.getProperty("jline.terminal") == null) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
Main.useJline = false;
@@ -233,6 +235,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -235,6 +237,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
LOGGER.warn((String) null, ex);
}
}
@ -226,7 +226,7 @@ index 80d8b0b0eac47b8d8e62db60da9daf0da8671fb3..ed32242bd169e9f28607942aa31aa48a
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
}
// CraftBukkit end
@@ -954,7 +958,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -977,7 +981,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
org.spigotmc.WatchdogThread.doStop(); // Spigot
// CraftBukkit start - Restore terminal to original settings
try {
@ -235,22 +235,22 @@ index 80d8b0b0eac47b8d8e62db60da9daf0da8671fb3..ed32242bd169e9f28607942aa31aa48a
} catch (Exception ignored) {
}
// CraftBukkit end
@@ -1478,7 +1482,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1348,7 +1352,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Override
public void sendMessage(IChatBaseComponent ichatbasecomponent) {
public void sendMessage(IChatBaseComponent ichatbasecomponent, UUID uuid) {
- MinecraftServer.LOGGER.info(ichatbasecomponent.getString());
+ MinecraftServer.LOGGER.info(org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(ichatbasecomponent));// Paper - Log message with colors
}
public KeyPair getKeyPair() {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index d6af965c9d391ee802d0d65110fe62f1eacbac98..6b669f0f632418d36617c980b01cfcd0ef7487c2 100644
index c595d6e6126749a94e264acdb9e0ba609c72e6bc..21f583302e9d8da8c9a9651ce40c64dc8abfa512 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -76,8 +76,7 @@ public abstract class PlayerList {
@@ -79,8 +79,7 @@ public abstract class PlayerList {
public PlayerList(MinecraftServer minecraftserver, int i) {
public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, 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));
@ -259,10 +259,10 @@ index d6af965c9d391ee802d0d65110fe62f1eacbac98..6b669f0f632418d36617c980b01cfcd0
this.k = new GameProfileBanList(PlayerList.b);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9eb4acf93c65a1473e385be317e5d93cd4571d41..681a84e5b3e7594a43fac0d47f1df2eef310bf81 100644
index 2cbf143d1a01a34c67b75ab1f7cd35f4a3a2f751..08bc47fdec472c73493cc1a75bd0d84287b1c811 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -42,7 +42,7 @@ import java.util.function.Consumer;
@@ -45,7 +45,7 @@ import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
@ -270,8 +270,8 @@ index 9eb4acf93c65a1473e385be317e5d93cd4571d41..681a84e5b3e7594a43fac0d47f1df2ee
+//import jline.console.ConsoleReader; // Paper
import net.minecraft.server.Advancement;
import net.minecraft.server.ArgumentEntity;
import net.minecraft.server.Block;
@@ -1118,9 +1118,13 @@ public final class CraftServer implements Server {
import net.minecraft.server.BiomeManager;
@@ -1177,9 +1177,13 @@ public final class CraftServer implements Server {
return logger;
}
@ -286,13 +286,13 @@ index 9eb4acf93c65a1473e385be317e5d93cd4571d41..681a84e5b3e7594a43fac0d47f1df2ee
@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 18a945ea8674390d294e2a978c78ee2b53039aed..c3641ca48bfe4051f6450c891ccd4dd023257cb5 100644
index b1157195cf00a05d3417bccf781fdf58ff9919b6..b77b051137f66106bac396debe0c0542ac86e257 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -13,7 +13,7 @@ import java.util.logging.Logger;
@@ -12,7 +12,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import net.minecraft.server.MinecraftServer;
-import org.fusesource.jansi.AnsiConsole;
+import net.minecrell.terminalconsole.TerminalConsoleAppender; // Paper
@ -325,7 +325,7 @@ index 18a945ea8674390d294e2a978c78ee2b53039aed..c3641ca48bfe4051f6450c891ccd4dd0
+ 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) {
@@ -226,7 +237,7 @@ public class Main {
System.out.println("Unable to read system info");
}
@ -333,10 +333,10 @@ index 18a945ea8674390d294e2a978c78ee2b53039aed..c3641ca48bfe4051f6450c891ccd4dd0
-
+ System.setProperty( "library.jansi.version", "Paper" ); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows
System.out.println("Loading libraries, please wait...");
MinecraftServer.main(options);
net.minecraft.server.Main.main(options);
} catch (Throwable t) {
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
index e0bd5adc19de0d4ab156bac95d3b4b2a86f89490..aae615c13b36f8e72b12260de8996317912fa917 100644
index fefb09f27d166568e9bbe6a7eea5067116103d89..88acfeb8fa1a82f7a896a181ac57b435454656df 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
@@ -2,15 +2,15 @@ package org.bukkit.craftbukkit.command;

View File

@ -21,10 +21,10 @@ index eae1690cc6db99b2f3af70a121f83b455b0fb20d..39ab5457569684bc66cd67f5f9d2505e
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index cc9887d040c06e453f11e94bb260a4504a607301..374cf28fb42b13152f58fd63c4f0cb25eae6a2d9 100644
index 302f795f27d67c1ce5257d3a8584866ffb5d2fef..af9ac84c2caf42d0714d6050ee7db7e39a47878b 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -228,7 +228,7 @@ public class EntityCreeper extends EntityMonster {
@@ -226,7 +226,7 @@ public class EntityCreeper extends EntityMonster {
private void createEffectCloud() {
Collection<MobEffect> collection = this.getEffects();

View File

@ -5,23 +5,23 @@ 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 1732c1ae9537957c51da5e484b55febb6e9f0091..b5816dc89ede5f5f1780d3086d9b1a41fba2b19d 100644
index f2cd6824790d7e76f8f10e2630bcd5ebbf2a4238..3997dc6d979bf5a027861397b948aa4e8486fc58 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -521,6 +521,11 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -539,6 +539,11 @@ public abstract class EntityInsentient extends EntityLiving {
EntityItem entityitem = (EntityItem) iterator.next();
if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p()) {
if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p() && this.i(entityitem.getItemStack())) {
+ // Paper Start
+ if (!entityitem.canMobPickup) {
+ continue;
+ }
+ // Paper End
this.a(entityitem);
this.b(entityitem);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 208dad2a34de2b898c3811af6e5363009f97a55f..97c6a8b6bd0bf9738428c2fda24b9e2586a783dd 100644
index ca1cc67fea6f1607a2d3d7869a0a023616c02ff7..159552192c2a6d62fb205ed5973f89a16e619d94 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -20,6 +20,7 @@ public class EntityItem extends Entity {

View File

@ -5,10 +5,10 @@ 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 97c6a8b6bd0bf9738428c2fda24b9e2586a783dd..8747dc7075ebe178f3b9ad3cb56f52847fd194b5 100644
index 159552192c2a6d62fb205ed5973f89a16e619d94..2546a706ef107fd94e4c17c10091d6c0a7241a70 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -322,6 +322,7 @@ public class EntityItem extends Entity {
@@ -331,6 +331,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 97c6a8b6bd0bf9738428c2fda24b9e2586a783dd..8747dc7075ebe178f3b9ad3cb56f5284
if (this.pickupDelay <= 0 && canHold > 0) {
itemstack.setCount(canHold);
@@ -329,8 +330,14 @@ public class EntityItem extends Entity {
@@ -338,8 +339,14 @@ 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);
@ -31,7 +31,7 @@ index 97c6a8b6bd0bf9738428c2fda24b9e2586a783dd..8747dc7075ebe178f3b9ad3cb56f5284
return;
}
@@ -354,7 +361,11 @@ public class EntityItem extends Entity {
@@ -363,7 +370,11 @@ public class EntityItem extends Entity {
// CraftBukkit end
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 8747dc7075ebe178f3b9ad3cb56f52847fd194b5..5efcc50ab9e8a99d88a9d2e7f15ecbcc4439b93e 100644
index 2546a706ef107fd94e4c17c10091d6c0a7241a70..cc173445caa0a064e724bc29b4955232a1dc1816 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -9,6 +9,7 @@ import javax.annotation.Nullable;
@ -16,7 +16,7 @@ index 8747dc7075ebe178f3b9ad3cb56f52847fd194b5..5efcc50ab9e8a99d88a9d2e7f15ecbcc
public class EntityItem extends Entity {
@@ -324,6 +325,22 @@ public class EntityItem extends Entity {
@@ -333,6 +334,22 @@ public class EntityItem extends Entity {
int remaining = i - canHold;
boolean flyAtPlayer = false; // Paper

View File

@ -5,18 +5,18 @@ 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 681a84e5b3e7594a43fac0d47f1df2eef310bf81..f01bd38d0b600a69224f610fd77a542ec6d1c322 100644
index 08bc47fdec472c73493cc1a75bd0d84287b1c811..1d7549e03bc43f1867662acf12ae3cb82a951478 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -80,6 +80,7 @@ import net.minecraft.server.WorldServer;
@@ -104,6 +104,7 @@ import net.minecraft.server.WorldNBTStorage;
import net.minecraft.server.WorldServer;
import net.minecraft.server.WorldSettings;
import net.minecraft.server.WorldType;
import org.apache.commons.lang.Validate;
+import org.apache.commons.lang3.StringUtils;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -151,6 +152,7 @@ import org.bukkit.craftbukkit.util.Versioning;
@@ -175,6 +176,7 @@ import org.bukkit.craftbukkit.util.Versioning;
import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -24,7 +24,7 @@ index 681a84e5b3e7594a43fac0d47f1df2eef310bf81..f01bd38d0b600a69224f610fd77a542e
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
import org.bukkit.event.server.BroadcastMessageEvent;
@@ -751,7 +753,13 @@ public final class CraftServer implements Server {
@@ -775,7 +777,13 @@ public final class CraftServer implements Server {
// Spigot start
if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {

View File

@ -309,23 +309,24 @@ index 0000000000000000000000000000000000000000..d73de9eb89c4e3a748907f2da21a3072
+}
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 0000000000000000000000000000000000000000..25836b975b51af701d4b9523ab398fbf157b82fd
index 0000000000000000000000000000000000000000..ef9f55afd6bffa8c02c6820295223e5465eed91e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java
@@ -0,0 +1,30 @@
@@ -0,0 +1,31 @@
+package com.destroystokyo.paper.profile;
+
+import com.mojang.authlib.Agent;
+import com.mojang.authlib.GameProfileRepository;
+import com.mojang.authlib.UserAuthentication;
+import com.mojang.authlib.*;
+import com.mojang.authlib.minecraft.MinecraftSessionService;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import com.mojang.authlib.yggdrasil.YggdrasilEnvironment;
+
+import java.net.Proxy;
+
+public class PaperAuthenticationService extends YggdrasilAuthenticationService {
+ private final Environment environment;
+ public PaperAuthenticationService(Proxy proxy, String clientToken) {
+ super(proxy, clientToken);
+ this.environment = (Environment)EnvironmentParser.getEnvironmentFromProperties().orElse(YggdrasilEnvironment.PROD);;
+ }
+
+ @Override
@ -335,30 +336,31 @@ index 0000000000000000000000000000000000000000..25836b975b51af701d4b9523ab398fbf
+
+ @Override
+ public MinecraftSessionService createMinecraftSessionService() {
+ return new PaperMinecraftSessionService(this);
+ return new PaperMinecraftSessionService(this, this.environment);
+ }
+
+ @Override
+ public GameProfileRepository createProfileRepository() {
+ return new PaperGameProfileRepository(this);
+ return new PaperGameProfileRepository(this, this.environment);
+ }
+}
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 0000000000000000000000000000000000000000..3bcdb8f93f1930ee53395470ffb3833e2bd75222
index 0000000000000000000000000000000000000000..582c169c85ac66f1f9430f79042e4655f776c157
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
@@ -0,0 +1,17 @@
@@ -0,0 +1,18 @@
+package com.destroystokyo.paper.profile;
+
+import com.mojang.authlib.Agent;
+import com.mojang.authlib.Environment;
+import com.mojang.authlib.ProfileLookupCallback;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
+
+public class PaperGameProfileRepository extends YggdrasilGameProfileRepository {
+ public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService) {
+ super(authenticationService);
+ public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService, Environment environment) {
+ super(authenticationService, environment);
+ }
+
+ @Override
@ -368,12 +370,13 @@ index 0000000000000000000000000000000000000000..3bcdb8f93f1930ee53395470ffb3833e
+}
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 0000000000000000000000000000000000000000..4b2a67423f57b70d316115e4525e3841a415b1cc
index 0000000000000000000000000000000000000000..93d73c27340645c7502acafdc0b2cfbc1a759dd8
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@@ -0,0 +1,29 @@
@@ -0,0 +1,30 @@
+package com.destroystokyo.paper.profile;
+
+import com.mojang.authlib.Environment;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.minecraft.MinecraftProfileTexture;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
@ -382,8 +385,8 @@ index 0000000000000000000000000000000000000000..4b2a67423f57b70d316115e4525e3841
+import java.util.Map;
+
+public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionService {
+ protected PaperMinecraftSessionService(YggdrasilAuthenticationService authenticationService) {
+ super(authenticationService);
+ protected PaperMinecraftSessionService(YggdrasilAuthenticationService authenticationService, Environment environment) {
+ super(authenticationService, environment);
+ }
+
+ @Override
@ -419,7 +422,7 @@ index 0000000000000000000000000000000000000000..3aceb0ea8a1a3ed94dd8a9e954c52ecd
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 16302c4ac6d3e40318a762cea0afcf3f94715216..148917547bb7a626d1b2bacce7385607043db7e2 100644
index da7a325d070e194cd1664ed20dcb3a762c9a517a..797654c653ec6dc4d46b457cf8a6121b29eca7aa 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -1,8 +1,11 @@
@ -445,21 +448,25 @@ index 16302c4ac6d3e40318a762cea0afcf3f94715216..148917547bb7a626d1b2bacce7385607
/**
* 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 ed32242bd169e9f28607942aa31aa48a5799b215..54f80cb8e1b771f2a493543e04f8bc8346a391dc 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1304,7 +1304,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
DispenserRegistry.init();
DispenserRegistry.c();
File s = (File) optionset.valueOf("universe"); // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 4537fc3e134973679a6b661a98437fb9120fc449..a4a796c0287021625c03ec68b79d555067c449cc 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -87,7 +87,7 @@ public class Main {
}
File file = (File) optionset.valueOf("universe"); // CraftBukkit
- 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(s, MinecraftServer.b.getName()));
@@ -1769,6 +1769,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.H = i;
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName()));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f2cdf60fd96f94e09a17ad1bdec522d282ccf3e9..82e0def9becf8ecb68b2629531852808ad5a40a3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1599,6 +1599,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.G = i;
}
+ public final MinecraftSessionService getSessionService() { return this.getMinecraftSessionService(); } // Paper - OBFHELPER
@ -467,10 +474,10 @@ index ed32242bd169e9f28607942aa31aa48a5799b215..54f80cb8e1b771f2a493543e04f8bc83
return this.minecraftSessionService;
}
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
index 177cceb77f8783fe93ba7e4342de9c589f155c1b..83faa9dc5f74df4609cab34a66e4feed12990463 100644
index 4fae1b3274a96b871b39de083e9b28ab6129533f..9a2efd38f28819355a271b9515ac98c3382c7383 100644
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
@@ -158,6 +158,7 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
@@ -161,6 +161,7 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
private void f() {
// Spigot start
GameProfile profile = this.gameProfile;
@ -478,7 +485,7 @@ index 177cceb77f8783fe93ba7e4342de9c589f155c1b..83faa9dc5f74df4609cab34a66e4feed
b(profile, new Predicate<GameProfile>() {
@Override
@@ -178,7 +179,16 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
@@ -181,7 +182,16 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
} else if (MinecraftServer.getServer() == null) {
callback.apply(gameprofile);
} else {
@ -496,7 +503,7 @@ index 177cceb77f8783fe93ba7e4342de9c589f155c1b..83faa9dc5f74df4609cab34a66e4feed
if (profile != null && Iterables.getFirst(profile.getProperties().get("textures"), (Object) null) != null) {
callback.apply(profile);
@@ -187,7 +197,10 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
@@ -190,7 +200,10 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
Callable<GameProfile> callable = new Callable<GameProfile>() {
@Override
public GameProfile call() {
@ -509,7 +516,7 @@ index 177cceb77f8783fe93ba7e4342de9c589f155c1b..83faa9dc5f74df4609cab34a66e4feed
@Override
public void run() {
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c12ea75272 100644
index 4f769211cf98c3da720a904da3dcdcd4c7611f0b..a038397028848edb4f43cd4f7262546666e32883 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 {
@ -521,7 +528,7 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1
private final Map<UUID, UserCache.UserCacheEntry> e = new java.util.concurrent.ConcurrentHashMap<>(); // Paper
private final Deque<GameProfile> f = new java.util.concurrent.LinkedBlockingDeque<GameProfile>(); // CraftBukkit
private final GameProfileRepository g;
@@ -104,6 +104,7 @@ public class UserCache {
@@ -93,6 +93,7 @@ public class UserCache {
return UserCache.c;
}
@ -529,7 +536,7 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1
public void a(GameProfile gameprofile) {
this.a(gameprofile, (Date) null);
}
@@ -165,6 +166,13 @@ public class UserCache {
@@ -154,6 +155,13 @@ public class UserCache {
return usercache_usercacheentry == null ? null : usercache_usercacheentry.a();
}
@ -543,7 +550,7 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1
@Nullable
public GameProfile getProfile(UUID uuid) {
UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.e.get(uuid);
@@ -273,7 +281,7 @@ public class UserCache {
@@ -262,7 +270,7 @@ public class UserCache {
class UserCacheEntry {
@ -553,10 +560,10 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1
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 f01bd38d0b600a69224f610fd77a542ec6d1c322..95f4abddf57eb8c59cb5a5410b8d551d39f94fd7 100644
index 1d7549e03bc43f1867662acf12ae3cb82a951478..07a4ce8c71d52f4a6f1f9c97b9cb143c72db8af9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -200,6 +200,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
@@ -224,6 +224,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
import net.md_5.bungee.api.chat.BaseComponent; // Spigot
@ -566,7 +573,7 @@ index f01bd38d0b600a69224f610fd77a542ec6d1c322..95f4abddf57eb8c59cb5a5410b8d551d
public final class CraftServer implements Server {
private final String serverName = "Paper"; // Paper
private final String serverVersion;
@@ -2154,5 +2157,24 @@ public final class CraftServer implements Server {
@@ -2205,5 +2208,24 @@ public final class CraftServer implements Server {
public boolean suggestPlayerNamesWhenNullTabCompletions() {
return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Shoulder Entities Release API
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index ad79e4521cee699de86a94885b27356339bcb866..8e5edd2c9b7cc9a441969efeb666061515188486 100644
index 0dc2ffcfceeffed2cb949d31c4f976bce639f110..69c0a4c7bfb1c753d544dcd074ad832d3e5ef3a0 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1901,20 +1901,44 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1779,20 +1779,44 @@ public abstract class EntityHuman extends EntityLiving {
}
@ -58,10 +58,10 @@ index ad79e4521cee699de86a94885b27356339bcb866..8e5edd2c9b7cc9a441969efeb6660615
@Override
public abstract boolean isSpectator();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 2c20a7b924e055794f6d3a296db754129052c3fe..191bb7345e06cbad7bef416e4e849df3727bdac0 100644
index 9e0bd99122832d3dc25a79569d9e134d0d072fa4..d67fd3bf1048afae0bb78a95724ddf53337d9a2f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -518,6 +518,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -485,6 +485,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
getHandle().getCooldownTracker().setCooldown(CraftMagicNumbers.getItem(material), ticks);
}

View File

@ -7,28 +7,27 @@ Adds a Pre Lookup Event and a Post Lookup Event so that plugins may prefill in p
profiles that had to be looked up.
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
index 3bcdb8f93f1930ee53395470ffb3833e2bd75222..bb9894318e1ff75f0c5611a65d3e4d9969eab1fb 100644
index 582c169c85ac66f1f9430f79042e4655f776c157..08fdb681a68e8be6e4062af0630957ce3e524806 100644
--- a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
@@ -1,17 +1,68 @@
@@ -1,11 +1,16 @@
package com.destroystokyo.paper.profile;
+import com.destroystokyo.paper.event.profile.LookupProfileEvent;
+import com.destroystokyo.paper.event.profile.PreLookupProfileEvent;
+import com.google.common.collect.Sets;
import com.mojang.authlib.Agent;
import com.mojang.authlib.Environment;
+import com.mojang.authlib.GameProfile;
import com.mojang.authlib.ProfileLookupCallback;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
+import java.util.Set;
+
public class PaperGameProfileRepository extends YggdrasilGameProfileRepository {
+
public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService) {
super(authenticationService);
}
public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService, Environment environment) {
super(authenticationService, environment);
@@ -13,6 +18,50 @@ public class PaperGameProfileRepository extends YggdrasilGameProfileRepository {
@Override
public void findProfilesByNames(String[] names, Agent agent, ProfileLookupCallback callback) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Block player logins during server shutdown
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 19e72da6d9a8bf43d1d25c1be3aa23c75dd6e5d7..234451ebc89fe47cffebdcbbc96a5163620b6124 100644
index 7c016afc904d6d6958abf73fd0d87a25c9fa41ad..975499bca45acb4ba3196c48e3739310275cfc8b 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -49,6 +49,12 @@ public class LoginListener implements PacketLoginInListener {
@@ -48,6 +48,12 @@ public class LoginListener implements PacketLoginInListener {
}
public void tick() {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Entity#fromMobSpawner()
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab61938cc8b 100644
index 400e6d5784d1d92678bf26fa3dbffbe2e0424a65..3e5b6c2a0ce6df2620d5f6505fcd25e6ea622744 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -188,6 +188,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -189,6 +189,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE;
@ -16,7 +16,7 @@ index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab6
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end
@@ -1622,6 +1623,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1583,6 +1584,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (this.origin != null) {
nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ()));
}
@ -27,7 +27,7 @@ index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab6
// Paper end
return nbttagcompound;
} catch (Throwable throwable) {
@@ -1742,6 +1747,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1705,6 +1710,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (!originTag.isEmpty()) {
origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
}
@ -37,7 +37,7 @@ index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab6
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index b249af20c4712a89e5f340eb922291557099058a..ab5d83d34d9314a253353d6d01fdcd2bed964933 100644
index 2b7f020e00fc1ea456d0155e7e383969aee318b7..5fda5be52ee7dbf29ac791d0f49326dd74ff2d08 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -140,6 +140,7 @@ public abstract class MobSpawnerAbstract {
@ -49,10 +49,10 @@ index b249af20c4712a89e5f340eb922291557099058a..ab5d83d34d9314a253353d6d01fdcd2b
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
Entity vehicle = entity.getVehicle();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 7a6df77f196db8ccdaf589b680de9aab09b0ef32..2d84f8410a7b8ff88d9dbab64741dcdf40fc1612 100644
index 613081685e233074728366b9ff16642c04774c91..66edc6ae67084959503ffa0df2c04174fb29b8d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1046,5 +1046,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1054,5 +1054,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Location origin = getHandle().origin;
return origin == null ? null : origin.clone();
}

View File

@ -7,10 +7,10 @@ Not all horses with Saddles have armor. This lets us break up the horses with sa
and access their saddle state separately from an interface shared with Armor.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
index 09016e35473069ac61572c4edf97c06077b0cf3b..9952db3eb5ba94547f5e786c473fb59dfec616ab 100644
index 339656c623a5af7fbf1a7e81952dec1dd3c18205..8c59b9ce12d4148b209c3824d44f6e9c736de16c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
@@ -6,6 +6,7 @@ import net.minecraft.server.EntityHorseAbstract;
@@ -6,6 +6,7 @@ import net.minecraft.server.GenericAttributes;
import org.apache.commons.lang.Validate;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.inventory.CraftInventoryAbstractHorse;

View File

@ -7,10 +7,10 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr
to ensure it meets latest minecraft expectations.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 01ab19434a39a7062c813b1696e8d35cb2712b46..8b219b5fa2746d73d6d3acb0b61d13218a2c6ea8 100644
index b2fadd5a3c2d35e1d6f3c02dd5cf450ff1f31d36..71e289b5a7777e307b937f243d4f2204d17d8845 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -335,4 +335,10 @@ public final class CraftItemFactory implements ItemFactory {
@@ -321,4 +321,10 @@ public final class CraftItemFactory implements ItemFactory {
public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException {
return ((CraftMetaItem) meta).updateMaterial(material);
}

View File

@ -8,27 +8,36 @@ Currently the server only supports the English language. To override this,
You must replace the language file embedded in the server jar.
diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java
index c0c13798f84029565e623fdd8cb85ffcd3504559..6012739331add8a77c6684b58a669f39bf183f5b 100644
index ea7cb9943dc6da7a05e0841985eb1be4b6bc5169..c83ba9d9869f8ba51df17963d530536d2a08c263 100644
--- a/src/main/java/net/minecraft/server/LocaleLanguage.java
+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java
@@ -65,10 +65,12 @@ public class LocaleLanguage {
@@ -29,7 +29,7 @@ public abstract class LocaleLanguage {
private static LocaleLanguage c() {
Builder<String, String> builder = ImmutableMap.builder();
- BiConsumer biconsumer = builder::put;
+ BiConsumer<String, String> biconsumer = builder::put; // Paper - decompile fix
try {
InputStream inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json");
@@ -91,10 +91,12 @@ public abstract class LocaleLanguage {
}
+ public static LocaleLanguage getInstance() { return a(); } // Paper - OBFHELPER
public static LocaleLanguage a() {
return LocaleLanguage.c;
return LocaleLanguage.d;
}
+ public synchronized String translateKey(String key) { return a(key); } // Paper - OBFHELPER
public synchronized String a(String s) {
return this.c(s);
}
+ public String translateKey(String key) { return a(key); } // Paper - OBFHELPER
public abstract String a(String s);
public abstract boolean b(String s);
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 8b219b5fa2746d73d6d3acb0b61d13218a2c6ea8..23d7756456fdd650914a3a49c653182a68924a5c 100644
index 71e289b5a7777e307b937f243d4f2204d17d8845..8d694e3a659a405fc5f6729ce512be81316229a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -340,5 +340,18 @@ public final class CraftItemFactory implements ItemFactory {
@@ -326,5 +326,18 @@ public final class CraftItemFactory implements ItemFactory {
public ItemStack ensureServerConversions(ItemStack item) {
return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item));
}

View File

@ -5,22 +5,19 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 6b669f0f632418d36617c980b01cfcd0ef7487c2..46ea6d8e487d0c051780b0bdb06622e515cd987f 100644
index 21f583302e9d8da8c9a9651ce40c64dc8abfa512..70339603aa3e256470be241bf033f3471e2090ea 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -509,9 +509,9 @@ public abstract class PlayerList {
// return chatmessage;
@@ -541,7 +541,7 @@ public abstract class PlayerList {
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot
- } else if (!this.isWhitelisted(gameprofile)) {
+ } else if (!this.isWhitelisted(gameprofile, event)) { // Paper
chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted", new Object[0]);
} else if (!this.isWhitelisted(gameprofile)) {
chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted");
- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot
+ //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted
} else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
IpBanEntry ipbanentry = this.l.get(socketaddress);
@@ -880,9 +880,25 @@ public abstract class PlayerList {
@@ -922,9 +922,25 @@ public abstract class PlayerList {
this.server.getCommandDispatcher().a(entityplayer);
}
@ -46,4 +43,4 @@ index 6b669f0f632418d36617c980b01cfcd0ef7487c2..46ea6d8e487d0c051780b0bdb06622e5
+ // Paper end
public boolean isOp(GameProfile gameprofile) {
return this.operators.d(gameprofile) || this.server.a(gameprofile) && this.server.getWorldServer(DimensionManager.OVERWORLD).getWorldData().t() || this.u;
return this.operators.d(gameprofile) || this.server.a(gameprofile) && this.server.getSaveData().n() || this.v;

View File

@ -9,12 +9,12 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa
and to provide some level of hint without being disruptive.
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index c3641ca48bfe4051f6450c891ccd4dd023257cb5..9b4f01120d473a4fea993a5df952e265b33cde0b 100644
index b77b051137f66106bac396debe0c0542ac86e257..05b647fbb360910b2961c9276c2928fe71dad90c 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -218,10 +218,12 @@ public class Main {
Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -21);
deadline.add(Calendar.DAY_OF_YEAR, -3);
if (buildDate.before(deadline.getTime())) {
- System.err.println("*** Error, this build is outdated ***");
+ // Paper start - This is some stupid bullshit

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Ocelot despawns should honor nametags and leash
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index 06241145537d311b1994a2d672ca975177d03a53..d9a7b8ac1eac58e02607f4df0c9413239fcec3a4 100644
index a88f15546e5cad8da5b342162c05228bdbbf5aad..9c1f019f911a1b91bbfa431e1558dec790624050 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -81,7 +81,7 @@ public class EntityOcelot extends EntityAnimal {
@ -16,4 +16,4 @@ index 06241145537d311b1994a2d672ca975177d03a53..d9a7b8ac1eac58e02607f4df0c941323
+ return !this.isTrusting() && !this.hasCustomName() && !this.isLeashed() /*&& this.ticksLived > 2400*/; // CraftBukkit // Paper - honor name and leash
}
@Override
public static AttributeProvider.Builder eL() {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Reset spawner timer when spawner event is cancelled
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index ab5d83d34d9314a253353d6d01fdcd2bed964933..c38295a09d99221cb196f9785ce674fe11120825 100644
index 5fda5be52ee7dbf29ac791d0f49326dd74ff2d08..efd4d2844c4ad638837a1fd971927758908e7db1 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -142,6 +142,7 @@ public abstract class MobSpawnerAbstract {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 203c4173ff2467a027da059b2d473ec1a90bb88b..d8509ccdb01be022d5aa216b05fd97faeebd53a9 100644
index cfd03f29e6c46c66bf3ad9253c88e27b30f313c1..b1d4f955a59313d7274e39870c9a7300fe012d08 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -648,7 +648,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -703,7 +703,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
gameprofilerfiller.enter("blockEntities");
timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) {

View File

@ -27,10 +27,10 @@ index 295b8390cbc31fc1fcb225f80ec2ff8f0df44321..5884b04f7e84048a9710736bd1423714
+ }
}
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 234451ebc89fe47cffebdcbbc96a5163620b6124..758fe774897245148befeb26ddd65cf4c1a8301b 100644
index 975499bca45acb4ba3196c48e3739310275cfc8b..723c73a8056d34136c64cd038f274d3d94749314 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -247,6 +247,10 @@ public class LoginListener implements PacketLoginInListener {
@@ -246,6 +246,10 @@ public class LoginListener implements PacketLoginInListener {
LoginListener.this.i = LoginListener.this.a(gameprofile);
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else {
@ -38,6 +38,6 @@ index 234451ebc89fe47cffebdcbbc96a5163620b6124..758fe774897245148befeb26ddd65cf4
+ if (com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage != null) {
+ LoginListener.this.disconnect(new ChatComponentText(com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage));
+ } else // Paper end
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0]));
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
}

View File

@ -5,23 +5,23 @@ Subject: [PATCH] LivingEntity#setKiller
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 28d873d8fe7bb79d2a84eb9bf234ac8ba0223813..ca2620548c7c80beab09554b96d8e55e499614f8 100644
index 34f2821a64c7893ff0a8c33ae4b77ce883227f0c..7ec1a572efd99928e8aae9b75c0eed73430aa337 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -80,7 +80,7 @@ public abstract class EntityLiving extends Entity {
@@ -86,7 +86,7 @@ public abstract class EntityLiving extends Entity {
public float aL;
public float aM;
@Nullable
public EntityHuman killer;
- protected int lastDamageByPlayerTime;
+ public int lastDamageByPlayerTime; // Paper - protected -> public
protected boolean killed;
protected int ticksFarFromPlayer;
protected float aR;
protected float aQ;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index da86ee41499b02959755328544307aed39752483..1760dfa7a312b63d7608d890c977452ad995d7ae 100644
index 8c3fa2335cfa1df94eb64bda5b12f1f5858dec27..1f33b2d7db6ab1c0f07f3e87cb046eda40f6c698 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -318,6 +318,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -319,6 +319,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
}

View File

@ -12,7 +12,7 @@ results in a separate line, even though it should not result in
a line break. Log4j's implementation handles it correctly.
diff --git a/pom.xml b/pom.xml
index aeaceac771644ece5365d07be77f4481ced2fe13..25e327c38cc3aa1f9ad9275faba481bdb4240e25 100644
index 2acc2a98bd8df6d81b5865b768265a210597b57b..55cdd9061b2c70abe8458de497dd61e1f734bc9f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,6 +66,11 @@
@ -28,10 +28,10 @@ index aeaceac771644ece5365d07be77f4481ced2fe13..25e327c38cc3aa1f9ad9275faba481bd
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index d34f772fae3543cec6a130831b1f3eaa67934944..ec257ba31f012d3d3576bbff41326df13ede6776 100644
index 49b5c226dcbd4ef7d2a3418ef2c7e98bb689ccfb..f6544e4fb0eacce7f3579998e8ec0743b7f46c65 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -155,8 +155,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@@ -131,8 +131,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
*/
// Paper end

View File

@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing
the plugin logger.
diff --git a/pom.xml b/pom.xml
index 25e327c38cc3aa1f9ad9275faba481bdb4240e25..daeb60a93cf0bbd1f6b731b9502a80c93b2e090b 100644
index 55cdd9061b2c70abe8458de497dd61e1f734bc9f..0cdfa5367766b3883433d39fec4d6dcb8aa14cdf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,7 +64,7 @@

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Include Log4J2 SLF4J implementation
diff --git a/pom.xml b/pom.xml
index daeb60a93cf0bbd1f6b731b9502a80c93b2e090b..8ad07cf6e03cbc5354d2dd2b149b51bbb5067a9d 100644
index 0cdfa5367766b3883433d39fec4d6dcb8aa14cdf..8150756361174fd46df8f73943ab48c55a523c0c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,6 +66,12 @@

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerJumpEvent
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 26f894c752d623ed082f97fdbffe5a6680a941b7..2fd9f9ceddd108f0d733ea481d5b5c7d4506329c 100644
index ace3f3e30224c09bdb296e4ac2974fb0bd3e7dbc..a7ab77707b5cd9ca65c012c3b18bc0c6db7fa7ee 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -58,6 +58,8 @@ import org.bukkit.inventory.CraftingInventory;
@ -17,10 +17,10 @@ index 26f894c752d623ed082f97fdbffe5a6680a941b7..2fd9f9ceddd108f0d733ea481d5b5c7d
import co.aikar.timings.MinecraftTimings; // Paper
// CraftBukkit end
@@ -925,7 +927,34 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
@@ -945,7 +947,34 @@ public class PlayerConnection implements PacketListenerPlayIn {
boolean flag = d8 > 0.0D;
if (this.player.onGround && !packetplayinflying.b() && d8 > 0.0D) {
if (this.player.isOnGround() && !packetplayinflying.b() && flag) {
- this.player.jump();
+ // Paper start - Add player jump event
+ Player player = this.getPlayer();

View File

@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 2fd9f9ceddd108f0d733ea481d5b5c7d4506329c..7512764532fc3403cf1daa31079fe739820facde 100644
index a7ab77707b5cd9ca65c012c3b18bc0c6db7fa7ee..79888d559e7d62216d48516ebb7da138395c2f2a 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2487,14 +2487,18 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2529,14 +2529,18 @@ public class PlayerConnection implements PacketListenerPlayIn {
@Override
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
@ -30,10 +30,9 @@ index 2fd9f9ceddd108f0d733ea481d5b5c7d4506329c..7512764532fc3403cf1daa31079fe739
this.player.ping = (this.player.ping * 3 + i) / 4;
this.awaitingKeepAlive = false;
} else if (!this.isExemptPlayer()) {
- this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
+ // Paper start - This needs to be handled on the main thread for plugins
+ minecraftServer.scheduleOnMain(() -> {
+ this.disconnect(new ChatMessage("disconnect.timeout"));
this.disconnect(new ChatMessage("disconnect.timeout"));
+ });
+ // Paper end
}

View File

@ -61,18 +61,10 @@ index 0000000000000000000000000000000000000000..5caca6439d2135e34880d501397fe2ea
+
+}
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index d0b9c6e3dcae76d802e095731c78fb9693982f90..8928d93e49bec174e86a2b451ac40f3946193009 100644
index a3b48376b92aee548ec28eec1cdc978925b96df0..8049f54f049122b065ea30e7e831c33486a83b7e 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -15,6 +15,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
private final MinecraftServer a;
private final NetworkManager b;
+ private NetworkManager getNetworkManager() { return b; } // Paper - OBFHELPER
public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.a = minecraftserver;
@@ -129,6 +130,10 @@ public class HandshakeListener implements PacketHandshakingInListener {
@@ -133,6 +133,10 @@ public class HandshakeListener implements PacketHandshakingInListener {
throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.b());
}
@ -84,7 +76,7 @@ index d0b9c6e3dcae76d802e095731c78fb9693982f90..8928d93e49bec174e86a2b451ac40f39
@Override
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 3ccf1663669c79a63a6b3a9f6dc17a6e25e91915..e2d8ed88f05bf8cb214329ea27ac2b67f43e071a 100644
index c2fdccfb9192aa7ec55fd67c169cba71a695075c..33900c22d4123e0f8333b9bdb9601d302e26c972 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -60,6 +60,10 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@ -111,10 +103,10 @@ index 4f008e4723d2cb0bcabb2d5621203d63c40c4923..8545146fb1f093f821e3b966d9337049
return this.a;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a4afce71be0707c43700b73ae0107074448e3d4a..3d4a1065fbe38239743e485d078b76b47981baf1 100644
index 527c116c23a505eead00e73a39ce9f932eb4ad8d..09ac19363ecfdebe2b124fdf68a95265ae085cfe 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -182,6 +182,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -186,6 +186,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}

View File

@ -17,7 +17,7 @@ from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 7512764532fc3403cf1daa31079fe739820facde..7d0fa2efe876d5de8b4bafd2be1a1323ea630410 100644
index 79888d559e7d62216d48516ebb7da138395c2f2a..b2eac041c3ff7d8a7c4524dac381ab95045f28af 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -70,7 +70,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -37,7 +37,7 @@ index 7512764532fc3403cf1daa31079fe739820facde..7d0fa2efe876d5de8b4bafd2be1a1323
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
@@ -182,18 +183,26 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -182,18 +183,25 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
this.minecraftServer.getMethodProfiler().enter("keepAlive");
@ -45,6 +45,12 @@ index 7512764532fc3403cf1daa31079fe739820facde..7d0fa2efe876d5de8b4bafd2be1a1323
-
- if (i - this.lastKeepAlive >= 25000L) { // CraftBukkit
- if (this.awaitingKeepAlive) {
- this.disconnect(new ChatMessage("disconnect.timeout"));
- } else {
- this.awaitingKeepAlive = true;
- this.lastKeepAlive = i;
- this.h = i;
- this.sendPacket(new PacketPlayOutKeepAlive(this.h));
+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2
+ long currentTime = SystemUtils.getMonotonicMillis();
@ -53,12 +59,7 @@ index 7512764532fc3403cf1daa31079fe739820facde..7d0fa2efe876d5de8b4bafd2be1a1323
+ if (this.isPendingPing()) {
+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
+ PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info
this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
- } else {
- this.awaitingKeepAlive = true;
- this.lastKeepAlive = i;
- this.h = i;
- this.sendPacket(new PacketPlayOutKeepAlive(this.h));
+ this.disconnect(new ChatMessage("disconnect.timeout", new Object[0]));
+ }
+ } else {
+ if (elapsedTime >= 15000L) { // 15 seconds
@ -66,7 +67,6 @@ index 7512764532fc3403cf1daa31079fe739820facde..7d0fa2efe876d5de8b4bafd2be1a1323
+ this.setLastPing(currentTime);
+ this.setKeepAliveID(currentTime);
+ this.sendPacket(new PacketPlayOutKeepAlive(this.getKeepAliveID()));
+
}
}
+ // Paper end

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523286c5106 100644
index 69c0a4c7bfb1c753d544dcd074ad832d3e5ef3a0..eaed020982bd19dab72872849170fa62d75699eb 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1023,6 +1023,15 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1002,6 +1002,15 @@ public abstract class EntityHuman extends EntityLiving {
return vec3d;
}
@ -23,9 +23,9 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523
+ // Paper end
+
public void attack(Entity entity) {
if (entity.bA()) {
if (entity.bH()) {
if (!entity.t(this)) {
@@ -1047,7 +1056,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1026,7 +1035,7 @@ public abstract class EntityHuman extends EntityLiving {
int i = b0 + EnchantmentManager.b((EntityLiving) this);
if (this.isSprinting() && flag) {
@ -34,16 +34,16 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523
++i;
flag1 = true;
}
@@ -1122,7 +1131,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1101,7 +1110,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F);
+ sendSoundEffect(this, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F); // Paper - send while respecting visibility
this.ea();
this.ew();
}
@@ -1150,15 +1159,15 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1129,15 +1138,15 @@ public abstract class EntityHuman extends EntityLiving {
}
if (flag2) {
@ -62,7 +62,7 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523
}
}
@@ -1210,7 +1219,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1189,7 +1198,7 @@ public abstract class EntityHuman extends EntityLiving {
this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value
} else {
@ -72,10 +72,10 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523
entity.extinguish();
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index d8509ccdb01be022d5aa216b05fd97faeebd53a9..4e41b4262971401d90a96cd7710890e5048d5b63 100644
index b1d4f955a59313d7274e39870c9a7300fe012d08..ad1841f16ea3ecfbd9c6047483a4b7bd061c1981 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -585,6 +585,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -640,6 +640,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.playSound(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1);
}

View File

@ -20,10 +20,10 @@ index 39ab5457569684bc66cd67f5f9d2505ef9f304ab..d2582d981f859b55ba5086540963c01e
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index f1a4de57282f3553f34245122bf15130420f558b..d012376c134886cdf692bfe29e6154a618f932ea 100644
index dc4fc5b300bb319be3d483aa7206bb0134343068..ee7f71c0fe2cf075ab2e821391cd94f920dc494b 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -550,16 +550,32 @@ public class CraftEventFactory {
@@ -548,16 +548,32 @@ public class CraftEventFactory {
EntityExperienceOrb xp = (EntityExperienceOrb) entity;
double radius = world.spigotConfig.expMerge;
if (radius > 0) {

View File

@ -0,0 +1,43 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: pkt77 <parkerkt77@gmail.com>
Date: Fri, 10 Nov 2017 23:46:34 -0500
Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 7ec1a572efd99928e8aae9b75c0eed73430aa337..26832d31cc64d26a9ca61a3bad21424ed366c74c 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; // Paper
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -2523,6 +2524,13 @@ public abstract class EntityLiving extends Entity {
ItemStack itemstack1 = this.getEquipment(enumitemslot);
if (!ItemStack.matches(itemstack1, itemstack)) {
+ // Paper start - PlayerArmorChangeEvent
+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1);
+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();
+ }
+ // Paper end
if (map == null) {
map = Maps.newEnumMap(EnumItemSlot.class);
}
diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java
index 02a7ae6785b0539e4aa567fca377d727184fd019..60b235f16f5e762d635efa1578b715db445513a5 100644
--- a/src/main/java/net/minecraft/server/EnumItemSlot.java
+++ b/src/main/java/net/minecraft/server/EnumItemSlot.java
@@ -16,6 +16,7 @@ public enum EnumItemSlot {
this.j = s;
}
+ public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER
public EnumItemSlot.Function a() {
return this.g;
}

View File

@ -1,43 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: pkt77 <parkerkt77@gmail.com>
Date: Fri, 10 Nov 2017 23:46:34 -0500
Subject: [PATCH] Add PlayerArmorChangeEvent
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index ca2620548c7c80beab09554b96d8e55e499614f8..f5da67fd8908f027835b837a8b847e27c3638790 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -2339,6 +2340,13 @@ public abstract class EntityLiving extends Entity {
ItemStack itemstack1 = this.getEquipment(enumitemslot);
if (!ItemStack.matches(itemstack1, itemstack)) {
+ // Paper start - PlayerArmorChangeEvent
+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1);
+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();
+ }
+ // Paper end
((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1));
if (!itemstack.isEmpty()) {
this.getAttributeMap().a(itemstack.a(enumitemslot));
diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java
index 02a7ae6785b0539e4aa567fca377d727184fd019..60b235f16f5e762d635efa1578b715db445513a5 100644
--- a/src/main/java/net/minecraft/server/EnumItemSlot.java
+++ b/src/main/java/net/minecraft/server/EnumItemSlot.java
@@ -16,6 +16,7 @@ public enum EnumItemSlot {
this.j = s;
}
+ public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER
public EnumItemSlot.Function a() {
return this.g;
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Prevent logins from being processed when the player has
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 758fe774897245148befeb26ddd65cf4c1a8301b..1fb609dcfc61adfc63f0d32dc87a5e144a5013cf 100644
index 723c73a8056d34136c64cd038f274d3d94749314..3cc12e7b75b8ed21a0ea44f8453553cf856fb786 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -56,7 +56,11 @@ public class LoginListener implements PacketLoginInListener {
@@ -55,7 +55,11 @@ public class LoginListener implements PacketLoginInListener {
}
// Paper end
if (this.g == LoginListener.EnumProtocolState.READY_TO_ACCEPT) {
@ -20,5 +20,5 @@ index 758fe774897245148befeb26ddd65cf4c1a8301b..1fb609dcfc61adfc63f0d32dc87a5e14
+ }
+ // Paper end
} else if (this.g == LoginListener.EnumProtocolState.DELAY_ACCEPT) {
EntityPlayer entityplayer = this.server.getPlayerList().a(this.i.getId());
EntityPlayer entityplayer = this.server.getPlayerList().getPlayer(this.i.getId());

View File

@ -18,10 +18,10 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 4e41b4262971401d90a96cd7710890e5048d5b63..6603392f475f0bfe7af259a54ba9bb3469c18541 100644
index ad1841f16ea3ecfbd9c6047483a4b7bd061c1981..6f91878fedd3bf8daedc16bcde7ac1fd042f704c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -66,7 +66,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -71,7 +71,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false;
@ -30,8 +30,8 @@ index 4e41b4262971401d90a96cd7710890e5048d5b63..6603392f475f0bfe7af259a54ba9bb34
public Map<BlockPosition, TileEntity> capturedTileEntities = new HashMap<>();
public List<EntityItem> captureDrops;
public long ticksPerAnimalSpawns;
@@ -258,7 +258,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
@@ -323,7 +323,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {
- CapturedBlockState blockstate = capturedBlockStates.get(blockposition);
@ -39,7 +39,7 @@ index 4e41b4262971401d90a96cd7710890e5048d5b63..6603392f475f0bfe7af259a54ba9bb34
if (blockstate == null) {
blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i);
this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate);
@@ -278,7 +278,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -343,7 +343,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// CraftBukkit start - capture blockstates
boolean captured = false;
if (this.captureBlockStates && !this.capturedBlockStates.containsKey(blockposition)) {
@ -48,7 +48,7 @@ index 4e41b4262971401d90a96cd7710890e5048d5b63..6603392f475f0bfe7af259a54ba9bb34
this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate);
captured = true;
}
@@ -546,7 +546,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -601,7 +601,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public IBlockData getType(BlockPosition blockposition) {
// CraftBukkit start - tree generation
if (captureTreeGeneration) {

View File

@ -13,7 +13,7 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
If Tile Entity was null, correct Sign to return empty lines instead of null
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index 630b279158f26902ebdcc6e5c810b189ce49c910..958279249fdadfe5c2808d2a046636f06c3bd500 100644
index 967aec7ce9a7fbbb42b51d1ed281db005e107c2c..54285237ed5a096b2e46cabd78f7dcd5128133a8 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -231,7 +231,12 @@ public abstract class TileEntity implements KeyedObject { // Paper
@ -39,7 +39,7 @@ index 630b279158f26902ebdcc6e5c810b189ce49c910..958279249fdadfe5c2808d2a046636f0
return null;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 5a1629a19f082235f91913736d78509d44f8fd67..dd0bccd6995a79c52ec20cf45df27bb7ed06a5e6 100644
index 562d9daa34540c0e3d99b799dd6f01bf87329006..5ce381ad88daf5f95b19871356ab5852097c5956 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -308,6 +308,20 @@ public class CraftBlock implements Block {
@ -64,7 +64,7 @@ index 5a1629a19f082235f91913736d78509d44f8fd67..dd0bccd6995a79c52ec20cf45df27bb7
switch (material) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 17d80b5c6e512e0c582b05c92bb795b004ba27c2..f6401e2cde9d56547cee7f8d9e4b2a58764ee895 100644
index 26cc40e57f5b73b9c32859bff37c4a3d94904c56..feeae1a9eb309ae4101783b191bb2bffe9aeb7d3 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -26,20 +26,40 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState

View File

@ -14,10 +14,10 @@ completion, such as offline players.
Also adds isCommand and getLocation to the sync TabCompleteEvent
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 7d0fa2efe876d5de8b4bafd2be1a1323ea630410..c256e798d12098881cb5bfb655eab5b63f1614e7 100644
index b2eac041c3ff7d8a7c4524dac381ab95045f28af..fa5c640239451579fba35ad7b0979739e0b7b16f 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -524,10 +524,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -527,10 +527,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
@Override
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
@ -30,7 +30,7 @@ index 7d0fa2efe876d5de8b4bafd2be1a1323ea630410..c256e798d12098881cb5bfb655eab5b6
return;
}
// CraftBukkit end
@@ -537,12 +537,37 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -540,12 +540,35 @@ public class PlayerConnection implements PacketListenerPlayIn {
stringreader.skip();
}
@ -46,19 +46,20 @@ index 7d0fa2efe876d5de8b4bafd2be1a1323ea630410..c256e798d12098881cb5bfb655eab5b6
+ // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server
+ if (!event.isHandled()) {
+ if (!event.isCancelled()) {
+ // Paper end - async tab completion
+ this.minecraftServer.scheduleOnMain(() -> { // Paper - This needs to be on main
+ ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
if (((Suggestions) suggestions).isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error
- this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
- if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions));
- });
+ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error
+ });
+ }); // Paper - This needs to be on main
+ this.minecraftServer.scheduleOnMain(() -> { // Paper - This needs to be on main
+ ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
+
+ this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
+ if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
+ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions));
+ });
+ });
+ }
+ // Paper start - async tab completion
+ } else if (!completions.isEmpty()) {
+ com.mojang.brigadier.suggestion.SuggestionsBuilder builder = new com.mojang.brigadier.suggestion.SuggestionsBuilder(packetplayintabcomplete.c(), stringreader.getTotalLength());
+
@ -67,15 +68,14 @@ index 7d0fa2efe876d5de8b4bafd2be1a1323ea630410..c256e798d12098881cb5bfb655eab5b6
+ player.playerConnection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), builder.buildFuture().join()));
+ }
+ // Paper end - async tab completion
+
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 95f4abddf57eb8c59cb5a5410b8d551d39f94fd7..3697b3298feaec30c305e3da011790f2406e12d7 100644
index 07a4ce8c71d52f4a6f1f9c97b9cb143c72db8af9..cf93d5451a68e812811b32add1a76ed1ee6f3c27 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1710,7 +1710,7 @@ public final class CraftServer implements Server {
@@ -1761,7 +1761,7 @@ public final class CraftServer implements Server {
offers = tabCompleteChat(player, message);
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Avoid NPE in PathfinderGoalTempt
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java
index eafdcb916af55978672c139b7ccdf5feba383264..d37a2fa0ab3cbf4b76be90079c083e208843fe6e 100644
index 351152ae32e162fa912d60e929abeec783140106..b115f40b0b11e89184960a5cce5b8295030469e9 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java
@@ -55,7 +55,7 @@ public class PathfinderGoalTempt extends PathfinderGoal {

View File

@ -6,15 +6,15 @@ Subject: [PATCH] PlayerPickupExperienceEvent
Allows plugins to cancel a player picking up an experience orb
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index d4275e733d9996d121efd95ae1ff4676a1ebfbb5..b3edb69a967058392f5027fbdc7fadff7e1dc6e2 100644
index d9a0cd1e90445ff7a1d9e7cef2f71e27bd3686cb..e7fb982913f391bafd608c4626086cd9cab7fad7 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -222,7 +222,7 @@ public class EntityExperienceOrb extends Entity {
@@ -217,7 +217,7 @@ public class EntityExperienceOrb extends Entity {
@Override
public void pickup(EntityHuman entityhuman) {
if (!this.world.isClientSide) {
- if (this.d == 0 && entityhuman.bC == 0) {
+ if (this.d == 0 && entityhuman.bC == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
entityhuman.bC = 2;
- if (this.d == 0 && entityhuman.bB == 0) {
+ if (this.d == 0 && entityhuman.bB == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
entityhuman.bB = 2;
entityhuman.receive(this, 1);
Entry<EnumItemSlot, ItemStack> entry = EnchantmentManager.b(Enchantments.MENDING, (EntityLiving) entityhuman);
Entry<EnumItemSlot, ItemStack> entry = EnchantmentManager.a(Enchantments.MENDING, (EntityLiving) entityhuman, ItemStack::f);

View File

@ -8,10 +8,10 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor
metadata such as spawn reason, or conditionally move data from source to target.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index d012376c134886cdf692bfe29e6154a618f932ea..6d7236d3dcdb70cc1f33f462d08e78720045ccd0 100644
index ee7f71c0fe2cf075ab2e821391cd94f920dc494b..8551d3c9ba808bb9a77897a9866249bc0845c3b2 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -560,7 +560,7 @@ public class CraftEventFactory {
@@ -558,7 +558,7 @@ public class CraftEventFactory {
if (e instanceof EntityExperienceOrb) {
EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
// Paper start

View File

@ -10,10 +10,10 @@ of giving the player experience points.
Both an API To standalone mend, and apply mending logic to .giveExp has been added.
diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java
index 1822178e8dd67bb063f5eab60335de9852b9a71c..d96c03a1a164799f49fdb3309594e7592a8d2206 100644
index cea65c1d80a7bd303cf28a6fe2bd73d542a19557..92ceb8bb7d7c47e395dfdcfe6d01f807c048ddc1 100644
--- a/src/main/java/net/minecraft/server/EnchantmentManager.java
+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java
@@ -246,6 +246,11 @@ public class EnchantmentManager {
@@ -251,6 +251,11 @@ public class EnchantmentManager {
return getEnchantmentLevel(Enchantments.CHANNELING, itemstack) > 0;
}
@ -24,12 +24,12 @@ index 1822178e8dd67bb063f5eab60335de9852b9a71c..d96c03a1a164799f49fdb3309594e759
+ }
@Nullable
public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) {
Map<EnumItemSlot, ItemStack> map = enchantment.a(entityliving);
return a(enchantment, entityliving, (itemstack) -> {
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index b3edb69a967058392f5027fbdc7fadff7e1dc6e2..87c6b77ce3b1446893a0d617b63f925a403e09cc 100644
index e7fb982913f391bafd608c4626086cd9cab7fad7..7f2d8de12473c5413bbfc10ea0947d6a30802645 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -254,10 +254,12 @@ public class EntityExperienceOrb extends Entity {
@@ -249,10 +249,12 @@ public class EntityExperienceOrb extends Entity {
}
}
@ -43,10 +43,10 @@ index b3edb69a967058392f5027fbdc7fadff7e1dc6e2..87c6b77ce3b1446893a0d617b63f925a
return i * 2;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 3d4a1065fbe38239743e485d078b76b47981baf1..5b088b21da2ca3945de9c5dcc4370114f930d739 100644
index 09ac19363ecfdebe2b124fdf68a95265ae085cfe..734274db8f8c53d7e5310f2c16b1c64a42a6277c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1017,8 +1017,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1058,8 +1058,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return GameMode.getByValue(getHandle().playerInteractManager.getGameMode().getId());
}

View File

@ -21,10 +21,10 @@ index d2582d981f859b55ba5086540963c01ed49e4c15..92e6891502ef6dc276ed5b371124f24d
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index 8c4f3b2c2e6e4e354562e32931b3fbf3d705a278..1c1ff2069d6daaf866a3e80a9b3ce78b19941384 100644
index 915a2736447b651ac892254ed6429bad5a56954e..9c9ec8226ab43beaae0ef4abc97632b503e2120c 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -171,7 +171,8 @@ public class EntitySquid extends EntityWaterAnimal {
@@ -169,7 +169,8 @@ public class EntitySquid extends EntityWaterAnimal {
}
public static boolean b(EntityTypes<EntitySquid> entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) {

View File

@ -0,0 +1,92 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:01:31 -0500
Subject: [PATCH] PreCreatureSpawnEvent
Adds an event to fire before an Entity is created, so that plugins that need to cancel
CreatureSpawnEvent can do so from this event instead.
Cancelling CreatureSpawnEvent rapidly causes a lot of garbage collection and CPU waste
as it's done after the Entity object has been fully created.
Mob Limiting plugins and blanket "ban this type of monster" plugins should use this event
instead and save a lot of server resources.
See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index efd4d2844c4ad638837a1fd971927758908e7db1..45cd44335427a818a580158d57025289f37079bf 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -105,6 +105,27 @@ public abstract class MobSpawnerAbstract {
double d5 = j >= 3 ? nbttaglist.h(2) : (double) blockposition.getZ() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D;
if (world.b(((EntityTypes) optional.get()).a(d3, d4, d5)) && EntityPositionTypes.a((EntityTypes) optional.get(), world.getMinecraftWorld(), EnumMobSpawn.SPAWNER, new BlockPosition(d3, d4, d5), world.getRandom())) {
+ // Paper start
+ EntityTypes<?> entityType = optional.get();
+ String key = EntityTypes.getName(entityType).getKey();
+
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key);
+ if (type != null) {
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ MCUtil.toLocation(world, d3, d4, d5),
+ type,
+ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+ );
+ if (!event.callEvent()) {
+ flag = true;
+ if (event.shouldAbortSpawn()) {
+ break;
+ }
+ continue;
+ }
+ }
+ // Paper end
Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> {
entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch);
return entity1;
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 50be743513145bd2c8b9c65af219f60099cbb09f..4b1a5e92cc05df06edd6d2d7eab5ca70b70ede79 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -180,7 +180,12 @@ public final class SpawnerCreature {
j1 = biomebase_biomemeta.d + worldserver.random.nextInt(1 + biomebase_biomemeta.e - biomebase_biomemeta.d);
}
- if (a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2) && spawnercreature_c.test(biomebase_biomemeta.c, blockposition_mutableblockposition, ichunkaccess)) {
+ // Paper start
+ Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2);
+ if (doSpawning == null) {
+ return;
+ }
+ if (doSpawning.booleanValue() && spawnercreature_c.test(biomebase_biomemeta.c, blockposition_mutableblockposition, ichunkaccess)) { // Paper end
EntityInsentient entityinsentient = a(worldserver, biomebase_biomemeta.c);
if (entityinsentient == null) {
@@ -234,8 +239,24 @@ public final class SpawnerCreature {
}
}
- private static boolean a(WorldServer worldserver, EnumCreatureType enumcreaturetype, StructureManager structuremanager, ChunkGenerator chunkgenerator, BiomeBase.BiomeMeta biomebase_biomemeta, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) {
+ private static Boolean a(WorldServer worldserver, EnumCreatureType enumcreaturetype, StructureManager structuremanager, ChunkGenerator chunkgenerator, BiomeBase.BiomeMeta biomebase_biomemeta, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { // Paper
EntityTypes<?> entitytypes = biomebase_biomemeta.c;
+ // Paper start
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityTypes.getName(entitytypes).getKey());
+ if (type != null) {
+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ MCUtil.toLocation(worldserver, blockposition_mutableblockposition),
+ type, SpawnReason.NATURAL
+ );
+ if (!event.callEvent()) {
+ if (event.shouldAbortSpawn()) {
+ return null;
+ }
+ return false; // TODO is this handled correctly?
+ }
+ }
+ // Paper end
if (entitytypes.e() == EnumCreatureType.MISC) {
return false;

View File

@ -9,27 +9,27 @@ from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 7464aeb4e2f2cbe177cfd2ac19c45aabac625632..261eff5bdb4f4dfae2f66eecad79b21fef69ea8f 100644
index 7abd3683f9cc21b90dc74739954de2decddf6478..6921def2dc8dd7f2b8ba9d46ab697a9f9b62cf4e 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -599,6 +599,15 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings
@@ -589,6 +589,15 @@ public class ChunkProviderServer extends IChunkProvider {
this.world.getMethodProfiler().exit();
//List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); // Paper
//Collections.shuffle(list); // Paper
+ //Paper start - call player naturally spawn event
+ int chunkRange = world.spigotConfig.mobSpawnRange;
+ chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange;
+ chunkRange = Math.min(chunkRange, 8);
+ for (EntityPlayer entityPlayer : this.world.players) {
+ for (EntityPlayer entityPlayer : this.world.getPlayers()) {
+ entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange);
+ entityPlayer.playerNaturallySpawnedEvent.callEvent();
+ };
+ // Paper end
this.playerChunkMap.f().forEach((playerchunk) -> {
Optional<Chunk> optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left();
this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no...
Optional<Chunk> optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left();
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index bf32997c422d478699c32ce0539a65c35fbf0d12..88692d9eaea57a4d172d537a6cf2a3bffe058d54 100644
index f4275e2ba2659d3087395105da9446225d3a904c..00b19cce68abf405117c5e2d55ba86fc10e7db34 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1,5 +1,6 @@
@ -39,7 +39,7 @@ index bf32997c422d478699c32ce0539a65c35fbf0d12..88692d9eaea57a4d172d537a6cf2a3bf
import com.google.common.collect.Lists;
import com.mojang.authlib.GameProfile;
import com.mojang.datafixers.util.Either;
@@ -89,6 +90,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -93,6 +94,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public boolean sentListPacket = false;
public Integer clientViewDistance;
// CraftBukkit end
@ -48,10 +48,10 @@ index bf32997c422d478699c32ce0539a65c35fbf0d12..88692d9eaea57a4d172d537a6cf2a3bf
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> cachedSingleHashSet; // Paper
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 0edba596754c6d5379c3c1eb0469aee447b7113f..7804cc0f6a02d14f4adbe05b37e8470a382c0d26 100644
index cec1baadf5e8e0459837522ca434327491005e8c..ebe18750e19030b7e7eceb8190fc8d78dc0c3a90 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -882,12 +882,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -912,12 +912,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;

View File

@ -1,87 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:01:31 -0500
Subject: [PATCH] PreCreatureSpawnEvent
Adds an event to fire before an Entity is created, so that plugins that need to cancel
CreatureSpawnEvent can do so from this event instead.
Cancelling CreatureSpawnEvent rapidly causes a lot of garbage collection and CPU waste
as it's done after the Entity object has been fully created.
Mob Limiting plugins and blanket "ban this type of monster" plugins should use this event
instead and save a lot of server resources.
See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index c38295a09d99221cb196f9785ce674fe11120825..43c491f71b7739c782b46ee77ff8debe44213f11 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -105,6 +105,27 @@ public abstract class MobSpawnerAbstract {
double d5 = j >= 3 ? nbttaglist.h(2) : (double) blockposition.getZ() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D;
if (world.a(((EntityTypes) optional.get()).a(d3, d4, d5)) && EntityPositionTypes.a((EntityTypes) optional.get(), world.getMinecraftWorld(), EnumMobSpawn.SPAWNER, new BlockPosition(d3, d4, d5), world.getRandom())) {
+ // Paper start
+ EntityTypes entityType = optional.get();
+ String key = EntityTypes.getName(entityType).getKey();
+
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key);
+ if (type != null) {
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ MCUtil.toLocation(world, d3, d4, d5),
+ type,
+ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+ );
+ if (!event.callEvent()) {
+ flag = true;
+ if (event.shouldAbortSpawn()) {
+ break;
+ }
+ continue;
+ }
+ }
+ // Paper end
Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> {
entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch);
return entity1;
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 02157d051f3ecfc05f23ae8631cf01b6133ad159..224443e03c9e55af2744eebd7e754e2a1b3fa296 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -38,7 +38,7 @@ public final class SpawnerCreature {
BiomeBase.BiomeMeta biomebase_biomemeta = null;
GroupDataEntity groupdataentity = null;
int l1 = MathHelper.f(Math.random() * 4.0D);
- int i2 = 0;
+ int i2 = 0; // Paper - force diff on name change
int j2 = 0;
while (true) {
@@ -77,6 +77,25 @@ public final class SpawnerCreature {
if (a(entitypositiontypes_surface, (IWorldReader) worldserver, (BlockPosition) blockposition_mutableblockposition, entitytypes) && EntityPositionTypes.a(entitytypes, worldserver, EnumMobSpawn.NATURAL, blockposition_mutableblockposition, worldserver.random) && worldserver.a(entitytypes.a((double) f, (double) k, (double) f1))) {
EntityInsentient entityinsentient;
+ // Paper start
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+ EntityTypes<?> cls = biomebase_biomemeta.b;
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityTypes.getName(cls).getKey());
+ if (type != null) {
+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ MCUtil.toLocation(worldserver, blockposition_mutableblockposition),
+ type, SpawnReason.NATURAL
+ );
+ if (!event.callEvent()) {
+ if (event.shouldAbortSpawn()) {
+ return;
+ }
+ ++i2;
+ continue;
+ }
+ }
+ // Paper end
+
try {
Entity entity = entitytypes.a((World) worldserver);

View File

@ -11,18 +11,19 @@ If Mojang API does need to be hit, event fire so you can get the results.
This is useful for implementing a ProfileCache for Player Skulls
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
index 4b2a67423f57b70d316115e4525e3841a415b1cc..61cfdf73c8a5b0dcf2f9903ebbb2f4132ba1f0dd 100644
index 93d73c27340645c7502acafdc0b2cfbc1a759dd8..5c7d2ee19243d0911a3a00af3ae42078a2ccba94 100644
--- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
+++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java
@@ -1,5 +1,7 @@
@@ -1,6 +1,8 @@
package com.destroystokyo.paper.profile;
import com.mojang.authlib.Environment;
+import com.destroystokyo.paper.event.profile.FillProfileEvent;
+import com.destroystokyo.paper.event.profile.PreFillProfileEvent;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
@@ -19,7 +21,15 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi
@@ -20,7 +22,15 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi
@Override
public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] PlayerAdvancementCriterionGrantEvent
diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
index ca661f3933dad81150654551de4679fe2baeb138..c41e1384724ab150f43dc43fe2a453c9b1262e48 100644
index 12fc641299342a317177cf0ab876186fb8a2b760..57b9d13447a4f7804827c1bd41121c3069c696bd 100644
--- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
+++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
@@ -276,6 +276,12 @@ public class AdvancementDataPlayer {
@@ -279,6 +279,12 @@ public class AdvancementDataPlayer {
boolean flag1 = advancementprogress.isDone();
if (advancementprogress.a(s)) {
@ -19,5 +19,5 @@ index ca661f3933dad81150654551de4679fe2baeb138..c41e1384724ab150f43dc43fe2a453c9
+ }
+ // Paper end
this.d(advancement);
this.i.add(advancement);
this.j.add(advancement);
flag = true;

View File

@ -267,10 +267,10 @@ index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index b9435bbd51764f75b8d24171513f3dddc48906f8..b87d2581754fde163a7b5532b9d5e21b48d3e243 100644
index c1a42d04429a4e9587a4907c29f6b917951e659c..e5a2779a0460500c7d58f97c605549a366b5f0ce 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -1428,7 +1428,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -1427,7 +1427,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
CraftMetaTropicalFishBucket.VARIANT.NBT,
CraftMetaCrossbow.CHARGED.NBT,
CraftMetaCrossbow.CHARGED_PROJECTILES.NBT,

View File

@ -13,10 +13,10 @@ Update adjacent blocks of doors, double plants, pistons and beds
when cancelling interaction.
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index dff3eb118856bb4b79e4378b5c39100d65a09767..e2e5c17c24c8f5e9807ca879b1025d13cb195226 100644
index ee59d76d31b8b8cfd39d612b1e6040891f2256f4..36cf4c332054a350ae193637f895a45a8b04da9b 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -137,6 +137,11 @@ public class PlayerInteractManager {
@@ -148,6 +148,11 @@ public class PlayerInteractManager {
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND);
if (event.isCancelled()) {
// Let the client know the block still exists
@ -28,15 +28,22 @@ index dff3eb118856bb4b79e4378b5c39100d65a09767..e2e5c17c24c8f5e9807ca879b1025d13
this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
// Update any tile entity data for this block
TileEntity tileentity = this.world.getTileEntity(blockposition);
@@ -449,7 +454,25 @@ public class PlayerInteractManager {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down()));
@@ -446,13 +451,32 @@ public class PlayerInteractManager {
interactResult = event.useItemInHand() == Event.Result.DENY;
if (event.useInteractedBlock() == Event.Result.DENY) {
+
// If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
if (iblockdata.getBlock() instanceof BlockDoor) {
boolean bottom = iblockdata.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER;
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down()));
} else if (iblockdata.getBlock() instanceof BlockCake) {
((EntityPlayer) entityhuman).getBukkitEntity().sendHealthUpdate(); // SPIGOT-1341 - reset health for cake
entityplayer.getBukkitEntity().sendHealthUpdate(); // SPIGOT-1341 - reset health for cake
+ // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method
+ } else if (iblockdata.getBlock() instanceof BlockStructure) {
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutCloseWindow());
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutCloseWindow());
+ } else if (iblockdata.getBlock() instanceof BlockCommand) {
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutCloseWindow());
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutCloseWindow());
+ } else if (iblockdata.getBlock() instanceof BlockFlowerPot) {
+ // Send a block change to air and then send back the correct block, just to make the client happy
+ PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(this.world, blockposition);
@ -51,6 +58,6 @@ index dff3eb118856bb4b79e4378b5c39100d65a09767..e2e5c17c24c8f5e9807ca879b1025d13
+ }
}
+ // Paper end - extend Player Interact cancellation
((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-2867
entityplayer.getBukkitEntity().updateInventory(); // SPIGOT-2867
enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS;
} else if (this.gamemode == EnumGamemode.SPECTATOR) {

View File

@ -7,7 +7,7 @@ This is faster if all you need is the UUID, as .getOwner() will cause
an OfflinePlayer to be loaded from disk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
index 9952db3eb5ba94547f5e786c473fb59dfec616ab..1aea5f3f05794b444ca592cf518e29f76ccbd397 100644
index 8c59b9ce12d4148b209c3824d44f6e9c736de16c..218a2190d1203ca0fbc2a5ad87e145f436aac314 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
@@ -90,6 +90,9 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
@ -21,7 +21,7 @@ index 9952db3eb5ba94547f5e786c473fb59dfec616ab..1aea5f3f05794b444ca592cf518e29f7
return getHandle().getOwnerUUID();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
index bff9854f3088649e6718ba8096abb170915f9d84..286d1194f2d46a8715a095ecaed276f657e5214b 100644
index 58d9cd8172dcb8d3df93355d8ff51053b7469c45..6a642155cf387f7d0e2cf9bdf1a78c62aef8205b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java
@@ -17,6 +17,9 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat

View File

@ -21,10 +21,10 @@ index 92e6891502ef6dc276ed5b371124f24d5237b26b..77cdbfadf9c3eddb6a02460c321fa816
private void allChunksAreSlimeChunks() {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 542f935b4e7a027b3df82f037fcd6523286c5106..55d08d77480fda81e0155aa1e0287fddc827b67a 100644
index eaed020982bd19dab72872849170fa62d75699eb..5326e7433dc0a4ff0e1d0ca30aad95b1ec718d6a 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1063,6 +1063,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1042,6 +1042,7 @@ public abstract class EntityHuman extends EntityLiving {
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isClimbing() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && entity instanceof EntityLiving;

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix NPE when getting location from InventoryEnderChest opened
diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java
index 5a9ac3960de199b166ba481794529f8801cdebb7..fd31b9a6dcf6aba4041f9f08e49a9b464b956843 100644
index ce74a5ff2905042e54615439b8e5369d6a921a27..bf8c5436b6cc9f661e7b607fa4696e7ae55b3a13 100644
--- a/src/main/java/net/minecraft/server/InventoryEnderChest.java
+++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java
@@ -5,7 +5,7 @@ import org.bukkit.inventory.InventoryHolder;

View File

@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 10 Mar 2018 16:33:15 -0500
Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks
diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java
index 061b157f66999a733c3c4e990371b6f8d7860de2..77f5f835c60c181a0a2d6fc782d756338bc2ccb0 100644
--- a/src/main/java/net/minecraft/server/BlockIceFrost.java
+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java
@@ -28,7 +28,8 @@ public class BlockIceFrost extends BlockIce {
EnumDirection enumdirection = aenumdirection[j];
blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, enumdirection);
- IBlockData iblockdata1 = worldserver.getType(blockposition_mutableblockposition);
+ IBlockData iblockdata1 = worldserver.getTypeIfLoaded(blockposition_mutableblockposition); // Paper
+ if (iblockdata1 == null) { continue; } // Paper
if (iblockdata1.a((Block) this) && !this.e(iblockdata1, (World) worldserver, blockposition_mutableblockposition)) {
worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
@@ -71,7 +72,9 @@ public class BlockIceFrost extends BlockIce {
EnumDirection enumdirection = aenumdirection[l];
blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, enumdirection);
- if (iblockaccess.getType(blockposition_mutableblockposition).a((Block) this)) {
+ // Paper start
+ IBlockData type = iblockaccess.getTypeIfLoaded(blockposition_mutableblockposition);
+ if (type != null && type.a((Block) this)) { // Paper end
++j;
if (j >= i) {
return false;

View File

@ -12,7 +12,7 @@ flushing on the netty event loop, so it won't do the flush on the main thread.
Renable flushing by passing -Dpaper.explicit-flush=true
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index e2d8ed88f05bf8cb214329ea27ac2b67f43e071a..08e314af7cbd6523bbd0bd5a5ad0a0fff2f080be 100644
index 33900c22d4123e0f8333b9bdb9601d302e26c972..8cb29ddc0d5a5951ea35e1a16c023efb9b0be42d 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -63,6 +63,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@ -23,7 +23,7 @@ index e2d8ed88f05bf8cb214329ea27ac2b67f43e071a..08e314af7cbd6523bbd0bd5a5ad0a0ff
// Paper end
public NetworkManager(EnumProtocolDirection enumprotocoldirection) {
@@ -231,7 +232,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@@ -230,7 +231,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
if (this.channel != null) {

View File

@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 10 Mar 2018 16:33:15 -0500
Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks
diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java
index 5e414138e4e542c16508d679e571aac72c082e7b..638a0aa5ae80da2df9e640060272b83c6fc986ae 100644
--- a/src/main/java/net/minecraft/server/BlockIceFrost.java
+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java
@@ -26,8 +26,8 @@ public class BlockIceFrost extends BlockIce {
EnumDirection enumdirection = aenumdirection[j];
blockposition_pooledblockposition.g(blockposition).c(enumdirection);
- IBlockData iblockdata1 = worldserver.getType(blockposition_pooledblockposition);
-
+ IBlockData iblockdata1 = worldserver.getTypeIfLoaded(blockposition_pooledblockposition); // Paper - don't load chunks
+ if (iblockdata1 == null) continue; // Paper
if (iblockdata1.getBlock() == this && !this.e(iblockdata1, (World) worldserver, blockposition_pooledblockposition)) {
worldserver.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
}
@@ -89,7 +89,7 @@ public class BlockIceFrost extends BlockIce {
EnumDirection enumdirection = aenumdirection[l];
blockposition_pooledblockposition.g(blockposition).c(enumdirection);
- if (iblockaccess.getType(blockposition_pooledblockposition).getBlock() == this) {
+ if (((World) iblockaccess).getBlockIfLoaded(blockposition_pooledblockposition) == this) { // Paper - don't load chunks
++j;
if (j >= i) {
boolean flag = false;

View File

@ -177,30 +177,30 @@ index 0000000000000000000000000000000000000000..a85466bc7e0a8aa54b9eff14077fe6c9
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 54f80cb8e1b771f2a493543e04f8bc8346a391dc..e7ee0e9b9b68f1fe31e189fbfd7e5b175a288a50 100644
index 82e0def9becf8ecb68b2629531852808ad5a40a3..445d691b5051b4aefe480bea33a7bd6855009ecf 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,6 +1,9 @@
package net.minecraft.server;
@@ -2,6 +2,9 @@ package net.minecraft.server;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
+import co.aikar.timings.Timings;
+import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
+import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.JsonElement;
@@ -1095,7 +1098,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (i - this.Z >= 5000000000L) {
this.Z = i;
import com.google.common.collect.Sets;
@@ -1118,7 +1121,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (i - this.T >= 5000000000L) {
this.T = i;
this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount()));
- GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), 12)];
+ GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), org.spigotmc.SpigotConfig.playerSample)]; // Paper
int j = MathHelper.nextInt(this.q, 0, this.getPlayerCount() - agameprofile.length);
int j = MathHelper.nextInt(this.r, 0, this.getPlayerCount() - agameprofile.length);
for (int k = 0; k < agameprofile.length; ++k) {
diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java
index 658ea609cb4927b29a3d5303006f2adf2847e06b..4bb21c48bd50353370ec3c3546a00a5d20e4b9d8 100644
index d9d9999e79f888d9d9ac0ef9ae5b3db67ac405ed..da804a9904c0bf7219729e9b9aca1bfc72dd10d6 100644
--- a/src/main/java/net/minecraft/server/PacketStatusListener.java
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java
@@ -37,6 +37,8 @@ public class PacketStatusListener implements PacketStatusInListener {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent
This will allow you to change the players name or skin on login.
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 1fb609dcfc61adfc63f0d32dc87a5e144a5013cf..1b43f921646e3c1bfdca22ef7d3719c72aaf4520 100644
index 3cc12e7b75b8ed21a0ea44f8453553cf856fb786..80a21dbc05ed3007f2e827f7a320131244c3044b 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -1,5 +1,7 @@
@ -16,8 +16,8 @@ index 1fb609dcfc61adfc63f0d32dc87a5e144a5013cf..1b43f921646e3c1bfdca22ef7d3719c7
+import com.destroystokyo.paper.profile.PlayerProfile;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.exceptions.AuthenticationUnavailableException;
import io.netty.channel.ChannelFuture;
@@ -19,6 +21,7 @@ import org.apache.logging.log4j.LogManager;
import java.math.BigInteger;
@@ -18,6 +20,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
// CraftBukkit start
@ -25,7 +25,7 @@ index 1fb609dcfc61adfc63f0d32dc87a5e144a5013cf..1b43f921646e3c1bfdca22ef7d3719c7
import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerPreLoginEvent;
@@ -287,8 +290,16 @@ public class LoginListener implements PacketLoginInListener {
@@ -286,8 +289,16 @@ public class LoginListener implements PacketLoginInListener {
java.util.UUID uniqueId = i.getId();
final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;