Skip to content

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.

public final class Scaffold extends JavaPlugin implements TabCompleter {

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

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