package me.sharpjaws.sharpSK.hooks.Kingdoms;
import java.util.ArrayList;

import javax.annotation.Nullable;

import org.bukkit.event.Event;
import org.kingdoms.constants.kingdom.OfflineKingdom;
import org.kingdoms.manager.game.GameManagement;

import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.util.Kleenean;

public class ExprKingdomsAllKingdoms extends SimpleExpression<String> {
	private GameManagement kman;
	
	
	

	@Override
	public Class<? extends String> getReturnType() {
		return String.class;
	}

	@SuppressWarnings("unchecked")
	@Override
	public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean paramKleenean,
			SkriptParser.ParseResult Result) {
		return true;
	}
	@Override
	public String toString(@Nullable Event e, boolean paramBoolean) {
		return "groups of %player%/%offlineplayer%";
	}


	@Override
	@Nullable
	protected String[] get(Event e) {
		
		
		
		ArrayList<String> narr = new ArrayList<String>(); 
		for (OfflineKingdom k : GameManagement.getKingdomManager().getKingdomList().values() ) {
		
			 narr.add(k.getKingdomName());
		 }
		
		 
		 return narr.toArray(new String[narr.size()]);
		
			}

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

	

}


