13
0
geforkt von Mirrors/Paper

[ci skip] Add more identifying patch comments, merge related patches

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-19 17:54:05 +01:00
Ursprung 64e5ff904c
Commit 3c246dc632
26 geänderte Dateien mit 99 neuen und 119 gelöschten Zeilen

Datei anzeigen

@ -129,7 +129,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else { } else {
this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold)); this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold));
} }
+ this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_THRESHOLD_SET); // Paper + this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_THRESHOLD_SET); // Paper - Add Channel initialization listeners
} else { } else {
if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) { if (this.channel.pipeline().get("decompress") instanceof CompressionDecoder) {
this.channel.pipeline().remove("decompress"); this.channel.pipeline().remove("decompress");
@ -137,7 +137,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.channel.pipeline().get("compress") instanceof CompressionEncoder) { if (this.channel.pipeline().get("compress") instanceof CompressionEncoder) {
this.channel.pipeline().remove("compress"); this.channel.pipeline().remove("compress");
} }
+ this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_DISABLED); // Paper + this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_DISABLED); // Paper - Add Channel initialization listeners
} }
} }
@ -149,7 +149,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
pending.add(object); // Paper pending.add(object); // Paper
((Connection) object).configurePacketHandler(channelpipeline); ((Connection) object).configurePacketHandler(channelpipeline);
((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); ((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));
+ io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper + io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper - Add Channel initialization listeners
} }
}).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit }).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
} }

Datei anzeigen

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void clearBees() { + public void clearBees() {
+ this.stored.clear(); + this.stored.clear();
+ } + }
+ // Paper end + // Paper end - Add EntityBlockStorage clearEntities
public static int getHoneyLevel(BlockState state) { public static int getHoneyLevel(BlockState state) {
return (Integer) state.getValue(BeehiveBlock.HONEY_LEVEL); return (Integer) state.getValue(BeehiveBlock.HONEY_LEVEL);
} }

Datei anzeigen

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 24 Dec 2020 12:27:41 -0800 Date: Thu, 24 Dec 2020 12:27:41 -0800
Subject: [PATCH] Added PlayerBedFailEnterEvent Subject: [PATCH] Add PlayerBedFailEnterEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@ -18,19 +18,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (!event.callEvent()) { + if (!event.callEvent()) {
+ return; + return;
+ } + }
+ // Paper end + // Paper end - PlayerBedFailEnterEvent
// CraftBukkit start - handling bed explosion from below here // CraftBukkit start - handling bed explosion from below here
- if (!world.dimensionType().bedWorks()) { - if (!world.dimensionType().bedWorks()) {
+ if (event.getWillExplode()) { // Paper + if (event.getWillExplode()) { // Paper - PlayerBedFailEnterEvent
this.explodeBed(finaliblockdata, world, finalblockposition); this.explodeBed(finaliblockdata, world, finalblockposition);
} else } else
// CraftBukkit end // CraftBukkit end
if (entityhuman_enumbedresult.getMessage() != null) { if (entityhuman_enumbedresult.getMessage() != null) {
- player.displayClientMessage(entityhuman_enumbedresult.getMessage(), true); - player.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
+ final net.kyori.adventure.text.Component message = event.getMessage(); // Paper + final net.kyori.adventure.text.Component message = event.getMessage(); // Paper - PlayerBedFailEnterEvent
+ if (message != null) player.displayClientMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), true); // Paper + if (message != null) player.displayClientMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), true); // Paper - PlayerBedFailEnterEvent
} }
+ } // Paper + } // Paper - PlayerBedFailEnterEvent
}); });
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;

Datei anzeigen

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 21 Apr 2021 15:58:19 -0700 Date: Wed, 21 Apr 2021 15:58:19 -0700
Subject: [PATCH] Added PlayerDeepSleepEvent Subject: [PATCH] Add PlayerDeepSleepEvent
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.isSleeping()) { if (this.isSleeping()) {
++this.sleepCounter; ++this.sleepCounter;
+ // Paper start + // Paper start - Add PlayerDeepSleepEvent
+ if (this.sleepCounter == 100) { + if (this.sleepCounter == 100) {
+ if (!new io.papermc.paper.event.player.PlayerDeepSleepEvent((org.bukkit.entity.Player) getBukkitEntity()).callEvent()) { this.sleepCounter = Integer.MIN_VALUE; } + if (!new io.papermc.paper.event.player.PlayerDeepSleepEvent((org.bukkit.entity.Player) getBukkitEntity()).callEvent()) { this.sleepCounter = Integer.MIN_VALUE; }
+ } + }
+ // Paper end + // Paper end - Add PlayerDeepSleepEvent
if (this.sleepCounter > 100) { if (this.sleepCounter > 100) {
this.sleepCounter = 100; this.sleepCounter = 100;
} }

Datei anzeigen

@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else { } else {
@@ -0,0 +0,0 @@ public class ServerConnectionListener { @@ -0,0 +0,0 @@ public class ServerConnectionListener {
((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); ((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));
io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper - Add Channel initialization listeners
} }
- }).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit - }).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
+ }).group(eventloopgroup).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper - Unix domain socket support + }).group(eventloopgroup).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper - Unix domain socket support
@ -125,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL @@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
// Paper end // Paper end
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - Add bypass host check
+ // Paper start - Unix domain socket support + // Paper start - Unix domain socket support
+ java.net.SocketAddress socketAddress = this.connection.getRemoteAddress(); + java.net.SocketAddress socketAddress = this.connection.getRemoteAddress();
this.connection.hostname = split[0]; this.connection.hostname = split[0];

Datei anzeigen

@ -13,16 +13,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return MobType.UNDEAD; return MobType.UNDEAD;
} }
+ // Paper start + // Paper start - shouldBurnInDay API
+ private boolean shouldBurnInDay = true; + private boolean shouldBurnInDay = true;
+ public boolean shouldBurnInDay() { return shouldBurnInDay; } + public boolean shouldBurnInDay() { return shouldBurnInDay; }
+ public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } + public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
+ // Paper end + // Paper end - shouldBurnInDay API
+ +
@Override @Override
public void aiStep() { public void aiStep() {
- boolean flag = this.isSunBurnTick(); - boolean flag = this.isSunBurnTick();
+ boolean flag = shouldBurnInDay && this.isSunBurnTick(); // Paper - Configurable Burning + boolean flag = shouldBurnInDay && this.isSunBurnTick(); // Paper - shouldBurnInDay API
if (flag) { if (flag) {
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
@ -30,20 +30,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void readAdditionalSaveData(CompoundTag nbt) { public void readAdditionalSaveData(CompoundTag nbt) {
super.readAdditionalSaveData(nbt); super.readAdditionalSaveData(nbt);
this.reassessWeaponGoal(); this.reassessWeaponGoal();
+ // Paper start + // Paper start - shouldBurnInDay API
+ if (nbt.contains("Paper.ShouldBurnInDay")) { + if (nbt.contains("Paper.ShouldBurnInDay")) {
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); + this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
+ } + }
+ // Paper end + // Paper end - shouldBurnInDay API
+ } + }
+ +
+ // Paper start + // Paper start - shouldBurnInDay API
+ @Override + @Override
+ public void addAdditionalSaveData(CompoundTag nbt) { + public void addAdditionalSaveData(CompoundTag nbt) {
+ super.addAdditionalSaveData(nbt); + super.addAdditionalSaveData(nbt);
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); + nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
} }
+ // Paper end + // Paper end - shouldBurnInDay API
@Override @Override
public void setItemSlot(EquipmentSlot slot, ItemStack stack) { public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public void aiStep() { public void aiStep() {
- if (this.isAlive() && this.isSunBurnTick()) { - if (this.isAlive() && this.isSunBurnTick()) {
+ if (this.isAlive() && shouldBurnInDay && this.isSunBurnTick()) { // Paper - Configurable Burning + if (this.isAlive() && shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API
this.setSecondsOnFire(8); this.setSecondsOnFire(8);
} }

Datei anzeigen

@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Paper end // Paper end
// if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
- if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { - if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
+ if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper + if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - Add bypass host check
this.connection.hostname = split[0]; this.connection.hostname = split[0];
this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] ); this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );

Datei anzeigen

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*/ */
boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");
+ if(!Boolean.parseBoolean(System.getenv().getOrDefault("PAPER_DISABLE_SERVER_GUI", String.valueOf(false)))) // Paper + if(!Boolean.parseBoolean(System.getenv().getOrDefault("PAPER_DISABLE_SERVER_GUI", String.valueOf(false)))) // Paper - Add environment variable to disable server gui
if (flag1 && !GraphicsEnvironment.isHeadless()) { if (flag1 && !GraphicsEnvironment.isHeadless()) {
dedicatedserver1.showGui(); dedicatedserver1.showGui();
} }

Datei anzeigen

@ -3,7 +3,6 @@ From: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
Date: Wed, 10 Mar 2021 21:26:31 +0100 Date: Wed, 10 Mar 2021 21:26:31 +0100
Subject: [PATCH] Add fast alternative constructor for Rotations Subject: [PATCH] Add fast alternative constructor for Rotations
Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
diff --git a/src/main/java/net/minecraft/core/Rotations.java b/src/main/java/net/minecraft/core/Rotations.java diff --git a/src/main/java/net/minecraft/core/Rotations.java b/src/main/java/net/minecraft/core/Rotations.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -23,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static Rotations createWithoutValidityChecks(float x, float y, float z) { + public static Rotations createWithoutValidityChecks(float x, float y, float z) {
+ return new Rotations(x, y, z, null); + return new Rotations(x, y, z, null);
+ } + }
+ // Paper end + // Paper end - faster alternative constructor
+ +
public ListTag save() { public ListTag save() {
ListTag listTag = new ListTag(); ListTag listTag = new ListTag();

Datei anzeigen

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Add more WanderingTrader API + // Paper start - Add more WanderingTrader API
+ public boolean canDrinkPotion = true; + public boolean canDrinkPotion = true;
+ public boolean canDrinkMilk = true; + public boolean canDrinkMilk = true;
+ // Paper end + // Paper end - Add more WanderingTrader API
public WanderingTrader(EntityType<? extends WanderingTrader> type, Level world) { public WanderingTrader(EntityType<? extends WanderingTrader> type, Level world) {
super(type, world); super(type, world);

Datei anzeigen

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (blockposition.getY() < i) { if (blockposition.getY() < i) {
- if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) { - if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig().spawn.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - sign check + if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig().spawn.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - Allow using signs inside spawn protection
this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706 this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);

Datei anzeigen

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ entityplayer.containerMenu.setCarried(net.minecraft.world.item.ItemStack.EMPTY); + entityplayer.containerMenu.setCarried(net.minecraft.world.item.ItemStack.EMPTY);
+ entityplayer.drop(carried, false); + entityplayer.drop(carried, false);
+ } + }
+ // Paper end + // Paper end - Drop carried item when player has disconnected
+ +
this.save(entityplayer); this.save(entityplayer);
if (entityplayer.isPassenger()) { if (entityplayer.isPassenger()) {

Datei anzeigen

@ -216,7 +216,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
thread.setDaemon(true); thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER)); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
- thread.start(); - thread.start();
+ // thread.start(); // Paper - moved down + // thread.start(); // Paper - Enhance console tab completions for brigadier commands; moved down
DedicatedServer.LOGGER.info("Starting minecraft server version {}", SharedConstants.getCurrentVersion().getName()); DedicatedServer.LOGGER.info("Starting minecraft server version {}", SharedConstants.getCurrentVersion().getName());
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
@ -224,7 +224,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames
// Paper end - convert old users earlier after PlayerList creation but before file load/save // Paper end - convert old users earlier after PlayerList creation but before file load/save
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
+ thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized + thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
@ -236,11 +236,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class ConsoleCommandCompleter implements Completer { public class ConsoleCommandCompleter implements Completer {
private final DedicatedServer server; // Paper - CraftServer -> DedicatedServer private final DedicatedServer server; // Paper - CraftServer -> DedicatedServer
+ private final io.papermc.paper.console.BrigadierCommandCompleter brigadierCompleter; // Paper + private final io.papermc.paper.console.BrigadierCommandCompleter brigadierCompleter; // Paper - Enhance console tab completions for brigadier commands
public ConsoleCommandCompleter(DedicatedServer server) { // Paper - CraftServer -> DedicatedServer public ConsoleCommandCompleter(DedicatedServer server) { // Paper - CraftServer -> DedicatedServer
this.server = server; this.server = server;
+ this.brigadierCompleter = new io.papermc.paper.console.BrigadierCommandCompleter(this.server); // Paper + this.brigadierCompleter = new io.papermc.paper.console.BrigadierCommandCompleter(this.server); // Paper - Enhance console tab completions for brigadier commands
} }
// Paper start - Change method signature for JLine update // Paper start - Change method signature for JLine update
@ -265,7 +265,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
try { try {
List<String> offers = waitable.get(); List<String> offers = waitable.get();
if (offers == null) { if (offers == null) {
+ this.addCompletions(reader, line, candidates, Collections.emptyList()); // Paper + this.addCompletions(reader, line, candidates, Collections.emptyList()); // Paper - Enhance console tab completions for brigadier commands
return; // Paper - Method returns void return; // Paper - Method returns void
} }

Datei anzeigen

@ -16,11 +16,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
final Spliterator<? extends Tag> spliterator = entityNbtList.spliterator(); final Spliterator<? extends Tag> spliterator = entityNbtList.spliterator();
return StreamSupport.stream(new Spliterator<Entity>() { return StreamSupport.stream(new Spliterator<Entity>() {
+ final java.util.Map<EntityType<?>, Integer> loadedEntityCounts = new java.util.HashMap<>(); // Paper + final java.util.Map<EntityType<?>, Integer> loadedEntityCounts = new java.util.HashMap<>(); // Paper - Entity load/save limit per chunk
public boolean tryAdvance(Consumer<? super Entity> consumer) { public boolean tryAdvance(Consumer<? super Entity> consumer) {
return spliterator.tryAdvance((nbtbase) -> { return spliterator.tryAdvance((nbtbase) -> {
EntityType.loadEntityRecursive((CompoundTag) nbtbase, world, (entity) -> { EntityType.loadEntityRecursive((CompoundTag) nbtbase, world, (entity) -> {
+ // Paper start + // Paper start - Entity load/save limit per chunk
+ final EntityType<?> entityType = entity.getType(); + final EntityType<?> entityType = entity.getType();
+ final int saveLimit = world.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1); + final int saveLimit = world.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1);
+ if (saveLimit > -1) { + if (saveLimit > -1) {
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ this.loadedEntityCounts.merge(entityType, 1, Integer::sum); + this.loadedEntityCounts.merge(entityType, 1, Integer::sum);
+ } + }
+ // Paper end + // Paper end - Entity load/save limit per chunk
consumer.accept(entity); consumer.accept(entity);
return entity; return entity;
}); });
@ -41,9 +41,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
ListTag listTag = new ListTag(); ListTag listTag = new ListTag();
+ final java.util.Map<net.minecraft.world.entity.EntityType<?>, Integer> savedEntityCounts = new java.util.HashMap<>(); // Paper + final java.util.Map<net.minecraft.world.entity.EntityType<?>, Integer> savedEntityCounts = new java.util.HashMap<>(); // Paper - Entity load/save limit per chunk
entities.forEach((entity) -> { // diff here: use entities parameter entities.forEach((entity) -> { // diff here: use entities parameter
+ // Paper start + // Paper start - Entity load/save limit per chunk
+ final EntityType<?> entityType = entity.getType(); + final EntityType<?> entityType = entity.getType();
+ final int saveLimit = level.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1); + final int saveLimit = level.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1);
+ if (saveLimit > -1) { + if (saveLimit > -1) {
@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ savedEntityCounts.merge(entityType, 1, Integer::sum); + savedEntityCounts.merge(entityType, 1, Integer::sum);
+ } + }
+ // Paper end + // Paper end - Entity load/save limit per chunk
CompoundTag compoundTag = new CompoundTag(); CompoundTag compoundTag = new CompoundTag();
if (entity.save(compoundTag)) { if (entity.save(compoundTag)) {
listTag.add(compoundTag); listTag.add(compoundTag);

Datei anzeigen

@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.dropLeash(true, false); - this.dropLeash(true, false);
+ // Paper start - drop leash variable + // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false); + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false);
+ if (!event.callEvent()) { return; } + this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash()); + this.dropLeash(true, event.isDropLeash());
+ // Paper end + // Paper end
this.getAllSlots().forEach((itemstack) -> { this.getAllSlots().forEach((itemstack) -> {
@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.dropLeash(true, true); - this.dropLeash(true, true);
+ // Paper start - drop leash variable + // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + if (!event.callEvent()) return;
+ this.dropLeash(true, event.isDropLeash()); + this.dropLeash(true, event.isDropLeash());
+ // Paper end + // Paper end
} }
@ -94,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.dropLeash(true, true); - this.dropLeash(true, true);
+ // Paper start - drop leash variable + // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + if (!event.callEvent()) return;
+ this.dropLeash(true, event.isDropLeash()); + this.dropLeash(true, event.isDropLeash());
+ // Paper end + // Paper end
this.goalSelector.disableControlFlag(Goal.Flag.MOVE); this.goalSelector.disableControlFlag(Goal.Flag.MOVE);

Datei anzeigen

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 15 May 2021 10:04:43 -0700 Date: Sat, 15 May 2021 10:04:43 -0700
Subject: [PATCH] additions to PlayerGameModeChangeEvent Subject: [PATCH] Expand PlayerGameModeChangeEvent
diff --git a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java diff --git a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java
@ -14,12 +14,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
for(ServerPlayer serverPlayer : minecraftServer.getPlayerList().getPlayers()) { for(ServerPlayer serverPlayer : minecraftServer.getPlayerList().getPlayers()) {
- if (serverPlayer.setGameMode(gameType)) { - if (serverPlayer.setGameMode(gameType)) {
- ++i; - ++i;
+ // Paper start - extend PlayerGameModeChangeEvent + // Paper start - Expand PlayerGameModeChangeEvent
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty()); + org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty());
+ if (event != null && event.isCancelled()) { + if (event != null && event.isCancelled()) {
+ source.sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); + source.sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false);
} }
+ // Paper end + // Paper end - Expand PlayerGameModeChangeEvent
+ ++i; + ++i;
} }
} }
@ -33,14 +33,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
for(ServerPlayer serverPlayer : targets) { for(ServerPlayer serverPlayer : targets) {
- if (serverPlayer.setGameMode(gameMode)) { - if (serverPlayer.setGameMode(gameMode)) {
+ // Paper start - extend PlayerGameModeChangeEvent + // Paper start - Expand PlayerGameModeChangeEvent
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.empty()); + org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.empty());
+ if (event != null && !event.isCancelled()) { + if (event != null && !event.isCancelled()) {
logGamemodeChange(context.getSource(), serverPlayer, gameMode); logGamemodeChange(context.getSource(), serverPlayer, gameMode);
++i; ++i;
+ } else if (event != null && event.cancelMessage() != null) { + } else if (event != null && event.cancelMessage() != null) {
+ context.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true); + context.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true);
+ // Paper end + // Paper end - Expand PlayerGameModeChangeEvent
} }
} }
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public boolean setGameMode(GameType gameMode) { public boolean setGameMode(GameType gameMode) {
- if (!this.gameMode.changeGameModeForPlayer(gameMode)) { - if (!this.gameMode.changeGameModeForPlayer(gameMode)) {
- return false; - return false;
+ // Paper start - Add cause and nullable message to event + // Paper start - Expand PlayerGameModeChangeEvent
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = this.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null); + org.bukkit.event.player.PlayerGameModeChangeEvent event = this.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
+ return event == null ? false : event.isCancelled(); + return event == null ? false : event.isCancelled();
+ } + }
@ -62,8 +62,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public org.bukkit.event.player.PlayerGameModeChangeEvent setGameMode(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, @Nullable net.kyori.adventure.text.Component message) { + public org.bukkit.event.player.PlayerGameModeChangeEvent setGameMode(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, @Nullable net.kyori.adventure.text.Component message) {
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = this.gameMode.changeGameModeForPlayer(gameMode, cause, message); + org.bukkit.event.player.PlayerGameModeChangeEvent event = this.gameMode.changeGameModeForPlayer(gameMode, cause, message);
+ if (event == null || event.isCancelled()) { + if (event == null || event.isCancelled()) {
+ // Paper end
+ return null; + return null;
+ // Paper end - Expand PlayerGameModeChangeEvent
} else { } else {
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId())); this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId()));
if (gameMode == GameType.SPECTATOR) { if (gameMode == GameType.SPECTATOR) {
@ -72,7 +72,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.onUpdateAbilities(); this.onUpdateAbilities();
this.updateEffectVisibility(); this.updateEffectVisibility();
- return true; - return true;
+ return event; // Paper + return event; // Paper - Expand PlayerGameModeChangeEvent
} }
} }
@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public void loadGameTypes(@Nullable CompoundTag nbt) { public void loadGameTypes(@Nullable CompoundTag nbt) {
+ // Paper start + // Paper start - Expand PlayerGameModeChangeEvent
+ if (this.server.getForcedGameType() != null && this.server.getForcedGameType() != ServerPlayer.readPlayerMode(nbt, "playerGameType")) { + if (this.server.getForcedGameType() != null && this.server.getForcedGameType() != ServerPlayer.readPlayerMode(nbt, "playerGameType")) {
+ if (new org.bukkit.event.player.PlayerGameModeChangeEvent(this.getBukkitEntity(), org.bukkit.GameMode.getByValue(this.server.getDefaultGameType().getId()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, null).callEvent()) { + if (new org.bukkit.event.player.PlayerGameModeChangeEvent(this.getBukkitEntity(), org.bukkit.GameMode.getByValue(this.server.getDefaultGameType().getId()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, null).callEvent()) {
+ this.gameMode.setGameModeForPlayer(this.server.getForcedGameType(), GameType.DEFAULT_MODE); + this.gameMode.setGameModeForPlayer(this.server.getForcedGameType(), GameType.DEFAULT_MODE);
@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ return; + return;
+ } + }
+ // Paper end + // Paper end - Expand PlayerGameModeChangeEvent
this.gameMode.setGameModeForPlayer(this.calculateGameModeForNewPlayer(ServerPlayer.readPlayerMode(nbt, "playerGameType")), ServerPlayer.readPlayerMode(nbt, "previousPlayerGameType")); this.gameMode.setGameModeForPlayer(this.calculateGameModeForNewPlayer(ServerPlayer.readPlayerMode(nbt, "playerGameType")), ServerPlayer.readPlayerMode(nbt, "previousPlayerGameType"));
} }
@ -101,16 +101,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public boolean changeGameModeForPlayer(GameType gameMode) { public boolean changeGameModeForPlayer(GameType gameMode) {
+ // Paper end + // Paper end - Expand PlayerGameModeChangeEvent
+ PlayerGameModeChangeEvent event = this.changeGameModeForPlayer(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null); + PlayerGameModeChangeEvent event = this.changeGameModeForPlayer(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
+ return event != null && event.isCancelled(); + return event != null && event.isCancelled();
+ } + }
+ @Nullable + @Nullable
+ public PlayerGameModeChangeEvent changeGameModeForPlayer(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, @Nullable net.kyori.adventure.text.Component cancelMessage) { + public PlayerGameModeChangeEvent changeGameModeForPlayer(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, @Nullable net.kyori.adventure.text.Component cancelMessage) {
+ // Paper end + // Paper end - Expand PlayerGameModeChangeEvent
if (gameMode == this.gameModeForPlayer) { if (gameMode == this.gameModeForPlayer) {
- return false; - return false;
+ return null; // Paper + return null; // Paper - Expand PlayerGameModeChangeEvent
} else { } else {
// CraftBukkit start // CraftBukkit start
- PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this.player.getBukkitEntity(), GameMode.getByValue(gameMode.getId())); - PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this.player.getBukkitEntity(), GameMode.getByValue(gameMode.getId()));
@ -118,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.level.getCraftServer().getPluginManager().callEvent(event); this.level.getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
- return false; - return false;
+ return event; // Paper + return event; // Paper - Expand PlayerGameModeChangeEvent
} }
// CraftBukkit end // CraftBukkit end
this.setGameModeForPlayer(gameMode, this.previousGameModeForPlayer); this.setGameModeForPlayer(gameMode, this.previousGameModeForPlayer);
@ -126,7 +126,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
this.level.updateSleepingPlayerList(); this.level.updateSleepingPlayerList();
- return true; - return true;
+ return event; // Paper + return event; // Paper - Expand PlayerGameModeChangeEvent
} }
} }
@ -139,7 +139,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
if (this.server.isHardcore()) { if (this.server.isHardcore()) {
- this.player.setGameMode(GameType.SPECTATOR); - this.player.setGameMode(GameType.SPECTATOR);
+ this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper + this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - Expand PlayerGameModeChangeEvent
((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server); ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
} }
} }
@ -152,7 +152,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.getHandle().connection == null) return; if (this.getHandle().connection == null) return;
- this.getHandle().setGameMode(GameType.byId(mode.getValue())); - this.getHandle().setGameMode(GameType.byId(mode.getValue()));
+ this.getHandle().setGameMode(GameType.byId(mode.getValue()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.PLUGIN, null); // Paper + this.getHandle().setGameMode(GameType.byId(mode.getValue()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.PLUGIN, null); // Paper - Expand PlayerGameModeChangeEvent
} }
@Override @Override

Datei anzeigen

@ -1,8 +1,9 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com> From: HexedHero <6012891+HexedHero@users.noreply.github.com>
Date: Thu, 22 Apr 2021 17:17:47 -0700 Date: Fri, 23 Apr 2021 22:42:42 +0100
Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent Subject: [PATCH] Expand PlayerRespawnEvent, fix passed parameter issues
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -13,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.player.wonGame) { if (this.player.wonGame) {
this.player.wonGame = false; this.player.wonGame = false;
- this.player = this.server.getPlayerList().respawn(this.player, true, RespawnReason.END_PORTAL); - this.player = this.server.getPlayerList().respawn(this.player, true, RespawnReason.END_PORTAL);
+ this.player = this.server.getPlayerList().respawn(this.player, this.server.getLevel(this.player.getRespawnDimension()), true, null, true, RespawnReason.END_PORTAL, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag.END_PORTAL); // Paper - add isEndCreditsRespawn argument + this.player = this.server.getPlayerList().respawn(this.player, this.server.getLevel(this.player.getRespawnDimension()), true, null, true, RespawnReason.END_PORTAL, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag.END_PORTAL); // Paper - Expand PlayerRespawnEvent
CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD); CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD);
} else { } else {
if (this.player.getHealth() > 0.0F) { if (this.player.getHealth() > 0.0F) {
@ -25,21 +26,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) { public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
+ // Paper start + // Paper start - Expand PlayerRespawnEvent
+ return respawn(entityplayer, worldserver, flag, location, avoidSuffocation, reason, new org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[0]); + return respawn(entityplayer, worldserver, flag, location, avoidSuffocation, reason, new org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[0]);
+ } + }
+ +
+ public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag...respawnFlags) { + public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag...respawnFlags) {
+ // Paper end + // Paper end - Expand PlayerRespawnEvent
entityplayer.stopRiding(); // CraftBukkit entityplayer.stopRiding(); // CraftBukkit
this.players.remove(entityplayer); this.players.remove(entityplayer);
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
@@ -0,0 +0,0 @@ public abstract class PlayerList {
// Paper start
boolean isBedSpawn = false;
+ boolean isAnchorSpawn = false; // Paper - Fix PlayerRespawnEvent
boolean isRespawn = false;
boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
// Paper end
@@ -0,0 +0,0 @@ public abstract class PlayerList {
if (optional.isPresent()) {
BlockState iblockdata = worldserver1.getBlockState(blockposition);
boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
+ isAnchorSpawn = flag3; // Paper - Fix PlayerRespawnEvent
Vec3 vec3d = (Vec3) optional.get();
float f1;
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
} }
Player respawnPlayer = entityplayer1.getBukkitEntity(); Player respawnPlayer = entityplayer1.getBukkitEntity();
- PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, reason); // Paper - Fix anchor respawn acting as a bed respawn from the end portal - PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !flag2, flag2, reason);
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, reason, com.google.common.collect.ImmutableSet.<org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag>builder().add(respawnFlags)); // Paper - Fix anchor respawn acting as a bed respawn from the end portal + PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, reason, com.google.common.collect.ImmutableSet.<org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag>builder().add(respawnFlags)); // Paper - PlayerRespawnEvent changes
this.cserver.getPluginManager().callEvent(respawnEvent); this.cserver.getPluginManager().callEvent(respawnEvent);
// Spigot Start // Spigot Start
if (entityplayer.connection.isDisconnected()) { if (entityplayer.connection.isDisconnected()) {

Datei anzeigen

@ -167,7 +167,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -0,0 +0,0 @@ public class ServerPlayerGameMode { @@ -0,0 +0,0 @@ public class ServerPlayerGameMode {
return event; // Paper return event; // Paper - Expand PlayerGameModeChangeEvent
} }
// CraftBukkit end // CraftBukkit end
- this.setGameModeForPlayer(gameMode, this.previousGameModeForPlayer); - this.setGameModeForPlayer(gameMode, this.previousGameModeForPlayer);
@ -483,7 +483,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name @@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(level, worldPosition); org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(level, worldPosition);
new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent(); new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent();
// Paper end // Paper end - beacon activation/deactivation events
+ // Paper start - fix MC-153086 + // Paper start - fix MC-153086
+ if (this.levels > 0 && !this.beamSections.isEmpty()) { + if (this.levels > 0 && !this.beamSections.isEmpty()) {
BeaconBlockEntity.playSound(this.level, this.worldPosition, SoundEvents.BEACON_DEACTIVATE); BeaconBlockEntity.playSound(this.level, this.worldPosition, SoundEvents.BEACON_DEACTIVATE);

Datei anzeigen

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HexedHero <6012891+HexedHero@users.noreply.github.com>
Date: Fri, 23 Apr 2021 22:42:42 +0100
Subject: [PATCH] Fix anchor respawn acting as a bed respawn from the end
portal
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList {
// Paper start
boolean isBedSpawn = false;
+ boolean isAnchorSpawn = false;
boolean isRespawn = false;
boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
// Paper end
@@ -0,0 +0,0 @@ public abstract class PlayerList {
if (optional.isPresent()) {
BlockState iblockdata = worldserver1.getBlockState(blockposition);
boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
+ isAnchorSpawn = flag3; // Paper - Fix anchor respawn acting as a bed respawn from the end portal
Vec3 vec3d = (Vec3) optional.get();
float f1;
@@ -0,0 +0,0 @@ public abstract class PlayerList {
}
Player respawnPlayer = entityplayer1.getBukkitEntity();
- PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !flag2, flag2, reason);
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, reason); // Paper - Fix anchor respawn acting as a bed respawn from the end portal
this.cserver.getPluginManager().callEvent(respawnEvent);
// Spigot Start
if (entityplayer.connection.isDisconnected()) {

Datei anzeigen

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo @@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
// Paper end // Paper end - shouldBurnInDay API
@Override @Override
- public void setItemSlot(EquipmentSlot slot, ItemStack stack) { - public void setItemSlot(EquipmentSlot slot, ItemStack stack) {

Datei anzeigen

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); + org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos);
+ new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent(); + new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent();
+ } + }
+ // Paper end + // Paper end - beacon activation/deactivation events
if (blockEntity.lastCheckY >= l) { if (blockEntity.lastCheckY >= l) {
blockEntity.lastCheckY = world.getMinBuildHeight() - 1; blockEntity.lastCheckY = world.getMinBuildHeight() - 1;
@ -28,10 +28,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public void setRemoved() { public void setRemoved() {
+ // Paper start - BeaconDeactivatedEvent + // Paper start - beacon activation/deactivation events
+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(level, worldPosition); + org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(level, worldPosition);
+ new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent(); + new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent();
+ // Paper end + // Paper end - beacon activation/deactivation events
BeaconBlockEntity.playSound(this.level, this.worldPosition, SoundEvents.BEACON_DEACTIVATE); BeaconBlockEntity.playSound(this.level, this.worldPosition, SoundEvents.BEACON_DEACTIVATE);
super.setRemoved(); super.setRemoved();
} }

Datei anzeigen

@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
if (this.server.isHardcore()) { if (this.server.isHardcore()) {
this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - Expand PlayerGameModeChangeEvent
- ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server); - ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
+ ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.player.serverLevel()); // Paper - Pass ServerLevel for gamerule callbacks + ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.player.serverLevel()); // Paper - Pass ServerLevel for gamerule callbacks
} }

Datei anzeigen

@ -14,11 +14,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void sendCommands(ServerPlayer player) { public void sendCommands(ServerPlayer player) {
- if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot - if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
+ // Paper start - Send empty commands if tab completion is disabled + // Paper start - Send empty commands if tab completion is disabled
+ if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) { //return; // Spigot + if (org.spigotmc.SpigotConfig.tabComplete < 0) {
+ player.connection.send(new ClientboundCommandsPacket(new RootCommandNode<>())); + player.connection.send(new ClientboundCommandsPacket(new RootCommandNode<>()));
+ return; + return;
+ } + }
+ // Paper end + // Paper end - Send empty commands if tab completion is disabled
// CraftBukkit start // CraftBukkit start
// Register Vanilla commands into builtRoot as before // Register Vanilla commands into builtRoot as before
// Paper start - Async command map building // Paper start - Async command map building

Datei anzeigen

@ -318,7 +318,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold)); - this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressionThreshold));
+ this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressor, compressionThreshold)); // Paper - Use Velocity cipher + this.channel.pipeline().addBefore("encoder", "compress", new CompressionEncoder(compressor, compressionThreshold)); // Paper - Use Velocity cipher
} }
this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_THRESHOLD_SET); // Paper this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_THRESHOLD_SET); // Paper - Add Channel initialization listeners
} else { } else {
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

Datei anzeigen

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
flag1 = true; flag1 = true;
- if (flag3) { - if (flag3) {
+ if (flag3 && furnaceBurnEvent.willConsumeFuel()) { // Paper + if (flag3 && furnaceBurnEvent.willConsumeFuel()) { // Paper - add consumeFuel to FurnaceBurnEvent
Item item = itemstack.getItem(); Item item = itemstack.getItem();
itemstack.shrink(1); itemstack.shrink(1);

Datei anzeigen

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private int ticksUntilNextAlert; private int ticksUntilNextAlert;
private static final float ZOMBIFIED_PIGLIN_EYE_HEIGHT = 1.79F; private static final float ZOMBIFIED_PIGLIN_EYE_HEIGHT = 1.79F;
private static final float ZOMBIFIED_PIGLIN_BABY_EYE_HEIGHT_ADJUSTMENT = 0.82F; private static final float ZOMBIFIED_PIGLIN_BABY_EYE_HEIGHT_ADJUSTMENT = 0.82F;
+ private HurtByTargetGoal pathfinderGoalHurtByTarget; // Paper + private HurtByTargetGoal pathfinderGoalHurtByTarget; // Paper - fix PigZombieAngerEvent cancellation
public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> type, Level world) { public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> type, Level world) {
super(type, world); super(type, world);
@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0D, false)); this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0D, false));
this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D)); this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D));
- this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers()); - this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers());
+ this.targetSelector.addGoal(1, pathfinderGoalHurtByTarget = (new HurtByTargetGoal(this, new Class[0])).setAlertOthers()); // Paper - assign field + this.targetSelector.addGoal(1, pathfinderGoalHurtByTarget = (new HurtByTargetGoal(this, new Class[0])).setAlertOthers()); // Paper - fix PigZombieAngerEvent cancellation
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true)); this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true));
} }
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.level().getCraftServer().getPluginManager().callEvent(event); this.level().getCraftServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
this.setPersistentAngerTarget(null); this.setPersistentAngerTarget(null);
+ pathfinderGoalHurtByTarget.stop(); // Paper - clear goalTargets to fix cancellation + pathfinderGoalHurtByTarget.stop(); // Paper - fix PigZombieAngerEvent cancellation
return; return;
} }
this.setRemainingPersistentAngerTime(event.getNewAnger()); this.setRemainingPersistentAngerTime(event.getNewAnger());