mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-04-05 07:22:25 +02:00
Custom Teams (#1731)
* Add support for creating and deleting custom teams. * Add support for creating and deleting custom teams. * Move some logic to TeamInfo::toProto
This commit is contained in:
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
import dev.morphia.annotations.Entity;
|
||||
import emu.grasscutter.game.avatar.Avatar;
|
||||
import emu.grasscutter.net.proto.AvatarTeamOuterClass.AvatarTeam;
|
||||
|
||||
@Entity
|
||||
public class TeamInfo {
|
||||
@@ -81,4 +82,16 @@ public class TeamInfo {
|
||||
this.getAvatars().add(id);
|
||||
}
|
||||
}
|
||||
|
||||
public AvatarTeam toProto(Player player) {
|
||||
AvatarTeam.Builder avatarTeam = AvatarTeam.newBuilder()
|
||||
.setTeamName(this.getName());
|
||||
|
||||
for (int i = 0; i < this.getAvatars().size(); i++) {
|
||||
Avatar avatar = player.getAvatars().getAvatarById(this.getAvatars().get(i));
|
||||
avatarTeam.addAvatarGuidList(avatar.getGuid());
|
||||
}
|
||||
|
||||
return avatarTeam.build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user