Bugfixes: No multiple player instances, spectator kit after death, confirmation message, allow request command while in team
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
98a376a62b
Commit
1a2eabaea4
@ -251,6 +251,7 @@ JOIN_REQUEST=§7Request join
|
|||||||
JOIN_REQUEST_TITLE=Request join
|
JOIN_REQUEST_TITLE=Request join
|
||||||
JOIN_REQUEST_ALREADY=§cYou have already sent a join request
|
JOIN_REQUEST_ALREADY=§cYou have already sent a join request
|
||||||
JOIN_REQUEST_TEAM=§eJoin {0}
|
JOIN_REQUEST_TEAM=§eJoin {0}
|
||||||
|
JOIN_REQUEST_CONFIRMATION=§7Join request submitted
|
||||||
JOIN_REQUEST_NOTIFICATION=§e{0} §7requests joining team {1}§8. §7Accept or decline using §8/§erequests
|
JOIN_REQUEST_NOTIFICATION=§e{0} §7requests joining team {1}§8. §7Accept or decline using §8/§erequests
|
||||||
|
|
||||||
REQUESTS=§7Open join requests
|
REQUESTS=§7Open join requests
|
||||||
|
@ -235,6 +235,7 @@ JOIN_REQUEST=§7Teambeitritt anfragen
|
|||||||
JOIN_REQUEST_TITLE=Teambeitritt anfragen
|
JOIN_REQUEST_TITLE=Teambeitritt anfragen
|
||||||
JOIN_REQUEST_ALREADY=§cDu hast bereits ein Team um Beitritt angefragt
|
JOIN_REQUEST_ALREADY=§cDu hast bereits ein Team um Beitritt angefragt
|
||||||
JOIN_REQUEST_TEAM={0} §ebeitreten
|
JOIN_REQUEST_TEAM={0} §ebeitreten
|
||||||
|
JOIN_REQUEST_CONFIRMATION=§7Teambeitritt angefragt
|
||||||
JOIN_REQUEST_NOTIFICATION=§e{0} §7möchte Team {1} §7beitreten§8. §7Akzeptiere oder lehne ab mit §8/§erequests
|
JOIN_REQUEST_NOTIFICATION=§e{0} §7möchte Team {1} §7beitreten§8. §7Akzeptiere oder lehne ab mit §8/§erequests
|
||||||
|
|
||||||
REQUESTS=§7Offene Beitrittsanfragen
|
REQUESTS=§7Offene Beitrittsanfragen
|
||||||
|
@ -22,6 +22,7 @@ package de.steamwar.fightsystem.commands;
|
|||||||
import de.steamwar.fightsystem.ArenaMode;
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
import de.steamwar.fightsystem.fight.Fight;
|
import de.steamwar.fightsystem.fight.Fight;
|
||||||
|
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
import de.steamwar.fightsystem.fight.JoinRequest;
|
import de.steamwar.fightsystem.fight.JoinRequest;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
@ -36,7 +37,8 @@ import java.util.function.BiConsumer;
|
|||||||
public class RequestsCommand implements CommandExecutor {
|
public class RequestsCommand implements CommandExecutor {
|
||||||
|
|
||||||
public RequestsCommand() {
|
public RequestsCommand() {
|
||||||
new StateDependentCommand(ArenaMode.VariableTeams, FightState.Setup, "requests", this);
|
new StateDependentCommand(ArenaMode.VariableTeams, FightState.AntiSpectate, "request", this);
|
||||||
|
new StateDependentCommand(ArenaMode.VariableTeams, FightState.AntiSpectate, "requests", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -44,6 +46,11 @@ public class RequestsCommand implements CommandExecutor {
|
|||||||
if(!(sender instanceof Player))
|
if(!(sender instanceof Player))
|
||||||
return false;
|
return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
FightPlayer fp = Fight.getFightPlayer(player);
|
||||||
|
if(fp == null || !(fp.isLeader() || fp.isLiving())) {
|
||||||
|
GUI.joinRequest(player);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(Commands.checkGetLeader(player) == null)
|
if(Commands.checkGetLeader(player) == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -23,11 +23,15 @@ import de.steamwar.fightsystem.Config;
|
|||||||
import de.steamwar.fightsystem.countdown.EnternCountdown;
|
import de.steamwar.fightsystem.countdown.EnternCountdown;
|
||||||
import de.steamwar.sql.PersonalKit;
|
import de.steamwar.sql.PersonalKit;
|
||||||
import de.steamwar.sql.SteamwarUser;
|
import de.steamwar.sql.SteamwarUser;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class FightPlayer {
|
public class FightPlayer {
|
||||||
|
|
||||||
private final Player player;
|
private final UUID uuid;
|
||||||
|
private Player player;
|
||||||
private final FightTeam team;
|
private final FightTeam team;
|
||||||
private boolean isOut;
|
private boolean isOut;
|
||||||
private Kit kit;
|
private Kit kit;
|
||||||
@ -35,6 +39,7 @@ public class FightPlayer {
|
|||||||
private EnternCountdown enternCountdown = null;
|
private EnternCountdown enternCountdown = null;
|
||||||
|
|
||||||
FightPlayer(Player player, FightTeam team) {
|
FightPlayer(Player player, FightTeam team) {
|
||||||
|
this.uuid = player.getUniqueId();
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.team = team;
|
this.team = team;
|
||||||
this.isOut = false;
|
this.isOut = false;
|
||||||
@ -70,7 +75,10 @@ public class FightPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return this.player;
|
Player bukkit = Bukkit.getPlayer(uuid);
|
||||||
|
if(bukkit != player)
|
||||||
|
player = bukkit;
|
||||||
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLiving() {
|
public boolean isLiving() {
|
||||||
|
@ -46,6 +46,7 @@ import org.bukkit.scoreboard.NameTagVisibility;
|
|||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
|
||||||
public class FightTeam {
|
public class FightTeam {
|
||||||
@ -90,7 +91,7 @@ public class FightTeam {
|
|||||||
private FightPlayer leader;
|
private FightPlayer leader;
|
||||||
private int schemRank;
|
private int schemRank;
|
||||||
|
|
||||||
private final Map<Player, FightPlayer> players = new HashMap<>();
|
private final Map<UUID, FightPlayer> players = new HashMap<>();
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String prefix;
|
private String prefix;
|
||||||
@ -164,11 +165,11 @@ public class FightTeam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void teleportToSpawn(){
|
public void teleportToSpawn(){
|
||||||
players.forEach((player, fp) -> player.teleport(spawn));
|
players.forEach((player, fp) -> Objects.requireNonNull(Bukkit.getPlayer(player)).teleport(spawn));
|
||||||
}
|
}
|
||||||
|
|
||||||
public FightPlayer getFightPlayer(Player player) {
|
public FightPlayer getFightPlayer(Player player) {
|
||||||
return players.get(player);
|
return players.get(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean allPlayersOut() {
|
public boolean allPlayersOut() {
|
||||||
@ -180,7 +181,7 @@ public class FightTeam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerInTeam(Player player) {
|
public boolean isPlayerInTeam(Player player) {
|
||||||
return players.containsKey(player);
|
return players.containsKey(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlayerEntern(Player player) {
|
public boolean canPlayerEntern(Player player) {
|
||||||
@ -199,22 +200,23 @@ public class FightTeam {
|
|||||||
ready = false;
|
ready = false;
|
||||||
schematic.reset();
|
schematic.reset();
|
||||||
|
|
||||||
Set<Player> playerSet = new HashSet<>(players.keySet());
|
Set<UUID> playerSet = new HashSet<>(players.keySet());
|
||||||
for(Player player : playerSet){
|
for(UUID uuid : playerSet){
|
||||||
if(!Bukkit.getOnlinePlayers().contains(player))
|
Player player = Bukkit.getPlayer(uuid);
|
||||||
|
if(player != null)
|
||||||
removePlayer(player);
|
removePlayer(player);
|
||||||
}
|
}
|
||||||
FightPlayer leaderBackup = leader;
|
FightPlayer leaderBackup = leader;
|
||||||
playerSet.removeIf(player -> !Bukkit.getOnlinePlayers().contains(player));
|
playerSet.removeIf(uuid -> Bukkit.getPlayer(uuid) == null);
|
||||||
players.clear();
|
players.clear();
|
||||||
leader = null;
|
leader = null;
|
||||||
|
|
||||||
if(leaderBackup != null){
|
if(leaderBackup != null){
|
||||||
playerSet.remove(leaderBackup.getPlayer());
|
playerSet.remove(leaderBackup.getPlayer().getUniqueId());
|
||||||
addMember(leaderBackup.getPlayer(), true);
|
addMember(leaderBackup.getPlayer(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
playerSet.forEach(p -> addMember(p, true));
|
playerSet.forEach(uuid -> addMember(Bukkit.getPlayer(uuid), true));
|
||||||
|
|
||||||
if(ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()){
|
if(ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()){
|
||||||
List<Player> onlinePlayers = new ArrayList<>(Bukkit.getOnlinePlayers());
|
List<Player> onlinePlayers = new ArrayList<>(Bukkit.getOnlinePlayers());
|
||||||
@ -229,15 +231,23 @@ public class FightTeam {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void broadcast(String message, Object... params) {
|
public void broadcast(String message, Object... params) {
|
||||||
players.forEach((player, fp) -> FightSystem.getMessage().sendPrefixless(message, player, ChatMessageType.ACTION_BAR, params));
|
broadcast(player -> FightSystem.getMessage().sendPrefixless(message, player, ChatMessageType.ACTION_BAR, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastSystem(String message, Object... params) {
|
public void broadcastSystem(String message, Object... params) {
|
||||||
players.forEach((player, fp) -> FightSystem.getMessage().send(message, player, params));
|
broadcast(player -> FightSystem.getMessage().send(message, player, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastChat(Player sender, String message) {
|
public void broadcastChat(Player sender, String message) {
|
||||||
players.forEach((player, fp) -> FightSystem.getMessage().sendPrefixless("TEAM_CHAT", player, ChatMessageType.CHAT, prefix, sender.getName(), message));
|
broadcast(player -> FightSystem.getMessage().sendPrefixless("TEAM_CHAT", player, ChatMessageType.CHAT, prefix, sender.getName(), message));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void broadcast(Consumer<Player> f) {
|
||||||
|
players.forEach((uuid, fightPlayer) -> {
|
||||||
|
Player player = Bukkit.getPlayer(uuid);
|
||||||
|
if(player != null)
|
||||||
|
f.accept(player);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMember(Player player) {
|
public void addMember(Player player) {
|
||||||
@ -248,7 +258,7 @@ public class FightTeam {
|
|||||||
final List<ProtocolUtils.ChunkPos> chunksToReload = FightSystem.getTechHider().prepareChunkReload(player, false);
|
final List<ProtocolUtils.ChunkPos> chunksToReload = FightSystem.getTechHider().prepareChunkReload(player, false);
|
||||||
FightPlayer fightPlayer = getFightPlayer(player) != null ? getFightPlayer(player) : new FightPlayer(player, this);
|
FightPlayer fightPlayer = getFightPlayer(player) != null ? getFightPlayer(player) : new FightPlayer(player, this);
|
||||||
fightPlayer.revive();
|
fightPlayer.revive();
|
||||||
players.put(player, fightPlayer);
|
players.put(player.getUniqueId(), fightPlayer);
|
||||||
Permanent.getSpectatorTeam().removeEntry(player.getName());
|
Permanent.getSpectatorTeam().removeEntry(player.getName());
|
||||||
team.addEntry(player.getName());
|
team.addEntry(player.getName());
|
||||||
|
|
||||||
@ -281,7 +291,7 @@ public class FightTeam {
|
|||||||
|
|
||||||
PersonalKitCreator.closeIfInKitCreator(player);
|
PersonalKitCreator.closeIfInKitCreator(player);
|
||||||
List<ProtocolUtils.ChunkPos> chunksToReload = FightSystem.getTechHider().prepareChunkReload(player, true);
|
List<ProtocolUtils.ChunkPos> chunksToReload = FightSystem.getTechHider().prepareChunkReload(player, true);
|
||||||
players.remove(player);
|
players.remove(player.getUniqueId());
|
||||||
team.removeEntry(player.getName());
|
team.removeEntry(player.getName());
|
||||||
Permanent.getSpectatorTeam().addEntry(player.getName());
|
Permanent.getSpectatorTeam().addEntry(player.getName());
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ public class JoinRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
activeRequests.put(player, this);
|
activeRequests.put(player, this);
|
||||||
|
FightSystem.getMessage().sendPrefixless("JOIN_REQUEST_CONFIRMATION", player, ChatMessageType.ACTION_BAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean required(FightTeam decider) {
|
public boolean required(FightTeam decider) {
|
||||||
|
@ -25,6 +25,7 @@ import de.steamwar.fightsystem.FightSystem;
|
|||||||
import de.steamwar.fightsystem.fight.Fight;
|
import de.steamwar.fightsystem.fight.Fight;
|
||||||
import de.steamwar.fightsystem.fight.FightPlayer;
|
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||||
import de.steamwar.fightsystem.fight.FightTeam;
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||||||
|
import de.steamwar.fightsystem.fight.HotbarKit;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||||
import de.steamwar.fightsystem.utils.BountifulWrapper;
|
import de.steamwar.fightsystem.utils.BountifulWrapper;
|
||||||
@ -76,6 +77,7 @@ public class Permanent implements Listener {
|
|||||||
|
|
||||||
FightTeam team = Fight.getPlayerTeam(player);
|
FightTeam team = Fight.getPlayerTeam(player);
|
||||||
event.setRespawnLocation(team == null ? Config.SpecSpawn : team.getSpawn());
|
event.setRespawnLocation(team == null ? Config.SpecSpawn : team.getSpawn());
|
||||||
|
HotbarKit.spectatorKit.loadToPlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ api-version: "1.13"
|
|||||||
|
|
||||||
commands:
|
commands:
|
||||||
ak:
|
ak:
|
||||||
|
request:
|
||||||
requests:
|
requests:
|
||||||
leave:
|
leave:
|
||||||
ready:
|
ready:
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren