SteamWar/FightSystem
Archiviert
13
1

Added paper-compatibility #258

Manuell gemergt
Lixfel hat 2 Commits von WorldResetPaper nach master 2021-04-13 19:51:05 +02:00 zusammengeführt
3 geänderte Dateien mit 11 neuen und 13 gelöschten Zeilen
Nur Änderungen aus Commit fe36f92def werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -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);

Datei anzeigen

@ -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);
}
}
@ -426,9 +426,7 @@ public class FightTeam implements IFightTeam{
public void enable() {
players.values().forEach(fightPlayer -> {
Fight.setPlayerGamemode(fightPlayer.getPlayer(), GameMode.SPECTATOR);
if(Fight.getOpposite(FightTeam.this).getExtendRegion().playerInRegion(fightPlayer.getPlayer().getLocation())){
fightPlayer.getPlayer().teleport(FightTeam.this.spawn);
}
});
}

Datei anzeigen

@ -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);