mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 08:56:04 +01:00
Fix whitespace [skip actions]
This commit is contained in:
@@ -39,11 +39,11 @@ public class GameHome {
|
|||||||
ConcurrentHashMap<Integer, HomeSceneItem> sceneMap;
|
ConcurrentHashMap<Integer, HomeSceneItem> sceneMap;
|
||||||
Set<Integer> unlockedHomeBgmList;
|
Set<Integer> unlockedHomeBgmList;
|
||||||
|
|
||||||
public void save(){
|
public void save() {
|
||||||
DatabaseHelper.saveHome(this);
|
DatabaseHelper.saveHome(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameHome getByUid(Integer uid){
|
public static GameHome getByUid(Integer uid) {
|
||||||
var home = DatabaseHelper.getHomeByUid(uid);
|
var home = DatabaseHelper.getHomeByUid(uid);
|
||||||
if (home == null) {
|
if (home == null) {
|
||||||
home = GameHome.create(uid);
|
home = GameHome.create(uid);
|
||||||
@@ -51,7 +51,7 @@ public class GameHome {
|
|||||||
return home;
|
return home;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameHome create(Integer uid){
|
public static GameHome create(Integer uid) {
|
||||||
return GameHome.of()
|
return GameHome.of()
|
||||||
.ownerUid(uid)
|
.ownerUid(uid)
|
||||||
.level(1)
|
.level(1)
|
||||||
@@ -62,7 +62,7 @@ public class GameHome {
|
|||||||
public HomeSceneItem getHomeSceneItem(int sceneId) {
|
public HomeSceneItem getHomeSceneItem(int sceneId) {
|
||||||
return sceneMap.computeIfAbsent(sceneId, e -> {
|
return sceneMap.computeIfAbsent(sceneId, e -> {
|
||||||
var defaultItem = GameData.getHomeworldDefaultSaveData().get(sceneId);
|
var defaultItem = GameData.getHomeworldDefaultSaveData().get(sceneId);
|
||||||
if (defaultItem != null){
|
if (defaultItem != null) {
|
||||||
Grasscutter.getLogger().info("Set player {} home {} to initial setting", ownerUid, sceneId);
|
Grasscutter.getLogger().info("Set player {} home {} to initial setting", ownerUid, sceneId);
|
||||||
return HomeSceneItem.parseFrom(defaultItem, sceneId);
|
return HomeSceneItem.parseFrom(defaultItem, sceneId);
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ public class GameHome {
|
|||||||
return this.player;
|
return this.player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HomeWorldLevelData getLevelData(){
|
public HomeWorldLevelData getLevelData() {
|
||||||
return GameData.getHomeWorldLevelDataMap().get(level);
|
return GameData.getHomeWorldLevelDataMap().get(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ public class HomeSceneItem {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(HomeSceneArrangementInfo arrangementInfo){
|
public void update(HomeSceneArrangementInfo arrangementInfo) {
|
||||||
for(var blockItem : arrangementInfo.getBlockArrangementInfoListList()){
|
for (var blockItem : arrangementInfo.getBlockArrangementInfoListList()) {
|
||||||
var block = this.blockItems.get(blockItem.getBlockId());
|
var block = this.blockItems.get(blockItem.getBlockId());
|
||||||
if(block == null){
|
if (block == null) {
|
||||||
Grasscutter.getLogger().warn("Could not found the Home Block {}", blockItem.getBlockId());
|
Grasscutter.getLogger().warn("Could not found the Home Block {}", blockItem.getBlockId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -61,20 +61,20 @@ public class HomeSceneItem {
|
|||||||
this.tmpVersion = arrangementInfo.getTmpVersion();
|
this.tmpVersion = arrangementInfo.getTmpVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRoomSceneId(){
|
public int getRoomSceneId() {
|
||||||
if(mainHouse == null || mainHouse.getAsItem() == null){
|
if (mainHouse == null || mainHouse.getAsItem() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return mainHouse.getAsItem().getRoomSceneId();
|
return mainHouse.getAsItem().getRoomSceneId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int calComfort(){
|
public int calComfort() {
|
||||||
return this.blockItems.values().stream()
|
return this.blockItems.values().stream()
|
||||||
.mapToInt(HomeBlockItem::calComfort)
|
.mapToInt(HomeBlockItem::calComfort)
|
||||||
.sum();
|
.sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HomeSceneArrangementInfo toProto(){
|
public HomeSceneArrangementInfo toProto() {
|
||||||
var proto = HomeSceneArrangementInfo.newBuilder();
|
var proto = HomeSceneArrangementInfo.newBuilder();
|
||||||
blockItems.values().forEach(b -> proto.addBlockArrangementInfoList(b.toProto()));
|
blockItems.values().forEach(b -> proto.addBlockArrangementInfoList(b.toProto()));
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ public class HomeSceneItem {
|
|||||||
.setUnk2700BJHAMKKECEI(homeBgmId)
|
.setUnk2700BJHAMKKECEI(homeBgmId)
|
||||||
.setTmpVersion(tmpVersion);
|
.setTmpVersion(tmpVersion);
|
||||||
|
|
||||||
if(mainHouse != null){
|
if (mainHouse != null) {
|
||||||
proto.setMainHouse(mainHouse.toProto());
|
proto.setMainHouse(mainHouse.toProto());
|
||||||
}
|
}
|
||||||
return proto.build();
|
return proto.build();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class PlayerCodex {
|
|||||||
@Getter private Set<Integer> unlockedReliquary;
|
@Getter private Set<Integer> unlockedReliquary;
|
||||||
@Getter private Set<Integer> unlockedReliquarySuitCodex;
|
@Getter private Set<Integer> unlockedReliquarySuitCodex;
|
||||||
|
|
||||||
public PlayerCodex(){
|
public PlayerCodex() {
|
||||||
this.unlockedWeapon = new HashSet<>();
|
this.unlockedWeapon = new HashSet<>();
|
||||||
this.unlockedAnimal = new HashMap<>();
|
this.unlockedAnimal = new HashMap<>();
|
||||||
this.unlockedMaterial = new HashSet<>();
|
this.unlockedMaterial = new HashSet<>();
|
||||||
@@ -38,7 +38,7 @@ public class PlayerCodex {
|
|||||||
this.unlockedReliquarySuitCodex = new HashSet<>();
|
this.unlockedReliquarySuitCodex = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerCodex(Player player){
|
public PlayerCodex(Player player) {
|
||||||
this();
|
this();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ public class PlayerCodex {
|
|||||||
this.fixReliquaries();
|
this.fixReliquaries();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkAddedItem(GameItem item){
|
public void checkAddedItem(GameItem item) {
|
||||||
val itemData = item.getItemData();
|
val itemData = item.getItemData();
|
||||||
val itemId = item.getItemId();
|
val itemId = item.getItemId();
|
||||||
switch (itemData.getItemType()) {
|
switch (itemData.getItemType()) {
|
||||||
@@ -85,7 +85,7 @@ public class PlayerCodex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkAnimal(GameEntity target, CodexAnimalData.CountType countType){
|
public void checkAnimal(GameEntity target, CodexAnimalData.CountType countType) {
|
||||||
if (target instanceof EntityMonster) {
|
if (target instanceof EntityMonster) {
|
||||||
val monsterId = ((EntityMonster) target).getMonsterData().getId();
|
val monsterId = ((EntityMonster) target).getMonsterData().getId();
|
||||||
val codexAnimal = GameData.getCodexAnimalDataMap().get(monsterId);
|
val codexAnimal = GameData.getCodexAnimalDataMap().get(monsterId);
|
||||||
@@ -101,7 +101,7 @@ public class PlayerCodex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkUnlockedSuits(int reliquaryId){
|
public void checkUnlockedSuits(int reliquaryId) {
|
||||||
GameData.getCodexReliquaryArrayList().stream()
|
GameData.getCodexReliquaryArrayList().stream()
|
||||||
.filter(x -> !this.getUnlockedReliquarySuitCodex().contains(x.getId()))
|
.filter(x -> !this.getUnlockedReliquarySuitCodex().contains(x.getId()))
|
||||||
.filter(x -> x.containsId(reliquaryId))
|
.filter(x -> x.containsId(reliquaryId))
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public abstract class ItemUseAddEnergy extends ItemUseAction {
|
|||||||
var activeTeam = teamManager.getActiveTeam();
|
var activeTeam = teamManager.getActiveTeam();
|
||||||
// On-field vs off-field multiplier.
|
// On-field vs off-field multiplier.
|
||||||
// The on-field character gets full amount, off-field characters get less depending on the team size.
|
// The on-field character gets full amount, off-field characters get less depending on the team size.
|
||||||
final float offFieldRatio = switch(activeTeam.size()) {
|
final float offFieldRatio = switch (activeTeam.size()) {
|
||||||
case 2 -> 0.8f;
|
case 2 -> 0.8f;
|
||||||
case 3 -> 0.7f;
|
case 3 -> 0.7f;
|
||||||
default -> 0.6f;
|
default -> 0.6f;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class WorldDataSystem extends BaseGameSystem {
|
|||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
private InvestigationMonsterOuterClass.InvestigationMonster getInvestigationMonster(Player player, InvestigationMonsterData imd) {
|
private InvestigationMonsterOuterClass.InvestigationMonster getInvestigationMonster(Player player, InvestigationMonsterData imd) {
|
||||||
if(imd.getGroupIdList().isEmpty() || imd.getMonsterIdList().isEmpty()){
|
if (imd.getGroupIdList().isEmpty() || imd.getMonsterIdList().isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,10 +84,10 @@ public class ScriptLoader {
|
|||||||
ctx.globals.set("ScriptLib", scriptLibLua);
|
ctx.globals.set("ScriptLib", scriptLibLua);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Optional<T> tryGet(SoftReference<T> softReference){
|
public static <T> Optional<T> tryGet(SoftReference<T> softReference) {
|
||||||
try{
|
try {
|
||||||
return Optional.ofNullable(softReference.get());
|
return Optional.ofNullable(softReference.get());
|
||||||
}catch (NullPointerException npe){
|
}catch (NullPointerException npe) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user