summaryrefslogtreecommitdiffstats
path: root/Essentials/src/net/ess3/settings/Commands.java
blob: 6bd29b4c7750c3c5935d8ddd68a9b533a22b237e (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
75
76
77
78
79
package net.ess3.settings;

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


@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 Near near = new Near();
	private SocialSpy socialspy = new SocialSpy();
	private Spawnmob spawnmob = new Spawnmob();
	private Teleport teleport = new Teleport();
	private Speed speed = new Speed();
	@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."
	})
	@Getter(AccessLevel.NONE)
	@Setter(AccessLevel.NONE)
	private List<String> overridden = null;
	@ListType
	@Comment("Disabled commands will be completelly unavailable on the server.")
	@Getter(AccessLevel.NONE)
	@Setter(AccessLevel.NONE)
	private List<String> disabled = null;

	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;
	}
}