Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
783474c958
Commit
a9453aa859
@ -105,7 +105,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
techHider = new TechHiderWrapper();
|
techHider = new TechHiderWrapper();
|
||||||
new FightWorld();
|
new FightWorld();
|
||||||
new FightUI();
|
new FightUI();
|
||||||
//new FightStatistics();
|
new FightStatistics();
|
||||||
new BungeeFightInfo();
|
new BungeeFightInfo();
|
||||||
|
|
||||||
new WinconditionAllDead();
|
new WinconditionAllDead();
|
||||||
|
@ -51,7 +51,7 @@ public class InfoCommand implements CommandExecutor {
|
|||||||
FightSystem.getMessage().send("INFO_RANKED", player, !FightStatistics.isUnranked());
|
FightSystem.getMessage().send("INFO_RANKED", player, !FightStatistics.isUnranked());
|
||||||
for(FightTeam team : Fight.teams()) {
|
for(FightTeam team : Fight.teams()) {
|
||||||
if(!team.isLeaderless())
|
if(!team.isLeaderless())
|
||||||
FightSystem.getMessage().send("INFO_LEADER", player, team.getColoredName(), team.getLeader().getPlayer().getName());
|
FightSystem.getMessage().send("INFO_LEADER", player, team.getColoredName(), team.getLeader().getEntity().getName());
|
||||||
|
|
||||||
if(team.getSchematic() != 0) {
|
if(team.getSchematic() != 0) {
|
||||||
SchematicNode schematic = SchematicNode.getSchematicNode(team.getSchematic());
|
SchematicNode schematic = SchematicNode.getSchematicNode(team.getSchematic());
|
||||||
|
@ -57,18 +57,18 @@ public class EnternCountdown extends Countdown {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void countdownFinished() {
|
public void countdownFinished() {
|
||||||
FightSystem.getMessage().sendPrefixless("ENTERN_ALLOWED", fightPlayer.getPlayer(), ChatMessageType.ACTION_BAR);
|
FightSystem.getMessage().sendPrefixless("ENTERN_ALLOWED", fightPlayer.getEntity(), ChatMessageType.ACTION_BAR);
|
||||||
fightPlayer.withPlayer(player -> FightSystem.getTechHider().reloadChunks(player, chunkPos, false));
|
fightPlayer.ifPlayer(player -> FightSystem.getTechHider().reloadChunks(player, chunkPos, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void prepareFinish() {
|
protected void prepareFinish() {
|
||||||
chunkPos = FightSystem.getTechHider().prepareChunkReload(fightPlayer.getPlayer(), false);
|
chunkPos = FightSystem.getTechHider().prepareChunkReload(fightPlayer.getEntity(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void broadcast(String message, int divisor) {
|
protected void broadcast(String message, int divisor) {
|
||||||
fightPlayer.withPlayer(player -> {
|
fightPlayer.ifPlayer(player -> {
|
||||||
player.playSound(player.getLocation(), sound, 100.0f, 1.0f);
|
player.playSound(player.getLocation(), sound, 100.0f, 1.0f);
|
||||||
sendCountdownMessage(player, message, time / divisor, appendix);
|
sendCountdownMessage(player, message, time / divisor, appendix);
|
||||||
});
|
});
|
||||||
|
@ -76,14 +76,14 @@ public class FightPlayer {
|
|||||||
enternCountdown = null;
|
enternCountdown = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LivingEntity getPlayer() {
|
public LivingEntity getEntity() {
|
||||||
Player bukkit = Bukkit.getPlayer(uuid);
|
Player bukkit = Bukkit.getPlayer(uuid);
|
||||||
if(bukkit != null)
|
if(bukkit != null)
|
||||||
entity = bukkit;
|
entity = bukkit;
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void withPlayer(Consumer<Player> function) {
|
public void ifPlayer(Consumer<Player> function) {
|
||||||
if(entity instanceof Player)
|
if(entity instanceof Player)
|
||||||
function.accept((Player) entity);
|
function.accept((Player) entity);
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ public class FightPlayer {
|
|||||||
|
|
||||||
public boolean isLeader() {
|
public boolean isLeader() {
|
||||||
FightPlayer leader = team.getLeader();
|
FightPlayer leader = team.getLeader();
|
||||||
return leader != null && leader.getPlayer() == entity;
|
return leader != null && leader.getEntity() == entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Kit getKit() {
|
public Kit getKit() {
|
||||||
|
@ -135,7 +135,7 @@ public class FightTeam {
|
|||||||
new OneShotStateDependent(Config.replayserver(), FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
new OneShotStateDependent(Config.replayserver(), FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||||
new OneShotStateDependent(ArenaMode.All, FightState.PostSchemSetup, () -> {
|
new OneShotStateDependent(ArenaMode.All, FightState.PostSchemSetup, () -> {
|
||||||
if(leader != null)
|
if(leader != null)
|
||||||
leader.withPlayer(notReadyKit::loadToPlayer);
|
leader.ifPlayer(notReadyKit::loadToPlayer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ public class FightTeam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void teleportToSpawn(){
|
public void teleportToSpawn(){
|
||||||
players.forEach((player, fp) -> fp.getPlayer().teleport(spawn));
|
players.forEach((player, fp) -> fp.getEntity().teleport(spawn));
|
||||||
}
|
}
|
||||||
|
|
||||||
public FightPlayer getFightPlayer(LivingEntity player) {
|
public FightPlayer getFightPlayer(LivingEntity player) {
|
||||||
@ -191,7 +191,7 @@ public class FightTeam {
|
|||||||
|
|
||||||
public boolean isPlayerLeader(LivingEntity player) {
|
public boolean isPlayerLeader(LivingEntity player) {
|
||||||
if(leader != null)
|
if(leader != null)
|
||||||
return leader.getPlayer().equals(player);
|
return leader.getEntity().equals(player);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ public class FightTeam {
|
|||||||
for(UUID uuid : playerSet){
|
for(UUID uuid : playerSet){
|
||||||
LivingEntity player = (LivingEntity) Bukkit.getEntity(uuid);
|
LivingEntity player = (LivingEntity) Bukkit.getEntity(uuid);
|
||||||
if(player == null)
|
if(player == null)
|
||||||
removePlayer(players.get(uuid).getPlayer());
|
removePlayer(players.get(uuid).getEntity());
|
||||||
}
|
}
|
||||||
FightPlayer leaderBackup = leader;
|
FightPlayer leaderBackup = leader;
|
||||||
playerSet.removeIf(uuid -> Bukkit.getEntity(uuid) == null);
|
playerSet.removeIf(uuid -> Bukkit.getEntity(uuid) == null);
|
||||||
@ -213,8 +213,8 @@ public class FightTeam {
|
|||||||
leader = null;
|
leader = null;
|
||||||
|
|
||||||
if(leaderBackup != null){
|
if(leaderBackup != null){
|
||||||
playerSet.remove(leaderBackup.getPlayer().getUniqueId());
|
playerSet.remove(leaderBackup.getEntity().getUniqueId());
|
||||||
addMember(leaderBackup.getPlayer(), true);
|
addMember(leaderBackup.getEntity(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
playerSet.forEach(uuid -> addMember((LivingEntity) Bukkit.getEntity(uuid), true));
|
playerSet.forEach(uuid -> addMember((LivingEntity) Bukkit.getEntity(uuid), true));
|
||||||
@ -266,7 +266,7 @@ public class FightTeam {
|
|||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
player.teleport(spawn);
|
player.teleport(spawn);
|
||||||
|
|
||||||
fightPlayer.withPlayer(p -> {
|
fightPlayer.ifPlayer(p -> {
|
||||||
BountifulWrapper.impl.setAttackSpeed(p);
|
BountifulWrapper.impl.setAttackSpeed(p);
|
||||||
p.setFoodLevel(20);
|
p.setFoodLevel(20);
|
||||||
p.getInventory().clear();
|
p.getInventory().clear();
|
||||||
@ -283,7 +283,7 @@ public class FightTeam {
|
|||||||
fightPlayer.startEnternCountdown();
|
fightPlayer.startEnternCountdown();
|
||||||
|
|
||||||
GlobalRecorder.getInstance().playerJoins(player);
|
GlobalRecorder.getInstance().playerJoins(player);
|
||||||
fightPlayer.withPlayer(p -> FightSystem.getTechHider().reloadChunks(p, chunksToReload, false));
|
fightPlayer.ifPlayer(p -> FightSystem.getTechHider().reloadChunks(p, chunksToReload, false));
|
||||||
|
|
||||||
if(isLeaderless())
|
if(isLeaderless())
|
||||||
setLeader(fightPlayer, silent);
|
setLeader(fightPlayer, silent);
|
||||||
@ -294,7 +294,7 @@ public class FightTeam {
|
|||||||
public void removePlayer(LivingEntity player) {
|
public void removePlayer(LivingEntity player) {
|
||||||
FightPlayer fightPlayer = getFightPlayer(player);
|
FightPlayer fightPlayer = getFightPlayer(player);
|
||||||
|
|
||||||
fightPlayer.withPlayer(PersonalKitCreator::closeIfInKitCreator);
|
fightPlayer.ifPlayer(PersonalKitCreator::closeIfInKitCreator);
|
||||||
List<ProtocolUtils.ChunkPos> chunksToReload = FightSystem.getTechHider().prepareChunkReload(player, true);
|
List<ProtocolUtils.ChunkPos> chunksToReload = FightSystem.getTechHider().prepareChunkReload(player, true);
|
||||||
players.remove(player.getUniqueId());
|
players.remove(player.getUniqueId());
|
||||||
team.removeEntry(player.getName());
|
team.removeEntry(player.getName());
|
||||||
@ -308,7 +308,7 @@ public class FightTeam {
|
|||||||
GlobalRecorder.getInstance().entityDespawns(player);
|
GlobalRecorder.getInstance().entityDespawns(player);
|
||||||
player.teleport(Config.SpecSpawn);
|
player.teleport(Config.SpecSpawn);
|
||||||
|
|
||||||
fightPlayer.withPlayer(p -> {
|
fightPlayer.ifPlayer(p -> {
|
||||||
Fight.setPlayerGamemode(p, GameMode.SPECTATOR);
|
Fight.setPlayerGamemode(p, GameMode.SPECTATOR);
|
||||||
p.getInventory().clear();
|
p.getInventory().clear();
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ public class FightTeam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setLeader(FightPlayer leader, boolean silent) {
|
private void setLeader(FightPlayer leader, boolean silent) {
|
||||||
leader.withPlayer(PersonalKitCreator::closeIfInKitCreator);
|
leader.ifPlayer(PersonalKitCreator::closeIfInKitCreator);
|
||||||
|
|
||||||
this.leader = leader;
|
this.leader = leader;
|
||||||
designatedLeader = null;
|
designatedLeader = null;
|
||||||
@ -351,9 +351,9 @@ public class FightTeam {
|
|||||||
setReady(false);
|
setReady(false);
|
||||||
|
|
||||||
if(!silent)
|
if(!silent)
|
||||||
FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getPlayer().getName());
|
FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getEntity().getName());
|
||||||
|
|
||||||
Optional<Integer> maxRank = SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(leader.getPlayer().getUniqueId()).getId(), Config.SchematicType.toDB()).stream().map(SchematicNode::getRank).max(Integer::compare);
|
Optional<Integer> maxRank = SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(leader.getEntity().getUniqueId()).getId(), Config.SchematicType.toDB()).stream().map(SchematicNode::getRank).max(Integer::compare);
|
||||||
if(Config.RanksEnabled)
|
if(Config.RanksEnabled)
|
||||||
schemRank = maxRank.orElse(1);
|
schemRank = maxRank.orElse(1);
|
||||||
else
|
else
|
||||||
@ -362,7 +362,7 @@ public class FightTeam {
|
|||||||
if(!Config.PersonalKits)
|
if(!Config.PersonalKits)
|
||||||
leader.setKit(Kit.getKitByName(Config.LeaderDefault));
|
leader.setKit(Kit.getKitByName(Config.LeaderDefault));
|
||||||
|
|
||||||
leader.withPlayer(player -> {
|
leader.ifPlayer(player -> {
|
||||||
if(FightState.getFightState() != FightState.POST_SCHEM_SETUP)
|
if(FightState.getFightState() != FightState.POST_SCHEM_SETUP)
|
||||||
chooseSchemKit.loadToPlayer(player);
|
chooseSchemKit.loadToPlayer(player);
|
||||||
else
|
else
|
||||||
@ -414,7 +414,7 @@ public class FightTeam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setReady(boolean ready) {
|
public void setReady(boolean ready) {
|
||||||
LivingEntity l = leader.getPlayer();
|
LivingEntity l = leader.getEntity();
|
||||||
|
|
||||||
if(!schematic.hasSchematic()){
|
if(!schematic.hasSchematic()){
|
||||||
FightSystem.getMessage().sendPrefixless("SCHEMATIC_REQUIRED", l, ChatMessageType.ACTION_BAR);
|
FightSystem.getMessage().sendPrefixless("SCHEMATIC_REQUIRED", l, ChatMessageType.ACTION_BAR);
|
||||||
@ -424,12 +424,12 @@ public class FightTeam {
|
|||||||
this.ready = ready;
|
this.ready = ready;
|
||||||
if(ready) {
|
if(ready) {
|
||||||
broadcast("TEAM_READY");
|
broadcast("TEAM_READY");
|
||||||
leader.withPlayer(readyKit::loadToPlayer);
|
leader.ifPlayer(readyKit::loadToPlayer);
|
||||||
if(Fight.getOpposite(this).isReady() || ArenaMode.SoloLeader.contains(Config.mode))
|
if(Fight.getOpposite(this).isReady() || ArenaMode.SoloLeader.contains(Config.mode))
|
||||||
FightState.setFightState(FightState.PRE_RUNNING);
|
FightState.setFightState(FightState.PRE_RUNNING);
|
||||||
} else {
|
} else {
|
||||||
broadcast("TEAM_NOT_READY");
|
broadcast("TEAM_NOT_READY");
|
||||||
leader.withPlayer(notReadyKit::loadToPlayer);
|
leader.ifPlayer(notReadyKit::loadToPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ public class FightTeam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getCurrentHearts() {
|
public double getCurrentHearts() {
|
||||||
return players.values().stream().filter(FightPlayer::isLiving).mapToDouble(fp -> fp.getPlayer().getHealth()).sum();
|
return players.values().stream().filter(FightPlayer::isLiving).mapToDouble(fp -> fp.getEntity().getHealth()).sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getHeartRatio(){
|
public double getHeartRatio(){
|
||||||
@ -502,7 +502,7 @@ public class FightTeam {
|
|||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
for(FightPlayer fightPlayer : players.values()) {
|
for(FightPlayer fightPlayer : players.values()) {
|
||||||
fightPlayer.withPlayer(player -> {
|
fightPlayer.ifPlayer(player -> {
|
||||||
PersonalKitCreator.closeIfInKitCreator(player);
|
PersonalKitCreator.closeIfInKitCreator(player);
|
||||||
|
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
@ -513,7 +513,7 @@ public class FightTeam {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
players.values().forEach(fightPlayer -> fightPlayer.withPlayer(p -> p.getInventory().clear()));
|
players.values().forEach(fightPlayer -> fightPlayer.ifPlayer(p -> p.getInventory().clear()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,14 +526,14 @@ public class FightTeam {
|
|||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
players.values().forEach(fightPlayer -> {
|
players.values().forEach(fightPlayer -> {
|
||||||
fightPlayer.withPlayer(player -> Fight.setPlayerGamemode(player, GameMode.SPECTATOR));
|
fightPlayer.ifPlayer(player -> Fight.setPlayerGamemode(player, GameMode.SPECTATOR));
|
||||||
fightPlayer.getPlayer().teleport(FightTeam.this.spawn);
|
fightPlayer.getEntity().teleport(FightTeam.this.spawn);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
players.values().forEach(fightPlayer -> fightPlayer.withPlayer(player -> Fight.setPlayerGamemode(player, GameMode.SURVIVAL)));
|
players.values().forEach(fightPlayer -> fightPlayer.ifPlayer(player -> Fight.setPlayerGamemode(player, GameMode.SURVIVAL)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,10 +68,10 @@ public class JoinRequest {
|
|||||||
if(leader == null)
|
if(leader == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(leader.getPlayer() == null)
|
if(leader.getEntity() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
leader.withPlayer(leaderPlayer -> FightSystem.getMessage().sendPrefixless("JOIN_REQUEST_NOTIFICATION", leaderPlayer, "REQUESTS", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/requests"), player.getName(), team.getColoredName()));
|
leader.ifPlayer(leaderPlayer -> FightSystem.getMessage().sendPrefixless("JOIN_REQUEST_NOTIFICATION", leaderPlayer, "REQUESTS", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/requests"), player.getName(), team.getColoredName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
activeRequests.put(player, this);
|
activeRequests.put(player, this);
|
||||||
|
@ -46,14 +46,14 @@ public class IngameDeath implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void broadcastDeath(EntityDeathEvent event) {
|
public void broadcastDeath(EntityDeathEvent event) {
|
||||||
onPlayerEnd(event.getEntity(), fightPlayer -> {
|
onPlayerEnd(event.getEntity(), fightPlayer -> {
|
||||||
FightUI.addSubtitle("UI_PLAYER_DEATH", fightPlayer.getTeam().getPrefix(), fightPlayer.getPlayer().getName());
|
FightUI.addSubtitle("UI_PLAYER_DEATH", fightPlayer.getTeam().getPrefix(), fightPlayer.getEntity().getName());
|
||||||
Fight.playSound(SWSound.ENTITY_WITHER_DEATH.getSound(), 100.0F, 1.0F);
|
Fight.playSound(SWSound.ENTITY_WITHER_DEATH.getSound(), 100.0F, 1.0F);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void broadcastQuit(PlayerQuitEvent event) {
|
public void broadcastQuit(PlayerQuitEvent event) {
|
||||||
onPlayerEnd(event.getPlayer(), fightPlayer -> FightUI.addSubtitle("UI_PLAYER_LEAVE", fightPlayer.getTeam().getPrefix(), fightPlayer.getPlayer().getName()));
|
onPlayerEnd(event.getPlayer(), fightPlayer -> FightUI.addSubtitle("UI_PLAYER_LEAVE", fightPlayer.getTeam().getPrefix(), fightPlayer.getEntity().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
@ -284,7 +284,7 @@ public class Recording implements Listener {
|
|||||||
if(!fp.isLiving())
|
if(!fp.isLiving())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fp.withPlayer(player -> {
|
fp.ifPlayer(player -> {
|
||||||
BountifulWrapper.impl.recordHandItems(player);
|
BountifulWrapper.impl.recordHandItems(player);
|
||||||
GlobalRecorder.getInstance().item(player, disarmNull(player.getInventory().getHelmet()), "HEAD");
|
GlobalRecorder.getInstance().item(player, disarmNull(player.getInventory().getHelmet()), "HEAD");
|
||||||
GlobalRecorder.getInstance().item(player, disarmNull(player.getInventory().getChestplate()), "CHEST");
|
GlobalRecorder.getInstance().item(player, disarmNull(player.getInventory().getChestplate()), "CHEST");
|
||||||
@ -297,7 +297,7 @@ public class Recording implements Listener {
|
|||||||
private void despawnTeam(FightTeam team){
|
private void despawnTeam(FightTeam team){
|
||||||
for(FightPlayer player : team.getPlayers()){
|
for(FightPlayer player : team.getPlayers()){
|
||||||
if(player.isLiving())
|
if(player.isLiving())
|
||||||
GlobalRecorder.getInstance().entityDespawns(player.getPlayer());
|
GlobalRecorder.getInstance().entityDespawns(player.getEntity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public interface Recorder {
|
|||||||
if(FightState.AntiSpectate.contains(FightState.getFightState())){
|
if(FightState.AntiSpectate.contains(FightState.getFightState())){
|
||||||
for(FightPlayer player : team.getPlayers()){
|
for(FightPlayer player : team.getPlayers()){
|
||||||
if(player.isLiving()){
|
if(player.isLiving()){
|
||||||
playerJoins(player.getPlayer());
|
playerJoins(player.getEntity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,12 +52,12 @@ public class BungeeFightInfo {
|
|||||||
Fight.getRedTeam().getColoredName(),
|
Fight.getRedTeam().getColoredName(),
|
||||||
FightState.getFightState().name(),
|
FightState.getFightState().name(),
|
||||||
StateDependentCountdown.getMainCountdown() != null ? StateDependentCountdown.getMainCountdown().getTimeLeft() : 0,
|
StateDependentCountdown.getMainCountdown() != null ? StateDependentCountdown.getMainCountdown().getTimeLeft() : 0,
|
||||||
Fight.getBlueTeam().getLeader() != null ? SteamwarUser.get(Fight.getBlueTeam().getLeader().getPlayer().getUniqueId()).getId() : 0,
|
Fight.getBlueTeam().getLeader() != null ? SteamwarUser.get(Fight.getBlueTeam().getLeader().getEntity().getUniqueId()).getId() : 0,
|
||||||
Fight.getRedTeam().getLeader() != null ? SteamwarUser.get(Fight.getRedTeam().getLeader().getPlayer().getUniqueId()).getId() : 0,
|
Fight.getRedTeam().getLeader() != null ? SteamwarUser.get(Fight.getRedTeam().getLeader().getEntity().getUniqueId()).getId() : 0,
|
||||||
Fight.getBlueTeam().getSchematic(),
|
Fight.getBlueTeam().getSchematic(),
|
||||||
Fight.getRedTeam().getSchematic(),
|
Fight.getRedTeam().getSchematic(),
|
||||||
Fight.getBlueTeam().getPlayers().stream().map(p -> SteamwarUser.get(p.getPlayer().getUniqueId()).getId()).collect(Collectors.toList()),
|
Fight.getBlueTeam().getPlayers().stream().map(p -> SteamwarUser.get(p.getEntity().getUniqueId()).getId()).collect(Collectors.toList()),
|
||||||
Fight.getRedTeam().getPlayers().stream().map(p -> SteamwarUser.get(p.getPlayer().getUniqueId()).getId()).collect(Collectors.toList()),
|
Fight.getRedTeam().getPlayers().stream().map(p -> SteamwarUser.get(p.getEntity().getUniqueId()).getId()).collect(Collectors.toList()),
|
||||||
Bukkit.getOnlinePlayers().stream().filter(p -> Fight.getPlayerTeam(p) == null).map(p -> SteamwarUser.get(p.getUniqueId()).getId()).collect(Collectors.toList())
|
Bukkit.getOnlinePlayers().stream().filter(p -> Fight.getPlayerTeam(p) == null).map(p -> SteamwarUser.get(p.getUniqueId()).getId()).collect(Collectors.toList())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ public class FightStatistics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Bukkit.getOnlinePlayers().isEmpty() && !unranked) {
|
if (!Bukkit.getOnlinePlayers().isEmpty() && !unranked) {
|
||||||
NetworkSender.send(new FightEndsPacket((byte) win, blueSchem == null ? 0 : blueSchem, redSchem == null ? 0 : redSchem, Fight.getBlueTeam().getPlayers().stream().map(FightPlayer::getPlayer).map(p -> SteamwarUser.get(p.getUniqueId())).map(SteamwarUser::getId).collect(Collectors.toList()), Fight.getRedTeam().getPlayers().stream().map(FightPlayer::getPlayer).map(p -> SteamwarUser.get(p.getUniqueId())).map(SteamwarUser::getId).collect(Collectors.toList()), gameMode, (int)(endTime.getEpochSecond() - starttime.toInstant().getEpochSecond())));
|
NetworkSender.send(new FightEndsPacket((byte) win, blueSchem == null ? 0 : blueSchem, redSchem == null ? 0 : redSchem, Fight.getBlueTeam().getPlayers().stream().map(FightPlayer::getEntity).map(p -> SteamwarUser.get(p.getUniqueId())).map(SteamwarUser::getId).collect(Collectors.toList()), Fight.getRedTeam().getPlayers().stream().map(FightPlayer::getEntity).map(p -> SteamwarUser.get(p.getUniqueId())).map(SteamwarUser::getId).collect(Collectors.toList()), gameMode, (int)(endTime.getEpochSecond() - starttime.toInstant().getEpochSecond())));
|
||||||
}
|
}
|
||||||
|
|
||||||
unranked = false;
|
unranked = false;
|
||||||
@ -144,14 +144,14 @@ public class FightStatistics {
|
|||||||
|
|
||||||
private int getLeader(FightTeam team) {
|
private int getLeader(FightTeam team) {
|
||||||
if (team.getLeader() != null)
|
if (team.getLeader() != null)
|
||||||
return SteamwarUser.get(team.getLeader().getPlayer().getUniqueId()).getId();
|
return SteamwarUser.get(team.getLeader().getEntity().getUniqueId()).getId();
|
||||||
else if (team.getDesignatedLeader() != null)
|
else if (team.getDesignatedLeader() != null)
|
||||||
return SteamwarUser.get(team.getDesignatedLeader()).getId();
|
return SteamwarUser.get(team.getDesignatedLeader()).getId();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void savePlayerStats(FightPlayer fp, int fightId) {
|
private void savePlayerStats(FightPlayer fp, int fightId) {
|
||||||
SteamwarUser user = SteamwarUser.get(fp.getPlayer().getUniqueId());
|
SteamwarUser user = SteamwarUser.get(fp.getEntity().getUniqueId());
|
||||||
de.steamwar.sql.FightPlayer.create(fightId, user.getId(), fp.getTeam().isBlue(), fp.getKit().getName(), fp.getKills(), !fp.isLiving());
|
de.steamwar.sql.FightPlayer.create(fightId, user.getId(), fp.getTeam().isBlue(), fp.getKit().getName(), fp.getKills(), !fp.isLiving());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class WinconditionAllDead extends Wincondition implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for(FightPlayer fp : team.getPlayers()) {
|
for(FightPlayer fp : team.getPlayers()) {
|
||||||
if(fp.isLiving() && fp.getPlayer() != player)
|
if(fp.isLiving() && fp.getEntity() != player)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +54,9 @@ public class WinconditionAmongUs extends Wincondition implements Listener {
|
|||||||
FightPlayer imposter = fightPlayerList.get(random.nextInt(fightPlayerList.size()));
|
FightPlayer imposter = fightPlayerList.get(random.nextInt(fightPlayerList.size()));
|
||||||
for (FightPlayer fightPlayer : fightPlayerList) {
|
for (FightPlayer fightPlayer : fightPlayerList) {
|
||||||
if (fightPlayer == imposter) {
|
if (fightPlayer == imposter) {
|
||||||
FightSystem.getMessage().send("AMONG_US_IMPOSTER_MESSAGE", fightPlayer.getPlayer());
|
FightSystem.getMessage().send("AMONG_US_IMPOSTER_MESSAGE", fightPlayer.getEntity());
|
||||||
} else {
|
} else {
|
||||||
FightSystem.getMessage().send("AMONG_US_IMPOSTER_AMONG_MESSAGE", fightPlayer.getPlayer());
|
FightSystem.getMessage().send("AMONG_US_IMPOSTER_AMONG_MESSAGE", fightPlayer.getEntity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return imposter;
|
return imposter;
|
||||||
|
@ -53,7 +53,7 @@ public class WinconditionCaptainDead extends Wincondition implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if(team.isPlayerLeader((LivingEntity) player)) {
|
if(team.isPlayerLeader((LivingEntity) player)) {
|
||||||
win(Fight.getOpposite(team), "WIN_LEADER_DEAD", team.getPrefix() + team.getLeader().getPlayer().getName());
|
win(Fight.getOpposite(team), "WIN_LEADER_DEAD", team.getPrefix() + team.getLeader().getEntity().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren