Skip to content

Commit

Permalink
fix list databases
Browse files Browse the repository at this point in the history
  • Loading branch information
efekos committed Feb 25, 2024
1 parent 4d57d1f commit 19b0c20
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ command classes yourself.\
## 1.7.1

![](https://raw.githubusercontent.com/efekos/efekos/main/icons/symbol-plus.svg) Added icons to changelogs.\
![](https://raw.githubusercontent.com/efekos/efekos/main/icons/symbol-change.svg) Changed
![](https://raw.githubusercontent.com/efekos/efekos/main/icons/symbol-change.svg) Changed `ListDataManager` and `MapDataManager`'s `#load` methods. Now they don't need a parameter.
11 changes: 6 additions & 5 deletions src/main/java/me/efekos/simpler/config/ListDataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@

package me.efekos.simpler.config;

import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nullable;
import java.io.*;
import java.lang.reflect.Type;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;

Expand Down Expand Up @@ -164,10 +163,12 @@ public void load(){
Reader reader = new FileReader(file);


TypeToken<List<T>> token = new TypeToken<>(){};
T[] n = gson.fromJson(reader, token.getType());
Type tType = new com.google.common.reflect.TypeToken<List<T>>() {
}.getType();
List<T> n = gson.fromJson(reader, tType);

Collections.addAll(datas, n);
datas.clear();
datas.addAll(n);

reader.close();
} catch (Exception e){
Expand Down

0 comments on commit 19b0c20

Please sign in to comment.