mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 06:24:06 +01:00
SPIGOT-4706: Can't interact with active item
This commit is contained in:
parent
494eef45d2
commit
f74c7b9578
@ -657,7 +657,7 @@
|
|||||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
EnumHand enumhand = packetplayinuseitem.d();
|
EnumHand enumhand = packetplayinuseitem.d();
|
||||||
ItemStack itemstack = this.player.b(enumhand);
|
ItemStack itemstack = this.player.b(enumhand);
|
||||||
@@ -772,6 +1175,13 @@
|
@@ -772,6 +1175,14 @@
|
||||||
|
|
||||||
this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, ChatMessageType.GAME_INFO));
|
this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, ChatMessageType.GAME_INFO));
|
||||||
} else if (this.teleportPos == null && this.player.d((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
|
} else if (this.teleportPos == null && this.player.d((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
|
||||||
@ -667,11 +667,12 @@
|
|||||||
+ if (reachDistance > (this.getPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) {
|
+ if (reachDistance > (this.getPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
|
+ this.player.clearActiveItem(); // SPIGOT-4706
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.e(), packetplayinuseitem.f(), packetplayinuseitem.g());
|
this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.e(), packetplayinuseitem.f(), packetplayinuseitem.g());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -781,13 +1191,52 @@
|
@@ -781,13 +1192,52 @@
|
||||||
|
|
||||||
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
|
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer());
|
||||||
@ -725,7 +726,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,13 +1256,18 @@
|
@@ -807,13 +1257,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
@ -746,7 +747,7 @@
|
|||||||
|
|
||||||
public void a(PacketPlayInBoatMove packetplayinboatmove) {
|
public void a(PacketPlayInBoatMove packetplayinboatmove) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.getWorldServer());
|
||||||
@@ -826,11 +1280,26 @@
|
@@ -826,11 +1281,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(IChatBaseComponent ichatbasecomponent) {
|
public void a(IChatBaseComponent ichatbasecomponent) {
|
||||||
@ -774,7 +775,7 @@
|
|||||||
if (this.minecraftServer.H() && this.player.getDisplayName().getString().equals(this.minecraftServer.G())) {
|
if (this.minecraftServer.H() && this.player.getDisplayName().getString().equals(this.minecraftServer.G())) {
|
||||||
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
|
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
|
||||||
this.minecraftServer.safeShutdown();
|
this.minecraftServer.safeShutdown();
|
||||||
@@ -856,6 +1325,15 @@
|
@@ -856,6 +1326,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,7 +791,7 @@
|
|||||||
try {
|
try {
|
||||||
this.networkManager.sendPacket(packet, genericfuturelistener);
|
this.networkManager.sendPacket(packet, genericfuturelistener);
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
@@ -871,17 +1349,37 @@
|
@@ -871,17 +1350,37 @@
|
||||||
|
|
||||||
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
|
||||||
@ -830,7 +831,7 @@
|
|||||||
this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend", new Object[0])).a(EnumChatFormat.RED)));
|
this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend", new Object[0])).a(EnumChatFormat.RED)));
|
||||||
} else {
|
} else {
|
||||||
this.player.resetIdleTimer();
|
this.player.resetIdleTimer();
|
||||||
@@ -891,39 +1389,255 @@
|
@@ -891,39 +1390,255 @@
|
||||||
|
|
||||||
for (int i = 0; i < s.length(); ++i) {
|
for (int i = 0; i < s.length(); ++i) {
|
||||||
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
||||||
@ -1093,7 +1094,7 @@
|
|||||||
this.player.resetIdleTimer();
|
this.player.resetIdleTimer();
|
||||||
IJumpable ijumpable;
|
IJumpable ijumpable;
|
||||||
|
|
||||||
@@ -986,6 +1700,7 @@
|
@@ -986,6 +1701,7 @@
|
||||||
|
|
||||||
public void a(PacketPlayInUseEntity packetplayinuseentity) {
|
public void a(PacketPlayInUseEntity packetplayinuseentity) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer());
|
||||||
@ -1101,7 +1102,7 @@
|
|||||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
Entity entity = packetplayinuseentity.a((World) worldserver);
|
Entity entity = packetplayinuseentity.a((World) worldserver);
|
||||||
|
|
||||||
@@ -1001,20 +1716,74 @@
|
@@ -1001,20 +1717,74 @@
|
||||||
if (this.player.h(entity) < d0) {
|
if (this.player.h(entity) < d0) {
|
||||||
EnumHand enumhand;
|
EnumHand enumhand;
|
||||||
|
|
||||||
@ -1177,7 +1178,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1030,7 +1799,8 @@
|
@@ -1030,7 +1800,8 @@
|
||||||
case PERFORM_RESPAWN:
|
case PERFORM_RESPAWN:
|
||||||
if (this.player.viewingCredits) {
|
if (this.player.viewingCredits) {
|
||||||
this.player.viewingCredits = false;
|
this.player.viewingCredits = false;
|
||||||
@ -1187,7 +1188,7 @@
|
|||||||
CriterionTriggers.v.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD);
|
CriterionTriggers.v.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD);
|
||||||
} else {
|
} else {
|
||||||
if (this.player.getHealth() > 0.0F) {
|
if (this.player.getHealth() > 0.0F) {
|
||||||
@@ -1052,14 +1822,20 @@
|
@@ -1052,14 +1823,20 @@
|
||||||
|
|
||||||
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
|
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
|
||||||
@ -1210,7 +1211,7 @@
|
|||||||
NonNullList<ItemStack> nonnulllist = NonNullList.a();
|
NonNullList<ItemStack> nonnulllist = NonNullList.a();
|
||||||
|
|
||||||
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
|
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
|
||||||
@@ -1068,8 +1844,274 @@
|
@@ -1068,8 +1845,274 @@
|
||||||
|
|
||||||
this.player.a(this.player.activeContainer, nonnulllist);
|
this.player.a(this.player.activeContainer, nonnulllist);
|
||||||
} else {
|
} else {
|
||||||
@ -1486,7 +1487,7 @@
|
|||||||
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
|
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
|
||||||
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
|
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
|
||||||
this.player.f = true;
|
this.player.f = true;
|
||||||
@@ -1112,6 +2154,7 @@
|
@@ -1112,6 +2155,7 @@
|
||||||
|
|
||||||
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
|
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
|
||||||
@ -1494,7 +1495,7 @@
|
|||||||
this.player.resetIdleTimer();
|
this.player.resetIdleTimer();
|
||||||
if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
||||||
this.player.activeContainer.a(this.player, packetplayinenchantitem.c());
|
this.player.activeContainer.a(this.player, packetplayinenchantitem.c());
|
||||||
@@ -1143,6 +2186,43 @@
|
@@ -1143,6 +2187,43 @@
|
||||||
|
|
||||||
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
|
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
|
||||||
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
||||||
@ -1538,7 +1539,7 @@
|
|||||||
|
|
||||||
if (flag1 && flag2) {
|
if (flag1 && flag2) {
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
@@ -1166,6 +2246,7 @@
|
@@ -1166,6 +2247,7 @@
|
||||||
|
|
||||||
public void a(PacketPlayInTransaction packetplayintransaction) {
|
public void a(PacketPlayInTransaction packetplayintransaction) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
|
||||||
@ -1546,7 +1547,7 @@
|
|||||||
Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
|
Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
|
||||||
|
|
||||||
if (oshort != null && packetplayintransaction.c() == oshort && this.player.activeContainer.windowId == packetplayintransaction.b() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
if (oshort != null && packetplayintransaction.c() == oshort && this.player.activeContainer.windowId == packetplayintransaction.b() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
||||||
@@ -1176,6 +2257,7 @@
|
@@ -1176,6 +2258,7 @@
|
||||||
|
|
||||||
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
|
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer());
|
||||||
@ -1554,7 +1555,7 @@
|
|||||||
this.player.resetIdleTimer();
|
this.player.resetIdleTimer();
|
||||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
BlockPosition blockposition = packetplayinupdatesign.b();
|
BlockPosition blockposition = packetplayinupdatesign.b();
|
||||||
@@ -1192,14 +2274,30 @@
|
@@ -1192,14 +2275,30 @@
|
||||||
|
|
||||||
if (!tileentitysign.d() || tileentitysign.e() != this.player) {
|
if (!tileentitysign.d() || tileentitysign.e() != this.player) {
|
||||||
this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign");
|
this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign");
|
||||||
@ -1586,7 +1587,7 @@
|
|||||||
|
|
||||||
tileentitysign.update();
|
tileentitysign.update();
|
||||||
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
|
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
|
||||||
@@ -1208,6 +2306,7 @@
|
@@ -1208,6 +2307,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
|
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
|
||||||
@ -1594,7 +1595,7 @@
|
|||||||
if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) {
|
if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) {
|
||||||
int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive);
|
int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive);
|
||||||
|
|
||||||
@@ -1221,7 +2320,17 @@
|
@@ -1221,7 +2321,17 @@
|
||||||
|
|
||||||
public void a(PacketPlayInAbilities packetplayinabilities) {
|
public void a(PacketPlayInAbilities packetplayinabilities) {
|
||||||
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
|
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
|
||||||
@ -1613,7 +1614,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(PacketPlayInSettings packetplayinsettings) {
|
public void a(PacketPlayInSettings packetplayinsettings) {
|
||||||
@@ -1229,5 +2338,47 @@
|
@@ -1229,5 +2339,47 @@
|
||||||
this.player.a(packetplayinsettings);
|
this.player.a(packetplayinsettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user