Fix techhider on team leave
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
f4788d8152
Commit
b6ad157e38
@ -48,7 +48,7 @@ public class EnternCountdown extends Countdown {
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
fightPlayer.getPlayer().sendMessage(FightSystem.PREFIX + "§aEntern ist nun erlaubt!");
|
||||
TechHider.reloadChunks(fightPlayer.getPlayer(), chunkPos);
|
||||
TechHider.reloadChunks(fightPlayer.getPlayer(), chunkPos, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,7 +70,7 @@ public class EnternCountdown extends Countdown {
|
||||
|
||||
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a1 §rSekunde " + countdownCounting()));
|
||||
|
||||
chunkPos = TechHider.prepareChunkReload(player);
|
||||
chunkPos = TechHider.prepareChunkReload(player, false);
|
||||
break;
|
||||
case 0:
|
||||
player.playSound(player.getLocation(), Countdown.getSound(SWSound.BLOCK_NOTE_PLING), 100.0F, 2.0F);
|
||||
|
@ -177,7 +177,7 @@ public class FightTeam implements IFightTeam{
|
||||
}
|
||||
|
||||
public void addMember(Player player) {
|
||||
final List<TechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player);
|
||||
final List<TechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player, false);
|
||||
FightPlayer fightPlayer = new FightPlayer(player, this);
|
||||
players.put(player, fightPlayer);
|
||||
invited.remove(player);
|
||||
@ -195,7 +195,7 @@ public class FightTeam implements IFightTeam{
|
||||
if(!Config.test())
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), prefix + player.getName()).send(player), 5);
|
||||
RecordSystem.playerJoins(player);
|
||||
TechHider.reloadChunks(player, chunksToReload);
|
||||
TechHider.reloadChunks(player, chunksToReload, false);
|
||||
|
||||
if(isLeaderless())
|
||||
setLeader(fightPlayer);
|
||||
@ -204,7 +204,7 @@ public class FightTeam implements IFightTeam{
|
||||
public void removePlayer(Player player) {
|
||||
FightPlayer fightPlayer = getFightPlayer(player);
|
||||
|
||||
List<TechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player);
|
||||
List<TechHider.ChunkPos> chunksToReload = TechHider.prepareChunkReload(player, true);
|
||||
players.remove(player);
|
||||
team.removeEntry(player.getName());
|
||||
|
||||
@ -219,7 +219,7 @@ public class FightTeam implements IFightTeam{
|
||||
if(player.isOnline()){
|
||||
if(!ArenaMode.Test.contains(Config.mode))
|
||||
new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), "§7" + player.getName()).send(player);
|
||||
TechHider.reloadChunks(player, chunksToReload);
|
||||
TechHider.reloadChunks(player, chunksToReload, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,23 +263,23 @@ public class TechHider extends StateDependent {
|
||||
}
|
||||
};
|
||||
|
||||
public static List<ChunkPos> prepareChunkReload(Player p){
|
||||
public static List<ChunkPos> prepareChunkReload(Player p, boolean hide){
|
||||
if(!enabled)
|
||||
return Collections.emptyList();
|
||||
List<ChunkPos> chunksToReload = new ArrayList<>();
|
||||
Config.ArenaRegion.forEachChunk((x, z) -> {
|
||||
if(!bypass(p, x, z))
|
||||
if(bypass(p, x, z) == hide)
|
||||
chunksToReload.add(new ChunkPos(x, z));
|
||||
});
|
||||
return chunksToReload;
|
||||
}
|
||||
|
||||
public static void reloadChunks(Player p, List<ChunkPos> chunksToReload){
|
||||
public static void reloadChunks(Player p, List<ChunkPos> chunksToReload, boolean hide){
|
||||
if(!enabled)
|
||||
return;
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||
for(ChunkPos chunk : chunksToReload){
|
||||
if(bypass(p, chunk.x(), chunk.z()))
|
||||
if(bypass(p, chunk.x(), chunk.z()) != hide)
|
||||
ChunkListener.sendChunk(p, chunk.x(), chunk.z());
|
||||
}
|
||||
}, 40);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren