forked from SteamWar/SteamWar
Fix SWPlayer on 1.15
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.core;
|
||||
|
||||
import de.steamwar.message.Message;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import lombok.experimental.Delegate;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
@@ -91,10 +92,16 @@ public class SWPlayer {
|
||||
return players.values().stream();
|
||||
}
|
||||
|
||||
public static <T extends Component> @NonNull Stream<Pair<SWPlayer, T>> allWithSingleComponent(Class<T> component) {
|
||||
public static <T extends Component> @NonNull Stream<SWPlayerWithComponent<T>> allWithSingleComponent(Class<T> component) {
|
||||
return players.values().stream()
|
||||
.filter(player -> player.components.containsKey(component))
|
||||
.map(player -> Pair.of(player, (T) player.components.get(component)));
|
||||
.map(player -> new SWPlayerWithComponent<>(player, (T) player.components.get(component)));
|
||||
}
|
||||
|
||||
@Data
|
||||
public static final class SWPlayerWithComponent<T extends Component> {
|
||||
private final SWPlayer player;
|
||||
private final T component;
|
||||
}
|
||||
|
||||
@Delegate
|
||||
|
||||
Reference in New Issue
Block a user