Skip to content

Commit 3706024

Browse files
committed
fix error and update build.yml
1 parent a4ead53 commit 3706024

File tree

5 files changed

+21
-15
lines changed

5 files changed

+21
-15
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ jobs:
4040
- run: java -version
4141
- run: mvn --version
4242
- run: mvn -B package
43+
44+
- name: Upload a Build Artifact
45+
uses: actions/upload-artifact@v3.1.0
46+
with:
47+
path: /home/runner/work/LeonGunWarNeo/LeonGunWarNeo/target/

src/main/java/net/azisaba/lgwneo/match/AssistStreaks.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@RequiredArgsConstructor
1717
public class AssistStreaks {
1818

19-
private final LeonGunWarNeo plugin;
19+
private final Match match;
2020
private final Map<UUID, AtomicInteger> streaksMap = new HashMap<>();
2121

2222
public void removedBy(UUID uuid) {
@@ -34,16 +34,15 @@ public void add(UUID uuid) {
3434
Player player = Bukkit.getPlayer(uuid);
3535

3636
// 報酬を付与
37-
plugin.getLeonGunWarNeoConfig().getAssistLevels().entrySet().stream()
37+
match.getPlugin().getLeonGunWarNeoConfig().getAssistLevels().entrySet().stream()
3838
.filter(entry -> streaks % entry.getKey() == 0)
3939
.map(Map.Entry::getValue)
4040
.map(Map.Entry::getValue)
4141
.flatMap(List::stream)
4242
.map(command -> Chat.f(command, player.getName()))
4343
.forEach(command -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command));
44-
Match match = plugin.getMatchOrganizer().getMatchFromPlayer(player);
4544
// アシストストリークをお知らせ
46-
plugin.getLeonGunWarNeoConfig().getAssistLevels().entrySet().stream()
45+
match.getPlugin().getLeonGunWarNeoConfig().getAssistLevels().entrySet().stream()
4746
.filter(entry -> streaks % entry.getKey() == 0)
4847
.map(Map.Entry::getValue)
4948
.map(Map.Entry::getKey)

src/main/java/net/azisaba/lgwneo/match/KillStreaks.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@RequiredArgsConstructor
1818
public class KillStreaks {
1919

20-
private final LeonGunWarNeo plugin;
20+
private final Match match;
2121

2222
private final Map<UUID, AtomicInteger> streaksMap = new HashMap<>();
2323

@@ -26,17 +26,16 @@ public void removedBy(UUID uuid, UUID killerU) {
2626
Player killer = Bukkit.getPlayer(killerU);
2727
int streaks = get(uuid).get();
2828
int minStreaks =
29-
plugin.getLeonGunWarNeoConfig().getStreaks().entrySet().stream()
29+
match.getPlugin().getLeonGunWarNeoConfig().getStreaks().entrySet().stream()
3030
.sorted(Map.Entry.comparingByKey())
3131
.map(Map.Entry::getKey)
3232
.findFirst()
3333
.orElse(-1);
3434

3535
if (killer != null && streaks >= minStreaks) {
36-
Match match = plugin.getMatchOrganizer().getMatchFromPlayer(uuid);
3736
match.broadcastMessage(
3837
Chat.f(
39-
plugin.getLeonGunWarNeoConfig().getRemoved(),
38+
match.getPlugin().getLeonGunWarNeoConfig().getRemoved(),
4039
LeonGunWarNeo.getChatPrefix(),
4140
killer.getDisplayName(),
4241
player.getDisplayName()
@@ -54,14 +53,14 @@ public AtomicInteger get(UUID uuid) {
5453

5554
private void giveRewards(int streaks, UUID uuid) {
5655
Player player = Bukkit.getPlayer(uuid);
57-
plugin.getLeonGunWarNeoConfig().getStreaks().entrySet().stream()
56+
match.getPlugin().getLeonGunWarNeoConfig().getStreaks().entrySet().stream()
5857
.filter(entry -> streaks == entry.getKey())
5958
.map(Map.Entry::getValue)
6059
.map(Map.Entry::getValue)
6160
.flatMap(List::stream)
6261
.map(command -> Chat.f(command, player.getName()))
6362
.forEach(command -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command));
64-
plugin.getLeonGunWarNeoConfig().getKillLevels().entrySet().stream()
63+
match.getPlugin().getLeonGunWarNeoConfig().getKillLevels().entrySet().stream()
6564
.filter(entry -> streaks % entry.getKey() == 0)
6665
.map(Map.Entry::getValue)
6766
.map(Map.Entry::getValue)
@@ -73,7 +72,6 @@ private void giveRewards(int streaks, UUID uuid) {
7372
public void add(UUID uuid) {
7473
// カウントを追加
7574
int streaks = get(uuid).incrementAndGet();
76-
Match match = plugin.getMatchOrganizer().getMatchFromPlayer(uuid);
7775
Player player = Bukkit.getPlayer(uuid);
7876
// 報酬を付与
7977
giveRewards(streaks, uuid);
@@ -85,14 +83,14 @@ public void add(UUID uuid) {
8583
}
8684

8785
// キルストリークをお知らせ
88-
plugin.getLeonGunWarNeoConfig().getStreaks().entrySet().stream()
86+
match.getPlugin().getLeonGunWarNeoConfig().getStreaks().entrySet().stream()
8987
.filter(entry -> streaks == entry.getKey())
9088
.map(Map.Entry::getValue)
9189
.map(Map.Entry::getKey)
9290
.flatMap(List::stream)
9391
.map(message -> Chat.f(message, LeonGunWarNeo.getChatPrefix(), player.getDisplayName()))
9492
.forEach(match::broadcastMessage);
95-
plugin.getLeonGunWarNeoConfig().getKillLevels().entrySet().stream()
93+
match.getPlugin().getLeonGunWarNeoConfig().getKillLevels().entrySet().stream()
9694
.filter(entry -> streaks % entry.getKey() == 0)
9795
.map(Map.Entry::getValue)
9896
.map(Map.Entry::getKey)

src/main/java/net/azisaba/lgwneo/match/mode/LeaderDeathMatch.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
@RequiredArgsConstructor
6060
public class LeaderDeathMatch implements Match {
6161

62+
@Getter
6263
private final LeonGunWarNeo plugin;
6364
@Getter
6465
private final String matchId;
@@ -103,9 +104,9 @@ public class LeaderDeathMatch implements Match {
103104
private final HashMap<MatchTeam, ItemStack> chestPlateMap = new HashMap<>();
104105

105106
@Getter
106-
private final KillStreaks killStreaks = new KillStreaks(plugin);
107+
private final KillStreaks killStreaks = new KillStreaks(this);
107108
@Getter
108-
private final AssistStreaks assistStreaks = new AssistStreaks(plugin);
109+
private final AssistStreaks assistStreaks = new AssistStreaks(this);
109110

110111
@Override
111112
public Map<String, Object> getMatchInformationAsMap() {

src/main/java/net/azisaba/lgwneo/match/mode/Match.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.Set;
55
import java.util.concurrent.CompletableFuture;
66

7+
import net.azisaba.lgwneo.LeonGunWarNeo;
78
import net.azisaba.lgwneo.match.AssistStreaks;
89
import net.azisaba.lgwneo.match.KillDeathAssistCounter;
910
import net.azisaba.lgwneo.match.KillStreaks;
@@ -136,4 +137,6 @@ public interface Match {
136137

137138
KillStreaks getKillStreaks();
138139
AssistStreaks getAssistStreaks();
140+
141+
LeonGunWarNeo getPlugin();
139142
}

0 commit comments

Comments
 (0)