3
0
Mirror von https://github.com/TheSilentPro/HeadDB.git synchronisiert 2024-12-27 11:20:05 +01:00

Change type from heads count to fetched heads map

Dieser Commit ist enthalten in:
NotStevy 2023-06-29 22:58:59 +02:00
Ursprung 51f3853910
Commit f00f099b24
2 geänderte Dateien mit 11 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -3,16 +3,21 @@ package tsp.headdb.core.api.events;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import tsp.headdb.implementation.category.Category;
import tsp.headdb.implementation.head.Head;
import java.util.List;
import java.util.Map;
public class AsyncHeadsFetchedEvent extends Event { public class AsyncHeadsFetchedEvent extends Event {
private static final HandlerList HANDLER_LIST = new HandlerList(); private static final HandlerList HANDLER_LIST = new HandlerList();
private final int headsCount; private final Map<Category, List<Head>> heads;
private final String providerName; private final String providerName;
private final long timeTook; private final long timeTook;
public AsyncHeadsFetchedEvent(int headsCount, String providerName, long timeTook) { public AsyncHeadsFetchedEvent(Map<Category, List<Head>> heads, String providerName, long timeTook) {
super(true); super(true);
this.headsCount = headsCount; this.heads = heads;
this.providerName = providerName; this.providerName = providerName;
this.timeTook = timeTook; this.timeTook = timeTook;
} }
@ -30,8 +35,8 @@ public class AsyncHeadsFetchedEvent extends Event {
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
public int getHeadsCount() { public Map<Category, List<Head>> getHeads() {
return headsCount; return heads;
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")

Datei anzeigen

@ -33,7 +33,7 @@ public class UpdateTask implements Task {
HeadDB.getInstance().getLog().debug("Fetched: " + size + " Heads | Provider: " + providerName + " | Time: " + time + "ms (" + TimeUnit.MILLISECONDS.toSeconds(time) + "s)"); HeadDB.getInstance().getLog().debug("Fetched: " + size + " Heads | Provider: " + providerName + " | Time: " + time + "ms (" + TimeUnit.MILLISECONDS.toSeconds(time) + "s)");
Bukkit.getPluginManager().callEvent( Bukkit.getPluginManager().callEvent(
new AsyncHeadsFetchedEvent( new AsyncHeadsFetchedEvent(
size, heads,
providerName, providerName,
time)); time));
}); });