Dieser Commit ist enthalten in:
Silent 2022-03-22 00:39:38 +01:00
Ursprung 119a4bcfac
Commit 2aed521382
7 geänderte Dateien mit 14 neuen und 18 gelöschten Zeilen

Datei anzeigen

@ -6,7 +6,7 @@
<groupId>tsp.headdb</groupId>
<artifactId>HeadDB</artifactId>
<version>4.2.2</version>
<version>4.2.4</version>
<packaging>jar</packaging>
<properties>

Datei anzeigen

@ -16,7 +16,6 @@ import javax.annotation.Nullable;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* This class provides simple methods

Datei anzeigen

@ -89,7 +89,7 @@ public class TreasuryProvider implements BasicEconomyProvider {
currency = provider.getPrimaryCurrency();
} else {
provider.getCurrencies().stream()
.filter(currency -> currency.getIdentifier().equalsIgnoreCase(rawCurrency))
.filter(c -> c.getIdentifier().equalsIgnoreCase(rawCurrency))
.findFirst()
.ifPresentOrElse(c -> currency = c, () -> Log.error("Could not find currency: " + rawCurrency));
}

Datei anzeigen

@ -20,7 +20,6 @@ import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -146,10 +145,10 @@ public class HeadDatabase {
for (Category category : categories) {
Log.debug("Caching heads from: " + category.getName());
List<Head> heads = new ArrayList<>();
List<Head> results = new ArrayList<>();
try {
// First the original api is fetched
heads = gather("https://minecraft-heads.com/scripts/api.php?cat=" + category.getName() + "&tags=true", category);
results = gather("https://minecraft-heads.com/scripts/api.php?cat=" + category.getName() + "&tags=true", category);
} catch (ParseException | IOException e) {
Log.debug("[" + plugin.getName() + "] Failed to fetch heads (no-cache) from category " + category.getName() + " | Stack Trace:");
Log.debug(e);
@ -158,7 +157,7 @@ public class HeadDatabase {
Log.info("Attempting fallback provider for: " + category.getName());
try {
// If the original fails and fallback is enabled, fetch from static archive
heads = gather("https://heads.pages.dev/archive/" + category.getName() + ".json", category);
results = gather("https://heads.pages.dev/archive/" + category.getName() + ".json", category);
} catch (IOException | ParseException ex) {
Log.error("Failed to fetch heads for " + category.getName() + "! (OF)"); // OF = Original-Fallback, both failed
Log.error(ex);
@ -167,7 +166,7 @@ public class HeadDatabase {
}
updated = System.nanoTime();
result.put(category, heads);
result.put(category, results);
}
resultSet.accept(result);

Datei anzeigen

@ -12,7 +12,7 @@ import java.util.function.Consumer;
public class Button {
private static int counter = 0;
private static final int id = counter++;
private static final int ID = counter++;
private final ItemStack itemStack;
private Consumer<InventoryClickEvent> action;
@ -67,14 +67,12 @@ public class Button {
if (this == o) {
return true;
}
if (!(o instanceof Button button)) {
return false;
}
return id == button.id;
return o instanceof Button;
}
@Override
public int hashCode() {
return Objects.hash(id);
return Objects.hash(ID);
}
}

Datei anzeigen

@ -18,7 +18,6 @@ import tsp.headdb.util.Utils;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
/**
* A paged pane. Credits @ I Al Ianstaan

Datei anzeigen

@ -116,8 +116,9 @@ public class PlayerDataFile {
public void load() {
try {
main = new JsonParser().parse(new FileReader(file)).getAsJsonObject();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (FileNotFoundException ex) {
Log.error("Failed to load player_data.json!");
Log.error(ex);
}
}
@ -131,7 +132,7 @@ public class PlayerDataFile {
writer.write(main.toString());
Log.debug("Saved data to " + file.getName());
} catch (IOException ex) {
Log.error("Failed to save player_data.json contents!");
Log.error("Failed to save player_data.json!");
Log.error(ex);
}
}