mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-14 16:04:40 +01:00
Add a loadReader helper function to DataLoader
Also minor name changing on a few DataLoader methods
This commit is contained in:
@@ -16,6 +16,7 @@ import org.reflections.Reflections;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -44,9 +45,9 @@ public class ActivityManager extends BasePlayerManager {
|
||||
activityWatcherTypeMap.put(typeName.value(), ConstructorAccess.get(item));
|
||||
});
|
||||
|
||||
try(InputStream is = DataLoader.load("ActivityConfig.json"); InputStreamReader isr = new InputStreamReader(is)) {
|
||||
try(Reader reader = DataLoader.loadReader("ActivityConfig.json")) {
|
||||
List<ActivityConfigItem> activities = Grasscutter.getGsonFactory().fromJson(
|
||||
isr,
|
||||
reader,
|
||||
TypeToken.getParameterized(List.class, ActivityConfigItem.class).getType());
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user