Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Online check in closeInventory #11699

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: bridge <[email protected]>
Date: Sun, 1 Dec 2024 15:43:12 +0100
Subject: [PATCH] Ensure the player hasn't disconnected
HumanEntity#closeInventory


diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5a8f396d47577f087abb415c972fd4f51e50faba..976de97751bb69cbf4fa18527f9ee03c4a0e293e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -177,6 +177,7 @@ import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.PlayerTeam;
import net.minecraft.world.scores.ScoreAccess;
import net.minecraft.world.scores.ScoreHolder;
+import org.bukkit.event.inventory.InventoryCloseEvent;
import org.slf4j.Logger;
import net.minecraft.world.Container;
import net.minecraft.world.Difficulty;
@@ -2059,6 +2060,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
}
@Override
public void closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
+ if (reason == InventoryCloseEvent.Reason.PLUGIN && !this.server.getPlayerList().players.contains(this)) {
+ return;
+ }
+
CraftEventFactory.handleInventoryCloseEvent(this, reason); // CraftBukkit
// Paper end - Inventory close reason
this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId));
Loading