mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 19:40:37 +01:00
more more more more more more more more more more work
This commit is contained in:
parent
2b7e17a127
commit
9e63e24f0b
32 changed files with 25 additions and 45 deletions
patches
server
Add-EntityPortalReadyEvent.patchAdd-NamespacedKey-biome-methods.patchAdd-Player-getFishHook.patchAdd-Velocity-IP-Forwarding-Support.patchAdd-a-consumer-parameter-to-ProjectileSource-launchP.patchAdd-and-fix-missing-BlockFadeEvents.patchAdd-some-minimal-debug-information-to-chat-packet-er.patchAdd-various-missing-EntityDropItemEvent-calls.patchAdded-byte-array-serialization-deserialization-for-P.patchBlock-Ticking-API.patchCall-BlockPhysicsEvent-more-often.patchCollision-API.patchConfigurable-chat-thread-limit.patchCustom-Chat-Completion-Suggestions-API.patchDo-not-sync-load-chunk-for-dynamic-game-event-listen.patchDon-t-broadcast-messages-to-command-blocks.patchDon-t-use-level-random-in-entity-constructors.patchFire-EntityChangeBlockEvent-in-more-places.patchFix-Bee-flower-NPE.patchFix-CCE-for-SplashPotion-and-LingeringPotion-spawnin.patchFix-Spigot-Config-not-using-commands.spam-exclusions.patchFix-plugin-loggers-on-server-shutdown.patchFix-suggest-command-message-for-brigadier-syntax-exc.patchMissing-eating-regain-reason.patchMissing-effect-cause.patchMore-Teleport-API.patchPrevent-empty-items-from-being-added-to-world.patchSend-block-entities-after-destroy-prediction.patchStop-large-look-changes-from-crashing-the-server.patchUse-thread-safe-random-in-ServerLoginPacketListenerI.patchWarn-on-plugins-accessing-faraway-chunks.patch
unapplied/server
|
@ -127,8 +127,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@Nullable
|
||||
private ServerPlayer delayedAcceptPlayer;
|
||||
private final String serverId;
|
||||
private ServerPlayer player; // CraftBukkit
|
||||
public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding
|
||||
+ private int velocityLoginMessageId = -1; // Paper - Velocity support
|
||||
|
||||
|
@ -154,20 +154,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
public class LoginHandler {
|
||||
|
||||
public void fireEvents() throws Exception {
|
||||
public void fireEvents(GameProfile gameprofile) throws Exception {
|
||||
+ // Paper start - Velocity support
|
||||
+ if (ServerLoginPacketListenerImpl.this.velocityLoginMessageId == -1 && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) {
|
||||
+ disconnect("This server requires you to connect with Velocity.");
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName();
|
||||
String playerName = gameprofile.getName();
|
||||
java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress();
|
||||
java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.channel.remoteAddress()).getAddress(); // Paper
|
||||
java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.channel.remoteAddress()).getAddress(); // Paper
|
||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
// Spigot end
|
||||
|
||||
public void handleCustomQueryPacket(ServerboundCustomQueryPacket packet) {
|
||||
@Override
|
||||
public void handleCustomQueryPacket(ServerboundCustomQueryAnswerPacket packet) {
|
||||
+ // Paper start - Velocity support
|
||||
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && packet.getTransactionId() == this.velocityLoginMessageId) {
|
||||
+ net.minecraft.network.FriendlyByteBuf buf = packet.getData();
|
||||
|
@ -193,23 +193,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ this.connection.address = new java.net.InetSocketAddress(com.destroystokyo.paper.proxy.VelocityProxy.readAddress(buf), port);
|
||||
+
|
||||
+ this.gameProfile = com.destroystokyo.paper.proxy.VelocityProxy.createProfile(buf);
|
||||
+ this.authenticatedProfile = com.destroystokyo.paper.proxy.VelocityProxy.createProfile(buf);
|
||||
+
|
||||
+ //TODO Update handling for lazy sessions, might not even have to do anything?
|
||||
+
|
||||
+ // Proceed with login
|
||||
+ authenticatorPool.execute(() -> {
|
||||
+ try {
|
||||
+ new LoginHandler().fireEvents();
|
||||
+ new LoginHandler().fireEvents(this.authenticatedProfile);
|
||||
+ } catch (Exception ex) {
|
||||
+ disconnect("Failed to verify username!");
|
||||
+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameProfile.getName(), ex);
|
||||
+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + this.authenticatedProfile.getName(), ex);
|
||||
+ }
|
||||
+ });
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.disconnect(Component.translatable("multiplayer.disconnect.unexpected_query_response"));
|
||||
this.disconnect(ServerLoginPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end - launchProjectile consumer
|
||||
Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
|
||||
// Copied from BlockDispenser.dispense()
|
||||
BlockSourceImpl isourceblock = new BlockSourceImpl((ServerLevel) this.dispenserBlock.getLevel(), this.dispenserBlock.getBlockPos());
|
||||
BlockSource sourceblock = new BlockSource((ServerLevel) this.dispenserBlock.getLevel(), this.dispenserBlock.getBlockPos(), this.dispenserBlock.getBlockState(), this.dispenserBlock);
|
||||
@@ -0,0 +0,0 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||
if (velocity != null) {
|
||||
((T) launch.getBukkitEntity()).setVelocity(velocity);
|
|
@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
|
||||
if (!this.updateChatOrder(timestamp)) {
|
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public boolean runNext(Level world) {
|
||||
BlockPos blockPos = this.sourcePos.relative(NeighborUpdater.UPDATE_ORDER[this.idx++]);
|
||||
BlockState blockState = world.getBlockState(blockPos);
|
||||
- blockState.neighborChanged(world, blockPos, this.sourceBlock, this.sourcePos, false);
|
||||
- NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, this.sourcePos, false);
|
||||
+ // Paper start
|
||||
+ try {
|
||||
+ boolean cancelled = false;
|
||||
|
@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ }
|
||||
+ if (!cancelled) { // continue to check for adjacent block (increase idx)
|
||||
+ blockState.neighborChanged(world, blockPos, this.sourceBlock, this.sourcePos, false);
|
||||
+ NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, this.sourcePos, false);
|
||||
+ }
|
||||
+ } catch (StackOverflowError ex) {
|
||||
+ world.lastPhysicsProblem = new BlockPos(blockPos);
|
|
@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- Optional<BlockPos> optional = LightningBolt.randomStepCleaningCopper(world, mutablePos);
|
||||
+ Optional<BlockPos> optional = LightningBolt.randomStepCleaningCopper(world, mutablePos, lightning); // Paper - transmit LightningBolt instance to call EntityChangeBlockEvent
|
||||
|
||||
if (!optional.isPresent()) {
|
||||
if (optional.isEmpty()) {
|
||||
break;
|
||||
@@ -0,0 +0,0 @@ public class LightningBolt extends Entity {
|
||||
|
|
@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
// Spigot end
|
||||
// this.chatSpamTickCount += 20;
|
|
@ -21,7 +21,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Rider
|
||||
@@ -0,0 +0,0 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
||||
} else {
|
||||
boolean bl = this.getHealth() < this.getMaxHealth();
|
||||
if (bl) {
|
|
@ -35,11 +35,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java
|
||||
@@ -0,0 +0,0 @@ public class SuspiciousStewItem extends Item {
|
||||
@Override
|
||||
public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user) {
|
||||
ItemStack itemStack = super.finishUsingItem(stack, world, user);
|
||||
- listPotionEffects(itemStack, user::addEffect);
|
||||
+ listPotionEffects(itemStack, effect -> user.addEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD)); // Paper
|
||||
listPotionEffects(itemStack, (effect) -> {
|
||||
- user.addEffect(effect.createEffectInstance());
|
||||
+ user.addEffect(effect.createEffectInstance(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper
|
||||
});
|
||||
return user instanceof Player && ((Player)user).getAbilities().instabuild ? itemStack : new ItemStack(Items.BOWL);
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
return false; // CraftBukkit - Return event status
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
return;
|
||||
}
|
||||
// Paper end - Don't allow digging in unloaded chunks
|
|
@ -9,10 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final int MAX_TICKS_BEFORE_LOGIN = 600;
|
||||
- private static final RandomSource RANDOM = RandomSource.create();
|
||||
private static final Component DISCONNECT_UNEXPECTED_QUERY = Component.translatable("multiplayer.disconnect.unexpected_query_response");
|
||||
+ private static final RandomSource RANDOM = new org.bukkit.craftbukkit.util.RandomSourceWrapper(new java.util.Random()); // Paper - This is called across threads, make safe
|
||||
private final byte[] challenge;
|
||||
final MinecraftServer server;
|
|
@ -1,19 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: pop4959 <pop4959@gmail.com>
|
||||
Date: Fri, 1 Jul 2022 22:00:06 -0700
|
||||
Subject: [PATCH] Don't print component in resource pack rejection message
|
||||
|
||||
|
||||
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
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
public void handleResourcePackResponse(ServerboundResourcePackPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
|
||||
- ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
|
||||
+ ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getGameProfile().getName()); // Paper - Don't print component in resource pack rejection message
|
||||
this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - add cause
|
||||
}
|
||||
// Paper start
|
Loading…
Add table
Reference in a new issue