package de.nerdclubtfg.signalbot;

import java.io.IOException;
import java.util.Arrays;

import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;

import de.nerdclubtfg.signalbot.plugins.Echo;
import de.nerdclubtfg.signalbot.plugins.Fefe;
import de.nerdclubtfg.signalbot.plugins.Plugins;
import de.nerdclubtfg.signalbot.plugins.Tex;
import de.nerdclubtfg.signalbot.plugins.Xkcd;
import de.thoffbauer.signal4j.store.Group;
import de.thoffbauer.signal4j.store.User;

public abstract class Plugin {

	public static final Plugin[] PLUGINS = new Plugin[] {
		new Echo(),
		new Fefe(),
		new Plugins(),
		new Tex(),
		new Xkcd()
	};
	
	public static Plugin getPlugin(String name) {
		return Arrays.stream(PLUGINS).filter(v -> v.getName().equals(name)).findFirst().orElse(null);
	}
	
	private boolean isEnabled;
	
	public abstract boolean accepts(User sender, Group group, SignalServiceDataMessage message);
	public abstract void onMessage(User sender, Group group, SignalServiceDataMessage message) throws IOException;
	
	public String getName() {
		return this.getClass().getSimpleName().toLowerCase();
	}

	public boolean isEnabled() {
		return isEnabled;
	}

	public void setEnabled(boolean isEnabled) {
		this.isEnabled = isEnabled;
	}
	
}

@@ -206,198 +206,9 @@
 ins.
-Echo;%0Aimport de.nerdclubtfg.signalbot.plugins.Fefe;%0Aimport de.nerdclubtfg.signalbot.plugins.Plugins;%0Aimport de.nerdclubtfg.signalbot.plugins.Tex;%0Aimport de.nerdclubtfg.signalbot.plugins.Xkcd
+*
 ;%0Aim

Revert Eclipse's import organizing