Hello, everyone! Some of you may have noticed that some "bigger" plugins have a fancy feature that when there's an unknown error, they post a log on Pastebin, and then print the URL and tell the server owner to send you, the plugin author, the URL. So, I thought to myself, why not make such a tool? And, voilĂ : it is finished. The usage is fairly simple: Code:java public class MyPlugin extends JavaPlugin public PastebinReporter REPORTER; @Overridepublic void onEnable() { this.REPORTER = new PastebinReporter(<Your pastebin API-Key>); } public PastebinReporter getReporter() {return this.REPORTER;} The API-Key is your personal API key for Pastebin. (to retrieve one, go to pastebin.com, create an account, and click "API") Then, if you want to make a report: Code:java Paste mySexyPaste = new Paste("This is the Header.\nThis header looks extremely sexy."); Then you can add as many lines as you want: Code:java mySexyPaste.appendLine("1. This is line 1!").appendLine("2. Line 2!").appendLine("Do you like it already?"); And then finally, to post your report on Pastebin do: Code:java MyPluginInstance.getReporter().post(<name of the paste, if null then no name will be given>, mySexyPaste, ReportFormat.YAML, ExpireDate.ONE_MONTH); My code supports all possible Pastebin syntaxes, so you can pick whichever you like. The "post(report, format);" returns the URL where the paste got posted. >>>Get PastebinReporter<<<
UnrealPowerz Yeah but keep in mind that the reportformat are over 200 diffrent formats so the "usefull" code is like 120 lines or so Added an "ExpireDate", you can pick between never, 10 minutes, 1 hour, 1 day, 1 week, 2 weeks and 1 month. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Nice, but is this running in the main server thread? Could bring a lot of servers to a grinding halt if pastebin is slow/down...
The_Doctor_123 Thank you LCastr0 Hmm, do this: System.out.print(reporter.post(<stuff here>)); and take a look at the url in the console.