Skip to content

Commit

Permalink
微修正
Browse files Browse the repository at this point in the history
  • Loading branch information
MORIMORI0317 committed Jan 27, 2024
1 parent 894bbb1 commit 4baa9f0
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.felnull.shortlifeplugin.gui.item;

import dev.felnull.shortlifeplugin.match.MapSelector;
import dev.felnull.shortlifeplugin.match.Match;
import dev.felnull.shortlifeplugin.match.PlayerInfo;
import dev.felnull.shortlifeplugin.match.map.MatchMap;
Expand Down Expand Up @@ -56,11 +57,14 @@ public ItemProvider getItemProvider() {
@Override
public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent inventoryClickEvent) {
if (this.match.isValid()) {
List<MatchMap> selectableMaps = this.match.getMapSelector().getSelectableMaps();
if (selectableMaps != null && selectableMaps.contains(this.matchMap)) {
Optional<PlayerInfo> playerInfo = this.match.getPlayerInfo(player);
playerInfo.ifPresent(info -> info.getMapSelectorInfo().setVotedMatchMap(matchMap));
player.sendMessage(Component.text(matchMap.name() + "に投票しました"));
MapSelector mapSelector = this.match.getMapSelector();
if (mapSelector.getSelectedMatchMap() == null) {
List<MatchMap> selectableMaps = this.match.getMapSelector().getSelectableMaps();
if (selectableMaps != null && selectableMaps.contains(this.matchMap)) {
Optional<PlayerInfo> playerInfo = this.match.getPlayerInfo(player);
playerInfo.ifPresent(info -> info.getMapSelectorInfo().setVotedMatchMap(matchMap));
player.sendMessage(Component.text(matchMap.name() + "に投票しました"));
}
}
}
getWindows().forEach(Window::close);
Expand Down

0 comments on commit 4baa9f0

Please sign in to comment.