Commit 5287882f authored by github-actions's avatar github-actions
Browse files

Fix whitespace [skip actions]

parent 8a5a6ab8
...@@ -5,34 +5,34 @@ import java.lang.annotation.RetentionPolicy; ...@@ -5,34 +5,34 @@ import java.lang.annotation.RetentionPolicy;
import java.util.List; import java.util.List;
import java.util.stream.Stream; import java.util.stream.Stream;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface ResourceType { public @interface ResourceType {
/** Names of the file that this Resource loads from */ /** Names of the file that this Resource loads from */
String[] name(); String[] name();
/** Load priority - dictates which order to load this resource, with "highest" being loaded first */ /** Load priority - dictates which order to load this resource, with "highest" being loaded first */
LoadPriority loadPriority() default LoadPriority.NORMAL; LoadPriority loadPriority() default LoadPriority.NORMAL;
public enum LoadPriority { public enum LoadPriority {
HIGHEST (4), HIGHEST (4),
HIGH (3), HIGH (3),
NORMAL (2), NORMAL (2),
LOW (1), LOW (1),
LOWEST (0); LOWEST (0);
private final int value; private final int value;
LoadPriority(int value) { LoadPriority(int value) {
this.value = value; this.value = value;
} }
public int value() { public int value() {
return value; return value;
} }
public static List<LoadPriority> getInOrder() { public static List<LoadPriority> getInOrder() {
return Stream.of(LoadPriority.values()).sorted((x, y) -> y.value() - x.value()).toList(); return Stream.of(LoadPriority.values()).sorted((x, y) -> y.value() - x.value()).toList();
} }
} }
} }
...@@ -32,12 +32,12 @@ public class MusicGameBeatmap { ...@@ -32,12 +32,12 @@ public class MusicGameBeatmap {
List<List<BeatmapNote>> beatmap; List<List<BeatmapNote>> beatmap;
public static MusicGameBeatmap getByShareId(long musicShareId){ public static MusicGameBeatmap getByShareId(long musicShareId) {
return DatabaseHelper.getMusicGameBeatmap(musicShareId); return DatabaseHelper.getMusicGameBeatmap(musicShareId);
} }
public void save(){ public void save() {
if(musicShareId == 0){ if (musicShareId == 0) {
musicShareId = new Random().nextLong(100000000000000L,999999999999999L); musicShareId = new Random().nextLong(100000000000000L,999999999999999L);
} }
DatabaseHelper.saveMusicGameBeatmap(this); DatabaseHelper.saveMusicGameBeatmap(this);
...@@ -51,7 +51,7 @@ public class MusicGameBeatmap { ...@@ -51,7 +51,7 @@ public class MusicGameBeatmap {
.toList(); .toList();
} }
public UgcMusicRecordOuterClass.UgcMusicRecord toProto(){ public UgcMusicRecordOuterClass.UgcMusicRecord toProto() {
return UgcMusicRecordOuterClass.UgcMusicRecord.newBuilder() return UgcMusicRecordOuterClass.UgcMusicRecord.newBuilder()
.setMusicId(musicId) .setMusicId(musicId)
.addAllMusicTrackList(beatmap.stream() .addAllMusicTrackList(beatmap.stream()
...@@ -60,7 +60,7 @@ public class MusicGameBeatmap { ...@@ -60,7 +60,7 @@ public class MusicGameBeatmap {
.build(); .build();
} }
public UgcMusicBriefInfoOuterClass.UgcMusicBriefInfo.Builder toBriefProto(){ public UgcMusicBriefInfoOuterClass.UgcMusicBriefInfo.Builder toBriefProto() {
var player = DatabaseHelper.getPlayerByUid(authorUid); var player = DatabaseHelper.getPlayerByUid(authorUid);
return UgcMusicBriefInfoOuterClass.UgcMusicBriefInfo.newBuilder() return UgcMusicBriefInfoOuterClass.UgcMusicBriefInfo.newBuilder()
...@@ -73,7 +73,7 @@ public class MusicGameBeatmap { ...@@ -73,7 +73,7 @@ public class MusicGameBeatmap {
.setVersion(1); .setVersion(1);
} }
private UgcMusicTrackOuterClass.UgcMusicTrack musicBeatmapListToProto(List<BeatmapNote> beatmapNoteList){ private UgcMusicTrackOuterClass.UgcMusicTrack musicBeatmapListToProto(List<BeatmapNote> beatmapNoteList) {
return UgcMusicTrackOuterClass.UgcMusicTrack.newBuilder() return UgcMusicTrackOuterClass.UgcMusicTrack.newBuilder()
.addAllMusicNoteList(beatmapNoteList.stream() .addAllMusicNoteList(beatmapNoteList.stream()
.map(BeatmapNote::toProto) .map(BeatmapNote::toProto)
...@@ -89,14 +89,14 @@ public class MusicGameBeatmap { ...@@ -89,14 +89,14 @@ public class MusicGameBeatmap {
int startTime; int startTime;
int endTime; int endTime;
public static BeatmapNote parse(UgcMusicNoteOuterClass.UgcMusicNote note){ public static BeatmapNote parse(UgcMusicNoteOuterClass.UgcMusicNote note) {
return BeatmapNote.of() return BeatmapNote.of()
.startTime(note.getStartTime()) .startTime(note.getStartTime())
.endTime(note.getEndTime()) .endTime(note.getEndTime())
.build(); .build();
} }
public UgcMusicNoteOuterClass.UgcMusicNote toProto(){ public UgcMusicNoteOuterClass.UgcMusicNote toProto() {
return UgcMusicNoteOuterClass.UgcMusicNote.newBuilder() return UgcMusicNoteOuterClass.UgcMusicNote.newBuilder()
.setStartTime(startTime) .setStartTime(startTime)
.setEndTime(endTime) .setEndTime(endTime)
......
...@@ -12,98 +12,98 @@ import emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture; ...@@ -12,98 +12,98 @@ import emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture;
@Entity(value = "friendships", useDiscriminator = false) @Entity(value = "friendships", useDiscriminator = false)
public class Friendship { public class Friendship {
@Id private ObjectId id; @Id private ObjectId id;
@Transient private Player owner; @Transient private Player owner;
@Indexed private int ownerId; @Indexed private int ownerId;
@Indexed private int friendId; @Indexed private int friendId;
private boolean isFriend; private boolean isFriend;
private int askerId; private int askerId;
private PlayerProfile profile; private PlayerProfile profile;
@Deprecated // Morphia use only @Deprecated // Morphia use only
public Friendship() { } public Friendship() { }
public Friendship(Player owner, Player friend, Player asker) { public Friendship(Player owner, Player friend, Player asker) {
this.setOwner(owner); this.setOwner(owner);
this.ownerId = owner.getUid(); this.ownerId = owner.getUid();
this.friendId = friend.getUid(); this.friendId = friend.getUid();
this.profile = friend.getProfile(); this.profile = friend.getProfile();
this.askerId = asker.getUid(); this.askerId = asker.getUid();
} }
public Player getOwner() { public Player getOwner() {
return owner; return owner;
} }
public void setOwner(Player owner) { public void setOwner(Player owner) {
this.owner = owner; this.owner = owner;
} }
public boolean isFriend() { public boolean isFriend() {
return isFriend; return isFriend;
} }
public void setIsFriend(boolean b) { public void setIsFriend(boolean b) {
this.isFriend = b; this.isFriend = b;
} }
public int getOwnerId() { public int getOwnerId() {
return ownerId; return ownerId;
} }
public int getFriendId() { public int getFriendId() {
return friendId; return friendId;
} }
public int getAskerId() { public int getAskerId() {
return askerId; return askerId;
} }
public void setAskerId(int askerId) { public void setAskerId(int askerId) {
this.askerId = askerId; this.askerId = askerId;
} }
public PlayerProfile getFriendProfile() { public PlayerProfile getFriendProfile() {
return profile; return profile;
} }
public void setFriendProfile(Player character) { public void setFriendProfile(Player character) {
if (character == null || this.friendId != character.getUid()) return; if (character == null || this.friendId != character.getUid()) return;
this.profile = character.getProfile(); this.profile = character.getProfile();
} }
public boolean isOnline() { public boolean isOnline() {
return getFriendProfile().getPlayer() != null; return getFriendProfile().getPlayer() != null;
} }
public void save() { public void save() {
DatabaseHelper.saveFriendship(this); DatabaseHelper.saveFriendship(this);
} }
public void delete() { public void delete() {
DatabaseHelper.deleteFriendship(this); DatabaseHelper.deleteFriendship(this);
} }
public FriendBrief toProto() { public FriendBrief toProto() {
FriendBrief proto = FriendBrief.newBuilder() FriendBrief proto = FriendBrief.newBuilder()
.setUid(getFriendProfile().getUid()) .setUid(getFriendProfile().getUid())
.setNickname(getFriendProfile().getName()) .setNickname(getFriendProfile().getName())
.setLevel(getFriendProfile().getPlayerLevel()) .setLevel(getFriendProfile().getPlayerLevel())
.setProfilePicture(ProfilePicture.newBuilder().setAvatarId(getFriendProfile().getAvatarId())) .setProfilePicture(ProfilePicture.newBuilder().setAvatarId(getFriendProfile().getAvatarId()))
.setWorldLevel(getFriendProfile().getWorldLevel()) .setWorldLevel(getFriendProfile().getWorldLevel())
.setSignature(getFriendProfile().getSignature()) .setSignature(getFriendProfile().getSignature())
.setOnlineState(getFriendProfile().isOnline() ? FriendOnlineState.FRIEND_ONLINE_STATE_ONLINE : FriendOnlineState.FRIEND_ONLINE_STATE_DISCONNECT) .setOnlineState(getFriendProfile().isOnline() ? FriendOnlineState.FRIEND_ONLINE_STATE_ONLINE : FriendOnlineState.FRIEND_ONLINE_STATE_DISCONNECT)
.setIsMpModeAvailable(true) .setIsMpModeAvailable(true)
.setLastActiveTime(getFriendProfile().getLastActiveTime()) .setLastActiveTime(getFriendProfile().getLastActiveTime())
.setNameCardId(getFriendProfile().getNameCard()) .setNameCardId(getFriendProfile().getNameCard())
.setParam(getFriendProfile().getDaysSinceLogin()) .setParam(getFriendProfile().getDaysSinceLogin())
.setIsGameSource(true) .setIsGameSource(true)
.setPlatformType(PlatformTypeOuterClass.PlatformType.PLATFORM_TYPE_PC) .setPlatformType(PlatformTypeOuterClass.PlatformType.PLATFORM_TYPE_PC)
.build(); .build();
return proto; return proto;
} }
} }
...@@ -10,15 +10,15 @@ import emu.grasscutter.server.packet.send.*; ...@@ -10,15 +10,15 @@ import emu.grasscutter.server.packet.send.*;
@Opcodes(PacketOpcodes.HomeChangeEditModeReq) @Opcodes(PacketOpcodes.HomeChangeEditModeReq)
public class HandlerHomeChangeEditModeReq extends PacketHandler { public class HandlerHomeChangeEditModeReq extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = HomeChangeEditModeReqOuterClass.HomeChangeEditModeReq.parseFrom(payload); var req = HomeChangeEditModeReqOuterClass.HomeChangeEditModeReq.parseFrom(payload);
session.send(new PacketHomePreChangeEditModeNotify(req.getIsEnterEditMode())); session.send(new PacketHomePreChangeEditModeNotify(req.getIsEnterEditMode()));
session.send(new PacketHomeBasicInfoNotify(session.getPlayer(), req.getIsEnterEditMode())); session.send(new PacketHomeBasicInfoNotify(session.getPlayer(), req.getIsEnterEditMode()));
session.send(new PacketHomeComfortInfoNotify(session.getPlayer())); session.send(new PacketHomeComfortInfoNotify(session.getPlayer()));
session.send(new PacketHomeChangeEditModeRsp(req.getIsEnterEditMode())); session.send(new PacketHomeChangeEditModeRsp(req.getIsEnterEditMode()));
} }
} }
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
// musicGameBeatmap.save(); // musicGameBeatmap.save();
// //
// var playerData = session.getPlayer().getActivityManager().getPlayerActivityDataByActivityType(ActivityType.NEW_ACTIVITY_MUSIC_GAME); // var playerData = session.getPlayer().getActivityManager().getPlayerActivityDataByActivityType(ActivityType.NEW_ACTIVITY_MUSIC_GAME);
// if(playerData.isEmpty()){ // if (playerData.isEmpty()) {
// return; // return;
// } // }
// //
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
// //
// var musicGameBeatmap = MusicGameBeatmap.getByShareId(req.getMusicShareId()); // var musicGameBeatmap = MusicGameBeatmap.getByShareId(req.getMusicShareId());
// //
// if(musicGameBeatmap == null){ // if (musicGameBeatmap == null) {
// return; // return;
// } // }
// //
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
// //
// var musicGameBeatmap = MusicGameBeatmap.getByShareId(req.getMusicShareId()); // var musicGameBeatmap = MusicGameBeatmap.getByShareId(req.getMusicShareId());
// //
// if(musicGameBeatmap == null){ // if (musicGameBeatmap == null) {
// session.send(new PacketMusicGameSearchBeatmapRsp(11153, req.getUnknownEnum1())); // session.send(new PacketMusicGameSearchBeatmapRsp(11153, req.getUnknownEnum1()));
// return; // return;
// } // }
......
...@@ -10,11 +10,11 @@ import emu.grasscutter.server.packet.send.PacketMusicGameStartRsp; ...@@ -10,11 +10,11 @@ import emu.grasscutter.server.packet.send.PacketMusicGameStartRsp;
@Opcodes(PacketOpcodes.MusicGameStartReq) @Opcodes(PacketOpcodes.MusicGameStartReq)
public class HandlerMusicGameStartReq extends PacketHandler { public class HandlerMusicGameStartReq extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = MusicGameStartReqOuterClass.MusicGameStartReq.parseFrom(payload); var req = MusicGameStartReqOuterClass.MusicGameStartReq.parseFrom(payload);
session.send(new PacketMusicGameStartRsp(req.getMusicBasicId(), req.getUgcGuid())); session.send(new PacketMusicGameStartRsp(req.getMusicBasicId(), req.getUgcGuid()));
} }
} }
...@@ -23,7 +23,7 @@ public class PacketEntityFightPropChangeReasonNotify extends BasePacket { ...@@ -23,7 +23,7 @@ public class PacketEntityFightPropChangeReasonNotify extends BasePacket {
.setReason(reason) .setReason(reason)
.setChangeHpReason(changeHpReason); .setChangeHpReason(changeHpReason);
for(int p : param){ for (int p : param) {
proto.addParamList(p); proto.addParamList(p);
} }
......
...@@ -6,14 +6,14 @@ import emu.grasscutter.net.proto.MusicGameStartRspOuterClass; ...@@ -6,14 +6,14 @@ import emu.grasscutter.net.proto.MusicGameStartRspOuterClass;
public class PacketMusicGameStartRsp extends BasePacket { public class PacketMusicGameStartRsp extends BasePacket {
public PacketMusicGameStartRsp(int musicBasicId, long musicShareId) { public PacketMusicGameStartRsp(int musicBasicId, long musicShareId) {
super(PacketOpcodes.MusicGameStartRsp); super(PacketOpcodes.MusicGameStartRsp);
var proto = MusicGameStartRspOuterClass.MusicGameStartRsp.newBuilder(); var proto = MusicGameStartRspOuterClass.MusicGameStartRsp.newBuilder();
proto.setMusicBasicId(musicBasicId) proto.setMusicBasicId(musicBasicId)
.setUgcGuid(musicShareId); .setUgcGuid(musicShareId);
this.setData(proto); this.setData(proto);
} }
} }
...@@ -8,29 +8,29 @@ import emu.grasscutter.net.proto.PlayerApplyEnterMpResultNotifyOuterClass.Player ...@@ -8,29 +8,29 @@ import emu.grasscutter.net.proto.PlayerApplyEnterMpResultNotifyOuterClass.Player
public class PacketPlayerApplyEnterMpResultNotify extends BasePacket { public class PacketPlayerApplyEnterMpResultNotify extends BasePacket {
public PacketPlayerApplyEnterMpResultNotify(Player target, boolean isAgreed, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason reason) { public PacketPlayerApplyEnterMpResultNotify(Player target, boolean isAgreed, PlayerApplyEnterMpResultNotifyOuterClass.PlayerApplyEnterMpResultNotify.Reason reason) {
super(PacketOpcodes.PlayerApplyEnterMpResultNotify); super(PacketOpcodes.PlayerApplyEnterMpResultNotify);
PlayerApplyEnterMpResultNotify proto = PlayerApplyEnterMpResultNotify.newBuilder() PlayerApplyEnterMpResultNotify proto = PlayerApplyEnterMpResultNotify.newBuilder()
.setTargetUid(target.getUid()) .setTargetUid(target.getUid())
.setTargetNickname(target.getNickname()) .setTargetNickname(target.getNickname())
.setIsAgreed(isAgreed) .setIsAgreed(isAgreed)
.setReason(reason) .setReason(reason)
.build(); .build();
this.setData(proto); this.setData(proto);
} }
public PacketPlayerApplyEnterMpResultNotify(int targetId, String targetName, boolean isAgreed, PlayerApplyEnterMpResultNotify.Reason reason) { public PacketPlayerApplyEnterMpResultNotify(int targetId, String targetName, boolean isAgreed, PlayerApplyEnterMpResultNotify.Reason reason) {
super(PacketOpcodes.PlayerApplyEnterMpResultNotify); super(PacketOpcodes.PlayerApplyEnterMpResultNotify);
PlayerApplyEnterMpResultNotify proto = PlayerApplyEnterMpResultNotify.newBuilder() PlayerApplyEnterMpResultNotify proto = PlayerApplyEnterMpResultNotify.newBuilder()
.setTargetUid(targetId) .setTargetUid(targetId)
.setTargetNickname(targetName) .setTargetNickname(targetName)
.setIsAgreed(isAgreed) .setIsAgreed(isAgreed)
.setReason(reason) .setReason(reason)
.build(); .build();
this.setData(proto); this.setData(proto);
} }
} }
...@@ -8,54 +8,54 @@ import emu.grasscutter.net.proto.PlayerChatNotifyOuterClass.PlayerChatNotify; ...@@ -8,54 +8,54 @@ import emu.grasscutter.net.proto.PlayerChatNotifyOuterClass.PlayerChatNotify;
public class PacketPlayerChatNotify extends BasePacket { public class PacketPlayerChatNotify extends BasePacket {
public PacketPlayerChatNotify(Player sender, int channelId, String message) { public PacketPlayerChatNotify(Player sender, int channelId, String message) {
super(PacketOpcodes.PlayerChatNotify); super(PacketOpcodes.PlayerChatNotify);
ChatInfo info = ChatInfo.newBuilder() ChatInfo info = ChatInfo.newBuilder()
.setTime((int) (System.currentTimeMillis() / 1000)) .setTime((int) (System.currentTimeMillis() / 1000))
.setUid(sender.getUid()) .setUid(sender.getUid())
.setText(message) .setText(message)
.build(); .build();
PlayerChatNotify proto = PlayerChatNotify.newBuilder() PlayerChatNotify proto = PlayerChatNotify.newBuilder()
.setChannelId(channelId) .setChannelId(channelId)
.setChatInfo(info) .setChatInfo(info)
.build(); .build();
this.setData(proto); this.setData(proto);
} }
public PacketPlayerChatNotify(Player sender, int channelId, int emote) { public PacketPlayerChatNotify(Player sender, int channelId, int emote) {
super(PacketOpcodes.PlayerChatNotify); super(PacketOpcodes.PlayerChatNotify);
ChatInfo info = ChatInfo.newBuilder() ChatInfo info = ChatInfo.newBuilder()
.setTime((int) (System.currentTimeMillis() / 1000)) .setTime((int) (System.currentTimeMillis() / 1000))
.setUid(sender.getUid()) .setUid(sender.getUid())
.setIcon(emote) .setIcon(emote)
.build(); .build();
PlayerChatNotify proto = PlayerChatNotify.newBuilder() PlayerChatNotify proto = PlayerChatNotify.newBuilder()
.setChannelId(channelId) .setChannelId(channelId)
.setChatInfo(info) .setChatInfo(info)
.build(); .build();
this.setData(proto); this.setData(proto);
} }
public PacketPlayerChatNotify(Player sender, int channelId, ChatInfo.SystemHint systemHint) { public PacketPlayerChatNotify(Player sender, int channelId, ChatInfo.SystemHint systemHint) {
super(PacketOpcodes.PlayerChatNotify); super(PacketOpcodes.PlayerChatNotify);
ChatInfo info = ChatInfo.newBuilder() ChatInfo info = ChatInfo.newBuilder()
.setTime((int) (System.currentTimeMillis() / 1000)) .setTime((int) (System.currentTimeMillis() / 1000))
.setUid(sender.getUid()) .setUid(sender.getUid())
.setSystemHint(systemHint) .setSystemHint(systemHint)
.build(); .build();
PlayerChatNotify proto = PlayerChatNotify.newBuilder() PlayerChatNotify proto = PlayerChatNotify.newBuilder()
.setChannelId(channelId) .setChannelId(channelId)
.setChatInfo(info) .setChatInfo(info)
.build(); .build();
this.setData(proto); this.setData(proto);
} }
} }
...@@ -11,7 +11,7 @@ public class PacketScenePointUnlockNotify extends BasePacket { ...@@ -11,7 +11,7 @@ public class PacketScenePointUnlockNotify extends BasePacket {
ScenePointUnlockNotify.Builder p = ScenePointUnlockNotify.newBuilder() ScenePointUnlockNotify.Builder p = ScenePointUnlockNotify.newBuilder()
.setSceneId(sceneId) .setSceneId(sceneId)
.addPointList(pointId) .addPointList(pointId)
.addUnhidePointList(pointId); .addUnhidePointList(pointId);
this.setData(p); this.setData(p);
} }
...@@ -22,7 +22,7 @@ public class PacketScenePointUnlockNotify extends BasePacket { ...@@ -22,7 +22,7 @@ public class PacketScenePointUnlockNotify extends BasePacket {
ScenePointUnlockNotify.Builder p = ScenePointUnlockNotify.newBuilder() ScenePointUnlockNotify.Builder p = ScenePointUnlockNotify.newBuilder()
.setSceneId(sceneId) .setSceneId(sceneId)
.addAllPointList(pointIds) .addAllPointList(pointIds)
.addAllUnhidePointList(pointIds); .addAllUnhidePointList(pointIds);
this.setData(p); this.setData(p);
} }
......
...@@ -7,17 +7,17 @@ import emu.grasscutter.net.proto.TowerCurLevelRecordOuterClass.TowerCurLevelReco ...@@ -7,17 +7,17 @@ import emu.grasscutter.net.proto.TowerCurLevelRecordOuterClass.TowerCurLevelReco
public class PacketTowerCurLevelRecordChangeNotify extends BasePacket { public class PacketTowerCurLevelRecordChangeNotify extends BasePacket {
public PacketTowerCurLevelRecordChangeNotify(int curFloorId, int curLevelIndex) { public PacketTowerCurLevelRecordChangeNotify(int curFloorId, int curLevelIndex) {
super(PacketOpcodes.TowerCurLevelRecordChangeNotify); super(PacketOpcodes.TowerCurLevelRecordChangeNotify);
TowerCurLevelRecordChangeNotify proto = TowerCurLevelRecordChangeNotify.newBuilder() TowerCurLevelRecordChangeNotify proto = TowerCurLevelRecordChangeNotify.newBuilder()
.setCurLevelRecord(TowerCurLevelRecord.newBuilder() .setCurLevelRecord(TowerCurLevelRecord.newBuilder()
.setCurFloorId(curFloorId) .setCurFloorId(curFloorId)
.setCurLevelIndex(curLevelIndex) .setCurLevelIndex(curLevelIndex)
// TODO team info // TODO team info
.build()) .build())
.build(); .build();
this.setData(proto); this.setData(proto);
} }
} }
...@@ -7,26 +7,26 @@ import emu.grasscutter.net.proto.TowerLevelStarCondNotifyOuterClass.TowerLevelSt ...@@ -7,26 +7,26 @@ import emu.grasscutter.net.proto.TowerLevelStarCondNotifyOuterClass.TowerLevelSt
public class PacketTowerLevelStarCondNotify extends BasePacket { public class PacketTowerLevelStarCondNotify extends BasePacket {
public PacketTowerLevelStarCondNotify(int floorId, int levelIndex) { public PacketTowerLevelStarCondNotify(int floorId, int levelIndex) {
super(PacketOpcodes.TowerLevelStarCondNotify); super(PacketOpcodes.TowerLevelStarCondNotify);
TowerLevelStarCondNotify proto = TowerLevelStarCondNotify.newBuilder() TowerLevelStarCondNotify proto = TowerLevelStarCondNotify.newBuilder()
.setFloorId(floorId) .setFloorId(floorId)
.setLevelIndex(levelIndex) .setLevelIndex(levelIndex)
.addCondDataList(TowerLevelStarCondData.newBuilder() .addCondDataList(TowerLevelStarCondData.newBuilder()
.setCondValue(1) .setCondValue(1)
.build() .build()
) )
.addCondDataList(TowerLevelStarCondData.newBuilder() .addCondDataList(TowerLevelStarCondData.newBuilder()
.setCondValue(2) .setCondValue(2)
.build() .build()
) )
.addCondDataList(TowerLevelStarCondData.newBuilder() .addCondDataList(TowerLevelStarCondData.newBuilder()
.setCondValue(3) .setCondValue(3)
.build() .build()
) )
.build(); .build();
this.setData(proto); this.setData(proto);
} }
} }
...@@ -122,7 +122,7 @@ public class JsonAdapters { ...@@ -122,7 +122,7 @@ public class JsonAdapters {
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
Class<T> enumClass = (Class<T>) type.getRawType(); Class<T> enumClass = (Class<T>) type.getRawType();
if (!enumClass.isEnum()) return null; if (!enumClass.isEnum()) return null;
// Make mappings of (string) names to enum constants // Make mappings of (string) names to enum constants
val map = new HashMap<String, T>(); val map = new HashMap<String, T>();
val enumConstants = enumClass.getEnumConstants(); val enumConstants = enumClass.getEnumConstants();
......
...@@ -252,7 +252,7 @@ public class TsvUtils { ...@@ -252,7 +252,7 @@ public class TsvUtils {
public JsonElement toJson() { public JsonElement toJson() {
// Determine if this is an object, an array, or a value // Determine if this is an object, an array, or a value
if (this.value != null) { // if (this.value != null) { //
return new JsonPrimitive(this.value); return new JsonPrimitive(this.value);
} }
if (!this.arrayChildren.isEmpty()) { if (!this.arrayChildren.isEmpty()) {
......
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