mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-23 00:03:48 -07:00
more more more more more more more more more more work
This commit is contained in:
@@ -127,8 +127,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
+++ b/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,
|
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||||
@Nullable
|
private final String serverId;
|
||||||
private ServerPlayer delayedAcceptPlayer;
|
private ServerPlayer player; // CraftBukkit
|
||||||
public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding
|
public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding
|
||||||
+ private int velocityLoginMessageId = -1; // Paper - Velocity support
|
+ private int velocityLoginMessageId = -1; // Paper - Velocity support
|
||||||
|
|
||||||
@@ -154,20 +154,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||||
public class LoginHandler {
|
public class LoginHandler {
|
||||||
|
|
||||||
public void fireEvents() throws Exception {
|
public void fireEvents(GameProfile gameprofile) throws Exception {
|
||||||
+ // Paper start - Velocity support
|
+ // Paper start - Velocity support
|
||||||
+ if (ServerLoginPacketListenerImpl.this.velocityLoginMessageId == -1 && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) {
|
+ if (ServerLoginPacketListenerImpl.this.velocityLoginMessageId == -1 && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) {
|
||||||
+ disconnect("This server requires you to connect with Velocity.");
|
+ disconnect("This server requires you to connect with Velocity.");
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // 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 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,
|
@@ -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
|
+ // Paper start - Velocity support
|
||||||
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && packet.getTransactionId() == this.velocityLoginMessageId) {
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && packet.getTransactionId() == this.velocityLoginMessageId) {
|
||||||
+ net.minecraft.network.FriendlyByteBuf buf = packet.getData();
|
+ 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.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?
|
+ //TODO Update handling for lazy sessions, might not even have to do anything?
|
||||||
+
|
+
|
||||||
+ // Proceed with login
|
+ // Proceed with login
|
||||||
+ authenticatorPool.execute(() -> {
|
+ authenticatorPool.execute(() -> {
|
||||||
+ try {
|
+ try {
|
||||||
+ new LoginHandler().fireEvents();
|
+ new LoginHandler().fireEvents(this.authenticatedProfile);
|
||||||
+ } catch (Exception ex) {
|
+ } catch (Exception ex) {
|
||||||
+ disconnect("Failed to verify username!");
|
+ 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;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // 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
|
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
|
+ // Paper end - launchProjectile consumer
|
||||||
Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
|
Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
|
||||||
// Copied from BlockDispenser.dispense()
|
// 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 {
|
@@ -0,0 +0,0 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||||
if (velocity != null) {
|
if (velocity != null) {
|
||||||
((T) launch.getBukkitEntity()).setVelocity(velocity);
|
((T) launch.getBukkitEntity()).setVelocity(velocity);
|
@@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/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) {
|
private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
|
||||||
if (!this.updateChatOrder(timestamp)) {
|
if (!this.updateChatOrder(timestamp)) {
|
@@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public boolean runNext(Level world) {
|
public boolean runNext(Level world) {
|
||||||
BlockPos blockPos = this.sourcePos.relative(NeighborUpdater.UPDATE_ORDER[this.idx++]);
|
BlockPos blockPos = this.sourcePos.relative(NeighborUpdater.UPDATE_ORDER[this.idx++]);
|
||||||
BlockState blockState = world.getBlockState(blockPos);
|
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
|
+ // Paper start
|
||||||
+ try {
|
+ try {
|
||||||
+ boolean cancelled = false;
|
+ boolean cancelled = false;
|
||||||
@@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ if (!cancelled) { // continue to check for adjacent block (increase idx)
|
+ 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) {
|
+ } catch (StackOverflowError ex) {
|
||||||
+ world.lastPhysicsProblem = new BlockPos(blockPos);
|
+ 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);
|
||||||
+ Optional<BlockPos> optional = LightningBolt.randomStepCleaningCopper(world, mutablePos, lightning); // Paper - transmit LightningBolt instance to call EntityChangeBlockEvent
|
+ Optional<BlockPos> optional = LightningBolt.randomStepCleaningCopper(world, mutablePos, lightning); // Paper - transmit LightningBolt instance to call EntityChangeBlockEvent
|
||||||
|
|
||||||
if (!optional.isPresent()) {
|
if (optional.isEmpty()) {
|
||||||
break;
|
break;
|
||||||
@@ -0,0 +0,0 @@ public class LightningBolt extends Entity {
|
@@ -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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/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
|
// Spigot end
|
||||||
// this.chatSpamTickCount += 20;
|
// 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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||||
+++ b/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 {
|
} else {
|
||||||
boolean bl = this.getHealth() < this.getMaxHealth();
|
boolean bl = this.getHealth() < this.getMaxHealth();
|
||||||
if (bl) {
|
if (bl) {
|
@@ -35,11 +35,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java
|
--- a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java
|
||||||
+++ b/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 {
|
@@ -0,0 +0,0 @@ public class SuspiciousStewItem extends Item {
|
||||||
@Override
|
|
||||||
public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user) {
|
public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user) {
|
||||||
ItemStack itemStack = super.finishUsingItem(stack, world, user);
|
ItemStack itemStack = super.finishUsingItem(stack, world, user);
|
||||||
- listPotionEffects(itemStack, user::addEffect);
|
listPotionEffects(itemStack, (effect) -> {
|
||||||
+ listPotionEffects(itemStack, effect -> user.addEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD)); // Paper
|
- 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);
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/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;
|
return;
|
||||||
}
|
}
|
||||||
// Paper end - Don't allow digging in unloaded chunks
|
// 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
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
+++ b/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,
|
@@ -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();
|
static final Logger LOGGER = LogUtils.getLogger();
|
||||||
private static final int MAX_TICKS_BEFORE_LOGIN = 600;
|
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 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;
|
private final byte[] challenge;
|
||||||
final MinecraftServer server;
|
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
|
|
Reference in New Issue
Block a user