mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-07 00:23:20 +08:00
refactor: unwrap redundant code block
This commit is contained in:
parent
029ef823e1
commit
9fa0f2bcad
@ -63,9 +63,7 @@ public final class GroupCommand implements CommandHandler {
|
|||||||
|
|
||||||
CommandHandler.sendMessage(sender, translate(sender, "commands.group.refreshed", groupId));
|
CommandHandler.sendMessage(sender, translate(sender, "commands.group.refreshed", groupId));
|
||||||
}
|
}
|
||||||
default -> {
|
default -> sendUsageMessage(sender);
|
||||||
sendUsageMessage(sender);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,14 +106,12 @@ public final class SendMailCommand implements CommandHandler {
|
|||||||
getConstructionArgs(mailBuilder.constructionStage, sender)));
|
getConstructionArgs(mailBuilder.constructionStage, sender)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "help" -> {
|
case "help" -> CommandHandler.sendMessage(
|
||||||
CommandHandler.sendMessage(
|
sender,
|
||||||
sender,
|
translate(
|
||||||
translate(
|
sender,
|
||||||
sender,
|
"commands.sendMail.please_use",
|
||||||
"commands.sendMail.please_use",
|
getConstructionArgs(mailBuilder.constructionStage, sender)));
|
||||||
getConstructionArgs(mailBuilder.constructionStage, sender)));
|
|
||||||
}
|
|
||||||
default -> {
|
default -> {
|
||||||
switch (mailBuilder.constructionStage) {
|
switch (mailBuilder.constructionStage) {
|
||||||
case 0 -> {
|
case 0 -> {
|
||||||
|
@ -45,9 +45,7 @@ public final class TalentCommand implements CommandHandler {
|
|||||||
|
|
||||||
String cmdSwitch = args.get(0).toLowerCase();
|
String cmdSwitch = args.get(0).toLowerCase();
|
||||||
switch (cmdSwitch) {
|
switch (cmdSwitch) {
|
||||||
default -> {
|
default -> sendUsageMessage(sender);
|
||||||
sendUsageMessage(sender);
|
|
||||||
}
|
|
||||||
case "set" -> {
|
case "set" -> {
|
||||||
if (args.size() < 3) {
|
if (args.size() < 3) {
|
||||||
sendUsageMessage(sender);
|
sendUsageMessage(sender);
|
||||||
|
@ -48,16 +48,14 @@ public class PlayerCodex {
|
|||||||
val itemData = item.getItemData();
|
val itemData = item.getItemData();
|
||||||
val itemId = item.getItemId();
|
val itemId = item.getItemId();
|
||||||
switch (itemData.getItemType()) {
|
switch (itemData.getItemType()) {
|
||||||
case ITEM_WEAPON -> {
|
case ITEM_WEAPON -> Optional.ofNullable(GameData.getCodexWeaponDataIdMap().get(itemId))
|
||||||
Optional.ofNullable(GameData.getCodexWeaponDataIdMap().get(itemId))
|
.ifPresent(
|
||||||
.ifPresent(
|
codexData -> {
|
||||||
codexData -> {
|
if (this.getUnlockedWeapon().add(itemId)) {
|
||||||
if (this.getUnlockedWeapon().add(itemId)) {
|
this.player.save();
|
||||||
this.player.save();
|
this.player.sendPacket(new PacketCodexDataUpdateNotify(2, codexData.getId()));
|
||||||
this.player.sendPacket(new PacketCodexDataUpdateNotify(2, codexData.getId()));
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
case ITEM_MATERIAL -> {
|
case ITEM_MATERIAL -> {
|
||||||
switch (itemData.getMaterialType()) {
|
switch (itemData.getMaterialType()) {
|
||||||
// Is this check even needed?
|
// Is this check even needed?
|
||||||
@ -65,17 +63,15 @@ public class PlayerCodex {
|
|||||||
MATERIAL_WIDGET,
|
MATERIAL_WIDGET,
|
||||||
MATERIAL_EXCHANGE,
|
MATERIAL_EXCHANGE,
|
||||||
MATERIAL_AVATAR_MATERIAL,
|
MATERIAL_AVATAR_MATERIAL,
|
||||||
MATERIAL_NOTICE_ADD_HP -> {
|
MATERIAL_NOTICE_ADD_HP -> Optional.ofNullable(GameData.getCodexMaterialDataIdMap().get(itemId))
|
||||||
Optional.ofNullable(GameData.getCodexMaterialDataIdMap().get(itemId))
|
.ifPresent(
|
||||||
.ifPresent(
|
codexData -> {
|
||||||
codexData -> {
|
if (this.getUnlockedMaterial().add(itemId)) {
|
||||||
if (this.getUnlockedMaterial().add(itemId)) {
|
this.player.save();
|
||||||
this.player.save();
|
this.player.sendPacket(
|
||||||
this.player.sendPacket(
|
new PacketCodexDataUpdateNotify(4, codexData.getId()));
|
||||||
new PacketCodexDataUpdateNotify(4, codexData.getId()));
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
default -> {}
|
default -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,24 +43,20 @@ public class HandlerTryEnterHomeReq extends PacketHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption
|
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption
|
||||||
.FRIEND_ENTER_HOME_OPTION_REFUSE_VALUE -> {
|
.FRIEND_ENTER_HOME_OPTION_REFUSE_VALUE -> session.send(
|
||||||
session.send(
|
new PacketTryEnterHomeRsp(
|
||||||
new PacketTryEnterHomeRsp(
|
RetcodeOuterClass.Retcode.RET_HOME_HOME_REFUSE_GUEST_ENTER_VALUE,
|
||||||
RetcodeOuterClass.Retcode.RET_HOME_HOME_REFUSE_GUEST_ENTER_VALUE,
|
req.getTargetUid()));
|
||||||
req.getTargetUid()));
|
|
||||||
}
|
|
||||||
|
|
||||||
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption
|
case FriendEnterHomeOptionOuterClass.FriendEnterHomeOption
|
||||||
.FRIEND_ENTER_HOME_OPTION_DIRECT_VALUE -> {
|
.FRIEND_ENTER_HOME_OPTION_DIRECT_VALUE -> session
|
||||||
session
|
.getServer()
|
||||||
.getServer()
|
.getHomeWorldMPSystem()
|
||||||
.getHomeWorldMPSystem()
|
.enterHome(
|
||||||
.enterHome(
|
session.getPlayer(),
|
||||||
session.getPlayer(),
|
targetPlayer,
|
||||||
targetPlayer,
|
req.getTargetPoint(),
|
||||||
req.getTargetPoint(),
|
req.getIsTransferToSafePoint());
|
||||||
req.getIsTransferToSafePoint());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -37,9 +37,7 @@ public class PacketVehicleInteractRsp extends BasePacket {
|
|||||||
QuestContent.QUEST_CONTENT_ENTER_VEHICLE,
|
QuestContent.QUEST_CONTENT_ENTER_VEHICLE,
|
||||||
((EntityVehicle) vehicle).getGadgetId());
|
((EntityVehicle) vehicle).getGadgetId());
|
||||||
}
|
}
|
||||||
case VEHICLE_INTERACT_TYPE_OUT -> {
|
case VEHICLE_INTERACT_TYPE_OUT -> ((EntityVehicle) vehicle).getVehicleMembers().remove(vehicleMember);
|
||||||
((EntityVehicle) vehicle).getVehicleMembers().remove(vehicleMember);
|
|
||||||
}
|
|
||||||
default -> {}
|
default -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,12 +55,8 @@ public class PacketVehicleInteractRsp extends BasePacket {
|
|||||||
proto.setMember(vehicleMember);
|
proto.setMember(vehicleMember);
|
||||||
|
|
||||||
switch (interactType) {
|
switch (interactType) {
|
||||||
case VEHICLE_INTERACT_TYPE_IN -> {
|
case VEHICLE_INTERACT_TYPE_IN -> vehicle.getVehicleMembers().add(vehicleMember);
|
||||||
vehicle.getVehicleMembers().add(vehicleMember);
|
case VEHICLE_INTERACT_TYPE_OUT -> vehicle.getVehicleMembers().remove(vehicleMember);
|
||||||
}
|
|
||||||
case VEHICLE_INTERACT_TYPE_OUT -> {
|
|
||||||
vehicle.getVehicleMembers().remove(vehicleMember);
|
|
||||||
}
|
|
||||||
default -> {}
|
default -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user