Package net.minecraftforge.event
Class ServerChatEvent
- java.lang.Object
-
- net.minecraftforge.eventbus.api.Event
-
- net.minecraftforge.event.ServerChatEvent
-
public class ServerChatEvent extends net.minecraftforge.eventbus.api.Event
ServerChatEvent is fired whenever a C01PacketChatMessage is processed.
This event is fired viaForgeHooks#onServerChatEvent(NetHandlerPlayServer, String, ITextComponent)
, which is executed by theNetHandlerPlayServer#processChatMessage(CPacketChatMessage)
username
contains the username of the player sending the chat message.
message
contains the message being sent.
player
the instance of EntityPlayerMP for the player sending the chat message.
component
contains the instance of ChatComponentTranslation for the sent message.
This event isCancelable
.
If this event is canceled, the chat message is never distributed to all clients.
This event does not have a result.Event.HasResult
This event is fired on theMinecraftForge.EVENT_BUS
.
-
-
Field Summary
Fields Modifier and Type Field Description private ITextComponent
component
private java.lang.String
message
private ServerPlayerEntity
player
private java.lang.String
username
-
Constructor Summary
Constructors Constructor Description ServerChatEvent(ServerPlayerEntity player, java.lang.String message, ITextComponent component)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ITextComponent
getComponent()
java.lang.String
getMessage()
ServerPlayerEntity
getPlayer()
java.lang.String
getUsername()
void
setComponent(ITextComponent e)
-
-
-
Field Detail
-
message
private final java.lang.String message
-
username
private final java.lang.String username
-
player
private final ServerPlayerEntity player
-
component
private ITextComponent component
-
-
Constructor Detail
-
ServerChatEvent
public ServerChatEvent(ServerPlayerEntity player, java.lang.String message, ITextComponent component)
-
-
Method Detail
-
setComponent
public void setComponent(ITextComponent e)
-
getComponent
public ITextComponent getComponent()
-
getMessage
public java.lang.String getMessage()
-
getUsername
public java.lang.String getUsername()
-
getPlayer
public ServerPlayerEntity getPlayer()
-
-