summaryrefslogtreecommitdiffstats
path: root/Essentials/src/net/ess3/settings/Commands.java
blob: 899ba6b1d53ef28afadea4aee1bb6bc943168f1e (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package net.ess3.settings;

import net.ess3.settings.commands.*;
import net.ess3.storage.Comment;
import net.ess3.storage.ListType;
import net.ess3.storage.StorageObject;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;


@Data
@EqualsAndHashCode(callSuper = false)
public class Commands implements StorageObject
{
	private Afk afk = new Afk();
	private Back back = new Back();
	private God god = new God();
	private Help help = new Help();
	private Home home = new Home();
	private Lightning lightning = new Lightning();
	private net.ess3.settings.commands.List list = new net.ess3.settings.commands.List();
	private Spawnmob spawnmob = new Spawnmob();
	private Tpa tpa = new Tpa();
	@ListType
	@Comment(
	{
		"When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take",
		"priority.  If a command is in this list, Essentials will try to give ITSELF priority.  This does not always work:",
		"usually whichever plugin was updated most recently wins out.  However, the full name of the command will always work.",
		"For example, if WorldGuard and Essentials are both enabled, and WorldGuard takes control over /god, /essentials:god",
		"will still map to Essentials, whereas it might normally get forced upon WorldGuard.  Commands prefixed with an \"e\",",
		"such as /egod, will always grant Essentials priority.",
		"We should try to take priority over /god.  If this doesn't work, use /essentials:god or /egod.",
		"If god is set using WorldGuard, use /ungod to remove then use whichever you see fit."
	})
	private List<String> overridden = new ArrayList<String>();
	@ListType
	@Comment("Disabled commands will be completelly unavailable on the server.")
	private List<String> disabled = new ArrayList<String>();

	public boolean isDisabled(final String commandName)
	{
		if (disabled == null)
		{
			return false;
		}
		for (String disabledCommand : disabled)
		{
			if (commandName.equalsIgnoreCase(disabledCommand))
			{
				return true;
			}
		}
		return false;
	}

	public boolean isOverridden(final String commandName)
	{
		if (overridden == null)
		{
			return false;
		}
		for (String overriddenCommand : overridden)
		{
			if (commandName.equalsIgnoreCase(overriddenCommand))
			{
				return true;
			}
		}
		return false;
	}
}