rename PacketConfirmTransactionReceiving

This commit is contained in:
Bixilon 2021-05-10 21:20:38 +02:00
parent ba63cfcd18
commit f2d5901b5c
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
5 changed files with 36 additions and 54 deletions

View File

@ -17,19 +17,19 @@ import de.bixilon.minosoft.protocol.protocol.PlayOutByteBuffer
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogMessageType
class ContainerConfirmationC2SP(
class ContainerActionStatusC2SP(
val containerId: Int,
val actionNumber: Int,
val actionId: Int,
val accepted: Boolean,
) : PlayC2SPacket {
override fun write(buffer: PlayOutByteBuffer) {
buffer.writeByte(containerId)
buffer.writeShort(actionNumber)
buffer.writeShort(actionId)
buffer.writeBoolean(accepted)
}
override fun log() {
Log.log(LogMessageType.NETWORK_PACKETS_OUT) { "Confirming container action (containerId=$containerId, actionNumber=$actionNumber, accepted=$accepted)" }
Log.log(LogMessageType.NETWORK_PACKETS_OUT) { "Confirming container action (containerId=$containerId, actionId=$actionId, accepted=$accepted)" }
}
}

View File

@ -0,0 +1,29 @@
/*
* Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.protocol.packets.s2c.play
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
class ContainerActionStatusS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket() {
val containerId = buffer.readUnsignedByte()
val actionId = buffer.readUnsignedShort()
val accepted = buffer.readBoolean()
override fun log() {
Log.log(LogMessageType.NETWORK_PACKETS_IN, level = LogLevels.VERBOSE) { "Container action status (containerId=$containerId, actionId=$actionId, accepted=$accepted)" }
}
}

View File

@ -1,47 +0,0 @@
/*
* Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.protocol.packets.s2c.play;
import de.bixilon.minosoft.protocol.packets.s2c.PlayS2CPacket;
import de.bixilon.minosoft.protocol.protocol.PlayInByteBuffer;
import de.bixilon.minosoft.util.logging.Log;
public class PacketConfirmTransactionReceiving extends PlayS2CPacket {
private final byte windowId;
private final short actionNumber;
private final boolean accepted;
public PacketConfirmTransactionReceiving(PlayInByteBuffer buffer) {
this.windowId = buffer.readByte();
this.actionNumber = buffer.readShort();
this.accepted = buffer.readBoolean();
}
@Override
public void log() {
Log.protocol(String.format("[IN] Window transaction receiving (windowId=%d, actionNumber=%s, accepted=%s)", this.windowId, this.actionNumber, this.accepted));
}
public byte getWindowId() {
return this.windowId;
}
public boolean wasAccepted() {
return this.accepted;
}
public short getActionNumber() {
return this.actionNumber;
}
}

View File

@ -62,7 +62,7 @@ class PacketTypes {
PLAY_CLIENT_ACTION(ClientActionC2SP::class.java),
PLAY_CLIENT_SETTINGS(ClientSettingsC2SP::class.java),
PLAY_TAB_COMPLETE(TabCompleteC2SP::class.java),
PLAY_CONTAINER_CONFIRMATION(ContainerConfirmationC2SP::class.java),
PLAY_CONTAINER_ACTION_STATUS(ContainerActionStatusC2SP::class.java),
PLAY_CONTAINER_CLICK_BUTTON(ContainerClickButtonC2SP::class.java),
PLAY_CONTAINER_SLOT_CLICK(ContainerSlotClickC2SP::class.java),
PLAY_CONTAINER_CLOSE(ContainerCloseC2SP::class.java),
@ -171,7 +171,7 @@ class PacketTypes {
PLAY_MASS_BLOCK_SET({ MassBlockSetS2CP(it) }),
PLAY_TAB_COMPLETE({ PacketTabCompleteReceiving(it) }),
PLAY_DECLARE_COMMANDS({ PacketDeclareCommands(it) }),
PLAY_CONTAINER_CONFIRMATION({ PacketConfirmTransactionReceiving(it) }),
PLAY_CONTAINER_ACTION_STATUS({ ContainerActionStatusS2CP(it) }),
PLAY_CONTAINER_CLOSE({ ContainerCloseS2CP(it) }),
PLAY_CONTAINER_ITEMS_SET({ ContainerItemsSetS2CP(it) }),
PLAY_CONTAINER_PROPERTY_SET({ ContainerPropertySetS2CP(it) }),

File diff suppressed because one or more lines are too long