1717@ RequiredArgsConstructor
1818public 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 )
0 commit comments