Skip to content

Commit 19837f9

Browse files
authored
Add some more dump files (#4785)
Adds worth, tpr, and spawns configs. See also EssentialsX/Website#68
1 parent 4b8b770 commit 19837f9

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

Essentials/src/main/java/com/earth2me/essentials/RandomTeleport.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,8 @@ private double getNetherYAt(final Location location) {
206206
private boolean isValidRandomLocation(final Location location) {
207207
return location.getBlockY() > ess.getWorldInfoProvider().getMinHeight(location.getWorld()) && !this.getExcludedBiomes().contains(location.getBlock().getBiome());
208208
}
209+
210+
public File getFile() {
211+
return config.getFile();
212+
}
209213
}

Essentials/src/main/java/com/earth2me/essentials/Worth.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ public void setPrice(final IEssentials ess, final ItemStack itemStack, final dou
149149
config.save();
150150
}
151151

152+
public File getFile() {
153+
return config.getFile();
154+
}
155+
152156
@Override
153157
public void reloadConfig() {
154158
config.load();

Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,19 +258,26 @@ private void runDump(Server server, CommandSource sender, String commandLabel, S
258258
files.add(new PasteUtil.PasteFile("dump.json", dump.toString()));
259259

260260
final Plugin essDiscord = Bukkit.getPluginManager().getPlugin("EssentialsDiscord");
261+
final Plugin essSpawn = Bukkit.getPluginManager().getPlugin("EssentialsSpawn");
261262

262263
// Further operations will be heavy IO
263264
ess.runTaskAsynchronously(() -> {
264265
boolean config = false;
265266
boolean discord = false;
266267
boolean kits = false;
267268
boolean log = false;
269+
boolean worth = false;
270+
boolean tpr = false;
271+
boolean spawns = false;
268272
for (final String arg : args) {
269273
if (arg.equals("*") || arg.equalsIgnoreCase("all")) {
270274
config = true;
271275
discord = true;
272276
kits = true;
273277
log = true;
278+
worth = true;
279+
tpr = true;
280+
spawns = true;
274281
break;
275282
} else if (arg.equalsIgnoreCase("config")) {
276283
config = true;
@@ -280,6 +287,12 @@ private void runDump(Server server, CommandSource sender, String commandLabel, S
280287
kits = true;
281288
} else if (arg.equalsIgnoreCase("log")) {
282289
log = true;
290+
} else if (arg.equalsIgnoreCase("worth")) {
291+
worth = true;
292+
} else if (arg.equalsIgnoreCase("tpr")) {
293+
tpr = true;
294+
} else if (arg.equalsIgnoreCase("spawns")) {
295+
spawns = true;
283296
}
284297
}
285298

@@ -319,6 +332,30 @@ private void runDump(Server server, CommandSource sender, String commandLabel, S
319332
}
320333
}
321334

335+
if (worth) {
336+
try {
337+
files.add(new PasteUtil.PasteFile("worth.yml", new String(Files.readAllBytes(ess.getWorth().getFile().toPath()), StandardCharsets.UTF_8)));
338+
} catch (IOException e) {
339+
sender.sendMessage(tl("dumpErrorUpload", "worth.yml", e.getMessage()));
340+
}
341+
}
342+
343+
if (tpr) {
344+
try {
345+
files.add(new PasteUtil.PasteFile("tpr.yml", new String(Files.readAllBytes(ess.getRandomTeleport().getFile().toPath()), StandardCharsets.UTF_8)));
346+
} catch (IOException e) {
347+
sender.sendMessage(tl("dumpErrorUpload", "tpr.yml", e.getMessage()));
348+
}
349+
}
350+
351+
if (spawns && essSpawn != null) {
352+
try {
353+
files.add(new PasteUtil.PasteFile("spawn.yml", new String(Files.readAllBytes(ess.getDataFolder().toPath().resolve("spawn.yml")), StandardCharsets.UTF_8)));
354+
} catch (IOException e) {
355+
sender.sendMessage(tl("dumpErrorUpload", "spawn.yml", e.getMessage()));
356+
}
357+
}
358+
322359
final CompletableFuture<PasteUtil.PasteResult> future = PasteUtil.createPaste(files);
323360
future.thenAccept(result -> {
324361
if (result != null) {
@@ -719,7 +756,7 @@ protected List<String> getTabCompleteOptions(final Server server, final CommandS
719756
}
720757
break;
721758
case "dump":
722-
final List<String> list = Lists.newArrayList("config", "kits", "log", "discord", "all");
759+
final List<String> list = Lists.newArrayList("config", "kits", "log", "discord", "worth", "tpr", "spawns", "all");
723760
for (String arg : args) {
724761
if (arg.equals("*") || arg.equalsIgnoreCase("all")) {
725762
list.clear();

0 commit comments

Comments
 (0)