Close #469 - chat event setMessage
This commit is contained in:
parent
23517a9a97
commit
d3bada58d4
@ -3,9 +3,11 @@ package net.md_5.bungee.protocol.packet;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@Setter
|
||||||
@ToString
|
@ToString
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class Packet3Chat extends DefinedPacket
|
public class Packet3Chat extends DefinedPacket
|
||||||
|
@ -84,18 +84,16 @@ public class UpstreamBridge extends PacketHandler
|
|||||||
public void handle(Packet3Chat chat) throws Exception
|
public void handle(Packet3Chat chat) throws Exception
|
||||||
{
|
{
|
||||||
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() )
|
||||||
{
|
{
|
||||||
|
chat.setMessage( chatEvent.getMessage() );
|
||||||
|
if ( !chatEvent.isCommand() || !bungee.getPluginManager().dispatchCommand( con, chat.getMessage().substring( 1 ) ) )
|
||||||
|
{
|
||||||
|
con.getServer().unsafe().sendPacket( chat );
|
||||||
|
}
|
||||||
|
}
|
||||||
throw new CancelSendSignal();
|
throw new CancelSendSignal();
|
||||||
}
|
}
|
||||||
if ( chatEvent.isCommand() )
|
|
||||||
{
|
|
||||||
if ( bungee.getPluginManager().dispatchCommand( con, chat.getMessage().substring( 1 ) ) )
|
|
||||||
{
|
|
||||||
throw new CancelSendSignal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketCCSettings settings) throws Exception
|
public void handle(PacketCCSettings settings) throws Exception
|
||||||
|
Loading…
Reference in New Issue
Block a user