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