/FileExtraction/Java_unseen/Wind-Development_WindSpigot/WindSpigot-Server/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java
package org.bukkit.craftbukkit.command;

import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ManuallyAbandonedConversationCanceller;
import org.bukkit.craftbukkit.conversations.ConversationTracker;

import ga.windpvp.windspigot.WindSpigot;

/**
 * Represents CLI input from a console
 */
public class CraftConsoleCommandSender extends ServerCommandSender implements ConsoleCommandSender {

	protected final ConversationTracker conversationTracker = new ConversationTracker();

	protected CraftConsoleCommandSender() {
		super();
	}

	@Override
	public void sendMessage(String message) {
		sendRawMessage(message);
	}

	@Override
	public void sendRawMessage(String message) {
		WindSpigot.LOGGER.info(ChatColor.stripColor(message));
	}

	@Override
	public void sendMessage(String[] messages) {
		for (String message : messages) {
			sendMessage(message);
		}
	}

	@Override
	public String getName() {
		return "CONSOLE";
	}

	@Override
	public boolean isOp() {
		return true;
	}

	@Override
	public void setOp(boolean value) {
		throw new UnsupportedOperationException("Cannot change operator status of server console");
	}

	@Override
	public boolean beginConversation(Conversation conversation) {
		return conversationTracker.beginConversation(conversation);
	}

	@Override
	public void abandonConversation(Conversation conversation) {
		conversationTracker.abandonConversation(conversation,
				new ConversationAbandonedEvent(conversation, new ManuallyAbandonedConversationCanceller()));
	}

	@Override
	public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
		conversationTracker.abandonConversation(conversation, details);
	}

	@Override
	public void acceptConversationInput(String input) {
		conversationTracker.acceptConversationInput(input);
	}

	@Override
	public boolean isConversing() {
		return conversationTracker.isConversing();
	}
}
