SteamWar/FightSystem
Archiviert
13
1

Allow administration replays without restrictions
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-03-03 10:01:05 +01:00
Ursprung 534b16b153
Commit ed6b24bd79
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
public void forceLoadChunk(World world, int cX, int cZ) {
// not possible in 1.8
world.setKeepSpawnInMemory(true);
}
@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> Ranked = Collections.unmodifiableSet(EnumSet.of(RANKED));
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> AntiTest = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK)));

Datei anzeigen

@ -141,6 +141,7 @@ public class FightSystem extends JavaPlugin {
new FileRecorder();
REntity.initWatchers();
FileSource.startReplay();
if(Config.mode == ArenaMode.EVENT) {
setPreSchemState();
@ -148,9 +149,6 @@ public class FightSystem extends JavaPlugin {
Fight.getBlueTeam().setSchem(SchematicNode.getSchematicNode(Config.CheckSchemID));
}else if(Config.mode == ArenaMode.PREPARE) {
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);
FlatteningWrapper.impl.forceLoadChunk(world, cX, cZ);
});
world.setKeepSpawnInMemory(true);
}
public static void resetWorld(){

Datei anzeigen

@ -20,11 +20,13 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -41,6 +43,12 @@ public class TestJoin implements Listener {
Player player = event.getPlayer();
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())) {
FightSystem.getMessage().send("TEST_BECOME_LEADER", player);
}

Datei anzeigen

@ -38,6 +38,7 @@ public class FileSource extends PacketSource {
return;
}
if(Config.ReplayID > 0) {
de.steamwar.sql.Fight.getReplay(Config.ReplayID, input -> {
try {
Files.copy(
@ -55,6 +56,7 @@ public class FileSource extends PacketSource {
throw new SecurityException("Could not start replay", e);
}
}
}
public FileSource(File fightFile) throws IOException {
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.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.fight.FightWorld;
import de.steamwar.fightsystem.fight.FreezeWorld;
import de.steamwar.fightsystem.listener.FightScoreboard;
import de.steamwar.fightsystem.states.FightState;
@ -124,6 +125,8 @@ public class PacketProcessor {
packetDecoder[0xef] = source::readUTF;
packetDecoder[0xff] = this::tick;
FightWorld.forceLoad();
if(source.async()) {
Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::process);
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::runSync, 1, 1);