From 48dd1685a2b204e04fef40af36d925fb2dc6e83b Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Sun, 30 Apr 2023 00:30:03 -0400 Subject: [PATCH] Check current character index --- src/main/java/emu/grasscutter/game/player/TeamManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/emu/grasscutter/game/player/TeamManager.java b/src/main/java/emu/grasscutter/game/player/TeamManager.java index e10bcc69e..111478e18 100644 --- a/src/main/java/emu/grasscutter/game/player/TeamManager.java +++ b/src/main/java/emu/grasscutter/game/player/TeamManager.java @@ -132,6 +132,10 @@ public final class TeamManager extends BasePlayerDataManager { } public EntityAvatar getCurrentAvatarEntity() { + if (this.currentCharacterIndex >= this.getActiveTeam().size()) { + this.currentCharacterIndex = 0; // Reset to the first character. + } + return this.getActiveTeam().get(this.currentCharacterIndex); }