<commit_before>package com.forgeessentials.remote;

import java.io.IOException;

import net.minecraft.util.IChatComponent;
import net.minecraftforge.common.util.FakePlayerFactory;

import com.forgeessentials.api.UserIdent;
import com.forgeessentials.api.remote.RemoteResponse;
import com.forgeessentials.api.remote.RemoteSession;
import com.forgeessentials.remote.network.ChatResponse;
import com.forgeessentials.util.DoAsCommandSender;
import com.forgeessentials.util.ServerUtil;
import com.forgeessentials.util.output.ChatOutputHandler;
import com.forgeessentials.util.output.LoggingHandler;

public class RemoteCommandSender extends DoAsCommandSender
{

    private RemoteSession session;

    public RemoteCommandSender(RemoteSession session)
    {
        super(session.getUserIdent());
        if (session.getUserIdent() != null)
            this.sender = session.getUserIdent().getFakePlayer();
        else
            this.sender = FakePlayerFactory.get(ServerUtil.getOverworld(), ModuleRemote.FAKEPLAYER);
        this.session = session;
    }

    public RemoteSession getSession()
    {
        return session;
    }

    @Override
    public UserIdent getUserIdent()
    {
        return session.getUserIdent();
    }

    @Override
    public String getCommandSenderName()
    {
        return session.getUserIdent() != null ? session.getUserIdent().getUsernameOrUuid() : "anonymous";
    }

    @Override
    public void addChatMessage(IChatComponent chatComponent)
    {
        if (session.getUserIdent() != null && session.getUserIdent().hasPlayer())
        {
            ChatOutputHandler.sendMessage(session.getUserIdent().getPlayer(), chatComponent);
        }
        if (!session.isClosed())
        {
            try
            {<commit_msg>Small tweak to RemoteCommandSender<commit_after>package com.forgeessentials.remote;

import java.io.IOException;

import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.common.util.FakePlayerFactory;

import com.forgeessentials.api.UserIdent;
import com.forgeessentials.api.remote.RemoteResponse;
import com.forgeessentials.api.remote.RemoteSession;
import com.forgeessentials.remote.network.ChatResponse;
import com.forgeessentials.util.DoAsCommandSender;
import com.forgeessentials.util.ServerUtil;
import com.forgeessentials.util.output.ChatOutputHandler;
import com.forgeessentials.util.output.LoggingHandler;

public class RemoteCommandSender extends DoAsCommandSender
{

    private RemoteSession session;

    public RemoteCommandSender(RemoteSession session)
    {
        super(session.getUserIdent());
        if (session.getUserIdent() != null)
            this.sender = session.getUserIdent().getFakePlayer();
        else
            this.sender = FakePlayerFactory.get(ServerUtil.getOverworld(), ModuleRemote.FAKEPLAYER);
        this.session = session;
    }

    public RemoteSession getSession()
    {
        return session;
    }

    @Override
    public UserIdent getUserIdent()
    {
        return session.getUserIdent();
    }

    @Override
    public String getCommandSenderName()
    {
        return session.getUserIdent() != null ? session.getUserIdent().getUsernameOrUuid() : "anonymous";
    }

    @Override
    public void addChatMessage(IChatComponent chatComponent)
    {
        ICommandSender receiver = MinecraftServer.getServer();
        if (session.getUserIdent() != null && session.getUserIdent().hasPlayer())
            receiver = session.getUserIdent().getPlayer();
        ChatOutputHandler.sendMessage(receiver, chatComponent);
        
        if (!session.isClosed())
        {
            try
            {
{'fraction_non_alphanumeric': 0.09581320450885668, 'fraction_numerical': 0.0, 'mean_word_length': 3.474189675870348, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '257783', 'n_tokens_mistral': 1027, 'n_tokens_neox': 1000, 'n_words': 174}