package me.wheezygold.skLib.WIP;

import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.eclipse.jdt.annotation.Nullable;

import ch.njol.skript.Skript;
import ch.njol.skript.lang.Effect;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import ch.njol.util.Kleenean;
import me.wheezygold.skLib.scoreboard.SbManager;

public class EffCreateScrollSB extends Effect {
	static {
			"[sk[-]Lib] create a (magic|scroll(ing|able)) scoreboard [with] title[d] %string% for %player%");
	private Expression<String> title;
	private Expression<Player> player;

	public boolean init(Expression<?>[] arg0, int arg1, Kleenean arg2, ParseResult arg3) {
		title = (Expression<String>) arg0[0];
		player = (Expression<Player>) arg0[1];
		return true;

	public String toString(@Nullable Event arg0, boolean arg1) {
		return "create a magic scoreboard titled " + title.getSingle(arg0) + " for " + player.getSingle(arg0);

	protected void execute(Event evt) {
		if(title.getSingle(evt) != null && player.getSingle(evt) != null) {
			Player p = player.getSingle(evt);
			SbManager.createscrollsb(p, title.getSingle(evt));
			Skript.error("May not provide null for either of the required arguments, refer to the syntax.");