Allow chat messages longer than 100 characters on > 1.11 clients
This commit is contained in:
parent
9a4150cd47
commit
f3e5f34aeb
@ -16,6 +16,7 @@ import net.md_5.bungee.forge.ForgeConstants;
|
|||||||
import net.md_5.bungee.netty.ChannelWrapper;
|
import net.md_5.bungee.netty.ChannelWrapper;
|
||||||
import net.md_5.bungee.netty.PacketHandler;
|
import net.md_5.bungee.netty.PacketHandler;
|
||||||
import net.md_5.bungee.protocol.PacketWrapper;
|
import net.md_5.bungee.protocol.PacketWrapper;
|
||||||
|
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||||
import net.md_5.bungee.protocol.packet.Chat;
|
import net.md_5.bungee.protocol.packet.Chat;
|
||||||
import net.md_5.bungee.protocol.packet.ClientSettings;
|
import net.md_5.bungee.protocol.packet.ClientSettings;
|
||||||
import net.md_5.bungee.protocol.packet.KeepAlive;
|
import net.md_5.bungee.protocol.packet.KeepAlive;
|
||||||
@ -109,7 +110,8 @@ public class UpstreamBridge extends PacketHandler
|
|||||||
@Override
|
@Override
|
||||||
public void handle(Chat chat) throws Exception
|
public void handle(Chat chat) throws Exception
|
||||||
{
|
{
|
||||||
Preconditions.checkArgument( chat.getMessage().length() <= 100, "Chat message too long" ); // Mojang limit, check on updates
|
int maxLength = ( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_11 ) ? 256 : 100;
|
||||||
|
Preconditions.checkArgument( chat.getMessage().length() <= maxLength, "Chat message too long" ); // Mojang limit, check on updates
|
||||||
|
|
||||||
ChatEvent chatEvent = new ChatEvent( con, con.getServer(), chat.getMessage() );
|
ChatEvent chatEvent = new ChatEvent( con, con.getServer(), chat.getMessage() );
|
||||||
if ( !bungee.getPluginManager().callEvent( chatEvent ).isCancelled() )
|
if ( !bungee.getPluginManager().callEvent( chatEvent ).isCancelled() )
|
||||||
|
Loading…
Reference in New Issue
Block a user