Skip to content

Commit 4fdfe0b

Browse files
committed
Revert "feat: integrate Sichuan Mahjong core flow"
This reverts commit 043b230.
1 parent c4cac6a commit 4fdfe0b

25 files changed

Lines changed: 67 additions & 752 deletions

src/main/java/top/ellan/mahjong/command/MahjongCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ private List<String> visibleRootCommands(CommandSender sender) {
526526
: ROOT_COMMANDS.stream().filter(command -> !this.isAdminRootCommand(command)).collect(java.util.stream.Collectors.toCollection(ArrayList::new));
527527
if (sender instanceof Player player) {
528528
MahjongTableSession table = this.tableManager.tableFor(player.getUniqueId());
529-
if (table != null && table.currentVariant() != MahjongVariant.RIICHI) {
529+
if (table != null && table.currentVariant() == MahjongVariant.GB) {
530530
commands.remove("riichi");
531531
commands.remove("kyuushu");
532532
}

src/main/java/top/ellan/mahjong/config/PluginSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public String craftEngineGbTileItemIdPrefix() {
132132
}
133133

134134
public String craftEngineTileItemIdPrefix(MahjongVariant variant) {
135-
if (variant != MahjongVariant.RIICHI) {
135+
if (variant == MahjongVariant.GB) {
136136
return this.craftEngineGbTileItemIdPrefix;
137137
}
138138
return this.craftEngineRiichiTileItemIdPrefix;

src/main/java/top/ellan/mahjong/table/core/MahjongTableSession.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import top.ellan.mahjong.riichi.model.MahjongSoulScoring;
1515
import top.ellan.mahjong.riichi.model.ScoringStick;
1616
import top.ellan.mahjong.table.core.round.GbTableRoundController;
17-
import top.ellan.mahjong.table.core.round.GbRuleProfile;
1817
import top.ellan.mahjong.table.core.round.OpeningDiceRoll;
1918
import top.ellan.mahjong.table.core.round.RiichiTableRoundController;
2019
import top.ellan.mahjong.table.core.round.TableRoundController;
@@ -913,14 +912,8 @@ private TableRoundController createRoundController() {
913912
seats.put(wind, playerId);
914913
displayNames.put(playerId, this.displayName(playerId));
915914
}
916-
if (this.currentVariant() != MahjongVariant.RIICHI) {
917-
return new GbTableRoundController(
918-
this.copyRule(),
919-
seats,
920-
displayNames,
921-
new GbNativeRulesGateway(),
922-
GbRuleProfile.forVariant(this.currentVariant())
923-
);
915+
if (this.currentVariant() == MahjongVariant.GB) {
916+
return new GbTableRoundController(this.copyRule(), seats, displayNames, new GbNativeRulesGateway());
924917
}
925918
List<RiichiPlayerState> players = new ArrayList<>(SeatWind.values().length);
926919
for (SeatWind wind : SeatWind.values()) {

src/main/java/top/ellan/mahjong/table/core/MahjongVariant.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
public enum MahjongVariant {
66
RIICHI,
7-
GB,
8-
SICHUAN;
7+
GB;
98

109
public String translationKey() {
1110
return "rule.variant." + this.name().toLowerCase(Locale.ROOT);

src/main/java/top/ellan/mahjong/table/core/SessionRuleCoordinator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ List<String> ruleKeys() {
6565

6666
List<String> ruleValues(String key) {
6767
return switch (key.toLowerCase(Locale.ROOT)) {
68-
case "preset", "mode" -> List.of("MAJSOUL_TONPUU", "MAJSOUL_HANCHAN", "GB", "SICHUAN");
69-
case "variant", "ruleset" -> List.of("RIICHI", "GB", "SICHUAN");
68+
case "preset", "mode" -> List.of("MAJSOUL_TONPUU", "MAJSOUL_HANCHAN", "GB");
69+
case "variant", "ruleset" -> List.of("RIICHI", "GB");
7070
case "length" -> List.of("ONE_GAME", "EAST", "SOUTH", "TWO_WIND");
7171
case "thinkingtime", "thinking" -> List.of("VERY_SHORT", "SHORT", "NORMAL", "LONG", "VERY_LONG");
7272
case "minimumhan", "minhan" -> List.of("ONE", "TWO", "FOUR", "YAKUMAN");

src/main/java/top/ellan/mahjong/table/core/SessionRulePresetResolver.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ static Preset resolve(String rawValue) {
1818
new Preset(MahjongVariant.RIICHI, majsoulRule(MahjongRule.GameLength.TWO_WIND));
1919
case "GB", "GUOBIAO", "ZHONGGUO", "CHINESE_OFFICIAL" ->
2020
new Preset(MahjongVariant.GB, gbRule());
21-
case "SICHUAN", "SCMJ", "SICHUAN_MAHJONG", "SICHUAN_TOURNAMENT" ->
22-
new Preset(MahjongVariant.SICHUAN, sichuanRule());
2321
default -> null;
2422
};
2523
}
2624

2725
static MahjongRule defaultRuleFor(MahjongVariant variant) {
28-
return variant == MahjongVariant.RIICHI ? majsoulRule(MahjongRule.GameLength.TWO_WIND) : gbRule();
26+
return variant == MahjongVariant.GB ? gbRule() : majsoulRule(MahjongRule.GameLength.TWO_WIND);
2927
}
3028

3129
static MahjongRule majsoulRule(MahjongRule.GameLength length) {
@@ -56,10 +54,6 @@ static MahjongRule gbRule() {
5654
);
5755
}
5856

59-
static MahjongRule sichuanRule() {
60-
return gbRule();
61-
}
62-
6357
record Preset(MahjongVariant variant, MahjongRule rule) {
6458
}
6559
}

src/main/java/top/ellan/mahjong/table/core/round/GbRoundSupport.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,23 +163,11 @@ static int rollDicePoints() {
163163
}
164164

165165
static List<MahjongTile> buildWall() {
166-
return buildWall(GbRuleProfile.GB);
167-
}
168-
169-
static List<MahjongTile> buildWall(GbRuleProfile profile) {
170-
GbRuleProfile safeProfile = profile == null ? GbRuleProfile.GB : profile;
171-
int initialCapacity = safeProfile.includesHonors() && safeProfile.includesFlowers() ? 144 : 108;
172-
List<MahjongTile> wall = new ArrayList<>(initialCapacity);
166+
List<MahjongTile> wall = new ArrayList<>(144);
173167
for (MahjongTile tile : MahjongTile.values()) {
174168
if (tile == MahjongTile.UNKNOWN || tile.isRedFive()) {
175169
continue;
176170
}
177-
if (!safeProfile.includesHonors() && isHonor(tile)) {
178-
continue;
179-
}
180-
if (!safeProfile.includesFlowers() && tile.isFlower()) {
181-
continue;
182-
}
183171
int copies = tile.isFlower() ? 1 : 4;
184172
for (int i = 0; i < copies; i++) {
185173
wall.add(tile);

src/main/java/top/ellan/mahjong/table/core/round/GbRuleProfile.java

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)