SteamWar/FightSystem
Archiviert
13
1

Merge pull request 'Allow administration replays without restrictions' (#329) from private_replays into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #329
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Lixfel 2022-03-03 14:38:14 +01:00
Commit 205115fdb0
7 geänderte Dateien mit 27 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -72,7 +72,7 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper
@Override @Override
public void forceLoadChunk(World world, int cX, int cZ) { public void forceLoadChunk(World world, int cX, int cZ) {
// not possible in 1.8 world.setKeepSpawnInMemory(true);
} }
@Override @Override

Datei anzeigen

@ -40,7 +40,7 @@ public enum ArenaMode {
public static final Set<ArenaMode> Test = Collections.unmodifiableSet(EnumSet.of(TEST, CHECK)); public static final Set<ArenaMode> Test = Collections.unmodifiableSet(EnumSet.of(TEST, CHECK));
public static final Set<ArenaMode> Ranked = Collections.unmodifiableSet(EnumSet.of(RANKED)); public static final Set<ArenaMode> Ranked = Collections.unmodifiableSet(EnumSet.of(RANKED));
public static final Set<ArenaMode> Prepare = Collections.unmodifiableSet(EnumSet.of(PREPARE)); public static final Set<ArenaMode> Prepare = Collections.unmodifiableSet(EnumSet.of(PREPARE));
public static final Set<ArenaMode> Replay = Collections.unmodifiableSet(EnumSet.of(REPLAY)); public static final Set<ArenaMode> Replay = Collections.unmodifiableSet(EnumSet.of(REPLAY, TEST));
public static final Set<ArenaMode> AntiReplay = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(REPLAY))); public static final Set<ArenaMode> AntiReplay = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(REPLAY)));
public static final Set<ArenaMode> AntiTest = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK))); public static final Set<ArenaMode> AntiTest = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK)));

Datei anzeigen

@ -141,6 +141,7 @@ public class FightSystem extends JavaPlugin {
new FileRecorder(); new FileRecorder();
REntity.initWatchers(); REntity.initWatchers();
FileSource.startReplay();
if(Config.mode == ArenaMode.EVENT) { if(Config.mode == ArenaMode.EVENT) {
setPreSchemState(); setPreSchemState();
@ -148,9 +149,6 @@ public class FightSystem extends JavaPlugin {
Fight.getBlueTeam().setSchem(SchematicNode.getSchematicNode(Config.CheckSchemID)); Fight.getBlueTeam().setSchem(SchematicNode.getSchematicNode(Config.CheckSchemID));
}else if(Config.mode == ArenaMode.PREPARE) { }else if(Config.mode == ArenaMode.PREPARE) {
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID)); Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID));
}else if(Config.mode == ArenaMode.REPLAY) {
FightWorld.forceLoad();
FileSource.startReplay();
} }
} }

Datei anzeigen

@ -61,7 +61,6 @@ public class FightWorld extends StateDependent {
world.loadChunk(cX, cZ); world.loadChunk(cX, cZ);
FlatteningWrapper.impl.forceLoadChunk(world, cX, cZ); FlatteningWrapper.impl.forceLoadChunk(world, cX, cZ);
}); });
world.setKeepSpawnInMemory(true);
} }
public static void resetWorld(){ public static void resetWorld(){

Datei anzeigen

@ -20,11 +20,13 @@
package de.steamwar.fightsystem.listener; package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
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.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
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.sql.SteamwarUser;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -41,6 +43,12 @@ public class TestJoin implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
FightTeam fightTeam = Fight.getPlayerTeam(player); FightTeam fightTeam = Fight.getPlayerTeam(player);
if(Config.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).getUserGroup().isAdminGroup()) {
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
player.kickPlayer("");
return;
}
if (fightTeam == null && (Fight.getRedTeam().isLeaderless() || Fight.getBlueTeam().isLeaderless())) { if (fightTeam == null && (Fight.getRedTeam().isLeaderless() || Fight.getBlueTeam().isLeaderless())) {
FightSystem.getMessage().send("TEST_BECOME_LEADER", player); FightSystem.getMessage().send("TEST_BECOME_LEADER", player);
} }

Datei anzeigen

@ -38,21 +38,23 @@ public class FileSource extends PacketSource {
return; return;
} }
de.steamwar.sql.Fight.getReplay(Config.ReplayID, input -> { if(Config.ReplayID > 0) {
de.steamwar.sql.Fight.getReplay(Config.ReplayID, input -> {
try {
Files.copy(
input,
FileRecorder.getFile().toPath(),
StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
throw new SecurityException("Could not start replay", e);
}
});
try { try {
Files.copy( new FileSource(FileRecorder.getFile());
input,
FileRecorder.getFile().toPath(),
StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) { } catch (IOException e) {
throw new SecurityException("Could not start replay", e); throw new SecurityException("Could not start replay", e);
} }
});
try {
new FileSource(FileRecorder.getFile());
} catch (IOException e) {
throw new SecurityException("Could not start replay", e);
} }
} }

Datei anzeigen

@ -26,6 +26,7 @@ import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.Countdown; import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.fight.FightWorld;
import de.steamwar.fightsystem.fight.FreezeWorld; import de.steamwar.fightsystem.fight.FreezeWorld;
import de.steamwar.fightsystem.listener.FightScoreboard; import de.steamwar.fightsystem.listener.FightScoreboard;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
@ -124,6 +125,8 @@ public class PacketProcessor {
packetDecoder[0xef] = source::readUTF; packetDecoder[0xef] = source::readUTF;
packetDecoder[0xff] = this::tick; packetDecoder[0xff] = this::tick;
FightWorld.forceLoad();
if(source.async()) { if(source.async()) {
Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::process); Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::process);
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::runSync, 1, 1); task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::runSync, 1, 1);