mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-22 07:28:09 -05:00
Updated Via*
This commit is contained in:
parent
a89f7bb1e5
commit
11b6426c79
2 changed files with 7 additions and 14 deletions
|
@ -61,8 +61,8 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
include "com.viaversion:viaversion-common:5.1.1"
|
include "com.viaversion:viaversion-common:5.1.2-SNAPSHOT"
|
||||||
include "com.viaversion:viabackwards-common:5.1.1"
|
include "com.viaversion:viabackwards-common:5.1.2-SNAPSHOT"
|
||||||
include "com.viaversion:viarewind-common:4.0.3"
|
include "com.viaversion:viarewind-common:4.0.3"
|
||||||
include "net.raphimc:ViaLegacy:3.0.5"
|
include "net.raphimc:ViaLegacy:3.0.5"
|
||||||
include "net.raphimc:viaaprilfools-common:3.0.4"
|
include "net.raphimc:viaaprilfools-common:3.0.4"
|
||||||
|
|
|
@ -41,22 +41,15 @@ public class AccountsSaveV3 extends AbstractSave {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(JsonElement jsonElement) throws Exception {
|
public void load(JsonElement jsonElement) throws Exception {
|
||||||
|
final List<ClassLoader> classLoaders = new ArrayList<>();
|
||||||
|
classLoaders.add(ViaProxy.class.getClassLoader());
|
||||||
|
classLoaders.addAll(ViaProxy.getPluginManager().getPlugins().stream().map(ViaProxyPlugin::getClassLoader).toList());
|
||||||
|
|
||||||
this.accounts = new ArrayList<>();
|
this.accounts = new ArrayList<>();
|
||||||
for (JsonElement element : jsonElement.getAsJsonArray()) {
|
for (JsonElement element : jsonElement.getAsJsonArray()) {
|
||||||
final JsonObject jsonObject = element.getAsJsonObject();
|
final JsonObject jsonObject = element.getAsJsonObject();
|
||||||
final String type = jsonObject.get("accountType").getAsString();
|
final String type = jsonObject.get("accountType").getAsString();
|
||||||
Class<?> clazz = Classes.byName(type);
|
final Class<?> clazz = Classes.find(type, true, classLoaders);
|
||||||
if (clazz == null) {
|
|
||||||
for (ViaProxyPlugin plugin : ViaProxy.getPluginManager().getPlugins()) {
|
|
||||||
clazz = Classes.byName(type, plugin.getClass().getClassLoader());
|
|
||||||
if (clazz != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (clazz == null) {
|
|
||||||
throw new ClassNotFoundException(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Account account = (Account) clazz.getConstructor(JsonObject.class).newInstance(jsonObject);
|
final Account account = (Account) clazz.getConstructor(JsonObject.class).newInstance(jsonObject);
|
||||||
this.accounts.add(account);
|
this.accounts.add(account);
|
||||||
|
|
Loading…
Reference in a new issue