mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-15 05:33:40 +00: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
3 changed files with 46 additions and 1 deletions
|
@ -206,4 +206,8 @@ public class RandomTeleport implements IConf {
|
||||||
private boolean isValidRandomLocation(final Location location) {
|
private boolean isValidRandomLocation(final Location location) {
|
||||||
return location.getBlockY() > ess.getWorldInfoProvider().getMinHeight(location.getWorld()) && !this.getExcludedBiomes().contains(location.getBlock().getBiome());
|
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();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File getFile() {
|
||||||
|
return config.getFile();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reloadConfig() {
|
public void reloadConfig() {
|
||||||
config.load();
|
config.load();
|
||||||
|
|
|
@ -258,6 +258,7 @@ public class Commandessentials extends EssentialsCommand {
|
||||||
files.add(new PasteUtil.PasteFile("dump.json", dump.toString()));
|
files.add(new PasteUtil.PasteFile("dump.json", dump.toString()));
|
||||||
|
|
||||||
final Plugin essDiscord = Bukkit.getPluginManager().getPlugin("EssentialsDiscord");
|
final Plugin essDiscord = Bukkit.getPluginManager().getPlugin("EssentialsDiscord");
|
||||||
|
final Plugin essSpawn = Bukkit.getPluginManager().getPlugin("EssentialsSpawn");
|
||||||
|
|
||||||
// Further operations will be heavy IO
|
// Further operations will be heavy IO
|
||||||
ess.runTaskAsynchronously(() -> {
|
ess.runTaskAsynchronously(() -> {
|
||||||
|
@ -265,12 +266,18 @@ public class Commandessentials extends EssentialsCommand {
|
||||||
boolean discord = false;
|
boolean discord = false;
|
||||||
boolean kits = false;
|
boolean kits = false;
|
||||||
boolean log = false;
|
boolean log = false;
|
||||||
|
boolean worth = false;
|
||||||
|
boolean tpr = false;
|
||||||
|
boolean spawns = false;
|
||||||
for (final String arg : args) {
|
for (final String arg : args) {
|
||||||
if (arg.equals("*") || arg.equalsIgnoreCase("all")) {
|
if (arg.equals("*") || arg.equalsIgnoreCase("all")) {
|
||||||
config = true;
|
config = true;
|
||||||
discord = true;
|
discord = true;
|
||||||
kits = true;
|
kits = true;
|
||||||
log = true;
|
log = true;
|
||||||
|
worth = true;
|
||||||
|
tpr = true;
|
||||||
|
spawns = true;
|
||||||
break;
|
break;
|
||||||
} else if (arg.equalsIgnoreCase("config")) {
|
} else if (arg.equalsIgnoreCase("config")) {
|
||||||
config = true;
|
config = true;
|
||||||
|
@ -280,6 +287,12 @@ public class Commandessentials extends EssentialsCommand {
|
||||||
kits = true;
|
kits = true;
|
||||||
} else if (arg.equalsIgnoreCase("log")) {
|
} else if (arg.equalsIgnoreCase("log")) {
|
||||||
log = true;
|
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);
|
final CompletableFuture<PasteUtil.PasteResult> future = PasteUtil.createPaste(files);
|
||||||
future.thenAccept(result -> {
|
future.thenAccept(result -> {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
@ -719,7 +756,7 @@ public class Commandessentials extends EssentialsCommand {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "dump":
|
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) {
|
for (String arg : args) {
|
||||||
if (arg.equals("*") || arg.equalsIgnoreCase("all")) {
|
if (arg.equals("*") || arg.equalsIgnoreCase("all")) {
|
||||||
list.clear();
|
list.clear();
|
||||||
|
|
Loading…
Reference in a new issue