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
|
package net.tylermurphy.hideAndSeek;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
import org.bukkit.util.Vector;
public class Store {
public static Map<String,Player>
playerList = new HashMap<String,Player>();
public static List<String>
Hider,
Seeker,
Spectator;
public static Scoreboard
board;
public static Team
HiderTeam,
SeekerTeam,
SpectatorTeam;
public static String
messagePrefix,
errorPrefix,
tauntPrefix,
worldborderPrefix,
abortPrefix,
gameoverPrefix,
warningPrefix,
spawnWorld,
status = "Standby";
public static Vector
spawnPosition,
worldborderPosition;
public static List<String>
blockedCommands;
public static boolean
nametagsVisible,
permissionsRequired,
unbreakableArmorstands,
unbreakablePaintings,
unbreakableItemframes,
interactableArmorstands,
interactableItemframes,
interactableDoors,
interactableTrapdoors,
interactableFencegate,
worldborderEnabled = false,
runningBackup = false;
public static int
minPlayers,
gameId = 0,
worldborderSize,
worldborderDelay,
currentWorldborderSize;
public static FileConfiguration getConfig() {
return Main.plugin.getConfig();
}
public static void saveConfig() {
Main.plugin.saveConfig();
}
public static void loadConfig() {
Main.plugin.reloadConfig();
//Default
getConfig().addDefault("spawn.x", 0);
getConfig().addDefault("spawn.y", 0);
getConfig().addDefault("spawn.z", 0);
getConfig().addDefault("spawn.world", "world");
getConfig().addDefault("worldBorder.x", 0);
getConfig().addDefault("worldBorder.z", 0);
getConfig().addDefault("worldBorder.delay", 10);
getConfig().addDefault("worldBorder.size", 500);
getConfig().addDefault("worldBorder.enabled", false);
getConfig().addDefault("blockedCommands", Arrays.asList("whisper","msg"));
getConfig().addDefault("prefix.default", "&9Hide and Seek > &f");
getConfig().addDefault("prefix.error", "&cError > &f");
getConfig().addDefault("prefix.taunt", "&eTaunt > &f");
getConfig().addDefault("prefix.border", "&cWorld Border > &f");
getConfig().addDefault("prefix.abort", "&cAbort > &f");
getConfig().addDefault("prefix.gameover", "&aGame Over > &f");
getConfig().addDefault("prefix.warning", "&cWarning > &f");
getConfig().addDefault("nametagsVisible", false);
getConfig().addDefault("permissionsRequired", true);
getConfig().addDefault("blockSettings.unbreakable.painting", false);
getConfig().addDefault("blockSettings.unbreakable.armorstand", false);
getConfig().addDefault("blockSettings.unbreakable.itemframe", false);
getConfig().addDefault("blockSettings.interactable.armorstand", true);
getConfig().addDefault("blockSettings.interactable.itemframe", true);
getConfig().addDefault("blockSettings.interactable.door", true);
getConfig().addDefault("blockSettings.interactable.trapdoor", true);
getConfig().addDefault("blockSettings.interactable.fence", true);
getConfig().addDefault("minPlayers", 2);
//Spawn
spawnPosition = new Vector(
getConfig().getDouble("spawn.x"),
Math.max(0,Math.min(255,getConfig().getDouble("spawn.y"))),
getConfig().getDouble("spawn.z")
);
spawnWorld = getConfig().getString("spawn.world");
//World border
worldborderPosition = new Vector(
getConfig().getInt("worldBorder.x"),
0,
getConfig().getInt("worldBorder.z")
);
worldborderSize = Math.max(100,getConfig().getInt("worldBorder.size"));
worldborderDelay = Math.max(1,getConfig().getInt("worldBorder.delay"));
worldborderEnabled = getConfig().getBoolean("worldBorder.enabled");
blockedCommands = getConfig().getStringList("blockedCommands");
blockedCommands.add("team");
//Prefix
char SYMBOLE = '\u00A7';
String SYMBOLE_STRING = new String(new char[] {SYMBOLE});
messagePrefix = getConfig().getString("prefix.default").replace("&", SYMBOLE_STRING);
errorPrefix = getConfig().getString("prefix.error").replace("&", SYMBOLE_STRING);
tauntPrefix = getConfig().getString("prefix.taunt").replace("&", SYMBOLE_STRING);
worldborderPrefix = getConfig().getString("prefix.border").replace("&", SYMBOLE_STRING);
abortPrefix = getConfig().getString("prefix.abort").replace("&", SYMBOLE_STRING);
gameoverPrefix = getConfig().getString("prefix.gameover").replace("&", SYMBOLE_STRING);
warningPrefix = getConfig().getString("prefix.warning").replace("&", SYMBOLE_STRING);
//Other
nametagsVisible = getConfig().getBoolean("nametagsVisible");
permissionsRequired = getConfig().getBoolean("permissionsRequired");
unbreakablePaintings = getConfig().getBoolean("blockSettings.unbreakable.painting");
unbreakableArmorstands = getConfig().getBoolean("blockSettings.unbreakable.armorstand");
unbreakableItemframes = getConfig().getBoolean("blockSettings.unbreakable.itemframe");
interactableArmorstands = getConfig().getBoolean("blockSettings.interactable.armorstand");
interactableItemframes = getConfig().getBoolean("blockSettings.interactable.itemframe");
interactableDoors = getConfig().getBoolean("blockSettings.interactable.door");
interactableTrapdoors = getConfig().getBoolean("blockSettings.interactable.trapdoor");
interactableFencegate = getConfig().getBoolean("blockSettings.interactable.fence");
minPlayers = Math.max(2,getConfig().getInt("minPlayers"));
getConfig().options().copyDefaults(true);
saveConfig();
}
public static void addToSection(String sectionName, Map<String,Object> values) {
ConfigurationSection section = getConfig().getConfigurationSection(sectionName);
if(section == null) section = getConfig().createSection(sectionName);
Map<String,Object> sectionValues = section.getValues(true);
for(Entry<String, Object> entry : values.entrySet()) {
sectionValues.put(entry.getKey(), entry.getValue());
}
getConfig().createSection(sectionName, sectionValues);
saveConfig();
}
}
|