Permalink
Browse files

1.8: Fixed plugin messages.

  • Loading branch information...
Howaner committed Sep 27, 2014
1 parent 576d088 commit 04ee8c43dd17eb98d1e3d66ff691898e9f269b95
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/Protocol/Protocol18x.cpp
@@ -989,7 +989,6 @@ void cProtocol180::SendPluginMessage(const AString & a_Channel, const AString &
cPacketizer Pkt(*this, 0x3f);
Pkt.WriteString(a_Channel);
Pkt.WriteVarInt((UInt32)a_Message.size());
Pkt.WriteBuf(a_Message.data(), a_Message.size());
}
@@ -2316,9 +2315,11 @@ void cProtocol180::HandlePacketPlayerPosLook(cByteBuffer & a_ByteBuffer)
void cProtocol180::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer)
{
HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel);
HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, DataLen);
AString Data;
a_ByteBuffer.ReadString(Data, DataLen);
if (!a_ByteBuffer.ReadString(Data, a_ByteBuffer.GetReadableSpace() - 1))
{
return;
}
m_Client->HandlePluginMessage(Channel, Data);
}

11 comments on commit 04ee8c4

@madmaxoft

This comment has been minimized.

Show comment
Hide comment
@madmaxoft

madmaxoft Sep 28, 2014

Member

Whaaat? Why did you do this? I had fixed it and it was working this way. Now it's not working again. The plugin messages DO contain the data length.

Member

madmaxoft replied Sep 28, 2014

Whaaat? Why did you do this? I had fixed it and it was working this way. Now it's not working again. The plugin messages DO contain the data length.

@Howaner

This comment has been minimized.

Show comment
Hide comment
@Howaner

Howaner Sep 28, 2014

Contributor

nope.

Contributor

Howaner replied Sep 28, 2014

nope.

@Howaner

This comment has been minimized.

Show comment
Hide comment
@Howaner

Howaner Sep 28, 2014

Contributor

Only the strings are prefixed with a varint. This will destroy other plugin messages (like bungeecord)

Contributor

Howaner replied Sep 28, 2014

Only the strings are prefixed with a varint. This will destroy other plugin messages (like bungeecord)

@madmaxoft

This comment has been minimized.

Show comment
Hide comment
@madmaxoft

madmaxoft Sep 28, 2014

Member

No, vanilla sends the data lengths.

Member

madmaxoft replied Sep 28, 2014

No, vanilla sends the data lengths.

@Howaner

This comment has been minimized.

Show comment
Hide comment
@Howaner

Howaner Sep 28, 2014

Contributor

Nope. Mojang changed only the strings in the plugin messages to a var int string.
But if you want to send other data, this won't work!

Contributor

Howaner replied Sep 28, 2014

Nope. Mojang changed only the strings in the plugin messages to a var int string.
But if you want to send other data, this won't work!

@madmaxoft

This comment has been minimized.

Show comment
Hide comment
@madmaxoft

madmaxoft Sep 28, 2014

Member

Vanilla still does send the payload with the size VarInt prefix. However this seems to be a vanilla thing, so let's compromise - we'll read everything and if we need to process vanilla-based message, we'll remove the length.

Member

madmaxoft replied Sep 28, 2014

Vanilla still does send the payload with the size VarInt prefix. However this seems to be a vanilla thing, so let's compromise - we'll read everything and if we need to process vanilla-based message, we'll remove the length.

@Howaner

This comment has been minimized.

Show comment
Hide comment
@Howaner

Howaner Sep 28, 2014

Contributor

Works the beacon ui with this changes?

Contributor

Howaner replied Sep 28, 2014

Works the beacon ui with this changes?

@madmaxoft

This comment has been minimized.

Show comment
Hide comment
@madmaxoft

madmaxoft Sep 28, 2014

Member

I have no idea how the beacon UI works, it doesn't seem to work at all, but then, it doesn't send any plugin messages either.

Member

madmaxoft replied Sep 28, 2014

I have no idea how the beacon UI works, it doesn't seem to work at all, but then, it doesn't send any plugin messages either.

@Howaner

This comment has been minimized.

Show comment
Hide comment
@Howaner

Howaner Sep 28, 2014

Contributor

build a little pyramide, place a beacon on it, place a diamond in the beacon slot, select a effect and click to finish

Contributor

Howaner replied Sep 28, 2014

build a little pyramide, place a beacon on it, place a diamond in the beacon slot, select a effect and click to finish

@madmaxoft

This comment has been minimized.

Show comment
Hide comment
@madmaxoft

madmaxoft Sep 29, 2014

Member

I did play with it for a while, the GUI seemed nonresponsive, but then on the other hand, the client didn't send any plugin message at all, so I don't know what to make of this.
Give it a try, I've already pushed the change that reads Vanilla plugin messages with VarInt length and the rest without.

Member

madmaxoft replied Sep 29, 2014

I did play with it for a while, the GUI seemed nonresponsive, but then on the other hand, the client didn't send any plugin message at all, so I don't know what to make of this.
Give it a try, I've already pushed the change that reads Vanilla plugin messages with VarInt length and the rest without.

@Howaner

This comment has been minimized.

Show comment
Hide comment
@Howaner

Howaner Sep 29, 2014

Contributor

The gui doesn't work because the plugin message haven't a length var int!

This happends if you try to activate the beacon:

[7f1b40aff700|14:17:41] Assertion failed: !"Bad plugin message payload length", file /home/franz/Schreibtisch/MCServer/src/Protocol/Protocol18x.cpp, line 2334
MCServer_debug: /home/franz/Schreibtisch/MCServer/src/Protocol/Protocol18x.cpp:2334: void cProtocol180::HandlePacketPluginMessage(cByteBuffer &): Assertion `0' failed.
Abgebrochen

The plugin messages that are tested you (MC|ItemName, MC|Brand) are only one string prefixed with a var int length. This works because Mojang changed the strings to varint strings. But other plugin messages (like MC|Beacon) won't work!

Contributor

Howaner replied Sep 29, 2014

The gui doesn't work because the plugin message haven't a length var int!

This happends if you try to activate the beacon:

[7f1b40aff700|14:17:41] Assertion failed: !"Bad plugin message payload length", file /home/franz/Schreibtisch/MCServer/src/Protocol/Protocol18x.cpp, line 2334
MCServer_debug: /home/franz/Schreibtisch/MCServer/src/Protocol/Protocol18x.cpp:2334: void cProtocol180::HandlePacketPluginMessage(cByteBuffer &): Assertion `0' failed.
Abgebrochen

The plugin messages that are tested you (MC|ItemName, MC|Brand) are only one string prefixed with a var int length. This works because Mojang changed the strings to varint strings. But other plugin messages (like MC|Beacon) won't work!

Please sign in to comment.