diff --git a/pom.xml b/pom.xml
index 5ad8535..54075d8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.mattyhd0
ChatColor
- 2.7.11
+ 2.7.12
jar
@@ -19,7 +19,7 @@
placeholderapi
- https://repo.extendedclip.com/content/repositories/placeholderapi/
+ https://repo.extendedclip.com/releases/
@@ -41,18 +41,17 @@
1.20.6-R0.1-SNAPSHOT
provided
-
+
com.github.cryptomorin
XSeries
- 11.3.0
- compile
+ 13.2.0
me.clip
placeholderapi
- 2.11.3
+ 2.11.6
provided
@@ -73,8 +72,7 @@
com.google.code.gson
gson
- 2.11.0
- provided
+ 2.13.1
diff --git a/src/main/java/me/mattyhd0/chatcolor/updatechecker/SpigotAPI.java b/src/main/java/me/mattyhd0/chatcolor/updatechecker/SpigotAPI.java
index e395c4e..3635555 100644
--- a/src/main/java/me/mattyhd0/chatcolor/updatechecker/SpigotAPI.java
+++ b/src/main/java/me/mattyhd0/chatcolor/updatechecker/SpigotAPI.java
@@ -10,34 +10,23 @@
public class SpigotAPI {
- public static SpigotResource getSpigotResource(int id){
-
+ public static SpigotResource getSpigotResource(int id) {
StringBuilder response = new StringBuilder();
try {
-
- URL urlObject = new URL("https://api.spigotmc.org/simple/0.2/index.php?action=getResource&id="+id);
+ URL urlObject = new URL("https://api.spigotmc.org/simple/0.2/index.php?action=getResource&id=" + id);
URLConnection urlConnection = urlObject.openConnection();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String line;
- while ((line = bufferedReader.readLine()) != null) {
-
- response.append(line);
-
- }
+ while ((line = bufferedReader.readLine()) != null) response.append(line);
bufferedReader.close();
-
- } catch (IOException e){
- return null;
+ } catch (IOException e) {
+ throw null;
}
-
Gson gson = new Gson();
return gson.fromJson(response.toString(), SpigotResource.class);
-
}
-
-
}
diff --git a/src/main/java/me/mattyhd0/chatcolor/updatechecker/SpigotResource.java b/src/main/java/me/mattyhd0/chatcolor/updatechecker/SpigotResource.java
index 615c822..4e7a675 100644
--- a/src/main/java/me/mattyhd0/chatcolor/updatechecker/SpigotResource.java
+++ b/src/main/java/me/mattyhd0/chatcolor/updatechecker/SpigotResource.java
@@ -14,7 +14,7 @@ public class SpigotResource {
private Stats stats;
private String description;
- private static class Author{
+ private static class Author {
private int id;
private String username;
@@ -26,10 +26,9 @@ public int getId(){
public String getUsername(){
return username;
}
-
}
- private static class Premium{
+ private static class Premium {
private String price;
private String currency;
@@ -41,15 +40,14 @@ public String getPrice(){
public String getCurrency(){
return currency;
}
-
}
- private static class Stats{
+ private static class Stats {
private int downloads;
private int updates;
private Reviews reviews;
- private int rating;
+ private double rating;
public int getDownloads() {
return downloads;
@@ -63,11 +61,11 @@ public Reviews getReviews() {
return reviews;
}
- public int getRating() {
+ public double getRating() {
return rating;
}
- private static class Reviews{
+ private static class Reviews {
private int unique;
private int total;
@@ -113,16 +111,10 @@ public String getIconLink() {
public Author getAuthor() { return author; }
- //public int getAuthorId() { return author.id; }
-
- //public String getAuthorUsername() { return author.username; }
-
public boolean isPremium(){
- return !(premium.price.equals("0.00") && premium.currency.equals(""));
+ return !(premium.price.equals("0.00") && premium.currency.isEmpty());
}
- //public Premium getPremium() { return premium; }
-
public String getPrice(){
return premium.price;
}
@@ -139,23 +131,18 @@ public String getDescription() {
return description;
}
- public String getDownloadUrl(){
+ public String getDownloadUrl() {
- String url = ("https://www.spigotmc.org/resources/"+title+"."+id+"/").replaceAll(" ", "-");
+ String url = ("https://www.spigotmc.org/resources/" + title + "." + id + "/").replaceAll(" ", "-");
String validChars = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:/.-_";
StringBuilder validUrl = new StringBuilder();
- for(int i = 0; i < url.length(); i++){
-
+ for (int i = 0; i < url.length(); i++) {
String c = Character.toString(url.charAt(i));
- if(validChars.contains(c)){
- validUrl.append(c);
- }
-
+ if (validChars.contains(c)) validUrl.append(c);
}
return validUrl.toString();
}
-
}