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().playEffect(source.getLocation(), Effect.getByName(effectName.toUpperCase()), data);
		} else {
			// default ?
			source.getLocation().getWorld().playEffect(source.getLocation(), Effect.SMOKE, 0);
		}
	}

}

@@ -444,32 +444,41 @@
 on().getWorld().
+spigot().
 playEffect(sourc
@@ -505,17 +505,15 @@
 ect.
-getByName
+valueOf
 (eff
@@ -535,21 +535,42 @@
 Case()),
+ 0,
  data
+, 0, 0, 0, 0, 1, 1
 );%0A%09%09%7D e
@@ -626,16 +626,25 @@
 World().
+spigot().
 playEffe
@@ -683,16 +683,37 @@
 SMOKE, 0
+, 0, 0, 0, 0, 0, 1, 1
 );%0A%09%09%7D%0A%09

fix NullPointerException