SPIGOT-8007: InventoryClickEvent.setCancelled(true) crashes client when in creative mode
This commit is contained in:
parent
ec571d7177
commit
c175d4f612
@ -1608,7 +1608,7 @@
|
|||||||
this.player.resetLastActionTime();
|
this.player.resetLastActionTime();
|
||||||
if (this.player.containerMenu.containerId == packetplayinenchantitem.containerId() && !this.player.isSpectator()) {
|
if (this.player.containerMenu.containerId == packetplayinenchantitem.containerId() && !this.player.isSpectator()) {
|
||||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||||
@@ -1945,6 +2983,43 @@
|
@@ -1945,6 +2983,42 @@
|
||||||
|
|
||||||
boolean flag1 = packetplayinsetcreativeslot.slotNum() >= 1 && packetplayinsetcreativeslot.slotNum() <= 45;
|
boolean flag1 = packetplayinsetcreativeslot.slotNum() >= 1 && packetplayinsetcreativeslot.slotNum() <= 45;
|
||||||
boolean flag2 = itemstack.isEmpty() || itemstack.getCount() <= itemstack.getMaxStackSize();
|
boolean flag2 = itemstack.isEmpty() || itemstack.getCount() <= itemstack.getMaxStackSize();
|
||||||
@ -1642,8 +1642,7 @@
|
|||||||
+ case DENY:
|
+ case DENY:
|
||||||
+ // Reset the slot
|
+ // Reset the slot
|
||||||
+ if (packetplayinsetcreativeslot.slotNum() >= 0) {
|
+ if (packetplayinsetcreativeslot.slotNum() >= 0) {
|
||||||
+ this.player.connection.send(new PacketPlayOutSetSlot(this.player.inventoryMenu.containerId, this.player.inventoryMenu.incrementStateId(), packetplayinsetcreativeslot.slotNum(), this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.slotNum()).getItem()));
|
+ this.player.inventoryMenu.sendAllDataToRemote();
|
||||||
+ this.player.connection.send(new PacketPlayOutSetSlot(-1, this.player.inventoryMenu.incrementStateId(), -1, ItemStack.EMPTY));
|
|
||||||
+ }
|
+ }
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
@ -1652,7 +1651,7 @@
|
|||||||
|
|
||||||
if (flag1 && flag2) {
|
if (flag1 && flag2) {
|
||||||
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.slotNum()).setByPlayer(itemstack);
|
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.slotNum()).setByPlayer(itemstack);
|
||||||
@@ -1972,6 +3047,7 @@
|
@@ -1972,6 +3046,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
|
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
|
||||||
@ -1660,7 +1659,7 @@
|
|||||||
this.player.resetLastActionTime();
|
this.player.resetLastActionTime();
|
||||||
WorldServer worldserver = this.player.serverLevel();
|
WorldServer worldserver = this.player.serverLevel();
|
||||||
BlockPosition blockposition = packetplayinupdatesign.getPos();
|
BlockPosition blockposition = packetplayinupdatesign.getPos();
|
||||||
@@ -1993,7 +3069,17 @@
|
@@ -1993,7 +3068,17 @@
|
||||||
@Override
|
@Override
|
||||||
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
|
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
|
||||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.serverLevel());
|
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.serverLevel());
|
||||||
@ -1679,7 +1678,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2058,7 +3144,7 @@
|
@@ -2058,7 +3143,7 @@
|
||||||
if (!this.waitingForSwitchToConfig) {
|
if (!this.waitingForSwitchToConfig) {
|
||||||
throw new IllegalStateException("Client acknowledged config, but none was requested");
|
throw new IllegalStateException("Client acknowledged config, but none was requested");
|
||||||
} else {
|
} else {
|
||||||
@ -1688,7 +1687,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2083,8 +3169,10 @@
|
@@ -2083,8 +3168,10 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user