SteamWar/FightSystem
Archiviert
13
1

Merge branch 'master' into record_extension

Dieser Commit ist enthalten in:
Chaoscaot 2021-04-14 20:40:37 +02:00
Commit 0fc55d4268
16 geänderte Dateien mit 60 neuen und 62 gelöschten Zeilen

Datei anzeigen

@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
public class FightWorld_10 { public class FightWorld_10 {
private FightWorld_10(){} private FightWorld_10(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z, boolean isPaper){
net.minecraft.server.v1_10_R1.World w = ((CraftWorld) world).getHandle(); net.minecraft.server.v1_10_R1.World w = ((CraftWorld) world).getHandle();
Chunk chunk = w.getChunkAt(x, z); Chunk chunk = w.getChunkAt(x, z);
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z); Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
@ -40,7 +40,9 @@ public class FightWorld_10 {
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length); System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length); System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
w.tileEntityListTick.removeAll(chunk.tileEntities.values()); w.tileEntityListTick.removeAll(chunk.tileEntities.values());
w.tileEntityList.removeAll(chunk.tileEntities.values()); if (!isPaper) {
w.tileEntityList.removeAll(chunk.tileEntities.values());
}
chunk.tileEntities.clear(); chunk.tileEntities.clear();
chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.tileEntities.putAll(backupChunk.tileEntities);
for(Player p : Bukkit.getOnlinePlayers()){ for(Player p : Bukkit.getOnlinePlayers()){

Datei anzeigen

@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
public class FightWorld_12 { public class FightWorld_12 {
private FightWorld_12(){} private FightWorld_12(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z, boolean isPaper){
net.minecraft.server.v1_12_R1.World w = ((CraftWorld) world).getHandle(); net.minecraft.server.v1_12_R1.World w = ((CraftWorld) world).getHandle();
Chunk chunk = w.getChunkAt(x, z); Chunk chunk = w.getChunkAt(x, z);
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z); Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
@ -40,7 +40,9 @@ public class FightWorld_12 {
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length); System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length); System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
w.tileEntityListTick.removeAll(chunk.tileEntities.values()); w.tileEntityListTick.removeAll(chunk.tileEntities.values());
w.tileEntityList.removeAll(chunk.tileEntities.values()); if (!isPaper) {
w.tileEntityList.removeAll(chunk.tileEntities.values());
}
chunk.tileEntities.clear(); chunk.tileEntities.clear();
chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.tileEntities.putAll(backupChunk.tileEntities);
for(Player p : Bukkit.getOnlinePlayers()){ for(Player p : Bukkit.getOnlinePlayers()){

Datei anzeigen

@ -123,7 +123,7 @@ public class FightTeam_14 {
return block.getType() == Material.MOVING_PISTON; return block.getType() == Material.MOVING_PISTON;
} }
public static void saveSchem(Schematic schem, Region region, int minY, boolean rotate) { public static void saveSchem(Schematic schem, Region region, int minY) {
World w = new BukkitWorld(Bukkit.getWorlds().get(0)); World w = new BukkitWorld(Bukkit.getWorlds().get(0));
BlockVector3 min = BlockVector3.at(region.getMinX(), minY, region.getMinZ()); BlockVector3 min = BlockVector3.at(region.getMinX(), minY, region.getMinZ());
CuboidRegion cuboidRegion = new CuboidRegion(w, min, BlockVector3.at(region.getMaxX(), region.getMaxY(), region.getMaxZ())); CuboidRegion cuboidRegion = new CuboidRegion(w, min, BlockVector3.at(region.getMaxX(), region.getMaxY(), region.getMaxZ()));
@ -132,9 +132,7 @@ public class FightTeam_14 {
ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, cuboidRegion, clipboard, min); ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, cuboidRegion, clipboard, min);
forwardExtentCopy.setCopyingEntities(false); forwardExtentCopy.setCopyingEntities(false);
if(rotate){
forwardExtentCopy.setTransform(new AffineTransform().rotateY(180));
}
try{ try{
Operations.complete(forwardExtentCopy); Operations.complete(forwardExtentCopy);
}catch(WorldEditException e){ }catch(WorldEditException e){

Datei anzeigen

@ -32,14 +32,16 @@ import org.bukkit.entity.Player;
public class FightWorld_14 { public class FightWorld_14 {
private FightWorld_14(){} private FightWorld_14(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z, boolean isPaper){
net.minecraft.server.v1_14_R1.World w = ((CraftWorld) world).getHandle(); net.minecraft.server.v1_14_R1.World w = ((CraftWorld) world).getHandle();
Chunk chunk = w.getChunkAt(x, z); Chunk chunk = w.getChunkAt(x, z);
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z); Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length); System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
w.tileEntityListTick.removeAll(chunk.tileEntities.values()); w.tileEntityListTick.removeAll(chunk.tileEntities.values());
w.tileEntityList.removeAll(chunk.tileEntities.values()); if (!isPaper) {
w.tileEntityList.removeAll(chunk.tileEntities.values());
}
chunk.tileEntities.clear(); chunk.tileEntities.clear();
chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.tileEntities.putAll(backupChunk.tileEntities);
chunk.heightMap.clear(); chunk.heightMap.clear();

Datei anzeigen

@ -32,14 +32,16 @@ import org.bukkit.entity.Player;
public class FightWorld_15 { public class FightWorld_15 {
private FightWorld_15(){} private FightWorld_15(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z, boolean isPaper){
net.minecraft.server.v1_15_R1.World w = ((CraftWorld) world).getHandle(); net.minecraft.server.v1_15_R1.World w = ((CraftWorld) world).getHandle();
Chunk chunk = w.getChunkAt(x, z); Chunk chunk = w.getChunkAt(x, z);
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z); Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length); System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
w.tileEntityListTick.removeAll(chunk.tileEntities.values()); w.tileEntityListTick.removeAll(chunk.tileEntities.values());
w.tileEntityList.removeAll(chunk.tileEntities.values()); if (!isPaper) {
w.tileEntityList.removeAll(chunk.tileEntities.values());
}
chunk.tileEntities.clear(); chunk.tileEntities.clear();
chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.tileEntities.putAll(backupChunk.tileEntities);
chunk.heightMap.clear(); chunk.heightMap.clear();

Datei anzeigen

@ -125,7 +125,7 @@ public class FightTeam_8 {
return block.getType() == Material.PISTON_MOVING_PIECE; return block.getType() == Material.PISTON_MOVING_PIECE;
} }
public static void saveSchem(Schematic schem, Region region, int minY, boolean rotate) { public static void saveSchem(Schematic schem, Region region, int minY) {
World w = new BukkitWorld(Bukkit.getWorlds().get(0)); World w = new BukkitWorld(Bukkit.getWorlds().get(0));
Vector min = new Vector(region.getMinX(), minY, region.getMinZ()); Vector min = new Vector(region.getMinX(), minY, region.getMinZ());
CuboidRegion cuboidRegion = new CuboidRegion(w, min, new Vector(region.getMaxX(), region.getMaxY(), region.getMaxZ())); CuboidRegion cuboidRegion = new CuboidRegion(w, min, new Vector(region.getMaxX(), region.getMaxY(), region.getMaxZ()));
@ -133,9 +133,6 @@ public class FightTeam_8 {
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1); EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1);
ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, cuboidRegion, clipboard, min); ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, cuboidRegion, clipboard, min);
if(rotate){
forwardExtentCopy.setTransform(new AffineTransform().rotateY(180));
}
try{ try{
Operations.complete(forwardExtentCopy); Operations.complete(forwardExtentCopy);
}catch(WorldEditException e){ }catch(WorldEditException e){

Datei anzeigen

@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
public class FightWorld_8 { public class FightWorld_8 {
private FightWorld_8(){} private FightWorld_8(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z, boolean isPaper){
net.minecraft.server.v1_8_R3.World w = ((CraftWorld) world).getHandle(); net.minecraft.server.v1_8_R3.World w = ((CraftWorld) world).getHandle();
Chunk chunk = w.getChunkAt(x, z); Chunk chunk = w.getChunkAt(x, z);
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z); Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);

Datei anzeigen

@ -32,7 +32,7 @@ import org.bukkit.entity.Player;
public class FightWorld_9 { public class FightWorld_9 {
private FightWorld_9(){} private FightWorld_9(){}
static void resetChunk(World world, World backup, int x, int z){ static void resetChunk(World world, World backup, int x, int z, boolean isPaper){
net.minecraft.server.v1_9_R2.World w = ((CraftWorld) world).getHandle(); net.minecraft.server.v1_9_R2.World w = ((CraftWorld) world).getHandle();
Chunk chunk = w.getChunkAt(x, z); Chunk chunk = w.getChunkAt(x, z);
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z); Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
@ -40,7 +40,9 @@ public class FightWorld_9 {
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length); System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length); System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
w.tileEntityListTick.removeAll(chunk.tileEntities.values()); w.tileEntityListTick.removeAll(chunk.tileEntities.values());
w.tileEntityList.removeAll(chunk.tileEntities.values()); if (!isPaper) {
w.tileEntityList.removeAll(chunk.tileEntities.values());
}
chunk.tileEntities.clear(); chunk.tileEntities.clear();
chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.tileEntities.putAll(backupChunk.tileEntities);
for(Player p : Bukkit.getOnlinePlayers()){ for(Player p : Bukkit.getOnlinePlayers()){

Datei anzeigen

@ -142,7 +142,11 @@ public class FightSystem extends JavaPlugin {
}else if(Config.mode == ArenaMode.CHECK){ }else if(Config.mode == ArenaMode.CHECK){
Fight.getBlueTeam().setSchem(Schematic.getSchemFromDB(Config.CheckSchemID)); Fight.getBlueTeam().setSchem(Schematic.getSchemFromDB(Config.CheckSchemID));
}else if(Config.mode == ArenaMode.PREPARE) { }else if(Config.mode == ArenaMode.PREPARE) {
Fight.getBlueTeam().setSchem(Schematic.getSchemFromDB(Config.PrepareSchemID)); if(Config.BlueRotate){
Fight.getRedTeam().setSchem(Schematic.getSchemFromDB(Config.PrepareSchemID));
}else{
Fight.getBlueTeam().setSchem(Schematic.getSchemFromDB(Config.PrepareSchemID));
}
} }
} }

Datei anzeigen

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

Datei anzeigen

@ -22,7 +22,6 @@ package de.steamwar.fightsystem.countdown;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.FightWorld;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown; import de.steamwar.fightsystem.states.StateDependentCountdown;
@ -30,11 +29,7 @@ public class EventSpectateCountdown extends Countdown {
public EventSpectateCountdown() { public EventSpectateCountdown() {
super(Config.SpectatorDuration, SWSound.BLOCK_NOTE_PLING, false); super(Config.SpectatorDuration, SWSound.BLOCK_NOTE_PLING, false);
if(FightWorld.isPaper()){ new StateDependentCountdown(ArenaMode.Event, FightState.Spectate, this);
new StateDependentCountdown(ArenaMode.Fight, FightState.Spectate, this);
}else{
new StateDependentCountdown(ArenaMode.Event, FightState.Spectate, this);
}
} }
@Override @Override

Datei anzeigen

@ -30,9 +30,7 @@ public class SpectateOverCountdown extends Countdown {
public SpectateOverCountdown() { public SpectateOverCountdown() {
super(Config.SpectatorDuration, SWSound.BLOCK_NOTE_PLING, false); super(Config.SpectatorDuration, SWSound.BLOCK_NOTE_PLING, false);
if(!FightWorld.isPaper()){ new StateDependentCountdown(ArenaMode.Restartable, FightState.Spectate, this);
new StateDependentCountdown(ArenaMode.Restartable, FightState.Spectate, this);
}
} }
@Override @Override

Datei anzeigen

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

Datei anzeigen

@ -35,22 +35,14 @@ public class FightWorld extends StateDependent {
private static final boolean paper; private static final boolean paper;
static{ static{
boolean ispaper; paper = Bukkit.getVersion().contains("git-Paper");
try {
Class.forName("com.destroystokyo.paper.PaperConfig");
ispaper = true;
} catch (ClassNotFoundException e) {
ispaper = false;
}
paper = ispaper;
} }
private final World world = Bukkit.getWorlds().get(0); private final World world = Bukkit.getWorlds().get(0);
public FightWorld() { public FightWorld() {
super(ArenaMode.Restartable, FightState.Schem); super(ArenaMode.Restartable, FightState.Schem);
if(!isPaper()) register();
register();
} }
@Override @Override
@ -72,17 +64,17 @@ public class FightWorld extends StateDependent {
World backup = new WorldCreator(world.getName() + "/backup").createWorld(); World backup = new WorldCreator(world.getName() + "/backup").createWorld();
assert backup != null; assert backup != null;
Config.ArenaRegion.forEachChunk((x, z) -> resetChunk(backup, x, z)); Config.ArenaRegion.forEachChunk((x, z) -> resetChunk(backup, x, z, FightWorld.isPaper()));
Bukkit.unloadWorld(backup, false); Bukkit.unloadWorld(backup, false);
} }
private void resetChunk(World backup, int x, int z){ private void resetChunk(World backup, int x, int z, boolean isPaper){
VersionedRunnable.call( VersionedRunnable.call(
new VersionedRunnable(() -> FightWorld_8.resetChunk(world, backup, x, z), 8), new VersionedRunnable(() -> FightWorld_8.resetChunk(world, backup, x, z, isPaper), 8),
new VersionedRunnable(() -> FightWorld_9.resetChunk(world, backup, x, z), 9), new VersionedRunnable(() -> FightWorld_9.resetChunk(world, backup, x, z, isPaper), 9),
new VersionedRunnable(() -> FightWorld_10.resetChunk(world, backup, x, z), 10), new VersionedRunnable(() -> FightWorld_10.resetChunk(world, backup, x, z, isPaper), 10),
new VersionedRunnable(() -> FightWorld_12.resetChunk(world, backup, x, z), 12), new VersionedRunnable(() -> FightWorld_12.resetChunk(world, backup, x, z, isPaper), 12),
new VersionedRunnable(() -> FightWorld_14.resetChunk(world, backup, x, z), 14), new VersionedRunnable(() -> FightWorld_14.resetChunk(world, backup, x, z, isPaper), 14),
new VersionedRunnable(() -> FightWorld_15.resetChunk(world, backup, x, z), 15)); new VersionedRunnable(() -> FightWorld_15.resetChunk(world, backup, x, z, isPaper), 15));
} }
} }

Datei anzeigen

@ -46,9 +46,9 @@ public class PrepareSchem implements Listener {
@Override @Override
public void disable() { public void disable() {
super.disable(); super.disable();
Region region = Fight.getBlueTeam().getExtendRegion();
World world = Bukkit.getWorlds().get(0); World world = Bukkit.getWorlds().get(0);
int minY = Fight.getBlueTeam().getSchemRegion().getMinY(); Region region = Config.BlueRotate ? Fight.getRedTeam().getExtendRegion() : Fight.getBlueTeam().getExtendRegion();
int minY = Config.BlueRotate ? Fight.getRedTeam().getSchemRegion().getMinY() : Fight.getBlueTeam().getSchemRegion().getMinY();
Schematic schem; Schematic schem;
try{ try{
@ -73,8 +73,8 @@ public class PrepareSchem implements Listener {
try{ try{
VersionedRunnable.call( VersionedRunnable.call(
new VersionedRunnable(() -> FightTeam_8.saveSchem(schem, region, minY, Config.BlueRotate), 8), new VersionedRunnable(() -> FightTeam_8.saveSchem(schem, region, minY), 8),
new VersionedRunnable(() -> FightTeam_14.saveSchem(schem, region, minY, Config.BlueRotate), 14)); new VersionedRunnable(() -> FightTeam_14.saveSchem(schem, region, minY), 14));
}catch(IllegalStateException e){ }catch(IllegalStateException e){
FightSystem.shutdown(FightSystem.PREFIX + "§cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen."); FightSystem.shutdown(FightSystem.PREFIX + "§cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen.");
return; return;
@ -92,7 +92,11 @@ public class PrepareSchem implements Listener {
FightTeam team = Fight.getPlayerTeam(player); FightTeam team = Fight.getPlayerTeam(player);
if (team == null) { if (team == null) {
Fight.getBlueTeam().addMember(player); if(Config.BlueRotate){
Fight.getRedTeam().addMember(player);
}else{
Fight.getBlueTeam().addMember(player);
}
} }
if(FightState.getFightState() == FightState.PRE_LEADER_SETUP) { if(FightState.getFightState() == FightState.PRE_LEADER_SETUP) {

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