package ru.beykerykt.lightsource.items.flags.basic;

import org.bukkit.Effect;

import ru.beykerykt.lightsource.items.flags.TickableFlagExecutor;
import ru.beykerykt.lightsource.sources.Source;

public class PlayEffectExecutor implements TickableFlagExecutor {

	@Override
	public void onTick(Source source, String[] args) {
		if (args.length >= 2) {
			String effectName = args[0];
			int data = Integer.parseInt(args[1]);
			source.getLocation().getWorld().spigot().playEffect(source.getLocation(), Effect.valueOf(effectName.toUpperCase()), 0, data, 0, 0, 0, 0, 1, 1);
		} else {
			// default ?
			source.getLocation().getWorld().spigot().playEffect(source.getLocation(), Effect.SMOKE, 0, 0, 0, 0, 0, 0, 1, 1);
		}
	}

}

@@ -343,9 +343,9 @@
  %3E= 
-2
+3
 ) %7B%0A
@@ -417,16 +417,58 @@
 gs%5B1%5D);%0A
+%09%09%09int count = Integer.parseInt(args%5B2%5D);%0A
 %09%09%09sourc
@@ -595,28 +595,33 @@
 0, 0, 0, 0, 
-1
+count
 , 1
+0
 );%0A%09%09%7D else 
@@ -722,16 +722,25 @@
  Effect.
+PARTICLE_
 SMOKE, 0
@@ -760,16 +760,17 @@
  0, 1, 1
+0
 );%0A%09%09%7D%0A%09

update playEffect