SteamWar/FightSystem
Archiviert
13
1

Allow administration replays without restrictions #329

Zusammengeführt
Lixfel hat 1 Commits von private_replays nach master 2022-03-03 14:38:14 +01:00 zusammengeführt
7 geänderte Dateien mit 27 neuen und 17 gelöschten Zeilen
Nur Änderungen aus Commit ed6b24bd79 werden angezeigt - Alle Commits anzeigen

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,6 +38,7 @@ public class FileSource extends PacketSource {
return; return;
} }
if(Config.ReplayID > 0) {
de.steamwar.sql.Fight.getReplay(Config.ReplayID, input -> { de.steamwar.sql.Fight.getReplay(Config.ReplayID, input -> {
try { try {
Files.copy( Files.copy(
@ -55,6 +56,7 @@ public class FileSource extends PacketSource {
throw new SecurityException("Could not start replay", e); throw new SecurityException("Could not start replay", e);
} }
} }
}
public FileSource(File fightFile) throws IOException { public FileSource(File fightFile) throws IOException {
super(new GZIPInputStream(new FileInputStream(fightFile))); super(new GZIPInputStream(new FileInputStream(fightFile)));

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