mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Add some more dump files (#4785)
Adds worth, tpr, and spawns configs. See also https://github.com/EssentialsX/Website/pull/68
This commit is contained in:
parent
4b8b770c30
commit
19837f9309
@ -206,4 +206,8 @@ public class RandomTeleport implements IConf {
|
||||
private boolean isValidRandomLocation(final Location location) {
|
||||
return location.getBlockY() > ess.getWorldInfoProvider().getMinHeight(location.getWorld()) && !this.getExcludedBiomes().contains(location.getBlock().getBiome());
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return config.getFile();
|
||||
}
|
||||
}
|
||||
|
@ -149,6 +149,10 @@ public class Worth implements IConf {
|
||||
config.save();
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return config.getFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadConfig() {
|
||||
config.load();
|
||||
|
@ -258,6 +258,7 @@ public class Commandessentials extends EssentialsCommand {
|
||||
files.add(new PasteUtil.PasteFile("dump.json", dump.toString()));
|
||||
|
||||
final Plugin essDiscord = Bukkit.getPluginManager().getPlugin("EssentialsDiscord");
|
||||
final Plugin essSpawn = Bukkit.getPluginManager().getPlugin("EssentialsSpawn");
|
||||
|
||||
// Further operations will be heavy IO
|
||||
ess.runTaskAsynchronously(() -> {
|
||||
@ -265,12 +266,18 @@ public class Commandessentials extends EssentialsCommand {
|
||||
boolean discord = false;
|
||||
boolean kits = false;
|
||||
boolean log = false;
|
||||
boolean worth = false;
|
||||
boolean tpr = false;
|
||||
boolean spawns = false;
|
||||
for (final String arg : args) {
|
||||
if (arg.equals("*") || arg.equalsIgnoreCase("all")) {
|
||||
config = true;
|
||||
discord = true;
|
||||
kits = true;
|
||||
log = true;
|
||||
worth = true;
|
||||
tpr = true;
|
||||
spawns = true;
|
||||
break;
|
||||
} else if (arg.equalsIgnoreCase("config")) {
|
||||
config = true;
|
||||
@ -280,6 +287,12 @@ public class Commandessentials extends EssentialsCommand {
|
||||
kits = true;
|
||||
} else if (arg.equalsIgnoreCase("log")) {
|
||||
log = true;
|
||||
} else if (arg.equalsIgnoreCase("worth")) {
|
||||
worth = true;
|
||||
} else if (arg.equalsIgnoreCase("tpr")) {
|
||||
tpr = true;
|
||||
} else if (arg.equalsIgnoreCase("spawns")) {
|
||||
spawns = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,6 +332,30 @@ public class Commandessentials extends EssentialsCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (worth) {
|
||||
try {
|
||||
files.add(new PasteUtil.PasteFile("worth.yml", new String(Files.readAllBytes(ess.getWorth().getFile().toPath()), StandardCharsets.UTF_8)));
|
||||
} catch (IOException e) {
|
||||
sender.sendMessage(tl("dumpErrorUpload", "worth.yml", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
if (tpr) {
|
||||
try {
|
||||
files.add(new PasteUtil.PasteFile("tpr.yml", new String(Files.readAllBytes(ess.getRandomTeleport().getFile().toPath()), StandardCharsets.UTF_8)));
|
||||
} catch (IOException e) {
|
||||
sender.sendMessage(tl("dumpErrorUpload", "tpr.yml", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
if (spawns && essSpawn != null) {
|
||||
try {
|
||||
files.add(new PasteUtil.PasteFile("spawn.yml", new String(Files.readAllBytes(ess.getDataFolder().toPath().resolve("spawn.yml")), StandardCharsets.UTF_8)));
|
||||
} catch (IOException e) {
|
||||
sender.sendMessage(tl("dumpErrorUpload", "spawn.yml", e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
final CompletableFuture<PasteUtil.PasteResult> future = PasteUtil.createPaste(files);
|
||||
future.thenAccept(result -> {
|
||||
if (result != null) {
|
||||
@ -719,7 +756,7 @@ public class Commandessentials extends EssentialsCommand {
|
||||
}
|
||||
break;
|
||||
case "dump":
|
||||
final List<String> list = Lists.newArrayList("config", "kits", "log", "discord", "all");
|
||||
final List<String> list = Lists.newArrayList("config", "kits", "log", "discord", "worth", "tpr", "spawns", "all");
|
||||
for (String arg : args) {
|
||||
if (arg.equals("*") || arg.equalsIgnoreCase("all")) {
|
||||
list.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user