// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.core.command.system.exceptions;

import javax.annotation.Nullable;
import com.hypixel.hytale.server.core.command.system.CommandSender;
import java.awt.Color;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.core.Message;

public class GeneralCommandException extends CommandException
{
    @Nonnull
    private final Message message;
    
    public GeneralCommandException(@Nonnull final Message message) {
        this.message = message.color(Color.RED);
    }
    
    @Override
    public void sendTranslatedMessage(@Nonnull final CommandSender sender) {
        sender.sendMessage(this.message);
    }
    
    @Nullable
    public String getMessageText() {
        try {
            return this.message.getAnsiMessage();
        }
        catch (final Exception e) {
            final String rawText = this.message.getRawText();
            if (rawText != null) {
                return rawText;
            }
            return this.message.getMessageId();
        }
    }
}
