Mirror von
https://github.com/TheSilentPro/HeadDB.git
synchronisiert 2024-12-26 19:02:39 +01:00
hotfix
Dieser Commit ist enthalten in:
Ursprung
ce442b645f
Commit
6ea59a99ba
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>tsp.headdb</groupId>
|
<groupId>tsp.headdb</groupId>
|
||||||
<artifactId>HeadDB</artifactId>
|
<artifactId>HeadDB</artifactId>
|
||||||
<version>3.2.2</version>
|
<version>3.2.4</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HeadDB</name>
|
<name>HeadDB</name>
|
||||||
|
@ -8,6 +8,7 @@ import org.json.simple.JSONObject;
|
|||||||
import org.json.simple.parser.JSONParser;
|
import org.json.simple.parser.JSONParser;
|
||||||
import org.json.simple.parser.ParseException;
|
import org.json.simple.parser.ParseException;
|
||||||
import tsp.headdb.api.Head;
|
import tsp.headdb.api.Head;
|
||||||
|
import tsp.headdb.event.DatabaseUpdateEvent;
|
||||||
import tsp.headdb.util.Log;
|
import tsp.headdb.util.Log;
|
||||||
import tsp.headdb.util.Utils;
|
import tsp.headdb.util.Utils;
|
||||||
|
|
||||||
@ -217,6 +218,7 @@ public class HeadDatabase {
|
|||||||
HEADS.clear();
|
HEADS.clear();
|
||||||
HEADS.putAll(heads);
|
HEADS.putAll(heads);
|
||||||
result.accept(heads);
|
result.accept(heads);
|
||||||
|
Bukkit.getPluginManager().callEvent(new DatabaseUpdateEvent(this, heads));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
54
src/main/java/tsp/headdb/event/DatabaseUpdateEvent.java
Normale Datei
54
src/main/java/tsp/headdb/event/DatabaseUpdateEvent.java
Normale Datei
@ -0,0 +1,54 @@
|
|||||||
|
package tsp.headdb.event;
|
||||||
|
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import tsp.headdb.api.Head;
|
||||||
|
import tsp.headdb.database.Category;
|
||||||
|
import tsp.headdb.database.HeadDatabase;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This event is called AFTER a {@link tsp.headdb.database.HeadDatabase} updates.
|
||||||
|
* The event is called asynchronously and can not be cancelled.
|
||||||
|
*
|
||||||
|
* @author TheSilentPro
|
||||||
|
*/
|
||||||
|
public class DatabaseUpdateEvent extends Event {
|
||||||
|
|
||||||
|
private final HandlerList handlerList = new HandlerList();
|
||||||
|
private final HeadDatabase database;
|
||||||
|
private final Map<Category, List<Head>> heads;
|
||||||
|
|
||||||
|
public DatabaseUpdateEvent(HeadDatabase database, Map<Category, List<Head>> heads) {
|
||||||
|
super(true);
|
||||||
|
|
||||||
|
this.database = database;
|
||||||
|
this.heads = heads;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the {@link HeadDatabase} associated with this event
|
||||||
|
*
|
||||||
|
* @return The database
|
||||||
|
*/
|
||||||
|
public HeadDatabase getDatabase() {
|
||||||
|
return database;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the result of the update
|
||||||
|
*
|
||||||
|
* @return The heads fetched from the update
|
||||||
|
*/
|
||||||
|
public Map<Category, List<Head>> getHeads() {
|
||||||
|
return heads;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlerList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren