mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-25 07:43:54 +00:00
Initial commit
This commit is contained in:
parent
def8cb4153
commit
b691c43c44
19437 changed files with 4363922 additions and 0 deletions
48
Minecraft.World/DisconnectPacket.cpp
Normal file
48
Minecraft.World/DisconnectPacket.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#include "stdafx.h"
|
||||
#include <iostream>
|
||||
#include "InputOutputStream.h"
|
||||
#include "SharedConstants.h"
|
||||
#include "PacketListener.h"
|
||||
#include "DisconnectPacket.h"
|
||||
|
||||
|
||||
|
||||
DisconnectPacket::DisconnectPacket()
|
||||
{
|
||||
reason = eDisconnect_None;
|
||||
}
|
||||
|
||||
DisconnectPacket::DisconnectPacket(eDisconnectReason reason)
|
||||
{
|
||||
this->reason = reason;
|
||||
}
|
||||
|
||||
void DisconnectPacket::read(DataInputStream *dis) //throws IOException
|
||||
{
|
||||
reason = (eDisconnectReason)dis->readInt();
|
||||
}
|
||||
|
||||
void DisconnectPacket::write(DataOutputStream *dos) //throws IOException
|
||||
{
|
||||
dos->writeInt((int)reason);
|
||||
}
|
||||
|
||||
void DisconnectPacket::handle(PacketListener *listener)
|
||||
{
|
||||
listener->handleDisconnect(shared_from_this());
|
||||
}
|
||||
|
||||
int DisconnectPacket::getEstimatedSize()
|
||||
{
|
||||
return sizeof(eDisconnectReason);
|
||||
}
|
||||
|
||||
bool DisconnectPacket::canBeInvalidated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DisconnectPacket::isInvalidatedBy(shared_ptr<Packet> packet)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue