Commit 09c8ed34 authored by Magix's avatar Magix Committed by GitHub
Browse files

Changes for Morphia 2.x upgrade

Morphia call fixes; add `@Entity` to more classes
parents 0a96012f 06101f1b
...@@ -139,7 +139,7 @@ public final class DatabaseHelper { ...@@ -139,7 +139,7 @@ public final class DatabaseHelper {
} }
public static List<GenshinAvatar> getAvatars(GenshinPlayer player) { public static List<GenshinAvatar> getAvatars(GenshinPlayer player) {
return DatabaseManager.getDatastore().find(GenshinAvatar.class).filter(Filters.eq("playerId", player.getUid())).stream().toList(); return DatabaseManager.getDatastore().find(GenshinAvatar.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList();
} }
public static void saveItem(GenshinItem item) { public static void saveItem(GenshinItem item) {
...@@ -155,7 +155,7 @@ public final class DatabaseHelper { ...@@ -155,7 +155,7 @@ public final class DatabaseHelper {
return DatabaseManager.getDatastore().find(GenshinItem.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList(); return DatabaseManager.getDatastore().find(GenshinItem.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList();
} }
public static List<Friendship> getFriends(GenshinPlayer player) { public static List<Friendship> getFriends(GenshinPlayer player) {
return DatabaseManager.getDatastore().find(Friendship.class).filter(Filters.eq("playerId", player.getUid())).stream().toList(); return DatabaseManager.getDatastore().find(Friendship.class).filter(Filters.eq("ownerId", player.getUid())).stream().toList();
} }
public static List<Friendship> getReverseFriends(GenshinPlayer player) { public static List<Friendship> getReverseFriends(GenshinPlayer player) {
......
...@@ -3,10 +3,12 @@ package emu.grasscutter.game; ...@@ -3,10 +3,12 @@ package emu.grasscutter.game;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import dev.morphia.annotations.Entity;
import emu.grasscutter.GenshinConstants; import emu.grasscutter.GenshinConstants;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.avatar.GenshinAvatar; import emu.grasscutter.game.avatar.GenshinAvatar;
@Entity
public class TeamInfo { public class TeamInfo {
private String name; private String name;
private List<Integer> avatars; private List<Integer> avatars;
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import dev.morphia.annotations.Entity;
import dev.morphia.annotations.Transient; import dev.morphia.annotations.Transient;
import emu.grasscutter.GenshinConstants; import emu.grasscutter.GenshinConstants;
import emu.grasscutter.Grasscutter; import emu.grasscutter.Grasscutter;
...@@ -41,6 +42,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; ...@@ -41,6 +42,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.ints.IntSet;
@Entity
public class TeamManager { public class TeamManager {
@Transient private GenshinPlayer player; @Transient private GenshinPlayer player;
......
package emu.grasscutter.game.avatar; package emu.grasscutter.game.avatar;
import dev.morphia.annotations.Entity;
@Entity
public class AvatarProfileData { public class AvatarProfileData {
private int avatarId; private int avatarId;
private int level; private int level;
......
...@@ -4,6 +4,7 @@ import dev.morphia.annotations.*; ...@@ -4,6 +4,7 @@ import dev.morphia.annotations.*;
import emu.grasscutter.game.GenshinPlayer; import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.utils.Utils; import emu.grasscutter.utils.Utils;
@Entity
public class PlayerProfile { public class PlayerProfile {
@Transient private GenshinPlayer player; @Transient private GenshinPlayer player;
......
package emu.grasscutter.game.gacha; package emu.grasscutter.game.gacha;
import dev.morphia.annotations.Entity;
@Entity
public class PlayerGachaBannerInfo { public class PlayerGachaBannerInfo {
private int pity5 = 0; private int pity5 = 0;
private int pity4 = 0; private int pity4 = 0;
......
package emu.grasscutter.game.gacha; package emu.grasscutter.game.gacha;
import dev.morphia.annotations.Entity;
@Entity
public class PlayerGachaInfo { public class PlayerGachaInfo {
private PlayerGachaBannerInfo standardBanner; private PlayerGachaBannerInfo standardBanner;
private PlayerGachaBannerInfo eventCharacterBanner; private PlayerGachaBannerInfo eventCharacterBanner;
......
...@@ -2,8 +2,10 @@ package emu.grasscutter.utils; ...@@ -2,8 +2,10 @@ package emu.grasscutter.utils;
import java.io.Serializable; import java.io.Serializable;
import dev.morphia.annotations.Entity;
import emu.grasscutter.net.proto.VectorOuterClass.Vector; import emu.grasscutter.net.proto.VectorOuterClass.Vector;
@Entity
public class Position implements Serializable { public class Position implements Serializable {
private static final long serialVersionUID = -2001232313615923575L; private static final long serialVersionUID = -2001232313615923575L;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment