package ru.dbotthepony.kstarbound.network.packets.serverbound

import ru.dbotthepony.kommons.io.readBinaryString
import ru.dbotthepony.kommons.io.writeBinaryString
import ru.dbotthepony.kstarbound.network.IServerPacket
import ru.dbotthepony.kstarbound.network.packets.clientbound.FindUniqueEntityResponsePacket
import ru.dbotthepony.kstarbound.server.ServerConnection
import java.io.DataInputStream
import java.io.DataOutputStream

class FindUniqueEntityPacket(val name: String) : IServerPacket {
	constructor(stream: DataInputStream, isLegacy: Boolean) : this(stream.readBinaryString())

	override fun write(stream: DataOutputStream, isLegacy: Boolean) {
		stream.writeBinaryString(name)
	}

	override fun play(connection: ServerConnection) {
		connection.enqueue {
			// Do something
			connection.send(FindUniqueEntityResponsePacket(name, null))
		}
	}
}
