Class UsercacheFile
java.lang.Object
me.pauleff.common.handlers.files.UsercacheFile
Represents a Minecraft
usercache.json file.
Prefer loadArray(Path) for one-shot loads. Use of(Path) when reusing a handle.
-
Method Summary
Modifier and TypeMethodDescriptionorg.json.JSONArrayLoads the contents of this usercache file as aJSONArray.static org.json.JSONArrayLoads the contents of the given usercache file as aJSONArray.static UsercacheFileReturns a handle for the given usercache path.path()Returns the path to this usercache file.
-
Method Details
-
of
Returns a handle for the given usercache path.- Parameters:
path- the path tousercache.json- Returns:
- a usercache file handle
- Throws:
NullPointerException- ifpathisnull
-
loadArray
Loads the contents of the given usercache file as aJSONArray.- Parameters:
path- the path tousercache.json- Returns:
- the parsed JSON array, or an empty array if the file could not be read
-
path
-
loadArray
public org.json.JSONArray loadArray()Loads the contents of this usercache file as aJSONArray.On read failure, logs a warning and returns an empty array so callers can continue without prefetched user data.
- Returns:
- the parsed JSON array, or an empty array if the file could not be read
-