https://github.com/carlgo11/report
Upload bukkit logs + plugin logs to pastebin.com
https://github.com/carlgo11/report
bukkit-plugin bukkit-plugins java minecraft-plugin pastebin
Last synced: 10 months ago
JSON representation
Upload bukkit logs + plugin logs to pastebin.com
- Host: GitHub
- URL: https://github.com/carlgo11/report
- Owner: Carlgo11
- License: gpl-3.0
- Created: 2014-02-09T00:52:20.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-12-27T16:12:12.000Z (over 6 years ago)
- Last Synced: 2025-03-23T00:41:44.302Z (about 1 year ago)
- Topics: bukkit-plugin, bukkit-plugins, java, minecraft-plugin, pastebin
- Language: Java
- Size: 65.4 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Report-API
[](https://github.com/Carlgo11/report/actions)
[](https://github.com/Carlgo11/report/blob/master/LICENSE.md)

Upload server logs & plugin configurations for bug reports.
## Installation
Add this to your pom.xml:
```XML
com.carlgo11
report
1.1
```
Run via command line:
```BASH
mvn install
```
import the Report class in your own class:
```JAVA
import com.carlgo11.report.Report;
```
Go to [Pastebin.com](https://pastebin.com) and create an account if you haven't already.
Then go to [Pastebin API](https://pastebin.com/api#1), retrieve your API key and optionally your [User Key](https://pastebin.com/api/api_user_key.html).
### Plugin dependency
As your plugin will have to load after the Report-API has finished loading it's a good idea to make that clear in the `plugin.yml` of your plugin. This can be done through several ways.
#### Hard dependency
The first one is to require Report-API to be present for your plugin do load:
```YAML
depend:
- report-api
```
#### Soft dependency
If you'd rather have the report feature as an optional functionality you can use the soft depend tag:
```YAML
softdepend:
- report-api
```
This way the server will try and load Report-API before your own plugin if Report-API is present in the plugins folder.
If not, it will just load your plugin normally.
## Usage
To generate a report, call the Report class like this:
```JAVA
String api_key = ""; //Pastebin API key
String user_key = ""; //Pastebin User key (can be left blank)
Report report = new Report(plugin, user_key, api_key); //Call Report class
report.makeReport(); //Send the data away to Pastebin
```
You can then send the URL to the user who sent the request.
```JAVA
URL url = report.getURL(); //Get the Pastebin URL
sender.sendMessage("Give this URL to the support agent: " + URL.toString);
```
### Optional code
It's a good idea to also check that the `makeReport()` function returns true and that the `getURL()` function returns a valid Pastebin URL.
```JAVA
String api_key = "";
String user_key = "";
try {
Report report = new Report(plugin, user_key, api_key);
if(report.makeReport()){
URL url = report.getURL();
if(url.toString().startsWith("https://pastebin.com/")){
sender.sendMessage("Give this URL to the support agent: " + url.toString);
}
}
} catch (ClassNotFoundException e) {
System.out.println("Report-API not installed!");
}
```
## Compile locally
To compile Report-API locally you need:
* Java JDK 8 or later
* Apache Maven
Then run:
```BASH
mvn install
```
_Depending on your OS and Maven setup you might need to replace `mvn` with `maven` in the example above_.
You should now have a Report-API JAR-file inside the `target` folder.