This repository has been archived by the owner on Nov 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
/
MassiveCoreMConf.java
194 lines (153 loc) · 7.01 KB
/
MassiveCoreMConf.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
package com.massivecraft.massivecore;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.command.editor.annotation.EditorName;
import com.massivecraft.massivecore.command.editor.annotation.EditorType;
import com.massivecraft.massivecore.command.type.TypeMillisDiff;
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanOn;
import com.massivecraft.massivecore.store.Entity;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.PermissionUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.xlib.mongodb.WriteConcern;
import org.bukkit.permissions.Permissible;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@EditorName("config")
public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
protected static transient MassiveCoreMConf i;
public static MassiveCoreMConf get() { return i; }
// -------------------------------------------- //
// ALIASES
// -------------------------------------------- //
// Base command aliases.
public List<String> aliasesMcore = MUtil.list("massivecore", "mcore");
public List<String> aliasesUsys = MUtil.list("usys");
public List<String> aliasesMstore = MUtil.list("massivestore", "mstore");
public List<String> aliasesBuffer = MUtil.list("buffer");
public List<String> aliasesCmdurl = MUtil.list("cmdurl");
// -------------------------------------------- //
// GENERAL
// -------------------------------------------- //
// General configuration options.
public String taskServerId = null;
public boolean versionSynchronizationEnabled = true;
public int tabCompletionLimit = 100;
public boolean recipientChatEventEnabled = true;
public boolean consoleColorsEnabled = true;
// -------------------------------------------- //
// PERMISSIONS FORMATS
// -------------------------------------------- //
// Permission denied formatting.
public Map<String, String> permissionDeniedFormats = MUtil.map(
"some.awesome.permission.node", "<b>You must be awesome to %s<b>.",
"some.derp.permission.node.1", "derp",
"some.derp.permission.node.2", "derp",
"some.derp.permission.node.3", "derp",
"derp", "<b>Only derp people can %s<b>.\n<i>Ask a moderator to become derp."
);
public String getPermissionDeniedFormat(String permissionName)
{
Map<String, String> map = this.permissionDeniedFormats;
String ret = map.get(permissionName);
if (ret == null) return null;
ret = MUtil.recurseResolveMap(ret, map);
return ret;
}
// -------------------------------------------- //
// TP DELAY
// -------------------------------------------- //
// Teleportation delay permissions.
public Map<String, Integer> permissionToTpdelay = MUtil.map(
"massivecore.notpdelay", 0,
"default", 10
);
public int getTpdelay(Permissible permissible)
{
Integer ret = PermissionUtil.pickFirstVal(permissible, permissionToTpdelay);
if (ret == null) ret = 0;
return ret;
}
// -------------------------------------------- //
// DELETE FILES
// -------------------------------------------- //
// Delete certain files for system cleanliness.
public List<String> deleteFiles = new ArrayList<>();
// -------------------------------------------- //
// VARIABLES
// -------------------------------------------- //
// Chat and command variables.
public String variableBookName = "***book***";
public boolean variableBookEnabled = true;
public String variableBufferName = "***buffer***";
public boolean variableBufferEnabled = true;
// -------------------------------------------- //
// CLICK
// -------------------------------------------- //
// Button click sound configuration.
public SoundEffect clickSound = SoundEffect.valueOf("UI_BUTTON_CLICK", 0.75f, 1.0f);
// -------------------------------------------- //
// MSTORE
// -------------------------------------------- //
// The database system.
@EditorType(TypeMillisDiff.class)
public volatile long millisBetweenLocalPoll = TimeUnit.MILLIS_PER_MINUTE * 5;
@EditorType(TypeMillisDiff.class)
public volatile long millisBetweenRemotePollWithoutPusher = TimeUnit.MILLIS_PER_SECOND * 10;
@EditorType(TypeMillisDiff.class)
public volatile long millisBetweenRemotePollWithPusher = TimeUnit.MILLIS_PER_MINUTE * 1;
@EditorType(TypeBooleanOn.class)
public boolean warnOnLocalAlter = false;
// -------------------------------------------- //
// CLEAN
// -------------------------------------------- //
// How often should the task run?
// When set to 0 this feature is disabled. Meaning no cleaning will be done.
// Default: 1 day (Per default once a day.)
public long cleanTaskPeriodMillis = TimeUnit.MILLIS_PER_DAY;
// This is used to decide at what time of the day the task will run.
// For Example: If the taskPeriodMillis is 24 hours:
// Set it to 0 for UTC midnight.
// Set it to 3600000 for UTC midnight + 1 hour.
public long cleanTaskOffsetMillis = 0;
// When did the task last run?
// This need not be modified by the server owner.
// It will be set for you automatically.
// 0 means it never ran before.
public long cleanTaskLastMillis = 0;
// -------------------------------------------- //
// MONGODB
// -------------------------------------------- //
// The database system MongoDB driver.
public boolean catchingMongoDbErrorsOnSave = true;
public boolean catchingMongoDbErrorsOnDelete = true;
public static WriteConcern getMongoDbWriteConcern(boolean catchingErrors) { return catchingErrors ? WriteConcern.ACKNOWLEDGED : WriteConcern.UNACKNOWLEDGED; }
public WriteConcern getMongoDbWriteConcernSave() { return getMongoDbWriteConcern(this.catchingMongoDbErrorsOnSave); }
public WriteConcern getMongoDbWriteConcernDelete() { return getMongoDbWriteConcern(this.catchingMongoDbErrorsOnDelete); }
// -------------------------------------------- //
// DEVELOPER
// -------------------------------------------- //
public boolean debugEnabled = false;
// -------------------------------------------- //
// SPONSOR
// -------------------------------------------- //
// URL connections to http://sponsorinfo.massivecraft.com/
public long sponsorUpdateMillis = 0;
public boolean sponsorEnabled = true;
// -------------------------------------------- //
// METRICS
// -------------------------------------------- //
// URL connections to https://bstats.org
public boolean metricsEnabled = true;
// -------------------------------------------- //
// LORE SORTING
// -------------------------------------------- //
public boolean loreSortOnInventoryClick = false;
public boolean loreSortOnInventoryOpen = false;
public Map<String, Integer> lorePrioritiesPrefix = new MassiveMap<>();
public Map<String, Integer> lorePrioritiesRegex = new MassiveMap<>();
}