Commit 6e5d9866 authored by github-actions's avatar github-actions
Browse files

Fix whitespace [skip actions]

parent 005a0bce
......@@ -225,7 +225,7 @@ public final class CommandMap {
Grasscutter.getLogger().info("Command used by server console: " + rawMessage);
}
}
rawMessage = rawMessage.trim();
if (rawMessage.length() == 0) {
CommandHandler.sendTranslatedMessage(player, "commands.generic.not_specified");
......
......@@ -96,7 +96,7 @@ public class ConfigContainer {
public Set<Integer> debugBlacklist = Set.of();
public ServerRunMode runMode = ServerRunMode.HYBRID;
public boolean logCommands = false;
public HTTP http = new HTTP();
public Game game = new Game();
......
......@@ -10,71 +10,71 @@ import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
public class PointData {
private int id;
private String $type;
private Position tranPos;
private int id;
private String $type;
private Position tranPos;
@SerializedName(value="dungeonIds", alternate={"JHHFPGJNMIN"})
private int[] dungeonIds;
@SerializedName(value="dungeonIds", alternate={"JHHFPGJNMIN"})
private int[] dungeonIds;
@SerializedName(value="dungeonRandomList", alternate={"OIBKFJNBLHO"})
private int[] dungeonRandomList;
@SerializedName(value="dungeonRandomList", alternate={"OIBKFJNBLHO"})
private int[] dungeonRandomList;
@SerializedName(value="tranSceneId", alternate={"JHBICGBAPIH"})
private int tranSceneId;
@SerializedName(value="tranSceneId", alternate={"JHBICGBAPIH"})
private int tranSceneId;
public int getId() {
return id;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public void setId(int id) {
this.id = id;
}
public String getType() {
return $type;
}
public String getType() {
return $type;
}
public Position getTranPos() {
return tranPos;
}
public Position getTranPos() {
return tranPos;
}
public int[] getDungeonIds() {
return dungeonIds;
}
public int[] getDungeonIds() {
return dungeonIds;
}
public int[] getDungeonRandomList() {
return dungeonRandomList;
}
public int[] getDungeonRandomList() {
return dungeonRandomList;
}
public int getTranSceneId() {
return tranSceneId;
}
public int getTranSceneId() {
return tranSceneId;
}
public void setTranSceneId(int tranSceneId) {
this.tranSceneId = tranSceneId;
}
public void setTranSceneId(int tranSceneId) {
this.tranSceneId = tranSceneId;
}
public void updateDailyDungeon() {
public void updateDailyDungeon() {
if (getDungeonRandomList() == null || getDungeonRandomList().length == 0) {
return;
}
}
IntList newDungeons = new IntArrayList();
int day = Grasscutter.getCurrentDayOfWeek();
IntList newDungeons = new IntArrayList();
int day = Grasscutter.getCurrentDayOfWeek();
for (int randomId : getDungeonRandomList()) {
DailyDungeonData data = GameData.getDailyDungeonDataMap().get(randomId);
for (int randomId : getDungeonRandomList()) {
DailyDungeonData data = GameData.getDailyDungeonDataMap().get(randomId);
if (data != null) {
int[] addDungeons = data.getDungeonsByDay(day);
if (data != null) {
int[] addDungeons = data.getDungeonsByDay(day);
for (int d : addDungeons) {
newDungeons.add(d);
}
}
}
for (int d : addDungeons) {
newDungeons.add(d);
}
}
}
this.dungeonIds = newDungeons.toIntArray();
}
this.dungeonIds = newDungeons.toIntArray();
}
}
......@@ -6,30 +6,30 @@ import emu.grasscutter.data.ResourceType;
@ResourceType(name = "AvatarCostumeExcelConfigData.json")
public class AvatarCostumeData extends GameResource {
private int costumeId;
private int itemId;
private int costumeId;
private int itemId;
private int characterId;
private int quality;
@Override
public int getId() {
return this.costumeId;
}
public int getItemId() {
return this.itemId;
}
public int getCharacterId() {
return characterId;
}
public int getQuality() {
@Override
public int getId() {
return this.costumeId;
}
public int getItemId() {
return this.itemId;
}
public int getCharacterId() {
return characterId;
}
public int getQuality() {
return quality;
}
@Override
public void onLoad() {
GameData.getAvatarCostumeDataItemIdMap().put(this.getItemId(), this);
}
public void onLoad() {
GameData.getAvatarCostumeDataItemIdMap().put(this.getItemId(), this);
}
}
......@@ -8,52 +8,52 @@ import emu.grasscutter.data.common.FightPropData;
@ResourceType(name = "EquipAffixExcelConfigData.json")
public class EquipAffixData extends GameResource {
private int affixId;
private int affixId;
private int id;
private int level;
private long nameTextMapHash;
private String openConfig;
private FightPropData[] addProps;
private float[] paramList;
@Override
public int getId() {
return affixId;
}
public int getMainId() {
return id;
}
public int getLevel() {
return level;
}
public long getNameTextMapHash() {
return nameTextMapHash;
}
public String getOpenConfig() {
return openConfig;
}
public FightPropData[] getAddProps() {
return addProps;
}
public float[] getParamList() {
return paramList;
}
@Override
public void onLoad() {
ArrayList<FightPropData> parsed = new ArrayList<FightPropData>(getAddProps().length);
for (FightPropData prop : getAddProps()) {
if (prop.getPropType() != null && prop.getValue() != 0f) {
prop.onLoad();
parsed.add(prop);
}
}
this.addProps = parsed.toArray(new FightPropData[parsed.size()]);
}
@Override
public int getId() {
return affixId;
}
public int getMainId() {
return id;
}
public int getLevel() {
return level;
}
public long getNameTextMapHash() {
return nameTextMapHash;
}
public String getOpenConfig() {
return openConfig;
}
public FightPropData[] getAddProps() {
return addProps;
}
public float[] getParamList() {
return paramList;
}
@Override
public void onLoad() {
ArrayList<FightPropData> parsed = new ArrayList<FightPropData>(getAddProps().length);
for (FightPropData prop : getAddProps()) {
if (prop.getPropType() != null && prop.getValue() != 0f) {
prop.onLoad();
parsed.add(prop);
}
}
this.addProps = parsed.toArray(new FightPropData[parsed.size()]);
}
}
......@@ -120,7 +120,7 @@ public class ItemData extends GameResource {
if (this.getFurnitureGadgetID() != null) {
this.furnitureGadgetID = this.furnitureGadgetID.stream().filter(x -> x > 0).toList();
}
// Prevent material type from being null
this.materialType = this.materialType == null ? MaterialType.MATERIAL_NONE : this.materialType;
}
......
......@@ -7,27 +7,27 @@ import emu.grasscutter.data.ResourceType;
@ResourceType(name = "ReliquarySetExcelConfigData.json")
public class ReliquarySetData extends GameResource {
private int setId;
private int setId;
private int[] setNeedNum;
@SerializedName(value="equipAffixId", alternate={"EquipAffixId"})
private int equipAffixId;
@Override
public int getId() {
return setId;
}
public int[] getSetNeedNum() {
return setNeedNum;
}
public int getEquipAffixId() {
return equipAffixId;
}
@Override
public void onLoad() {
}
@Override
public int getId() {
return setId;
}
public int[] getSetNeedNum() {
return setNeedNum;
}
public int getEquipAffixId() {
return equipAffixId;
}
@Override
public void onLoad() {
}
}
......@@ -600,7 +600,7 @@ public class Avatar {
}
}
}
public void addToExtraAbilityEmbryos(String openConfig) {
this.addToExtraAbilityEmbryos(openConfig, false);
}
......
......@@ -130,7 +130,7 @@ public class EntityAvatar extends GameEntity {
if (!this.isAlive()) {
return 0f;
}
float healed = super.heal(amount);
if (healed > 0f) {
......
......@@ -16,66 +16,66 @@ import emu.grasscutter.server.packet.send.PacketGadgetInteractRsp;
import emu.grasscutter.utils.Utils;
public class GadgetGatherObject extends GadgetContent {
private int itemId;
private boolean isForbidGuest;
public GadgetGatherObject(EntityGadget gadget) {
super(gadget);
if (gadget.getSpawnEntry() != null) {
this.itemId = gadget.getSpawnEntry().getGatherItemId();
}
}
public int getItemId() {
return this.itemId;
}
public boolean isForbidGuest() {
return isForbidGuest;
}
public boolean onInteract(Player player, GadgetInteractReq req) {
// Sanity check
ItemData itemData = GameData.getItemDataMap().get(getItemId());
if (itemData == null) {
return false;
}
GameItem item = new GameItem(itemData, 1);
player.getInventory().addItem(item, ActionReason.Gather);
getGadget().getScene().broadcastPacket(new PacketGadgetInteractRsp(getGadget(), InteractType.INTERACT_TYPE_GATHER));
return true;
}
public void onBuildProto(SceneGadgetInfo.Builder gadgetInfo) {
GatherGadgetInfo gatherGadgetInfo = GatherGadgetInfo.newBuilder()
.setItemId(this.getItemId())
.setIsForbidGuest(this.isForbidGuest())
.build();
gadgetInfo.setGatherGadget(gatherGadgetInfo);
}
public void dropItems(Player player) {
Scene scene = getGadget().getScene();
int times = Utils.randomRange(1,2);
private int itemId;
private boolean isForbidGuest;
public GadgetGatherObject(EntityGadget gadget) {
super(gadget);
if (gadget.getSpawnEntry() != null) {
this.itemId = gadget.getSpawnEntry().getGatherItemId();
}
}
public int getItemId() {
return this.itemId;
}
public boolean isForbidGuest() {
return isForbidGuest;
}
public boolean onInteract(Player player, GadgetInteractReq req) {
// Sanity check
ItemData itemData = GameData.getItemDataMap().get(getItemId());
if (itemData == null) {
return false;
}
GameItem item = new GameItem(itemData, 1);
player.getInventory().addItem(item, ActionReason.Gather);
getGadget().getScene().broadcastPacket(new PacketGadgetInteractRsp(getGadget(), InteractType.INTERACT_TYPE_GATHER));
return true;
}
public void onBuildProto(SceneGadgetInfo.Builder gadgetInfo) {
GatherGadgetInfo gatherGadgetInfo = GatherGadgetInfo.newBuilder()
.setItemId(this.getItemId())
.setIsForbidGuest(this.isForbidGuest())
.build();
gadgetInfo.setGatherGadget(gatherGadgetInfo);
}
public void dropItems(Player player) {
Scene scene = getGadget().getScene();
int times = Utils.randomRange(1,2);
for (int i = 0 ; i < times ; i++) {
EntityItem item = new EntityItem(
scene,
player,
scene,
player,
GameData.getItemDataMap().get(itemId),
getGadget().getPosition().nearby2d(1f).addY(2f),
1,
true);
scene.addEntity(item);
}
scene.killEntity(this.getGadget(), player.getTeamManager().getCurrentAvatarEntity().getId());
// Todo: add record
}
}
}
......@@ -14,50 +14,50 @@ import emu.grasscutter.net.proto.SceneGadgetInfoOuterClass.SceneGadgetInfo;
import emu.grasscutter.utils.Utils;
public class GadgetGatherPoint extends GadgetContent {
private int itemId;
private boolean isForbidGuest;
public GadgetGatherPoint(EntityGadget gadget) {
super(gadget);
if (gadget.getSpawnEntry() != null) {
this.itemId = gadget.getSpawnEntry().getGatherItemId();
} else {
GatherData gatherData = GameData.getGatherDataMap().get(gadget.getPointType());
this.itemId = gatherData.getItemId();
this.isForbidGuest = gatherData.isForbidGuest();
}
}
public int getItemId() {
return this.itemId;
}
private int itemId;
private boolean isForbidGuest;
public boolean isForbidGuest() {
return isForbidGuest;
}
public GadgetGatherPoint(EntityGadget gadget) {
super(gadget);
public boolean onInteract(Player player, GadgetInteractReq req) {
GameItem item = new GameItem(getItemId(), 1);
player.getInventory().addItem(item, ActionReason.Gather);
return true;
}
if (gadget.getSpawnEntry() != null) {
this.itemId = gadget.getSpawnEntry().getGatherItemId();
} else {
GatherData gatherData = GameData.getGatherDataMap().get(gadget.getPointType());
this.itemId = gatherData.getItemId();
this.isForbidGuest = gatherData.isForbidGuest();
}
}
public int getItemId() {
return this.itemId;
}
public boolean isForbidGuest() {
return isForbidGuest;
}
public boolean onInteract(Player player, GadgetInteractReq req) {
GameItem item = new GameItem(getItemId(), 1);
player.getInventory().addItem(item, ActionReason.Gather);
public void onBuildProto(SceneGadgetInfo.Builder gadgetInfo) {
GatherGadgetInfo gatherGadgetInfo = GatherGadgetInfo.newBuilder()
.setItemId(this.getItemId())
.setIsForbidGuest(this.isForbidGuest())
.build();
return true;
}
gadgetInfo.setGatherGadget(gatherGadgetInfo);
}
public void onBuildProto(SceneGadgetInfo.Builder gadgetInfo) {
GatherGadgetInfo gatherGadgetInfo = GatherGadgetInfo.newBuilder()
.setItemId(this.getItemId())
.setIsForbidGuest(this.isForbidGuest())
.build();
gadgetInfo.setGatherGadget(gatherGadgetInfo);
}
public void dropItems(Player player) {
Scene scene = getGadget().getScene();
int times = Utils.randomRange(1,2);
public void dropItems(Player player) {
Scene scene = getGadget().getScene();
int times = Utils.randomRange(1,2);
for (int i = 0 ; i < times ; i++) {
EntityItem item = new EntityItem(
scene,
......@@ -69,11 +69,11 @@ public class GadgetGatherPoint extends GadgetContent {
.addZ(Utils.randomFloatRange(-1f, 1f)),
1,
true);
scene.addEntity(item);
}
scene.killEntity(this.getGadget(), player.getTeamManager().getCurrentAvatarEntity().getId());
// Todo: add record
}
}
}
......@@ -45,7 +45,7 @@ public class HomeBlockItem {
.toList();
}
public int calComfort(){
public int calComfort() {
return this.deployFurnitureList.stream()
.mapToInt(HomeFurnitureItem::getComfort)
.sum();
......
......@@ -15,11 +15,11 @@ public class MapMark {
private int monsterId;
private MapMarkFromType mapMarkFromType;
private int questId;
@Deprecated // Morhpia
public MapMark() {
this.mapMarkPointType = MapMarkPointType.MAP_MARK_POINT_TYPE_MONSTER;
this.mapMarkFromType = MapMarkFromType.MAP_MARK_FROM_TYPE_MONSTER;
this.mapMarkPointType = MapMarkPointType.MAP_MARK_POINT_TYPE_MONSTER;
this.mapMarkFromType = MapMarkFromType.MAP_MARK_FROM_TYPE_MONSTER;
}
public MapMark(MapMarkPoint mapMarkPoint) {
......@@ -35,28 +35,28 @@ public class MapMark {
public int getSceneId() {
return this.sceneId;
}
public String getName() {
return this.name;
}
public Position getPosition() {
return this.position;
}
public MapMarkPointType getMapMarkPointType() {
return this.mapMarkPointType;
}
public int getMonsterId() {
return this.monsterId;
}
public MapMarkFromType getMapMarkFromType() {
return this.mapMarkFromType;
}
public int getQuestId() {
return this.questId;
}
}
\ No newline at end of file
}
......@@ -181,7 +181,7 @@ public class GameQuest {
}
return false;
}
public void save() {
getMainQuest().save();
}
......
......@@ -313,20 +313,20 @@ public class QuestManager extends BasePlayerManager {
}
public void loadFromDatabase() {
List<GameMainQuest> quests = DatabaseHelper.getAllQuests(getPlayer());
for (GameMainQuest mainQuest : quests) {
boolean cancelAdd = false;
mainQuest.setOwner(this.getPlayer());
for (GameQuest quest : mainQuest.getChildQuests().values()) {
QuestData questConfig = GameData.getQuestDataMap().get(quest.getSubQuestId());
if (questConfig == null) {
mainQuest.delete();
cancelAdd = true;
break;
}
quest.setMainQuest(mainQuest);
quest.setConfig(questConfig);
}
......
......@@ -13,7 +13,7 @@ public interface Router {
* @param javalin A Javalin instance.
*/
void applyRoutes(Javalin javalin);
/**
* Applies this handler to all endpoint types
* @param javalin A Javalin instance.
......
......@@ -15,12 +15,12 @@ import emu.grasscutter.server.packet.send.PacketMusicGameSettleRsp;
@Opcodes(PacketOpcodes.MusicGameSettleReq)
public class HandlerMusicGameSettleReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = MusicGameSettleReqOuterClass.MusicGameSettleReq.parseFrom(payload);
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = MusicGameSettleReqOuterClass.MusicGameSettleReq.parseFrom(payload);
var playerData = session.getPlayer().getActivityManager().getPlayerActivityDataByActivityType(ActivityType.NEW_ACTIVITY_MUSIC_GAME);
if(playerData.isEmpty()){
if (playerData.isEmpty()) {
return;
}
var handler = (MusicGameActivityHandler) playerData.get().getActivityHandler();
......@@ -32,7 +32,7 @@ public class HandlerMusicGameSettleReq extends PacketHandler {
// Probably was an issue in 2.8 but was discovered in 3.0 port.
// - Benj
/*if(req.getMusicShareId() == 0){
/*if (req.getMusicShareId() == 0) {
session.getPlayer().getActivityManager().triggerWatcher(
WatcherTriggerType.TRIGGER_FLEUR_FAIR_MUSIC_GAME_REACH_SCORE,
String.valueOf(req.getMusicBasicId()),
......@@ -48,7 +48,7 @@ public class HandlerMusicGameSettleReq extends PacketHandler {
// update activity info
session.send(new PacketActivityInfoNotify(handler.toProto(playerData.get())));
}else{
}else {
handler.setMusicGameCustomBeatmapRecord(playerData.get(),
MusicGamePlayerData.CustomBeatmapRecord.of()
.musicShareId(req.getMusicShareId())
......@@ -58,7 +58,7 @@ public class HandlerMusicGameSettleReq extends PacketHandler {
}
session.send(new PacketMusicGameSettleRsp(req.getMusicBasicId(), req.getMusicShareId(), isNewRecord));*/
}
session.send(new PacketMusicGameSettleRsp(req.getMusicBasicId(), req.getMusicShareId(), isNewRecord));*/
}
}
......@@ -13,24 +13,24 @@ import emu.grasscutter.utils.Position;
@Opcodes(PacketOpcodes.PersonalSceneJumpReq)
public class HandlerPersonalSceneJumpReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
PersonalSceneJumpReq req = PersonalSceneJumpReq.parseFrom(payload);
var player = session.getPlayer();
// get the scene point
String code = player.getSceneId() + "_" + req.getPointId();
ScenePointEntry scenePointEntry = GameData.getScenePointEntries().get(code);
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
PersonalSceneJumpReq req = PersonalSceneJumpReq.parseFrom(payload);
var player = session.getPlayer();
if (scenePointEntry != null) {
Position pos = scenePointEntry.getPointData().getTranPos().clone(); // This might not need cloning
int sceneId = scenePointEntry.getPointData().getTranSceneId();
// get the scene point
String code = player.getSceneId() + "_" + req.getPointId();
ScenePointEntry scenePointEntry = GameData.getScenePointEntries().get(code);
player.getWorld().transferPlayerToScene(player, sceneId, pos);
session.send(new PacketPersonalSceneJumpRsp(sceneId, pos));
}
if (scenePointEntry != null) {
Position pos = scenePointEntry.getPointData().getTranPos().clone(); // This might not need cloning
int sceneId = scenePointEntry.getPointData().getTranSceneId();
}
player.getWorld().transferPlayerToScene(player, sceneId, pos);
session.send(new PacketPersonalSceneJumpRsp(sceneId, pos));
}
}
}
......@@ -12,7 +12,7 @@ public class PacketAddCustomTeamRsp extends BasePacket {
AddCustomTeamRsp proto = AddCustomTeamRsp.newBuilder()
.setRetcode(retcode.getNumber())
.build();
this.setData(proto);
}
......
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