package au.com.mineauz.minigamesregions.util;

import au.com.mineauz.minigames.MinigameUtils;
import au.com.mineauz.minigames.Minigames;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;

import java.util.Set;

public class NullCommandSender implements ConsoleCommandSender {
	@Override
	public void sendMessage(String message) {
		MinigameUtils.debugMessage("[Suppressed] " + message);
	}

	@Override
	public void sendMessage(String[] messages) {
        if (Minigames.getPlugin().isDebugging()) {
			for (String message : messages) {
				MinigameUtils.debugMessage("[Suppressed] " + message);
			}
		}
	}
	
	@Override
	public void sendRawMessage(String message) {
		MinigameUtils.debugMessage("[Suppressed] " + message);
	}

	@Override
	public Server getServer() {
		return Bukkit.getServer();
	}

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

	public Spigot spigot() {
		return new Spigot();
	}

	@Override
	public boolean isPermissionSet(String name) {
		return true;
	}

	@Override
	public boolean isPermissionSet(Permission perm) {
		return true;
	}

	@Override
	public boolean hasPermission(String name) {
		return true;
	}

	@Override
	public boolean hasPermission(Permission perm) {
		return true;
	}

	@Override
	public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
		return new PermissionAttachment(plugin, this);
	}

	@Override
	public PermissionAttachment addAttachment(Plugin plugin) {
		return new PermissionAttachment(plugin, this);
	}

	@Override
	public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
		return new PermissionAttachment(plugin, this);
	}

	@Override
	public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
		return new PermissionAttachment(plugin, this);
	}

	@Override
	public void removeAttachment(PermissionAttachment attachment) {
	}

	@Override
	public void recalculatePermissions() {
	}

	@Override
	public Set<PermissionAttachmentInfo> getEffectivePermissions() {
		return Bukkit.getConsoleSender().getEffectivePermissions();
	}

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

	@Override
	public void setOp(boolean value) {
	}

	@Override
	public boolean isConversing() {
		return false;
	}

	@Override
	public void acceptConversationInput(String input) {
	}

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

	@Override
	public void abandonConversation(Conversation conversation) {
	}

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

@@ -1195,61 +1195,8 @@
 %09%7D%0A%0A
-%09public Spigot spigot() %7B%0A%09%09return new Spigot();%0A%09%7D%0A%0A
 %09@Ov

Fix regions dep back to bukkit