The plugin configuration file is now included in internal bug reports
This commit is contained in:
parent
a366018bdd
commit
2f44e8a631
@ -35,67 +35,78 @@ public class BugReport {
|
|||||||
playerUUID = "CONSOLE";
|
playerUUID = "CONSOLE";
|
||||||
}
|
}
|
||||||
|
|
||||||
report = "Server IP Address: " + serverIP + "\r\n" +
|
|
||||||
"Submission UUID: " + playerUUID + "\r\n" +
|
|
||||||
"Server Port: " + Bukkit.getServer().getPort() + "\r\n" +
|
|
||||||
"Version: " + ConfigDB.pluginVersionNumber + "\r\n\r\n";
|
|
||||||
|
|
||||||
// Assemble the array of words in to a single message.
|
|
||||||
for(int x = 1; x < messageWords.length; x++) {
|
|
||||||
report += messageWords[x] + " ";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the MD5 hash of the plugin.
|
|
||||||
checksum = computeMD5();
|
|
||||||
|
|
||||||
// After all of the necessary information has been acquired, submit the report.
|
|
||||||
try {
|
try {
|
||||||
String postData = URLEncoder.encode("report", "UTF-8") + "=" + URLEncoder.encode(report, "UTF-8") +
|
// Get the contents of the configuration file.
|
||||||
"&" + URLEncoder.encode("checksum", "UTF-8") + "=" + URLEncoder.encode(checksum, "UTF-8") +
|
File configFile = new File("plugins" + File.separator + "Herobrine" + File.separator + "config.yml");
|
||||||
"&" + URLEncoder.encode("ip", "UTF-8") + "=" + URLEncoder.encode(serverIP, "UTF-8") +
|
FileInputStream configFileInputStream = new FileInputStream(configFile);
|
||||||
"&" + URLEncoder.encode("uuid", "UTF-8") + "=" + URLEncoder.encode(playerUUID, "UTF-8");
|
byte[] configFileBytes = new byte[(int) configFile.length()];
|
||||||
URL submitURL = new URL("https://theprogrammersworld.net/Herobrine/pluginBugReporter.php");
|
configFileInputStream.read(configFileBytes);
|
||||||
URLConnection urlConn = submitURL.openConnection();
|
configFileInputStream.close();
|
||||||
urlConn.setDoOutput(true);
|
String configFileString = new String(configFileBytes, "UTF-8");
|
||||||
OutputStreamWriter wr = new OutputStreamWriter(urlConn.getOutputStream());
|
|
||||||
wr.write(postData);
|
|
||||||
wr.flush();
|
|
||||||
|
|
||||||
BufferedReader rd = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
|
report = "Server IP Address: " + serverIP + "\r\n" +
|
||||||
String serverResponse;
|
"Submission UUID: " + playerUUID + "\r\n" +
|
||||||
while((serverResponse = rd.readLine()) != null) {
|
"Server Port: " + Bukkit.getServer().getPort() + "\r\n" +
|
||||||
if(serverResponse.equals("1")) {
|
"Version: " + ConfigDB.pluginVersionNumber + "\r\n\r\n" +
|
||||||
// Report Failed - Unofficial Version
|
"Plugin Configuration File:\r\n" + configFileString + " \r\n\r\n";
|
||||||
rd.close();
|
|
||||||
wr.close();
|
// Assemble the array of words in to a single message.
|
||||||
return "1";
|
for(int x = 1; x < messageWords.length; x++) {
|
||||||
}
|
report += messageWords[x] + " ";
|
||||||
else if(serverResponse.equals("2")) {
|
|
||||||
// Report Failed - Unsupported Version
|
|
||||||
rd.close();
|
|
||||||
wr.close();
|
|
||||||
return "2";
|
|
||||||
}
|
|
||||||
else if(serverResponse.equals("3")) {
|
|
||||||
// Report Successful - Get the Report ID
|
|
||||||
String reportID = rd.readLine();
|
|
||||||
rd.close();
|
|
||||||
wr.close();
|
|
||||||
return reportID;
|
|
||||||
}
|
|
||||||
else if(serverResponse.equals("4")) {
|
|
||||||
// Report Failed - Server is Banned
|
|
||||||
rd.close();
|
|
||||||
wr.close();
|
|
||||||
return "4";
|
|
||||||
}
|
|
||||||
else if(serverResponse.equals("5")) {
|
|
||||||
// Report Failed - Player UUID is Banned
|
|
||||||
rd.close();
|
|
||||||
wr.close();
|
|
||||||
return "5";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine the MD5 hash of the plugin.
|
||||||
|
checksum = computeMD5();
|
||||||
|
|
||||||
|
// After all of the necessary information has been acquired, submit the report.
|
||||||
|
try {
|
||||||
|
String postData = URLEncoder.encode("report", "UTF-8") + "=" + URLEncoder.encode(report, "UTF-8") +
|
||||||
|
"&" + URLEncoder.encode("checksum", "UTF-8") + "=" + URLEncoder.encode(checksum, "UTF-8") +
|
||||||
|
"&" + URLEncoder.encode("ip", "UTF-8") + "=" + URLEncoder.encode(serverIP, "UTF-8") +
|
||||||
|
"&" + URLEncoder.encode("uuid", "UTF-8") + "=" + URLEncoder.encode(playerUUID, "UTF-8");
|
||||||
|
URL submitURL = new URL("https://theprogrammersworld.net/Herobrine/pluginBugReporter.php");
|
||||||
|
URLConnection urlConn = submitURL.openConnection();
|
||||||
|
urlConn.setDoOutput(true);
|
||||||
|
OutputStreamWriter wr = new OutputStreamWriter(urlConn.getOutputStream());
|
||||||
|
wr.write(postData);
|
||||||
|
wr.flush();
|
||||||
|
|
||||||
|
BufferedReader rd = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
|
||||||
|
String serverResponse;
|
||||||
|
while((serverResponse = rd.readLine()) != null) {
|
||||||
|
if(serverResponse.equals("1")) {
|
||||||
|
// Report Failed - Unofficial Version
|
||||||
|
rd.close();
|
||||||
|
wr.close();
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
else if(serverResponse.equals("2")) {
|
||||||
|
// Report Failed - Unsupported Version
|
||||||
|
rd.close();
|
||||||
|
wr.close();
|
||||||
|
return "2";
|
||||||
|
}
|
||||||
|
else if(serverResponse.equals("3")) {
|
||||||
|
// Report Successful - Get the Report ID
|
||||||
|
String reportID = rd.readLine();
|
||||||
|
rd.close();
|
||||||
|
wr.close();
|
||||||
|
return reportID;
|
||||||
|
}
|
||||||
|
else if(serverResponse.equals("4")) {
|
||||||
|
// Report Failed - Server is Banned
|
||||||
|
rd.close();
|
||||||
|
wr.close();
|
||||||
|
return "4";
|
||||||
|
}
|
||||||
|
else if(serverResponse.equals("5")) {
|
||||||
|
// Report Failed - Player UUID is Banned
|
||||||
|
rd.close();
|
||||||
|
wr.close();
|
||||||
|
return "5";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e){}
|
||||||
} catch (Exception e){}
|
} catch (Exception e){}
|
||||||
// The report failed because for some reason, the server could not be reached.
|
// The report failed because for some reason, the server could not be reached.
|
||||||
return "0";
|
return "0";
|
||||||
|
Reference in New Issue
Block a user