Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement export options. #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

benrobson
Copy link
Contributor

  • Added a config.yml.
export:
  # Maximum amount of downloads before link is dead.
  maxdownloads: 1
  # Maximum amount of days before link is dead.
  maxdays: 3

This allows the Server Administrator to customise the max downloads and days for worlds.

private static Scaffold instance;
public static Scaffold instance;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is not needed as the getter method below is already public

@@ -238,7 +238,7 @@ public static void upload(CommandContext cmd, CommandSender sender) {

sender.sendMessage(ChatColor.YELLOW + "Uploading world...");
try {
HttpResponse<String> response = Unirest.post("https://transfer.sh/").header("Max-Downloads", "1").header("Max-Days", "3").field("upload-file", zip).asString();
HttpResponse<String> response = Unirest.post("https://transfer.sh/").header("Max-Downloads", Scaffold.get().getConfig().getString("export.maxdownloads")).header("Max-Days", Scaffold.get().getConfig().getString("export.maxdays")).field("upload-file", zip).asString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reduce the width of this line, store the config retrieved from Scaffold.get().getConfig() into a local variable and provide a default value for the config paths you are requesting, as such: config.getString("export.maxdownloads", 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants