Arena system and some changes (not finished)
This commit is contained in:
24
src/main/java/rip/tilly/bedwars/game/Game.java
Normal file
24
src/main/java/rip/tilly/bedwars/game/Game.java
Normal file
@ -0,0 +1,24 @@
|
||||
package rip.tilly.bedwars.game;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by Lucanius
|
||||
* Project: BedWars
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class Game {
|
||||
|
||||
private final UUID gameId = UUID.randomUUID();
|
||||
private final List<GameTeam> teams;
|
||||
|
||||
public Game(GameTeam... teams) {
|
||||
this.teams = Arrays.asList(teams);
|
||||
}
|
||||
}
|
50
src/main/java/rip/tilly/bedwars/game/GameTeam.java
Normal file
50
src/main/java/rip/tilly/bedwars/game/GameTeam.java
Normal file
@ -0,0 +1,50 @@
|
||||
package rip.tilly.bedwars.game;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.entity.Player;
|
||||
import rip.tilly.bedwars.BedWars;
|
||||
import rip.tilly.bedwars.player.PlayerTeam;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Created by Lucanius
|
||||
* Project: BedWars
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class GameTeam {
|
||||
|
||||
protected final BedWars plugin = BedWars.getInstance();
|
||||
|
||||
private final List<UUID> allPlayers;
|
||||
private final List<UUID> playingPlayers = new ArrayList<>();
|
||||
private UUID leader;
|
||||
|
||||
private final PlayerTeam playerTeam;
|
||||
|
||||
public GameTeam(UUID leader, List<UUID> allPlayers, PlayerTeam playerTeam) {
|
||||
this.leader = leader;
|
||||
this.allPlayers = allPlayers;
|
||||
this.playingPlayers.addAll(allPlayers);
|
||||
|
||||
this.playerTeam = playerTeam;
|
||||
}
|
||||
|
||||
public void removePlayer(UUID uuid) {
|
||||
this.playingPlayers.remove(uuid);
|
||||
}
|
||||
|
||||
public Stream<Player> allPlayers() {
|
||||
return this.allPlayers.stream().map(this.plugin.getServer()::getPlayer).filter(Objects::nonNull);
|
||||
}
|
||||
|
||||
public Stream<Player> playingPlayers() {
|
||||
return this.playingPlayers.stream().map(this.plugin.getServer()::getPlayer).filter(Objects::nonNull);
|
||||
}
|
||||
}
|
60
src/main/java/rip/tilly/bedwars/game/arena/Arena.java
Normal file
60
src/main/java/rip/tilly/bedwars/game/arena/Arena.java
Normal file
@ -0,0 +1,60 @@
|
||||
package rip.tilly.bedwars.game.arena;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import rip.tilly.bedwars.utils.CustomLocation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
/**
|
||||
* Created by Lucanius
|
||||
* Project: BedWars
|
||||
*/
|
||||
public class Arena {
|
||||
|
||||
private final String name;
|
||||
|
||||
private List<CopiedArena> copiedArenas;
|
||||
private List<CopiedArena> availableArenas;
|
||||
|
||||
private String icon;
|
||||
private int iconData;
|
||||
|
||||
private CustomLocation a;
|
||||
private CustomLocation b;
|
||||
|
||||
private CustomLocation min;
|
||||
private CustomLocation max;
|
||||
|
||||
private CustomLocation teamAmin;
|
||||
private CustomLocation teamAmax;
|
||||
|
||||
private CustomLocation teamBmin;
|
||||
private CustomLocation teamBmax;
|
||||
|
||||
private int deadZone;
|
||||
private int buildMax;
|
||||
|
||||
private boolean enabled;
|
||||
|
||||
public CopiedArena getAvailableArena() {
|
||||
CopiedArena copiedArena = this.availableArenas.get(0);
|
||||
this.availableArenas.remove(0);
|
||||
|
||||
return copiedArena;
|
||||
}
|
||||
|
||||
public void addCopiedArena(CopiedArena copiedArena) {
|
||||
this.copiedArenas.add(copiedArena);
|
||||
}
|
||||
|
||||
public void addAvailableArena(CopiedArena copiedArena) {
|
||||
this.availableArenas.add(copiedArena);
|
||||
}
|
||||
}
|
30
src/main/java/rip/tilly/bedwars/game/arena/CopiedArena.java
Normal file
30
src/main/java/rip/tilly/bedwars/game/arena/CopiedArena.java
Normal file
@ -0,0 +1,30 @@
|
||||
package rip.tilly.bedwars.game.arena;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import rip.tilly.bedwars.utils.CustomLocation;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
/**
|
||||
* Created by Lucanius
|
||||
* Project: BedWars
|
||||
*/
|
||||
public class CopiedArena {
|
||||
|
||||
private CustomLocation a;
|
||||
private CustomLocation b;
|
||||
|
||||
private CustomLocation min;
|
||||
private CustomLocation max;
|
||||
|
||||
private CustomLocation teamAmin;
|
||||
private CustomLocation teamAmax;
|
||||
|
||||
private CustomLocation teamBmin;
|
||||
private CustomLocation teamBmax;
|
||||
}
|
Reference in New Issue
Block a user