56 lines
1.3 KiB
Java
56 lines
1.3 KiB
Java
package net.crankedpvp.tournaments.struct;
|
|
|
|
import lombok.Getter;
|
|
import lombok.Setter;
|
|
import net.crankedpvp.crankedutils.utils.CC;
|
|
import net.crankedpvp.storageutils.struct.NewKeyToSave;
|
|
import net.crankedpvp.tournaments.TournamentsPlugin;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.entity.Player;
|
|
|
|
import java.util.UUID;
|
|
|
|
@Getter
|
|
public class TournamentPlayer implements NewKeyToSave<UUID> {
|
|
|
|
private UUID playerUUID;
|
|
|
|
@Setter
|
|
private boolean inTournament;
|
|
|
|
@Setter
|
|
private boolean alive;
|
|
|
|
public TournamentPlayer(UUID uuid) {
|
|
this.playerUUID = uuid;
|
|
this.alive = false;
|
|
this.inTournament = false;
|
|
}
|
|
|
|
public Player getPlayer() {
|
|
return Bukkit.getPlayer(this.playerUUID);
|
|
}
|
|
|
|
public void sendMessage(String message) {
|
|
this.getPlayer().sendMessage(CC.translate(message));
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
public UUID getKey() {
|
|
return this.playerUUID;
|
|
}
|
|
|
|
@Override
|
|
public void setKey(UUID uuid) {
|
|
this.playerUUID = uuid;
|
|
}
|
|
|
|
public void kill() {
|
|
this.setAlive(false);
|
|
this.getPlayer().teleport(TournamentsPlugin.getInstance().getTournamentManager().getWaitingRoomLocation());
|
|
this.sendMessage("&cYou have been eliminated from the tournament");
|
|
}
|
|
}
|