generated from devcordde/PluginJamGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
281ac32
commit 75e841e
Showing
12 changed files
with
381 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
package club.devcord.gamejam; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.World; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import java.util.stream.Stream; | ||
import java.util.stream.StreamSupport; | ||
|
||
public record Team( | ||
Player creator, | ||
List<Player> players, | ||
String name, | ||
List<UUID> playerUUIDS, | ||
World world | ||
) { | ||
|
||
public Team(Player creator, World world) { | ||
this(creator.getName(), new ArrayList<>(), world); | ||
playerUUIDS.add(creator.getUniqueId()); | ||
} | ||
|
||
|
||
public List<Player> players() { | ||
var list = new ArrayList<>(players); | ||
list.addFirst(creator); | ||
return list; | ||
return playerUUIDS | ||
.stream() | ||
.map(Bukkit::getPlayer) | ||
.toList(); | ||
} | ||
|
||
public void addPlayer(Player player) { | ||
players.add(player); | ||
playerUUIDS.add(player.getUniqueId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/club/devcord/gamejam/level/LevelPipeline.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package club.devcord.gamejam.level; | ||
|
||
import club.devcord.gamejam.Nigulpyggub; | ||
import club.devcord.gamejam.Team; | ||
import club.devcord.gamejam.level.poempel.PoempelLevel; | ||
import club.devcord.gamejam.level.thejump.TheJumpLevel; | ||
import net.kyori.adventure.key.Key; | ||
import net.kyori.adventure.sound.Sound; | ||
|
||
import java.util.ArrayDeque; | ||
import java.util.List; | ||
import java.util.Queue; | ||
|
||
public class LevelPipeline { | ||
private final Team team; | ||
private final Queue<Level> levels; | ||
|
||
public LevelPipeline(Team team, Nigulpyggub plugin) { | ||
this.team = team; | ||
var levels = List.of( | ||
new PoempelLevel(team, plugin, this), | ||
new TheJumpLevel(team, plugin, this) | ||
); | ||
this.levels = new ArrayDeque<>(levels); | ||
} | ||
|
||
public void next() { | ||
team.players().forEach( | ||
p -> p.playSound(Sound.sound(Key.key("minecraft:effect.achievementcompleted"), Sound.Source.MASTER, 100, 1)) | ||
); | ||
levels.poll().stop(); | ||
if(!levels.isEmpty()) { | ||
start(); | ||
} else { | ||
|
||
} | ||
} | ||
|
||
public void start() { | ||
levels.peek().start(); | ||
} | ||
|
||
public void stop() { | ||
levels.peek().stop(); | ||
} | ||
} |
Oops, something went wrong.