summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate/src/net/ess3/update/states/EssentialsChat.java
blob: a62735f5e1be205b48f38af4ed2e2de7a9bac445 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package net.ess3.update.states;

import net.ess3.update.AbstractWorkListener;
import net.ess3.update.tasks.InstallModule;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;


public class EssentialsChat extends AbstractYesNoState
{
	public EssentialsChat(final StateMap states)
	{
		super(states, EssentialsChatSettings.class);
	}

	@Override
	public boolean guessAnswer()
	{
		final Plugin plugin = Bukkit.getPluginManager().getPlugin("EssentialsChat");
		if (plugin != null)
		{
			setAnswer(true);
			return true;
		}
		return false;
	}

	@Override
	public void askQuestion(final Player sender)
	{
		sender.sendMessage("Do you want to install EssentialsChat? (yes/no)");
		sender.sendMessage("EssentialsChat is a simple chat formatting plugin");
		sender.sendMessage("It allows you to make user prefixes and coloured text.");
	}

	@Override
	public void doWork(final AbstractWorkListener listener)
	{
		if (getAnswer())
		{
			new InstallModule(listener, "EssentialsChat").start();
			return;
		}
		listener.onWorkDone();
	}
}