Close #469 - chat event setMessage

This commit is contained in:
md_5 2013-07-02 10:45:04 +10:00
parent 23517a9a97
commit d3bada58d4
2 changed files with 7 additions and 7 deletions

View File

@ -3,9 +3,11 @@ package net.md_5.bungee.protocol.packet;
import io.netty.buffer.ByteBuf;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
@EqualsAndHashCode(callSuper = false)
public class Packet3Chat extends DefinedPacket

View File

@ -84,17 +84,15 @@ public class UpstreamBridge extends PacketHandler
public void handle(Packet3Chat chat) throws Exception
{
ChatEvent chatEvent = new ChatEvent( con, con.getServer(), chat.getMessage() );
if ( bungee.getPluginManager().callEvent( chatEvent ).isCancelled() )
if ( !bungee.getPluginManager().callEvent( chatEvent ).isCancelled() )
{
throw new CancelSendSignal();
}
if ( chatEvent.isCommand() )
{
if ( bungee.getPluginManager().dispatchCommand( con, chat.getMessage().substring( 1 ) ) )
chat.setMessage( chatEvent.getMessage() );
if ( !chatEvent.isCommand() || !bungee.getPluginManager().dispatchCommand( con, chat.getMessage().substring( 1 ) ) )
{
throw new CancelSendSignal();
con.getServer().unsafe().sendPacket( chat );
}
}
throw new CancelSendSignal();
}
@Override