Skip to content

Instantly share code, notes, and snippets.

@DavidDudson
Created January 3, 2014 00:45
Show Gist options
  • Save DavidDudson/8230352 to your computer and use it in GitHub Desktop.
Save DavidDudson/8230352 to your computer and use it in GitHub Desktop.
Chat messages in 1.7.2
package nz.co.bigdavenz.ei.core.handler;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.*;
import nz.co.bigdavenz.ei.lib.Reference;
public class ChatMessageHandler {
private static final IChatComponent EIChatComponent = createEIChatComponent(Reference.MOD_ID.toUpperCase());
public static void icommandsenderReply(ICommandSender player, String message) {
sendEIChatToPlayer((EntityPlayer)player, message);
}
private static IChatComponent createEIChatComponent(String string) {
ChatComponentText EIComponent = new ChatComponentText(string);
return EIComponent;
}
public static IChatComponent createChatComponent(String message) {
ChatComponentText component = new ChatComponentText(message);
return EIChatComponent.func_150257_a(component);
}
public static void sendEIChatToPlayer(EntityPlayer player, String message) {
player.func_146105_b(createChatComponent(message));
}
public static void broadcastEIMessageToPlayers(String message){
MinecraftServer.getServer().getConfigurationManager().func_148539_a(createChatComponent(message));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment