Compare commits

...

2 Commits

Author SHA1 Message Date
Auxilor
4609d38389 Updated to 6.10.1 2021-10-08 10:50:57 +01:00
Auxilor
2d6836cc93 Moved frames to only affect player inventories 2021-10-08 10:50:47 +01:00
2 changed files with 19 additions and 10 deletions

View File

@@ -18,24 +18,33 @@ class PacketWindowItems(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, Packe
player: Player, player: Player,
event: PacketEvent event: PacketEvent
) { ) {
val windowId = packet.integers.read(0)
packet.itemListModifier.modify(0) { itemStacks: List<ItemStack>? -> packet.itemListModifier.modify(0) { itemStacks: List<ItemStack>? ->
if (itemStacks == null) { if (itemStacks == null) {
return@modify null return@modify null
} }
val frameMap = mutableMapOf<Byte, Int>()
for (index in itemStacks.indices) { if (windowId == 0) {
frameMap[index.toByte()] = FastItemStack.wrap(itemStacks[index]).hashCode() val frameMap = mutableMapOf<Byte, Int>()
}
val newFrame = DisplayFrame(frameMap) for (index in itemStacks.indices) {
frameMap[index.toByte()] = FastItemStack.wrap(itemStacks[index]).hashCode()
}
val changes = player.lastDisplayFrame.getChangedSlots(newFrame) val newFrame = DisplayFrame(frameMap)
player.lastDisplayFrame = newFrame val changes = player.lastDisplayFrame.getChangedSlots(newFrame)
for (index in changes) { player.lastDisplayFrame = newFrame
Display.display(itemStacks[index.toInt()], player)
for (index in changes) {
Display.display(itemStacks[index.toInt()], player)
}
} else {
itemStacks.forEach {
Display.display(it, player)
}
} }
itemStacks itemStacks
} }

View File

@@ -1,2 +1,2 @@
version = 6.10.0 version = 6.10.1
plugin-name = eco plugin-name = eco