mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-13 11:41:52 +01:00
Add interpretPacketQueue for testing purpose
This commit is contained in:
parent
bcc652ede8
commit
bd23cd6568
@ -316,7 +316,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
|||||||
this.playerConnection.update();
|
this.playerConnection.update();
|
||||||
|
|
||||||
// Process received packets
|
// Process received packets
|
||||||
this.packets.drain(packet -> MinecraftServer.getPacketListenerManager().processClientPacket(packet, this));
|
interpretPacketQueue();
|
||||||
|
|
||||||
super.update(time); // Super update (item pickup/fire management)
|
super.update(time); // Super update (item pickup/fire management)
|
||||||
|
|
||||||
@ -1673,6 +1673,13 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
|||||||
this.packets.offer(packet);
|
this.packets.offer(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiStatus.Internal
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public void interpretPacketQueue() {
|
||||||
|
// This method is NOT thread-safe
|
||||||
|
this.packets.drain(packet -> MinecraftServer.getPacketListenerManager().processClientPacket(packet, this));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the storage player latency and update its tab value.
|
* Changes the storage player latency and update its tab value.
|
||||||
*
|
*
|
||||||
|
@ -26,7 +26,7 @@ public class PlayerHeldIntegrationTest {
|
|||||||
assertEquals(0, player.getHeldSlot());
|
assertEquals(0, player.getHeldSlot());
|
||||||
|
|
||||||
player.addPacketToQueue(new ClientHeldItemChangePacket((short) 1));
|
player.addPacketToQueue(new ClientHeldItemChangePacket((short) 1));
|
||||||
env.tick();
|
player.interpretPacketQueue();
|
||||||
|
|
||||||
assertEquals(ItemStack.of(Material.STONE), player.getItemInMainHand());
|
assertEquals(ItemStack.of(Material.STONE), player.getItemInMainHand());
|
||||||
assertEquals(1, player.getHeldSlot());
|
assertEquals(1, player.getHeldSlot());
|
||||||
|
Loading…
Reference in New Issue
Block a user