#Storing block location and UUID pairs

1 messages · Page 1 of 1 (latest)

half blaze
#

I created a cobweb class which has a UUID and Location

private ArrayList<SpiderSwordCobweb<UUID, Location>> SpiderSwordCobwebs = new ArrayList<>();

But now I don't know how to find a location from a UUID in it like I was doing before when it was a hashmap

spiderSwordCobwebs.containsKey(playerUuid)
SpiderSwordCobwebs.remove(playerUuid)
autumn snow
#

containsValue

#

basically you have a n-n relationship where each unique key has a value but like

#

what if you have multiple cobwebs in the same location 🤔

half blaze
#

Cobwebs are blocks

#

so they can't be in the same location right?

autumn snow
#

not strictly

#

also 2 locations may be different if any of the decimal values is marginally different

#

so you'll have some problems on that aspect

half blaze
#

Storing block location and UUID pairs

#

What I really want is a hashmap that can have duplicate keys

#

I need to store a list of locations and UUIDs connect them in a way that I can easily find locations based on UUID

#

I can do this right?

private Map<UUID, ArrayList<Location>> SpiderSwordCobwebs = new HashMap<>();