Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
ffb9ccfe
Commit
ffb9ccfe
authored
Apr 22, 2022
by
Magix
Committed by
GitHub
Apr 22, 2022
Browse files
Merge pull request #130 from Grasscutters/java-16
Upgrade to versions of Java beyond 8
parents
627d3dda
7b944760
Changes
19
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
ffb9ccfe
...
...
@@ -16,7 +16,7 @@ A WIP server reimplementation for *some anime game* 2.3-2.6
*
If you update from an older version, delete
`config.json`
for regeneration
### Prerequisites
*
J
DK-8u202 (
[
mirror link
](
https://mirrors.huaweicloud.com/java/jdk/8u202-b08/
)
since Oracle required an account to download old builds)
*
J
ava 16
*
Mongodb (recommended 4.0+)
*
Proxy daemon: mitmproxy (mitmdump, recommended), Fiddler Classic, etc.
...
...
build.gradle
View file @
ffb9ccfe
...
...
@@ -14,17 +14,16 @@ plugins {
id
'application'
}
sourceCompatibility
=
1
.8
targetCompatibility
=
1
.8
sourceCompatibility
=
1
6
targetCompatibility
=
1
6
repositories
{
mavenCentral
()
jcenter
()
}
dependencies
{
implementation
fileTree
(
dir:
'lib'
,
include:
[
'*.jar'
])
implementation
group:
'org.slf4j'
,
name:
'slf4j-api'
,
version:
'1.7.32'
implementation
group:
'ch.qos.logback'
,
name:
'logback-core'
,
version:
'1.2.6'
implementation
group:
'ch.qos.logback'
,
name:
'logback-classic'
,
version:
'1.2.6'
...
...
@@ -33,9 +32,9 @@ dependencies {
implementation
group:
'com.google.code.gson'
,
name:
'gson'
,
version:
'2.8.8'
implementation
group:
'com.google.protobuf'
,
name:
'protobuf-java'
,
version:
'3.18.1'
implementation
group:
'org.reflections'
,
name:
'reflections'
,
version:
'0.
9.1
2'
implementation
group:
'org.reflections'
,
name:
'reflections'
,
version:
'0.
10.
2'
implementation
group:
'dev.morphia.morphia'
,
name:
'core'
,
version:
'
1.6.1
'
implementation
group:
'dev.morphia.morphia'
,
name:
'
morphia-
core'
,
version:
'
2.2.6
'
implementation
group:
'org.greenrobot'
,
name:
'eventbus-java'
,
version:
'3.3.1'
}
...
...
src/main/java/emu/grasscutter/Grasscutter.java
View file @
ffb9ccfe
...
...
@@ -34,7 +34,7 @@ public final class Grasscutter {
private
static
DispatchServer
dispatchServer
;
private
static
GameServer
gameServer
;
public
static
final
Reflections
reflector
=
new
Reflections
();
public
static
final
Reflections
reflector
=
new
Reflections
(
"emu.grasscutter"
);
static
{
// Declare logback configuration.
...
...
src/main/java/emu/grasscutter/command/CommandMap.java
View file @
ffb9ccfe
...
...
@@ -11,6 +11,7 @@ import java.util.*;
public
final
class
CommandMap
{
private
final
Map
<
String
,
CommandHandler
>
commands
=
new
HashMap
<>();
private
final
Map
<
String
,
Command
>
annotations
=
new
HashMap
<>();
public
CommandMap
()
{
this
(
false
);
}
...
...
src/main/java/emu/grasscutter/database/DatabaseCounter.java
View file @
ffb9ccfe
...
...
@@ -3,7 +3,7 @@ package emu.grasscutter.database;
import
dev.morphia.annotations.Entity
;
import
dev.morphia.annotations.Id
;
@Entity
(
value
=
"counters"
,
noClassnameS
tor
ed
=
tru
e
)
@Entity
(
value
=
"counters"
,
useDiscrimina
tor
=
fals
e
)
public
class
DatabaseCounter
{
@Id
private
String
id
;
...
...
src/main/java/emu/grasscutter/database/DatabaseHelper.java
View file @
ffb9ccfe
...
...
@@ -2,41 +2,33 @@ package emu.grasscutter.database;
import
java.util.List
;
import
com.mongodb.WriteResult
;
import
dev.morphia.query.FindOptions
;
import
dev.morphia.query.Query
;
import
dev.morphia.query.internal.MorphiaCursor
;
import
com.mongodb.client.result.DeleteResult
;
import
dev.morphia.query.experimental.filters.Filters
;
import
emu.grasscutter.GenshinConstants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.avatar.GenshinAvatar
;
import
emu.grasscutter.game.friends.Friendship
;
import
emu.grasscutter.game.inventory.GenshinItem
;
public
class
DatabaseHelper
{
protected
static
FindOptions
FIND_ONE
=
new
FindOptions
().
limit
(
1
);
public
final
class
DatabaseHelper
{
public
static
Account
createAccount
(
String
username
)
{
return
createAccountWithId
(
username
,
0
);
}
public
static
Account
createAccountWithId
(
String
username
,
int
reservedId
)
{
// Unique names only
Account
exists
=
DatabaseHelper
.
getAccountByName
(
username
);
if
(
exists
!=
null
)
{
return
null
;
}
// Make sure there are no id collisions
if
(
reservedId
>
0
)
{
// Cannot make account with the same uid as the server console
if
(
reservedId
==
GenshinConstants
.
SERVER_CONSOLE_UID
)
{
return
null
;
}
exists
=
DatabaseHelper
.
getAccountByPlayerId
(
reservedId
);
if
(
exists
!=
null
)
{
return
null
;
...
...
@@ -47,10 +39,10 @@ public class DatabaseHelper {
Account
account
=
new
Account
();
account
.
setUsername
(
username
);
account
.
setId
(
Integer
.
toString
(
DatabaseManager
.
getNextId
(
account
)));
if
(
reservedId
>
0
)
{
account
.
setPlayerId
(
reservedId
);
}
}
DatabaseHelper
.
saveAccount
(
account
);
return
account
;
...
...
@@ -63,65 +55,52 @@ public class DatabaseHelper {
if
(
exists
!=
null
)
{
return
null
;
}
// Account
Account
account
=
new
Account
();
account
.
setId
(
Integer
.
toString
(
DatabaseManager
.
getNextId
(
account
)));
account
.
setUsername
(
username
);
account
.
setPassword
(
password
);
DatabaseHelper
.
saveAccount
(
account
);
DatabaseHelper
.
saveAccount
(
account
);
return
account
;
}
public
static
void
saveAccount
(
Account
account
)
{
DatabaseManager
.
getAccountDatastore
().
save
(
account
);
}
public
static
Account
getAccountByName
(
String
username
)
{
MorphiaCursor
<
Account
>
cursor
=
DatabaseManager
.
getAccountDatastore
().
createQuery
(
Account
.
class
).
field
(
"username"
).
equalIgnoreCase
(
username
).
find
(
FIND_ONE
);
if
(!
cursor
.
hasNext
())
return
null
;
return
cursor
.
next
();
return
DatabaseManager
.
getDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"username"
,
username
)).
first
();
}
public
static
Account
getAccountByToken
(
String
token
)
{
if
(
token
==
null
)
return
null
;
MorphiaCursor
<
Account
>
cursor
=
DatabaseManager
.
getAccountDatastore
().
createQuery
(
Account
.
class
).
field
(
"token"
).
equal
(
token
).
find
(
FIND_ONE
);
if
(!
cursor
.
hasNext
())
return
null
;
return
cursor
.
next
();
if
(
token
==
null
)
return
null
;
return
DatabaseManager
.
getDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"token"
,
token
)).
first
();
}
public
static
Account
getAccountById
(
String
uid
)
{
MorphiaCursor
<
Account
>
cursor
=
DatabaseManager
.
getAccountDatastore
().
createQuery
(
Account
.
class
).
field
(
"_id"
).
equal
(
uid
).
find
(
FIND_ONE
);
if
(!
cursor
.
hasNext
())
return
null
;
return
cursor
.
next
();
return
DatabaseManager
.
getDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
uid
)).
first
();
}
public
static
Account
getAccountByPlayerId
(
int
playerId
)
{
MorphiaCursor
<
Account
>
cursor
=
DatabaseManager
.
getAccountDatastore
().
createQuery
(
Account
.
class
).
field
(
"playerId"
).
equal
(
playerId
).
find
(
FIND_ONE
);
if
(!
cursor
.
hasNext
())
return
null
;
return
cursor
.
next
();
return
DatabaseManager
.
getDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"playerId"
,
playerId
)).
first
();
}
public
static
boolean
deleteAccount
(
String
username
)
{
Query
<
Account
>
q
=
DatabaseManager
.
getAccountDatastore
().
createQuery
(
Account
.
class
).
field
(
"username"
).
equalIgnoreCase
(
username
);
return
DatabaseManager
.
getDatastore
().
findAndDelete
(
q
)
!=
null
;
return
DatabaseManager
.
getDatastore
().
find
(
Account
.
class
).
filter
(
Filters
.
eq
(
"username"
,
username
)).
delete
().
getDeletedCount
()
>
0
;
}
public
static
GenshinPlayer
getPlayerById
(
int
id
)
{
Query
<
GenshinPlayer
>
query
=
DatabaseManager
.
getDatastore
().
createQuery
(
GenshinPlayer
.
class
).
field
(
"_id"
).
equal
(
id
);
MorphiaCursor
<
GenshinPlayer
>
cursor
=
query
.
find
(
FIND_ONE
);
if
(!
cursor
.
hasNext
())
return
null
;
return
cursor
.
next
();
return
DatabaseManager
.
getDatastore
().
find
(
GenshinPlayer
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
id
)).
first
();
}
public
static
boolean
checkPlayerExists
(
int
id
)
{
MorphiaCursor
<
GenshinPlayer
>
query
=
DatabaseManager
.
getDatastore
().
createQuery
(
GenshinPlayer
.
class
).
field
(
"_id"
).
equal
(
id
).
find
(
FIND_ONE
);
return
query
.
hasNext
();
return
DatabaseManager
.
getDatastore
().
find
(
GenshinPlayer
.
class
).
filter
(
Filters
.
eq
(
"_id"
,
id
)).
first
()
!=
null
;
}
public
static
synchronized
GenshinPlayer
createPlayer
(
GenshinPlayer
character
,
int
reservedId
)
{
// Check if reserved id
int
id
=
0
;
int
id
;
if
(
reservedId
>
0
&&
!
checkPlayerExists
(
reservedId
))
{
id
=
reservedId
;
character
.
setUid
(
id
);
...
...
@@ -136,10 +115,10 @@ public class DatabaseHelper {
DatabaseManager
.
getDatastore
().
save
(
character
);
return
character
;
}
public
static
synchronized
int
getNextPlayerId
(
int
reservedId
)
{
// Check if reserved id
int
id
=
0
;
int
id
;
if
(
reservedId
>
0
&&
!
checkPlayerExists
(
reservedId
))
{
id
=
reservedId
;
}
else
{
...
...
@@ -150,41 +129,37 @@ public class DatabaseHelper {
}
return
id
;
}
public
static
void
savePlayer
(
GenshinPlayer
character
)
{
DatabaseManager
.
getDatastore
().
save
(
character
);
}
public
static
void
saveAvatar
(
GenshinAvatar
avatar
)
{
DatabaseManager
.
getDatastore
().
save
(
avatar
);
}
public
static
List
<
GenshinAvatar
>
getAvatars
(
GenshinPlayer
player
)
{
Query
<
GenshinAvatar
>
query
=
DatabaseManager
.
getDatastore
().
createQuery
(
GenshinAvatar
.
class
).
filter
(
"ownerId"
,
player
.
getUid
());
return
query
.
find
().
toList
();
return
DatabaseManager
.
getDatastore
().
find
(
GenshinAvatar
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
}
public
static
void
saveItem
(
GenshinItem
item
)
{
DatabaseManager
.
getDatastore
().
save
(
item
);
}
public
static
boolean
deleteItem
(
GenshinItem
item
)
{
Wri
teResult
result
=
DatabaseManager
.
getDatastore
().
delete
(
item
);
Dele
teResult
result
=
DatabaseManager
.
getDatastore
().
delete
(
item
);
return
result
.
wasAcknowledged
();
}
public
static
List
<
GenshinItem
>
getInventoryItems
(
GenshinPlayer
player
)
{
Query
<
GenshinItem
>
query
=
DatabaseManager
.
getDatastore
().
createQuery
(
GenshinItem
.
class
).
filter
(
"ownerId"
,
player
.
getUid
());
return
query
.
find
().
toList
();
return
DatabaseManager
.
getDatastore
().
find
(
GenshinItem
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
}
public
static
List
<
Friendship
>
getFriends
(
GenshinPlayer
player
)
{
Query
<
Friendship
>
query
=
DatabaseManager
.
getDatastore
().
createQuery
(
Friendship
.
class
).
filter
(
"ownerId"
,
player
.
getUid
());
return
query
.
find
().
toList
();
return
DatabaseManager
.
getDatastore
().
find
(
Friendship
.
class
).
filter
(
Filters
.
eq
(
"ownerId"
,
player
.
getUid
())).
stream
().
toList
();
}
public
static
List
<
Friendship
>
getReverseFriends
(
GenshinPlayer
player
)
{
Query
<
Friendship
>
query
=
DatabaseManager
.
getDatastore
().
createQuery
(
Friendship
.
class
).
filter
(
"friendId"
,
player
.
getUid
());
return
query
.
find
().
toList
();
return
DatabaseManager
.
getDatastore
().
find
(
Friendship
.
class
).
filter
(
Filters
.
eq
(
"friendId"
,
player
.
getUid
())).
stream
().
toList
();
}
public
static
void
saveFriendship
(
Friendship
friendship
)
{
...
...
@@ -196,13 +171,9 @@ public class DatabaseHelper {
}
public
static
Friendship
getReverseFriendship
(
Friendship
friendship
)
{
Query
<
Friendship
>
query
=
DatabaseManager
.
getDatastore
().
createQuery
(
Friendship
.
class
);
query
.
and
(
query
.
criteria
(
"ownerId"
).
equal
(
friendship
.
getFriendId
()),
query
.
criteria
(
"friendId"
).
equal
(
friendship
.
getOwnerId
())
);
MorphiaCursor
<
Friendship
>
reverseFriendship
=
query
.
find
(
FIND_ONE
);
if
(!
reverseFriendship
.
hasNext
())
return
null
;
return
reverseFriendship
.
next
();
return
DatabaseManager
.
getDatastore
().
find
(
Friendship
.
class
).
filter
(
Filters
.
and
(
Filters
.
eq
(
"ownerId"
,
friendship
.
getFriendId
()),
Filters
.
eq
(
"friendId"
,
friendship
.
getOwnerId
())
)).
first
();
}
}
src/main/java/emu/grasscutter/database/DatabaseManager.java
View file @
ffb9ccfe
package
emu.grasscutter.database
;
import
com.mongodb.MongoClient
;
import
com.mongodb.MongoClientURI
;
import
com.mongodb.MongoCommandException
;
import
com.mongodb.client.MongoClient
;
import
com.mongodb.client.MongoClients
;
import
com.mongodb.client.MongoDatabase
;
import
com.mongodb.client.MongoIterable
;
import
dev.morphia.Datastore
;
import
dev.morphia.Morphia
;
import
dev.morphia.mapping.MapperOptions
;
import
dev.morphia.query.experimental.filters.Filters
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.game.GenshinPlayer
;
...
...
@@ -16,6 +19,7 @@ import emu.grasscutter.game.friends.Friendship;
import
emu.grasscutter.game.inventory.GenshinItem
;
public
final
class
DatabaseManager
{
private
static
MongoClient
mongoClient
;
private
static
MongoClient
dispatchMongoClient
;
...
...
@@ -26,15 +30,11 @@ public final class DatabaseManager {
DatabaseCounter
.
class
,
Account
.
class
,
GenshinPlayer
.
class
,
GenshinAvatar
.
class
,
GenshinItem
.
class
,
Friendship
.
class
};
public
static
MongoClient
getMongoClient
()
{
return
mongoClient
;
public
static
Datastore
getDatastore
()
{
return
datastore
;
}
public
static
Datastore
getDatastore
()
{
return
datastore
;
}
public
static
MongoDatabase
getDatabase
()
{
public
static
MongoDatabase
getDatabase
()
{
return
getDatastore
().
getDatabase
();
}
...
...
@@ -50,27 +50,23 @@ public final class DatabaseManager {
public
static
void
initialize
()
{
// Initialize
mongoClient
=
new
MongoClient
(
new
MongoClientURI
(
Grasscutter
.
getConfig
().
DatabaseUrl
));
Morphia
morphia
=
new
Morphia
();
// TODO Update when migrating to Morphia 2.0
morphia
.
getMapper
().
getOptions
().
setStoreEmpties
(
true
);
morphia
.
getMapper
().
getOptions
().
setStoreNulls
(
false
);
morphia
.
getMapper
().
getOptions
().
setDisableEmbeddedIndexes
(
true
);
MongoClient
mongoClient
=
MongoClients
.
create
(
Grasscutter
.
getConfig
().
DatabaseUrl
);
// Map
morphia
.
map
(
mappedClasses
);
// Build datastore
datastore
=
morphia
.
createDatastore
(
mongoClient
,
Grasscutter
.
getConfig
().
DatabaseCollection
);
// Set mapper options.
MapperOptions
mapperOptions
=
MapperOptions
.
builder
()
.
storeEmpties
(
true
).
storeNulls
(
false
).
build
();
// Create data store.
datastore
=
Morphia
.
createDatastore
(
mongoClient
,
Grasscutter
.
getConfig
().
DatabaseCollection
,
mapperOptions
);
// Map classes.
datastore
.
getMapper
().
map
(
mappedClasses
);
// Ensure indexes
try
{
datastore
.
ensureIndexes
();
}
catch
(
MongoCommandException
e
)
{
Grasscutter
.
getLogger
().
info
(
"Mongo index error: "
,
e
);
}
catch
(
MongoCommandException
e
xception
)
{
Grasscutter
.
getLogger
().
info
(
"Mongo index error: "
,
e
xception
);
// Duplicate index error
if
(
e
.
getCode
()
==
85
)
{
if
(
e
xception
.
getCode
()
==
85
)
{
// Drop all indexes and re add them
MongoIterable
<
String
>
collections
=
datastore
.
getDatabase
().
listCollectionNames
();
for
(
String
name
:
collections
)
{
...
...
@@ -82,8 +78,8 @@ public final class DatabaseManager {
}
if
(
Grasscutter
.
getConfig
().
RunMode
.
equalsIgnoreCase
(
"GAME_ONLY"
))
{
dispatchMongoClient
=
new
MongoClient
(
new
MongoClientURI
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
DispatchServerDatabaseUrl
)
)
;
dispatchDatastore
=
m
orphia
.
createDatastore
(
dispatchMongoClient
,
Grasscutter
.
getConfig
().
getGameServerOptions
().
DispatchServerDatabaseCollection
);
dispatchMongoClient
=
MongoClient
s
.
create
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
DispatchServerDatabaseUrl
);
dispatchDatastore
=
M
orphia
.
createDatastore
(
dispatchMongoClient
,
Grasscutter
.
getConfig
().
getGameServerOptions
().
DispatchServerDatabaseCollection
);
// Ensure indexes for dispatch server
try
{
...
...
@@ -103,9 +99,9 @@ public final class DatabaseManager {
}
}
}
public
static
synchronized
int
getNextId
(
Class
<?>
c
)
{
DatabaseCounter
counter
=
getDatastore
().
createQuery
(
DatabaseCounter
.
class
).
fi
eld
(
"_id"
).
equal
(
c
.
getSimple
Name
()).
fi
nd
().
tryNex
t
();
DatabaseCounter
counter
=
getDatastore
().
find
(
DatabaseCounter
.
class
).
fi
lter
(
Filters
.
eq
(
"_id"
,
c
.
get
Name
())
)
.
fi
rs
t
();
if
(
counter
==
null
)
{
counter
=
new
DatabaseCounter
(
c
.
getSimpleName
());
}
...
...
@@ -115,7 +111,7 @@ public final class DatabaseManager {
getDatastore
().
save
(
counter
);
}
}
public
static
synchronized
int
getNextId
(
Object
o
)
{
return
getNextId
(
o
.
getClass
());
}
...
...
src/main/java/emu/grasscutter/game/Account.java
View file @
ffb9ccfe
package
emu.grasscutter.game
;
import
dev.morphia.annotations.AlsoLoad
;
import
dev.morphia.annotations.Collation
;
import
dev.morphia.annotations.Entity
;
import
dev.morphia.annotations.Id
;
import
dev.morphia.annotations.Indexed
;
import
dev.morphia.annotations.PreLoad
;
import
dev.morphia.annotations.*
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.utils.Crypto
;
import
emu.grasscutter.utils.Utils
;
import
dev.morphia.annotations.IndexOptions
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.bson.Document
;
import
com.mongodb.DBObject
;
@Entity
(
value
=
"accounts"
,
noClassnameS
tor
ed
=
tru
e
)
@Entity
(
value
=
"accounts"
,
useDiscrimina
tor
=
fals
e
)
public
class
Account
{
@Id
private
String
id
;
...
...
@@ -31,7 +27,7 @@ public class Account {
private
String
token
;
private
String
sessionKey
;
// Session token for dispatch server
private
List
<
String
>
permissions
;
@Deprecated
public
Account
()
{
this
.
permissions
=
new
ArrayList
<>();
...
...
@@ -122,15 +118,15 @@ public class Account {
return
this
.
token
;
}
public
void
save
()
{
DatabaseHelper
.
saveAccount
(
this
);
}
@PreLoad
public
void
onLoad
(
D
BObject
dbObj
)
{
public
void
onLoad
(
D
ocument
document
)
{
// Grant the superuser permissions to accounts created before the permissions update
if
(!
d
bObj
.
contains
Field
(
"permissions"
))
{
if
(!
d
ocument
.
contains
Key
(
"permissions"
))
{
this
.
addPermission
(
"*"
);
}
}
public
void
save
()
{
DatabaseHelper
.
saveAccount
(
this
);
}
}
src/main/java/emu/grasscutter/game/GenshinPlayer.java
View file @
ffb9ccfe
...
...
@@ -61,7 +61,7 @@ import emu.grasscutter.utils.Position;
import
it.unimi.dsi.fastutil.ints.Int2ObjectMap
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
;
@Entity
(
value
=
"players"
,
noClassnameS
tor
ed
=
tru
e
)
@Entity
(
value
=
"players"
,
useDiscrimina
tor
=
fals
e
)
public
class
GenshinPlayer
{
@Id
private
int
id
;
@Indexed
(
options
=
@IndexOptions
(
unique
=
true
))
private
String
accountId
;
...
...
src/main/java/emu/grasscutter/game/TeamInfo.java
View file @
ffb9ccfe
...
...
@@ -3,10 +3,12 @@ package emu.grasscutter.game;
import
java.util.ArrayList
;
import
java.util.List
;
import
dev.morphia.annotations.Entity
;
import
emu.grasscutter.GenshinConstants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.avatar.GenshinAvatar
;
@Entity
public
class
TeamInfo
{
private
String
name
;
private
List
<
Integer
>
avatars
;
...
...
src/main/java/emu/grasscutter/game/TeamManager.java
View file @
ffb9ccfe
...
...
@@ -8,6 +8,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Set
;
import
dev.morphia.annotations.Entity
;
import
dev.morphia.annotations.Transient
;
import
emu.grasscutter.GenshinConstants
;
import
emu.grasscutter.Grasscutter
;
...
...
@@ -41,6 +42,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import
it.unimi.dsi.fastutil.ints.IntOpenHashSet
;
import
it.unimi.dsi.fastutil.ints.IntSet
;
@Entity
public
class
TeamManager
{
@Transient
private
GenshinPlayer
player
;
...
...
src/main/java/emu/grasscutter/game/avatar/AvatarProfileData.java
View file @
ffb9ccfe
package
emu.grasscutter.game.avatar
;
import
dev.morphia.annotations.Entity
;
@Entity
public
class
AvatarProfileData
{
private
int
avatarId
;
private
int
level
;
...
...
src/main/java/emu/grasscutter/game/avatar/GenshinAvatar.java
View file @
ffb9ccfe
...
...
@@ -56,7 +56,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import
it.unimi.dsi.fastutil.ints.Int2ObjectMap
;
import
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
;
@Entity
(
value
=
"avatars"
,
noClassnameS
tor
ed
=
tru
e
)
@Entity
(
value
=
"avatars"
,
useDiscrimina
tor
=
fals
e
)
public
class
GenshinAvatar
{
@Id
private
ObjectId
id
;
@Indexed
private
int
ownerId
;
// Id of player that this avatar belongs to
...
...
src/main/java/emu/grasscutter/game/friends/Friendship.java
View file @
ffb9ccfe
...
...
@@ -9,7 +9,7 @@ import emu.grasscutter.net.proto.FriendBriefOuterClass.FriendBrief;
import
emu.grasscutter.net.proto.FriendOnlineStateOuterClass.FriendOnlineState
;
import
emu.grasscutter.net.proto.HeadImageOuterClass.HeadImage
;
@Entity
(
value
=
"friendships"
,
noClassnameS
tor
ed
=
tru
e
)
@Entity
(
value
=
"friendships"
,
useDiscrimina
tor
=
fals
e
)
public
class
Friendship
{
@Id
private
ObjectId
id
;
...
...
src/main/java/emu/grasscutter/game/friends/PlayerProfile.java
View file @
ffb9ccfe
...
...
@@ -4,6 +4,7 @@ import dev.morphia.annotations.*;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.utils.Utils
;
@Entity
public
class
PlayerProfile
{
@Transient
private
GenshinPlayer
player
;
...
...
src/main/java/emu/grasscutter/game/gacha/PlayerGachaBannerInfo.java
View file @
ffb9ccfe
package
emu.grasscutter.game.gacha
;
import
dev.morphia.annotations.Entity
;
@Entity
public
class
PlayerGachaBannerInfo
{
private
int
pity5
=
0
;
private
int
pity4
=
0
;
...
...
src/main/java/emu/grasscutter/game/gacha/PlayerGachaInfo.java
View file @
ffb9ccfe
package
emu.grasscutter.game.gacha
;
import
dev.morphia.annotations.Entity
;
@Entity
public
class
PlayerGachaInfo
{
private
PlayerGachaBannerInfo
standardBanner
;
private
PlayerGachaBannerInfo
eventCharacterBanner
;
...
...
src/main/java/emu/grasscutter/game/inventory/GenshinItem.java
View file @
ffb9ccfe
...
...
@@ -34,7 +34,7 @@ import emu.grasscutter.net.proto.SceneWeaponInfoOuterClass.SceneWeaponInfo;
import
emu.grasscutter.net.proto.WeaponOuterClass.Weapon
;
import
emu.grasscutter.utils.WeightedList
;
@Entity
(
value
=
"items"
,
noClassnameS
tor
ed
=
tru
e
)
@Entity
(
value
=
"items"
,
useDiscrimina
tor
=
fals
e
)
public
class
GenshinItem
{
@Id
private
ObjectId
id
;
@Indexed
private
int
ownerId
;
...
...
src/main/java/emu/grasscutter/utils/Position.java
View file @
ffb9ccfe
...
...
@@ -2,8 +2,10 @@ package emu.grasscutter.utils;
import
java.io.Serializable
;
import
dev.morphia.annotations.Entity
;
import
emu.grasscutter.net.proto.VectorOuterClass.Vector
;
@Entity
public
class
Position
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2001232313615923575L
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment