/
Settings.java
214 lines (144 loc) · 6.02 KB
/
Settings.java
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
package net.aufdemrand.denizen;
import net.aufdemrand.denizen.utilities.DenizenAPI;
public class Settings {
/*
# Whether Denizen should display debug in the console
*/
public static boolean ShowDebug() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Debug.Show", true);
}
/*
# Sets the default speed between execution of commands in queues
*/
public static String ScriptQueueSpeed() {
String delay = DenizenAPI.getCurrentInstance().getConfig()
.getString("Scripts.Queue Speed", "0.5s");
// Check for users setting delay to 0, which will in turn lock up the server
try { if (Double.valueOf(delay) < 1) delay = "1t"; }
catch (Exception e) { delay = "0.5s"; }
return delay;
}
/*
# Whether scripts in subfolders of the scripts folder should be loaded
*/
public static boolean LoadScriptsInSubfolders() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Scripts.Load Scripts in Subfolders", true);
}
/*
# Whether the Health trait should be enabled by default
*/
public static boolean HealthTraitEnabledByDefault() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Traits.Health.Enabled", false);
}
/*
# Whether NPCs with the Health trait should respawn after being killed
*/
public static boolean HealthTraitRespawnEnabled() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Traits.Health.Respawn.Enabled", true);
}
/*
# How long it should take for NPCs with the Health trait to respawn
*/
public static String HealthTraitRespawnDelay() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Traits.Health.Respawn.Delay", "10s");
}
/*
# Whether a certain trigger is enabled by default or not
*/
public static boolean TriggerEnabled(String triggerName) {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers." + triggerName + ".Enabled", true);
}
/*
# Default duration of cooldown set to Denizens for when a trigger is
# triggered. Not all triggers may use this, it is optional!
*/
public static String TriggerDefaultCooldown(String triggerName) {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Triggers." + triggerName + ".Cooldown", "5s");
}
/*
# This set of nodes defines ranges for different types of
# interact-script triggers. Not all triggers use a range,
# as it may not be applicable to the trigger.
*/
public static double TriggerDefaultRange(String triggerName) {
return DenizenAPI.getCurrentInstance().getConfig()
.getDouble("Triggers." + triggerName + ".Range", -1);
}
/*
# If the damage trigger is disabled on an NPC, and the NPC is not
# vulnerable, both the right and left clicks can be used to activate
# the click trigger. Default setting in versions 0.8+ is 'false',
# but it's worth noting that in previous versions this was by
# default 'true'.
#
# Select true if you would like invulnerable NPCs to use both right
# and left clicks to activate the click trigger.
*/
public static boolean ClickTriggerAllowsLeftClick() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Click.Allows Left Click", false);
}
/*
# Default engage timeout. When NPCs are set to ENGAGE, this is
# the default timeout that they will auto-DISENGAGE if not otherwise
# specified. (Default, 150 seconds)
*/
public static String EngageTimeoutInSeconds() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Commands.Engage.Timeout", "150s");
}
/*
# The formats in which Chat Trigger input from players appears to
# themselves and to players who can overhear them
*/
public static String ChatToNpcFormat() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Triggers.Chat.Formats.Player to NPC", "You -> <npc.name.nickname>: <text>");
}
public static String ChatToNpcOverheardFormat() {
return DenizenAPI.getCurrentInstance().getConfig()
.getString("Triggers.Chat.Formats.Player to Bystanders", "<player.name> -> <npc.name.nickname>: <text>");
}
/*
# The distance from which a player chatting to an NPC can be overheard
# by other players
*/
public static double ChatToNpcOverhearingRange() {
return DenizenAPI.getCurrentInstance().getConfig()
.getDouble("Triggers.Chat.Overhearing Range", 4);
}
/*
# Prerequisites for triggering a Chat Trigger
*/
public static boolean ChatMustSeeNPC() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Prerequisites.Must Be Able to See NPC", true);
}
public static boolean ChatMustLookAtNPC() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Prerequisites.Must Be Looking in Direction of NPC", true);
}
/*
# Circumstances under which a player's Chat Trigger input should
# appear in the global chat
*/
public static boolean ChatGloballyIfFailedChatTriggers() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Appears Globally.If Triggers Failed", false);
}
public static boolean ChatGloballyIfNoChatTriggers() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Appears Globally.If Triggers Missing", true);
}
public static boolean ChatGloballyIfUninteractable() {
return DenizenAPI.getCurrentInstance().getConfig()
.getBoolean("Triggers.Chat.Appears Globally.If NPC Uninteractable", true);
}
}