summaryrefslogtreecommitdiffstats
path: root/Essentials/src/net/ess3/settings/General.java
blob: ccb91c0f2a100355da8090340c42c7c3229b248a (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package net.ess3.settings;

import java.util.HashMap;
import java.util.Map;
import lombok.Data;
import lombok.EqualsAndHashCode;
import net.ess3.storage.Comment;
import net.ess3.storage.StorageObject;
import org.bukkit.entity.EntityType;


@Data
@EqualsAndHashCode(callSuper = false)
public class General implements StorageObject
{
	public General()
	{
		//Populate creature spawn values
		for (EntityType t : EntityType.values())
		{
			if (t.isAlive())
			{
				creatureSpawn.put(t, false);
			}
		}
	}
	@Comment("Backup runs a command while saving is disabled")
	private Backup backup = new Backup();
	@Comment("You can disable the death messages of minecraft.")
	private boolean deathMessages = true;
	@Comment("Turn this on, if you want to see more error messages, if something goes wrong.")
	private boolean debug = false;
	@Comment(
	{
		"Set the locale here, if you want to change the language of Essentials.",
		"If this is not set, Essentials will use the language of your computer.",
		"Available locales: da, de, en, fr, nl"
	})
	private String locale;
	@Comment(
	{
		"The number of items given, if the quantity parameter is left out in /item or /give.",
		"If this number is below 1, the maximum stack size size is given. If oversized stacks",
		"is not enabled, any number higher then the maximum stack size results in more than one stack."
	})
	private int defaultStacksize = -1;
	@Comment(
	{
		"Oversized stacks are stacks that ignore the normal max stacksize.",
		"They can be obtained using /give and /item, if the player has essentials.oversizedstacks permission.",
		"How many items should be in a oversized stack?"
	})
	private int oversizedStacksize = 64;


	public enum GroupStorage
	{
		FILE, GROUPMANAGER, VAULT
	}
	@Comment(
	{
		"Sets the place where group options should be stored:",
		" FILE: Options are stored inside groups.yml in the Essentials folder",
		" GROUPMANAGER: Options are stored using the GroupManager groups",
		" VAULT: Options are stored using a permissions plugin supported by Vault"
	})
	private GroupStorage groupStorage = GroupStorage.FILE;
	@Comment(
	{
		"The delay, in seconds, a player can't be attacked by other players after he has been teleported by a command",
		"This will also prevent that the player can attack other players"
	})
	private long teleportInvulnerability = 0;

	public long getTeleportInvulnerability()
	{
		return teleportInvulnerability * 1000;
	}
	@Comment(
	{
		"Set to true to enable per-world permissions for teleporting between worlds with essentials commands",
		"This applies to /world, /back, /tp[a|o][here|all], but not warps.",
		"Give someone permission to teleport to a world with essentials.world.<worldname>"
	})
	private boolean worldTeleportPermissions = false;
	private boolean worldHomePermissions = false;
	@Comment("Delay to wait before people can cause attack damage after logging in ")
	private long loginAttackDelay = 0;

	public long getLoginAttackDelay()
	{
		return loginAttackDelay * 1000;
	}
	public boolean metricsEnabled = true;
	@Comment("Prevent creatures spawning")
	private Map<EntityType, Boolean> creatureSpawn = new HashMap<EntityType, Boolean>();

	public boolean getPreventSpawn(String creatureName)
	{
		return getPreventSpawn(EntityType.fromName(creatureName));
	}

	public boolean getPreventSpawn(EntityType creature)
	{
		if (creatureSpawn == null)
		{
			return false;
		}
		return creatureSpawn.get(creature);
	}
}