ill try smth
This commit is contained in:
parent
77decae10c
commit
a365f70873
28 changed files with 433 additions and 96 deletions
|
|
@ -21,11 +21,11 @@ public final class PlayerManager {
|
|||
this.minigame = minigame;
|
||||
}
|
||||
|
||||
public Stream<Player> getParticipants() {
|
||||
public Stream<Player> participants() {
|
||||
return participants.stream().map(Bukkit::getPlayer);
|
||||
}
|
||||
|
||||
public Stream<Player> getSpectators() {
|
||||
public Stream<Player> spectators() {
|
||||
return spectators.stream().map(Bukkit::getPlayer);
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ public final class PlayerManager {
|
|||
return spectators.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
public Stream<Player> getAllPlayers() {
|
||||
return Stream.concat(getParticipants(), getSpectators());
|
||||
public Stream<Player> allPlayers() {
|
||||
return Stream.concat(participants(), spectators());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ public class LobbyPhase<T extends Minigame> extends CompositePhase<T> {
|
|||
ctx.listeners().on(PlayerJoinEvent.class, EventPriority.LOWEST, this::onJoin);
|
||||
ctx.listeners().on(PlayerQuitEvent.class, EventPriority.LOWEST, this::onQuit);
|
||||
|
||||
//noinspection unchecked
|
||||
ctx.listeners().cancel(
|
||||
HangingBreakByEntityEvent.class,
|
||||
PlayerInteractAtEntityEvent.class,
|
||||
|
|
@ -51,13 +50,13 @@ public class LobbyPhase<T extends Minigame> extends CompositePhase<T> {
|
|||
|
||||
private void onJoin(PlayerJoinEvent ev) {
|
||||
ctx.players().addParticipant(ev.getPlayer());
|
||||
ctx.players().getAllPlayers().forEach(p ->
|
||||
ctx.players().allPlayers().forEach(p ->
|
||||
p.sendMessage("§8[§a+§8] §7" + ev.getPlayer().getName()));
|
||||
}
|
||||
|
||||
private void onQuit(PlayerQuitEvent ev) {
|
||||
if (ctx.players().removeParticipant(ev.getPlayer()))
|
||||
ctx.players().getAllPlayers().forEach(p ->
|
||||
ctx.players().allPlayers().forEach(p ->
|
||||
p.sendMessage("§8[§c-§8] §7" + ev.getPlayer().getName()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class WaitForMaximumPlayersPhase<T extends Minigame> extends Phase<T> {
|
|||
@Override
|
||||
protected void onTick(int tick) {
|
||||
if (tick % 20 == 0) {
|
||||
ctx.players().getAllPlayers().forEach(player ->
|
||||
ctx.players().allPlayers().forEach(player ->
|
||||
player.sendTitle("Game starting in " + secsLeft + " seconds", "have fun", 5, 20, 10)
|
||||
);
|
||||
secsLeft--;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue