Refactor some commands and move inventory/team limits to the config

This commit is contained in:
Melledy
2022-04-19 02:22:21 -07:00
parent f7752c027d
commit c4ccb298f9
39 changed files with 116 additions and 109 deletions

View File

@@ -104,21 +104,25 @@ public final class GameServer extends MihoyoKcpServer {
}
public void registerPlayer(GenshinPlayer player) {
getPlayers().put(player.getId(), player);
getPlayers().put(player.getUid(), player);
}
public GenshinPlayer getPlayerById(int id) {
return this.getPlayers().get(id);
public GenshinPlayer getPlayerByUid(int id) {
return this.getPlayerByUid(id, false);
}
public GenshinPlayer forceGetPlayerById(int id) {
public GenshinPlayer getPlayerByUid(int id, boolean allowOfflinePlayers) {
// Console check
if (id == GenshinConstants.SERVER_CONSOLE_UID) {
return null;
}
// Get from online players
GenshinPlayer player = this.getPlayerById(id);
GenshinPlayer player = this.getPlayerByUid(id);
if (!allowOfflinePlayers) {
return player;
}
// Check database if character isnt here
if (player == null) {
@@ -128,9 +132,9 @@ public final class GameServer extends MihoyoKcpServer {
return player;
}
public SocialDetail.Builder getSocialDetailById(int id) {
public SocialDetail.Builder getSocialDetailByUid(int id) {
// Get from online players
GenshinPlayer player = this.forceGetPlayerById(id);
GenshinPlayer player = this.getPlayerByUid(id, true);
if (player == null) {
return null;