Example usage for net.minecraftforge.event ServerChatEvent getUsername

List of usage examples for net.minecraftforge.event ServerChatEvent getUsername

Introduction

In this page you can find the example usage for net.minecraftforge.event ServerChatEvent getUsername.

Prototype

public String getUsername() 

Source Link

Usage

From source file:com.cnaude.purpleirc.GameListeners.GamePlayerChatListener.java

License:Open Source License

@SubscribeEvent(receiveCanceled = true)
public void onServerChat(ServerChatEvent event) {
    plugin.logDebug("[onServerChat]: " + event.getUsername() + ": " + event.getMessage());
    if (event.isCanceled() && !plugin.ignoreChatCancel) {
        plugin.logDebug(/*from   w w  w . ja  va2  s.  co  m*/
                "Chat canceled! Accepting cancellation due to ignore-chat-cancel = " + plugin.ignoreChatCancel);
        return;
    }
    EntityPlayerMP player = (EntityPlayerMP) event.getPlayer();
    for (PurpleBot ircBot : plugin.ircBots.values()) {
        plugin.logDebug("[onServerChat]: Calling gameChat()...");
        ircBot.gameChat(player, event.getMessage());
    }
}