mirror of
https://github.com/zDevelopers/ImageOnMap.git
synced 2025-02-19 04:51:20 +01:00
Added getMapIdSet that return a map of all map id used by each player
This commit is contained in:
parent
2192605725
commit
304dec6a1c
@ -44,7 +44,9 @@ import fr.moribus.imageonmap.map.MapManagerException.Reason;
|
|||||||
import fr.zcraft.quartzlib.tools.PluginLogger;
|
import fr.zcraft.quartzlib.tools.PluginLogger;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -362,6 +364,29 @@ public abstract class MapManager {
|
|||||||
return store;
|
return store;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a map of all minecraft maps id used by ImageOnMap images with the player uuid as key.
|
||||||
|
*
|
||||||
|
* @return The set of all map id used by each player.
|
||||||
|
*/
|
||||||
|
public static Map<UUID, List<Integer>> getMapIdSet() {
|
||||||
|
HashMap<UUID, List<Integer>> hashMap = new HashMap<>();
|
||||||
|
synchronized (playerMaps) {
|
||||||
|
for (PlayerMapStore tmpStore : playerMaps) {
|
||||||
|
ArrayList<Integer> ids = new ArrayList<>();
|
||||||
|
UUID uuid = tmpStore.getUUID();
|
||||||
|
List<ImageMap> mapList = tmpStore.getMapList();
|
||||||
|
for (ImageMap map : mapList) {
|
||||||
|
for (int id : map.getMapsIDs()) {
|
||||||
|
ids.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hashMap.put(uuid, ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hashMap;
|
||||||
|
}
|
||||||
|
|
||||||
private static PlayerMapStore getExistingPlayerMapStore(UUID playerUUID) {
|
private static PlayerMapStore getExistingPlayerMapStore(UUID playerUUID) {
|
||||||
synchronized (playerMaps) {
|
synchronized (playerMaps) {
|
||||||
for (PlayerMapStore mapStore : playerMaps) {
|
for (PlayerMapStore mapStore : playerMaps) {
|
||||||
|
Loading…
Reference in New Issue
Block a user