forked from SteamWar/SteamWar
Move arena runtime configuration into GameCore
- Replace FightSystem runtime properties with shared GameConfig - Update dependent modules, commands, states, and tests
This commit is contained in:
@@ -22,8 +22,7 @@ package de.steamwar.fightsystem;
|
||||
import de.steamwar.data.GameModeConfigUtils;
|
||||
import de.steamwar.fightsystem.utils.Region;
|
||||
import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.config.GameRuntimeProperties;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.sql.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@@ -37,7 +36,6 @@ import org.bukkit.util.Vector;
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Config {
|
||||
@@ -46,7 +44,6 @@ public class Config {
|
||||
}
|
||||
|
||||
public static final World world = Bukkit.getWorlds().get(0);
|
||||
public static final GameRuntimeProperties RuntimeProperties = GameRuntimeProperties.load();
|
||||
|
||||
public static final GameModeConfig<Material, Winconditions> GameModeConfig;
|
||||
|
||||
@@ -78,8 +75,6 @@ public class Config {
|
||||
public static final String TeamBlueName;
|
||||
public static final String TeamRedColor;
|
||||
public static final String TeamBlueColor;
|
||||
public static final UUID BlueLeader;
|
||||
public static final UUID RedLeader;
|
||||
|
||||
//event parameter
|
||||
public static final EventFight EventKampf;
|
||||
@@ -90,23 +85,12 @@ public class Config {
|
||||
public static final int MaximumTeamMembers;
|
||||
public static final boolean LiveReplay;
|
||||
|
||||
//check parameter
|
||||
public static final int CheckSchemID;
|
||||
public static final int PrepareSchemID;
|
||||
|
||||
public static final ArenaMode mode;
|
||||
|
||||
//replay system parameter
|
||||
public static final String spectateIP = "127.0.0.1";
|
||||
public static final int SpectatePort;
|
||||
public static final int ReplayID;
|
||||
|
||||
static {
|
||||
CheckSchemID = RuntimeProperties.getCheckSchematicId();
|
||||
PrepareSchemID = RuntimeProperties.getPrepareSchematicId();
|
||||
ReplayID = RuntimeProperties.getReplayId();
|
||||
|
||||
String configFile = RuntimeProperties.getConfigFile();
|
||||
String configFile = GameConfig.ConfigFile;
|
||||
if (!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
|
||||
FightSystem.getPlugin().saveDefaultConfig();
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
||||
@@ -212,7 +196,7 @@ public class Config {
|
||||
|
||||
BlueInsetRegion = new Region(BluePasteRegion.getMinX() + GameModeConfig.Schematic.Inset.x, BluePasteRegion.getMinY() + GameModeConfig.Schematic.Inset.bottom, BluePasteRegion.getMinZ() + GameModeConfig.Schematic.Inset.z, BluePasteRegion.getMaxX() - GameModeConfig.Schematic.Inset.x, BluePasteRegion.getMaxY() - GameModeConfig.Schematic.Inset.top, BluePasteRegion.getMaxZ() - GameModeConfig.Schematic.Inset.z);
|
||||
|
||||
int eventKampfID = RuntimeProperties.getFightId();
|
||||
int eventKampfID = GameConfig.EventKampfID;
|
||||
if (eventKampfID >= 1) {
|
||||
EventKampf = EventFight.byId(eventKampfID);
|
||||
if (EventKampf == null) {
|
||||
@@ -264,20 +248,8 @@ public class Config {
|
||||
Referees = Collections.emptySet();
|
||||
MaximumTeamMembers = Integer.MAX_VALUE;
|
||||
LiveReplay = false;
|
||||
SpectatePort = -ReplayID;
|
||||
SpectatePort = -GameConfig.ReplayID;
|
||||
}
|
||||
|
||||
BlueLeader = RuntimeProperties.getBlueLeader();
|
||||
RedLeader = RuntimeProperties.getRedLeader();
|
||||
mode = ArenaMode.from(RuntimeProperties);
|
||||
}
|
||||
|
||||
public static boolean test() {
|
||||
return ArenaMode.Test.contains(mode);
|
||||
}
|
||||
|
||||
public static boolean replayserver() {
|
||||
return RuntimeProperties.isReplayServer();
|
||||
}
|
||||
|
||||
public static boolean blueNegZ() {
|
||||
|
||||
@@ -37,6 +37,7 @@ import de.steamwar.fightsystem.utils.HullHider;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import de.steamwar.fightsystem.utils.TechHiderWrapper;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.linkage.AbstractLinker;
|
||||
import de.steamwar.linkage.SpigotLinker;
|
||||
import de.steamwar.message.Message;
|
||||
@@ -76,7 +77,7 @@ public class FightSystem extends JavaPlugin {
|
||||
}
|
||||
if (Config.SpectatePort != 0) {
|
||||
Core.setServerName("Spectate");
|
||||
} else if (Config.ReplayID != 0) {
|
||||
} else if (GameConfig.ReplayID != 0) {
|
||||
Core.setServerName("Replay");
|
||||
}
|
||||
|
||||
@@ -110,7 +111,7 @@ public class FightSystem extends JavaPlugin {
|
||||
});
|
||||
new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f));
|
||||
new OneShotStateDependent(ArenaMode.Test, FightState.All, WorldEditRendererCUIEditor::new);
|
||||
Config.world.setGameRule(GameRule.REDUCED_DEBUG_INFO, ArenaMode.AntiTest.contains(Config.mode));
|
||||
Config.world.setGameRule(GameRule.REDUCED_DEBUG_INFO, ArenaMode.AntiTest.contains(GameConfig.mode));
|
||||
|
||||
hullHider = new HullHider();
|
||||
techHider = new TechHiderWrapper(hullHider);
|
||||
@@ -119,10 +120,10 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
FileSource.startReplay();
|
||||
|
||||
if (Config.mode == ArenaMode.EVENT) {
|
||||
if (GameConfig.mode == ArenaMode.EVENT) {
|
||||
FightState.setFightState(FightState.PRE_SCHEM_SETUP);
|
||||
} else if (Config.mode == ArenaMode.CHECK) {
|
||||
SchematicNode checkSchematicNode = SchematicNode.getSchematicNode(Config.CheckSchemID);
|
||||
} else if (GameConfig.mode == ArenaMode.CHECK) {
|
||||
SchematicNode checkSchematicNode = SchematicNode.getSchematicNode(GameConfig.CheckSchemID);
|
||||
Fight.getBlueTeam().setSchem(checkSchematicNode);
|
||||
|
||||
if (checkSchematicNode.isPrepared()) {
|
||||
@@ -130,8 +131,8 @@ public class FightSystem extends JavaPlugin {
|
||||
}
|
||||
|
||||
new TechareaCommand();
|
||||
} else if (Config.mode == ArenaMode.PREPARE) {
|
||||
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID));
|
||||
} else if (GameConfig.mode == ArenaMode.PREPARE) {
|
||||
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(GameConfig.PrepareSchemID));
|
||||
}
|
||||
|
||||
Config.world.setGameRule(GameRule.LOCATOR_BAR, false);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.fightsystem.ai;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -35,7 +35,7 @@ import java.util.stream.Collectors;
|
||||
@AllArgsConstructor
|
||||
public class AIManager {
|
||||
private static final List<AIManager> AIs = Arrays.asList(
|
||||
new AIManager("DummyAI", DummyAI::new, Material.STONE, () -> ArenaMode.Test.contains(Config.mode))
|
||||
new AIManager("DummyAI", DummyAI::new, Material.STONE, () -> ArenaMode.Test.contains(GameConfig.mode))
|
||||
);
|
||||
|
||||
public static List<AIManager> availableAIs() {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.ai.AIManager;
|
||||
@@ -56,7 +57,7 @@ public class GUI {
|
||||
inv.setItem(pos, ColorConverter.chat2dye(team.getColor()), msg.parse("JOIN_REQUEST_TEAM", p, team.getColor() + name), click -> {
|
||||
p.closeInventory();
|
||||
|
||||
if (ArenaMode.ManualTeams.contains(Config.mode) && team.canbeLeader(p)) {
|
||||
if (ArenaMode.ManualTeams.contains(GameConfig.mode) && team.canbeLeader(p)) {
|
||||
team.addMember(p);
|
||||
} else {
|
||||
JoinRequest.forPlayer(p, team);
|
||||
@@ -198,7 +199,7 @@ public class GUI {
|
||||
}
|
||||
|
||||
public static void preSchemDialog(Player p) {
|
||||
if (!Config.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP) {
|
||||
if (!GameConfig.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP) {
|
||||
msg.sendPrefixless("SCHEM_NO_ENEMY", p, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
}
|
||||
@@ -209,7 +210,7 @@ public class GUI {
|
||||
for (int i = 0; i < Config.GameModeConfig.Schematic.SubTypes.size(); i++) {
|
||||
setupSchemTypeRow(p, inv, Config.GameModeConfig.Schematic.SubTypes.get(i), i + 1);
|
||||
}
|
||||
if (!Config.test() && SteamwarUser.get(p.getUniqueId()).hasPerm(UserPerm.TEAM)) {
|
||||
if (!GameConfig.test() && SteamwarUser.get(p.getUniqueId()).hasPerm(UserPerm.TEAM)) {
|
||||
SchematicNode node = SchematicNode.getSchematicNode(-1, Config.GameModeConfig.GameName, (Integer) null);
|
||||
if (node != null) {
|
||||
inv.setItem(2, new SWItem(SWItem.getMaterial(node.getItem()), msg.parse("SCHEM_DIRT", p), click -> {
|
||||
@@ -233,14 +234,14 @@ public class GUI {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type.checkType() != null && type.checkType() != type && ArenaMode.AntiEvent.contains(Config.mode) && !SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.checkType().toDB()).isEmpty()) {
|
||||
if (type.checkType() != null && type.checkType() != type && ArenaMode.AntiEvent.contains(GameConfig.mode) && !SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.checkType().toDB()).isEmpty()) {
|
||||
inv.setItem(row * 9 + 4, Material.ANVIL, msg.parse("SCHEM_UNCHECKED", p, type.name()), (ClickType click) -> {
|
||||
p.closeInventory();
|
||||
schemDialog(p, type, false, true);
|
||||
});
|
||||
}
|
||||
|
||||
if (SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.toDB()).isEmpty() && !Config.test()) {
|
||||
if (SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.toDB()).isEmpty() && !GameConfig.test()) {
|
||||
inv.setItem(row * 9, Material.GRAY_DYE, (byte) 8, msg.parse("SCHEM_NO_PRIVATE", p, type.name()), (ClickType click) -> {
|
||||
});
|
||||
return;
|
||||
@@ -253,7 +254,7 @@ public class GUI {
|
||||
}
|
||||
|
||||
private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked) {
|
||||
SchematicSelector selector = new SchematicSelector(p, Config.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
|
||||
SchematicSelector selector = new SchematicSelector(p, GameConfig.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
|
||||
schemSelect(p, node);
|
||||
});
|
||||
selector.setPublicMode(publicSchems ? SchematicSelector.PublicMode.PUBLIC_ONLY : SchematicSelector.PublicMode.PRIVATE_ONLY);
|
||||
@@ -263,7 +264,7 @@ public class GUI {
|
||||
private static void schemSelect(Player p, SchematicNode node) {
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||
if (fightTeam == null) return;
|
||||
if (Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) {
|
||||
if (GameConfig.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) {
|
||||
fightTeam.pasteSchem(node);
|
||||
}
|
||||
p.closeInventory();
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ package de.steamwar.fightsystem.commands;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -65,7 +66,7 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
|
||||
Player p = (Player) sender;
|
||||
|
||||
if (!(Config.test() || Config.isReferee(p))) {
|
||||
if (!(GameConfig.test() || Config.isReferee(p))) {
|
||||
FightSystem.getMessage().sendPrefixless("GAMEMODE_NOT_ALLOWED", p, ChatMessageType.ACTION_BAR);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.record.PacketProcessor;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
@@ -35,7 +35,7 @@ import org.bukkit.entity.Player;
|
||||
public class SkipCommand implements CommandExecutor {
|
||||
|
||||
public SkipCommand() {
|
||||
new StateDependentCommand(ArenaMode.AntiPrepare, ArenaMode.Replay.contains(Config.mode) ? FightState.All : FightState.TeamFix, "skip", this);
|
||||
new StateDependentCommand(ArenaMode.AntiPrepare, ArenaMode.Replay.contains(GameConfig.mode) ? FightState.All : FightState.TeamFix, "skip", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@ package de.steamwar.fightsystem.commands;
|
||||
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@@ -49,7 +50,7 @@ public class TechhiderbugCommand implements CommandExecutor {
|
||||
StringWriter writer = new StringWriter();
|
||||
|
||||
try {
|
||||
writer.append("ArenaMode: ").append(Config.mode.name()).append('\n');
|
||||
writer.append("ArenaMode: ").append(GameConfig.mode.name()).append('\n');
|
||||
writer.append("FightState: ").append(FightState.getFightState().name()).append('\n');
|
||||
writer.append("TechHider enabled: ").append(FightState.getStateDependentFeatures().get(FightSystem.getTechHider()).toString()).append('\n');
|
||||
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.gamecore.countdown.StandardCountdown;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
@@ -34,7 +35,7 @@ public class EventSpectateCountdown extends StandardCountdown {
|
||||
|
||||
public EventSpectateCountdown() {
|
||||
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.SpectatorDuration, FightCountdownAdapter.presentation(new Message("SHUTDOWN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false));
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.NotRestartable.contains(Config.mode) && !Config.replayserver(), FightState.Spectate, this);
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.NotRestartable.contains(GameConfig.mode) && !GameConfig.replayserver(), FightState.Spectate, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
@@ -36,7 +37,7 @@ public class NoPlayersOnlineCountdown extends StandardCountdown {
|
||||
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.NoPlayersOnlineDuration, FightCountdownAdapter.presentation(new Message("SHUTDOWN_COUNTDOWN"), null, false));
|
||||
|
||||
if (!Config.GameModeConfig.Arena.Leaveable) {
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.AntiReplay.contains(Config.mode), FightState.PreLeaderSetup, this);
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.AntiReplay.contains(GameConfig.mode), FightState.PreLeaderSetup, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
@@ -33,11 +34,11 @@ public class PostSchemCountdown extends StandardCountdown {
|
||||
|
||||
public PostSchemCountdown() {
|
||||
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.SetupDuration, FightCountdownAdapter.presentation(new Message("POST_SCHEM_COUNTDOWN"), null, false));
|
||||
if (Config.mode == ArenaMode.PREPARE && Config.GameModeConfig.Schematic.UnlimitedPrepare) {
|
||||
if (GameConfig.mode == ArenaMode.PREPARE && Config.GameModeConfig.Schematic.UnlimitedPrepare) {
|
||||
return;
|
||||
}
|
||||
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.SeriousFight.contains(Config.mode), FightState.PostSchemSetup, this);
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.SeriousFight.contains(GameConfig.mode), FightState.PostSchemSetup, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
@@ -34,7 +35,7 @@ public class PreRunningCountdown extends StandardCountdown {
|
||||
|
||||
public PreRunningCountdown() {
|
||||
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.PreFightDuration, FightCountdownAdapter.presentation(new Message("PRE_RUNNING_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, true));
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.AntiReplay.contains(Config.mode), FightState.PreRunning, this);
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.AntiReplay.contains(GameConfig.mode), FightState.PreRunning, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
@@ -34,7 +35,7 @@ public class PreSchemCountdown extends StandardCountdown {
|
||||
|
||||
public PreSchemCountdown() {
|
||||
super(FightSystem.getPlugin(), Config.GameModeConfig.Times.PreSchemPasteDuration, FightCountdownAdapter.presentation(new Message("PRE_SCHEM_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false));
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.AntiReplay.contains(Config.mode), FightState.PreSchemSetup, this);
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.AntiReplay.contains(GameConfig.mode), FightState.PreSchemSetup, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-2
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.countdown;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
@@ -33,8 +34,8 @@ import de.steamwar.linkage.Linked;
|
||||
public class SpectateOverCountdown extends StandardCountdown {
|
||||
|
||||
public SpectateOverCountdown() {
|
||||
super(FightSystem.getPlugin(), Config.test() ? 3600 : Config.GameModeConfig.Times.SpectatorDuration, FightCountdownAdapter.presentation(new Message("SPECTATE_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false));
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.Restartable.contains(Config.mode) || Config.replayserver(), FightState.Spectate, this);
|
||||
super(FightSystem.getPlugin(), GameConfig.test() ? 3600 : Config.GameModeConfig.Times.SpectatorDuration, FightCountdownAdapter.presentation(new Message("SPECTATE_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false));
|
||||
new StateDependentCountdown<>(FightState.lifecycle, ArenaMode.Restartable.contains(GameConfig.mode) || GameConfig.replayserver(), FightState.Spectate, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ package de.steamwar.fightsystem.event;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
@@ -37,7 +37,7 @@ import java.util.logging.Level;
|
||||
public class PersistentDamage {
|
||||
|
||||
public PersistentDamage() {
|
||||
if (!ArenaMode.SeriousFight.contains(Config.mode)) return;
|
||||
if (!ArenaMode.SeriousFight.contains(GameConfig.mode)) return;
|
||||
|
||||
new OneShotStateDependent(Winconditions.PERSISTENT_DAMAGE, FightState.Spectate, () -> Fight.teams().forEach(team -> {
|
||||
try {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
import de.steamwar.gamecore.team.TeamRegistry;
|
||||
@@ -37,9 +38,9 @@ public class Fight {
|
||||
}
|
||||
|
||||
@Getter
|
||||
private static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedColor, Config.TeamRedSpawn, Config.RedPasteRegion, Config.RedExtendRegion, Config.RedRotate, false, Config.RedLeader);
|
||||
private static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedColor, Config.TeamRedSpawn, Config.RedPasteRegion, Config.RedExtendRegion, Config.RedRotate, false, GameConfig.RedLeader);
|
||||
@Getter
|
||||
private static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBlueColor, Config.TeamBlueSpawn, Config.BluePasteRegion, Config.BlueExtendRegion, Config.BlueRotate, true, Config.BlueLeader);
|
||||
private static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBlueColor, Config.TeamBlueSpawn, Config.BluePasteRegion, Config.BlueExtendRegion, Config.BlueRotate, true, GameConfig.BlueLeader);
|
||||
private static final TeamRegistry<FightTeam, LivingEntity> teamRegistry = new TeamRegistry<>(List.of(redTeam, blueTeam));
|
||||
|
||||
public static FightTeam getPlayerTeam(LivingEntity player) {
|
||||
@@ -90,7 +91,7 @@ public class Fight {
|
||||
if (Config.OnlyPublicSchematics) {
|
||||
return true;
|
||||
}
|
||||
if (Config.GameModeConfig.Schematic.IgnorePublicOnly || ArenaMode.RankedEvent.contains(Config.mode)) {
|
||||
if (Config.GameModeConfig.Schematic.IgnorePublicOnly || ArenaMode.RankedEvent.contains(GameConfig.mode)) {
|
||||
return false;
|
||||
}
|
||||
if (redTeam.getLeader() == null || blueTeam.getLeader() == null) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
@@ -130,7 +131,7 @@ public class FightSchematic extends StateDependent {
|
||||
setSchematic(publics.get(new Random().nextInt(publics.size())));
|
||||
}
|
||||
|
||||
if (ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
if (ArenaMode.AntiReplay.contains(GameConfig.mode)) {
|
||||
boolean changeRotation = false;
|
||||
if (Config.GameModeConfig.WinConditions.contains(Winconditions.RANDOM_ROTATE)) {
|
||||
changeRotation = new Random().nextBoolean();
|
||||
@@ -148,7 +149,7 @@ public class FightSchematic extends StateDependent {
|
||||
|
||||
private void replaceTeamColor(Clipboard clipboard) {
|
||||
try {
|
||||
WorldeditWrapper.impl.replaceTeamColor(clipboard, ArenaMode.AntiPrepare.contains(Config.mode) ? ColorConverter.chat2dyeColor(team.getColor()) : DyeColor.PINK);
|
||||
WorldeditWrapper.impl.replaceTeamColor(clipboard, ArenaMode.AntiPrepare.contains(GameConfig.mode) ? ColorConverter.chat2dyeColor(team.getColor()) : DyeColor.PINK);
|
||||
} catch (WorldEditException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Could not recolor schematic", e);
|
||||
}
|
||||
@@ -173,7 +174,7 @@ public class FightSchematic extends StateDependent {
|
||||
);
|
||||
FightSystem.getHullHider().initialize(team);
|
||||
team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard)));
|
||||
if (ArenaMode.Check.contains(Config.mode) && !team.isBlue()) {
|
||||
if (ArenaMode.Check.contains(GameConfig.mode) && !team.isBlue()) {
|
||||
replaceSync(Material.TNT, Material.RED_WOOL);
|
||||
}
|
||||
|
||||
@@ -182,7 +183,7 @@ public class FightSchematic extends StateDependent {
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
if (Config.mode == ArenaMode.PREPARE) {
|
||||
if (GameConfig.mode == ArenaMode.PREPARE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ package de.steamwar.fightsystem.fight;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.ai.AIManager;
|
||||
@@ -79,14 +80,14 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
|
||||
static {
|
||||
setKitButton(notReadyKit, true);
|
||||
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode)) {
|
||||
if (ArenaMode.VariableTeams.contains(GameConfig.mode)) {
|
||||
notReadyKit.setItem(2, "REQUESTS", new ItemBuilder(Material.PAPER).build(), GUI::chooseJoinRequests);
|
||||
if (!AIManager.availableAIs().isEmpty()) {
|
||||
notReadyKit.setItem(6, "ADD_AI", new ItemBuilder(Material.REDSTONE).build(), GUI::addAI);
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.test()) {
|
||||
if (GameConfig.test()) {
|
||||
notReadyKit.setItem(5, "CHOOSE_SCHEMATIC", new ItemBuilder(Material.CAULDRON).enchant().build(), GUI::preSchemDialog);
|
||||
}
|
||||
|
||||
@@ -163,7 +164,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
|
||||
}
|
||||
|
||||
new OneShotStateDependent(ArenaMode.Restartable, FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||
new OneShotStateDependent(Config.replayserver(), FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||
new OneShotStateDependent(GameConfig.replayserver(), FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||
new OneShotStateDependent(ArenaMode.All, FightState.PostSchemSetup, () -> {
|
||||
if (leader != null) leader.ifPlayer(notReadyKit::loadToPlayer);
|
||||
});
|
||||
@@ -236,7 +237,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
|
||||
|
||||
playerSet.forEach(uuid -> addMember(Bukkit.getPlayer(uuid), SteamwarUser.get(uuid), true));
|
||||
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()) {
|
||||
if (ArenaMode.VariableTeams.contains(GameConfig.mode) && isLeaderless()) {
|
||||
List<Player> onlinePlayers = new ArrayList<>(Bukkit.getOnlinePlayers());
|
||||
Collections.shuffle(onlinePlayers);
|
||||
for (Player player : onlinePlayers) {
|
||||
@@ -338,7 +339,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
|
||||
FightSystem.getHullHider().updatePlayer(player);
|
||||
FightSystem.getTechHider().reloadChunks(player, Config.ArenaRegion, Fight.getOpposite(this).getExtendRegion());
|
||||
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode)) {
|
||||
if (ArenaMode.VariableTeams.contains(GameConfig.mode)) {
|
||||
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
|
||||
}
|
||||
}
|
||||
@@ -356,7 +357,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
|
||||
this.leader = null;
|
||||
if (!players.isEmpty()) {
|
||||
setLeader(players.values().iterator().next(), false);
|
||||
} else if (FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(Config.mode)) {
|
||||
} else if (FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(GameConfig.mode)) {
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> FightState.setFightState(FightState.PRE_LEADER_SETUP), 1);
|
||||
}
|
||||
}
|
||||
@@ -448,7 +449,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
|
||||
}
|
||||
|
||||
private void testPasteAction() {
|
||||
if (Config.test()) {
|
||||
if (GameConfig.test()) {
|
||||
this.schematic.enable();
|
||||
} else if (Fight.getOpposite(this).schematic.hasSchematic()) {
|
||||
FightState.setFightState(FightState.POST_SCHEM_SETUP);
|
||||
@@ -480,7 +481,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
|
||||
if (ready) {
|
||||
broadcast("TEAM_READY");
|
||||
leader.ifPlayer(readyKit::loadToPlayer);
|
||||
if (Fight.allTeamsReady() || ArenaMode.SoloLeader.contains(Config.mode)) {
|
||||
if (Fight.allTeamsReady() || ArenaMode.SoloLeader.contains(GameConfig.mode)) {
|
||||
FightState.setFightState(FightState.PRE_RUNNING);
|
||||
}
|
||||
} else {
|
||||
@@ -493,7 +494,7 @@ public class FightTeam implements de.steamwar.gamecore.team.GameTeam<LivingEntit
|
||||
this.skip = !skip;
|
||||
if (skip) {
|
||||
broadcast("SKIP_READY");
|
||||
if (Fight.getOpposite(this).skip || Config.test()) {
|
||||
if (Fight.getOpposite(this).skip || GameConfig.test()) {
|
||||
skip = false;
|
||||
Fight.getOpposite(this).skip = false;
|
||||
if (Countdown.skipActive()) {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.listener.Recording;
|
||||
@@ -46,7 +47,7 @@ public class FightWorld extends StateDependent {
|
||||
private static final boolean PAPER = Bukkit.getVersion().contains("git-Paper");
|
||||
|
||||
public FightWorld() {
|
||||
super(ArenaMode.Restartable.contains(Config.mode) || Config.replayserver(), FightState.Schem);
|
||||
super(ArenaMode.Restartable.contains(GameConfig.mode) || GameConfig.replayserver(), FightState.Schem);
|
||||
register();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
@@ -51,7 +51,7 @@ public class Check implements Listener {
|
||||
|
||||
if (user.hasPerm(UserPerm.CHECK)) return;
|
||||
|
||||
SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
|
||||
SchematicNode schem = SchematicNode.getSchematicNode(GameConfig.CheckSchemID);
|
||||
if (user.getId() == schem.getOwner()) return;
|
||||
|
||||
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@@ -85,7 +86,7 @@ public class Permanent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onTpGM3(PlayerTeleportEvent e) {
|
||||
if (ArenaMode.AntiTest.contains(Config.mode) && e.getCause() == PlayerTeleportEvent.TeleportCause.SPECTATE) {
|
||||
if (ArenaMode.AntiTest.contains(GameConfig.mode) && e.getCause() == PlayerTeleportEvent.TeleportCause.SPECTATE) {
|
||||
e.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_TELEPORT", e.getPlayer(), ChatMessageType.ACTION_BAR);
|
||||
e.getPlayer().kickPlayer(null);
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.PistonMoveReaction;
|
||||
@@ -41,7 +42,7 @@ public class PistonListener implements Listener {
|
||||
|
||||
public PistonListener(Set<ArenaMode> condition, Consumer<BlockPistonEvent> leftAreaHandler) {
|
||||
this.leftAreaHandler = leftAreaHandler;
|
||||
if (!condition.contains(Config.mode)) return;
|
||||
if (!condition.contains(GameConfig.mode)) return;
|
||||
|
||||
//Wenn Entern aktiv ist, sollen Raketen etc. entern können
|
||||
new StateDependentListener(!Config.GameModeConfig.Arena.AllowMissiles, FightState.All, this);
|
||||
|
||||
@@ -21,6 +21,7 @@ package de.steamwar.fightsystem.listener;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@@ -67,7 +68,7 @@ public class PrepareSchem implements Listener {
|
||||
|
||||
SchematicNode schem;
|
||||
try {
|
||||
schem = SchematicNode.getSchematicNode(Config.PrepareSchemID);
|
||||
schem = SchematicNode.getSchematicNode(GameConfig.PrepareSchemID);
|
||||
} catch (SecurityException e) {
|
||||
FightSystem.getMessage().broadcast("PREPARE_SCHEM_DELETED");
|
||||
Bukkit.shutdown();
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
@@ -33,12 +34,12 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
public class Shutdown implements Listener {
|
||||
|
||||
public Shutdown() {
|
||||
new StateDependentListener(ArenaMode.AntiEvent.contains(Config.mode) && !Config.replayserver(), FightState.All, this);
|
||||
new StateDependentListener(ArenaMode.AntiEvent.contains(GameConfig.mode) && !GameConfig.replayserver(), FightState.All, this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerQuit(PlayerQuitEvent event) {
|
||||
if (Config.replayserver() || Config.GameModeConfig.Arena.Leaveable) return;
|
||||
if (GameConfig.replayserver() || Config.GameModeConfig.Arena.Leaveable) return;
|
||||
|
||||
//Shutdown server if nobody online
|
||||
if (Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer()))) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
@@ -43,7 +43,7 @@ public class TestJoin implements Listener {
|
||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (Config.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.MODERATION)) {
|
||||
if (GameConfig.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.MODERATION)) {
|
||||
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
|
||||
player.kickPlayer("");
|
||||
return;
|
||||
|
||||
@@ -22,6 +22,7 @@ package de.steamwar.fightsystem.record;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependent;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class FileRecorder extends StateDependent implements Recorder {
|
||||
private DataOutputStream outputStream;
|
||||
|
||||
public FileRecorder() {
|
||||
super(Config.ReplayID == 0, FightState.Recording);
|
||||
super(GameConfig.ReplayID == 0, FightState.Recording);
|
||||
register();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.fightsystem.record;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -33,7 +33,7 @@ public class FileSource extends PacketSource {
|
||||
}
|
||||
|
||||
public static void startReplay() {
|
||||
if (Config.replayserver()) {
|
||||
if (GameConfig.replayserver()) {
|
||||
try {
|
||||
new LiveServer();
|
||||
} catch (IOException e) {
|
||||
@@ -42,9 +42,9 @@ public class FileSource extends PacketSource {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.ReplayID > 0) {
|
||||
if (GameConfig.ReplayID > 0) {
|
||||
try {
|
||||
new FileSource(replayFile(Config.ReplayID));
|
||||
new FileSource(replayFile(GameConfig.ReplayID));
|
||||
} catch (IOException e) {
|
||||
throw new SecurityException("Could not start replay", e);
|
||||
}
|
||||
|
||||
+3
-2
@@ -25,6 +25,7 @@ import de.steamwar.entity.REntity;
|
||||
import de.steamwar.entity.REntityServer;
|
||||
import de.steamwar.entity.RPlayer;
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.countdown.FightCountdownAdapter;
|
||||
@@ -255,7 +256,7 @@ public class PacketProcessor implements Listener {
|
||||
addREntity(entityId, new RPlayer(entityServer, user.getUUID(), user.getUserName(), Config.SpecSpawn));
|
||||
team.addEntry(user.getUserName());
|
||||
|
||||
if (ArenaMode.Test.contains(Config.mode)) {
|
||||
if (ArenaMode.Test.contains(GameConfig.mode)) {
|
||||
entities.get(entityId).setGlowing(true);
|
||||
}
|
||||
});
|
||||
@@ -633,7 +634,7 @@ public class PacketProcessor implements Listener {
|
||||
entities.clear();
|
||||
|
||||
freezer.disable();
|
||||
if (!Config.replayserver()) {
|
||||
if (!GameConfig.replayserver()) {
|
||||
FightSystem.getMessage().broadcast("REPLAY_ENDS");
|
||||
}
|
||||
if (FightSystem.getLastWinner() != null) {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.record;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||
@@ -51,7 +52,7 @@ public interface Recorder {
|
||||
default void enable() {
|
||||
GlobalRecorder.getInstance().add(this);
|
||||
|
||||
if (ArenaMode.Event.contains(Config.mode)) {
|
||||
if (ArenaMode.Event.contains(GameConfig.mode)) {
|
||||
teamIds(Config.EventTeamBlueID, Config.EventTeamRedID);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -2,13 +2,14 @@ package de.steamwar.fightsystem.states;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Deprecated
|
||||
public class OneShotStateDependent extends de.steamwar.gamecore.state.OneShotStateDependent<FightState> implements IStateDependent {
|
||||
public OneShotStateDependent(Set<de.steamwar.gamecore.ArenaMode> modes, Set<FightState> states, Runnable runnable) {
|
||||
super(FightState.lifecycle, modes, Config.mode, states, runnable);
|
||||
super(FightState.lifecycle, modes, GameConfig.mode, states, runnable);
|
||||
}
|
||||
|
||||
public OneShotStateDependent(Winconditions wincondition, Set<FightState> states, Runnable runnable) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package de.steamwar.fightsystem.states;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -12,7 +13,7 @@ public abstract class StateDependent extends de.steamwar.gamecore.state.StateDep
|
||||
}
|
||||
|
||||
protected StateDependent(Set<de.steamwar.gamecore.ArenaMode> modes, Set<FightState> states) {
|
||||
super(FightState.lifecycle, modes, Config.mode, states);
|
||||
super(FightState.lifecycle, modes, GameConfig.mode, states);
|
||||
}
|
||||
|
||||
protected StateDependent(boolean enabled, Set<FightState> states) {
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package de.steamwar.fightsystem.states;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
||||
@@ -15,6 +15,6 @@ public class StateDependentCommand extends de.steamwar.gamecore.state.StateDepen
|
||||
};
|
||||
|
||||
public StateDependentCommand(Set<de.steamwar.gamecore.ArenaMode> modes, Set<FightState> states, String name, CommandExecutor executor) {
|
||||
super(FightState.lifecycle, modes.contains(Config.mode), states, FightSystem.getPlugin(), name, executor, unavailable);
|
||||
super(FightState.lifecycle, modes.contains(GameConfig.mode), states, FightSystem.getPlugin(), name, executor, unavailable);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package de.steamwar.fightsystem.states;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -18,6 +19,6 @@ public class StateDependentListener extends de.steamwar.gamecore.state.StateDepe
|
||||
}
|
||||
|
||||
public StateDependentListener(Set<de.steamwar.gamecore.ArenaMode> modes, Set<FightState> states, Listener listener) {
|
||||
super(FightState.lifecycle, modes, Config.mode, states, FightSystem.getPlugin(), listener);
|
||||
super(FightState.lifecycle, modes, GameConfig.mode, states, FightSystem.getPlugin(), listener);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package de.steamwar.fightsystem.states;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -17,6 +18,6 @@ public class StateDependentTask extends de.steamwar.gamecore.state.StateDependen
|
||||
}
|
||||
|
||||
public StateDependentTask(Set<de.steamwar.gamecore.ArenaMode> modes, Set<FightState> states, Runnable runnable, long delay, long period) {
|
||||
super(FightState.lifecycle, modes, Config.mode, states, FightSystem.getPlugin(), runnable, delay, period);
|
||||
super(FightState.lifecycle, modes, GameConfig.mode, states, FightSystem.getPlugin(), runnable, delay, period);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.gamecore.countdown.Countdown;
|
||||
@@ -125,7 +126,7 @@ public class FightStatistics {
|
||||
savePlayerStats(fp, fightId);
|
||||
}
|
||||
|
||||
if (ArenaMode.Event.contains(Config.mode)) {
|
||||
if (ArenaMode.Event.contains(GameConfig.mode)) {
|
||||
Config.EventKampf.setFight(fightId);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -29,6 +29,7 @@ import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependent;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.techhider.AccessPrivilegeProvider;
|
||||
import de.steamwar.techhider.TechHider;
|
||||
import lombok.Getter;
|
||||
@@ -58,7 +59,7 @@ import java.util.stream.Stream;
|
||||
|
||||
public class TechHiderWrapper extends StateDependent implements Listener {
|
||||
|
||||
public static final boolean ENABLED = !Config.OnlyPublicSchematics && !Config.test() && Config.GameModeConfig.Techhider.Active;
|
||||
public static final boolean ENABLED = !Config.OnlyPublicSchematics && !GameConfig.test() && Config.GameModeConfig.Techhider.Active;
|
||||
|
||||
@Getter
|
||||
private final ConcurrentHashMap<Player, Region> hiddenRegion = new ConcurrentHashMap<>();
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ contains the mechanics that do not depend on a specific arena:
|
||||
- reusable winner/draw results and score/last-remaining evaluation;
|
||||
- the complete state-dependent lifecycle (one-shots, tasks, listeners, commands,
|
||||
and countdowns);
|
||||
- the FightSystem arena modes and typed JVM runtime properties;
|
||||
- the FightSystem arena modes and shared JVM runtime configuration;
|
||||
- observable, generic game-state transitions.
|
||||
|
||||
GameCore intentionally does not define a game-state enum. Each consumer supplies
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
package de.steamwar.gamecore
|
||||
|
||||
import de.steamwar.gamecore.config.GameRuntimeProperties
|
||||
import java.util.Collections
|
||||
import java.util.EnumSet
|
||||
|
||||
@@ -50,16 +49,6 @@ enum class ArenaMode {
|
||||
@JvmField val NotOnBau: Set<ArenaMode> = complement(TEST, CHECK, PREPARE, REPLAY)
|
||||
@JvmField val SeriousFight: Set<ArenaMode> = complement(TEST, CHECK, REPLAY)
|
||||
|
||||
@JvmStatic
|
||||
fun from(properties: GameRuntimeProperties): ArenaMode = when {
|
||||
properties.checkSchematicId != 0 -> CHECK
|
||||
properties.prepareSchematicId != 0 -> PREPARE
|
||||
properties.fightId >= 1 -> EVENT
|
||||
properties.fightId == -1 -> TEST
|
||||
properties.replayId != 0 -> REPLAY
|
||||
else -> NORMAL
|
||||
}
|
||||
|
||||
private fun complement(vararg modes: ArenaMode): Set<ArenaMode> =
|
||||
immutable(EnumSet.complementOf(EnumSet.copyOf(modes.toSet())))
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
package de.steamwar.gamecore
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
* Runtime configuration shared by all GameCore game modes.
|
||||
*
|
||||
* The values are supplied as JVM system properties by the game server launcher.
|
||||
*/
|
||||
object GameConfig {
|
||||
@JvmField
|
||||
val CheckSchemID: Int = System.getProperty("checkSchemID", "0").toInt()
|
||||
|
||||
@JvmField
|
||||
val PrepareSchemID: Int = System.getProperty("prepareSchemID", "0").toInt()
|
||||
|
||||
@JvmField
|
||||
val ReplayID: Int = System.getProperty("replay", "0").toInt()
|
||||
|
||||
@JvmField
|
||||
val ConfigFile: String = System.getProperty("config", "config.yml")
|
||||
|
||||
@JvmField
|
||||
val EventKampfID: Int = System.getProperty("fightID", "0").toInt()
|
||||
|
||||
@JvmField
|
||||
val BlueLeader: UUID? = System.getProperty("blueLeader")?.let(UUID::fromString)
|
||||
|
||||
@JvmField
|
||||
val RedLeader: UUID? = System.getProperty("redLeader")?.let(UUID::fromString)
|
||||
|
||||
@JvmField
|
||||
val mode: ArenaMode = resolveArenaMode(CheckSchemID, PrepareSchemID, EventKampfID, ReplayID)
|
||||
|
||||
@JvmStatic
|
||||
fun test(): Boolean = ArenaMode.Test.contains(mode)
|
||||
|
||||
@JvmStatic
|
||||
fun replayserver(): Boolean = ReplayID < 0
|
||||
|
||||
internal fun resolveArenaMode(
|
||||
checkSchemID: Int,
|
||||
prepareSchemID: Int,
|
||||
eventKampfID: Int,
|
||||
replayID: Int,
|
||||
): ArenaMode = when {
|
||||
checkSchemID != 0 -> ArenaMode.CHECK
|
||||
prepareSchemID != 0 -> ArenaMode.PREPARE
|
||||
eventKampfID >= 1 -> ArenaMode.EVENT
|
||||
eventKampfID == -1 -> ArenaMode.TEST
|
||||
replayID != 0 -> ArenaMode.REPLAY
|
||||
else -> ArenaMode.NORMAL
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2026 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
package de.steamwar.gamecore.config
|
||||
|
||||
import java.util.Properties
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
* Typed view of every JVM system property historically consumed by FightSystem.
|
||||
*
|
||||
* Other game modes use the same names and parser, so launch behavior is
|
||||
* consistent across the complete GameCore family.
|
||||
*/
|
||||
data class GameRuntimeProperties(
|
||||
val checkSchematicId: Int,
|
||||
val prepareSchematicId: Int,
|
||||
val replayId: Int,
|
||||
val configFile: String,
|
||||
val fightId: Int,
|
||||
val blueLeader: UUID?,
|
||||
val redLeader: UUID?,
|
||||
) {
|
||||
val isReplayServer: Boolean
|
||||
get() = replayId < 0
|
||||
|
||||
companion object {
|
||||
const val CHECK_SCHEMATIC_ID = "checkSchemID"
|
||||
const val PREPARE_SCHEMATIC_ID = "prepareSchemID"
|
||||
const val REPLAY_ID = "replay"
|
||||
const val CONFIG_FILE = "config"
|
||||
const val FIGHT_ID = "fightID"
|
||||
const val BLUE_LEADER = "blueLeader"
|
||||
const val RED_LEADER = "redLeader"
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun load(properties: Properties = System.getProperties()): GameRuntimeProperties =
|
||||
GameRuntimeProperties(
|
||||
checkSchematicId = properties.int(CHECK_SCHEMATIC_ID),
|
||||
prepareSchematicId = properties.int(PREPARE_SCHEMATIC_ID),
|
||||
replayId = properties.int(REPLAY_ID),
|
||||
configFile = properties.getProperty(CONFIG_FILE, "config.yml"),
|
||||
fightId = properties.int(FIGHT_ID),
|
||||
blueLeader = properties.uuid(BLUE_LEADER),
|
||||
redLeader = properties.uuid(RED_LEADER),
|
||||
)
|
||||
|
||||
private fun Properties.int(name: String): Int =
|
||||
getProperty(name, "0").toInt()
|
||||
|
||||
private fun Properties.uuid(name: String): UUID? =
|
||||
getProperty(name)?.let(UUID::fromString)
|
||||
}
|
||||
}
|
||||
@@ -1,38 +1,31 @@
|
||||
package de.steamwar.gamecore
|
||||
|
||||
import de.steamwar.gamecore.config.GameRuntimeProperties
|
||||
import org.hamcrest.MatcherAssert.assertThat
|
||||
import org.hamcrest.Matchers.equalTo
|
||||
import org.junit.Test
|
||||
import java.util.Properties
|
||||
|
||||
class ArenaModeTest {
|
||||
@Test
|
||||
fun resolvesEveryFightSystemArenaMode() {
|
||||
assertThat(mode(), equalTo(ArenaMode.NORMAL))
|
||||
assertThat(mode(GameRuntimeProperties.FIGHT_ID to "42"), equalTo(ArenaMode.EVENT))
|
||||
assertThat(mode(GameRuntimeProperties.FIGHT_ID to "-1"), equalTo(ArenaMode.TEST))
|
||||
assertThat(mode(GameRuntimeProperties.REPLAY_ID to "42"), equalTo(ArenaMode.REPLAY))
|
||||
assertThat(mode(GameRuntimeProperties.PREPARE_SCHEMATIC_ID to "42"), equalTo(ArenaMode.PREPARE))
|
||||
assertThat(mode(GameRuntimeProperties.CHECK_SCHEMATIC_ID to "42"), equalTo(ArenaMode.CHECK))
|
||||
assertThat(mode(eventKampfID = 42), equalTo(ArenaMode.EVENT))
|
||||
assertThat(mode(eventKampfID = -1), equalTo(ArenaMode.TEST))
|
||||
assertThat(mode(replayID = 42), equalTo(ArenaMode.REPLAY))
|
||||
assertThat(mode(prepareSchemID = 42), equalTo(ArenaMode.PREPARE))
|
||||
assertThat(mode(checkSchemID = 42), equalTo(ArenaMode.CHECK))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun keepsFightSystemResolutionPrecedence() {
|
||||
val resolved = mode(
|
||||
GameRuntimeProperties.CHECK_SCHEMATIC_ID to "1",
|
||||
GameRuntimeProperties.PREPARE_SCHEMATIC_ID to "2",
|
||||
GameRuntimeProperties.FIGHT_ID to "3",
|
||||
GameRuntimeProperties.REPLAY_ID to "4",
|
||||
)
|
||||
val resolved = mode(checkSchemID = 1, prepareSchemID = 2, eventKampfID = 3, replayID = 4)
|
||||
|
||||
assertThat(resolved, equalTo(ArenaMode.CHECK))
|
||||
}
|
||||
|
||||
private fun mode(vararg values: Pair<String, String>): ArenaMode {
|
||||
val properties = Properties().apply {
|
||||
values.forEach { (name, value) -> setProperty(name, value) }
|
||||
}
|
||||
return ArenaMode.from(GameRuntimeProperties.load(properties))
|
||||
}
|
||||
private fun mode(
|
||||
checkSchemID: Int = 0,
|
||||
prepareSchemID: Int = 0,
|
||||
eventKampfID: Int = 0,
|
||||
replayID: Int = 0,
|
||||
): ArenaMode = GameConfig.resolveArenaMode(checkSchemID, prepareSchemID, eventKampfID, replayID)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package de.steamwar.gamecore
|
||||
|
||||
import org.hamcrest.MatcherAssert.assertThat
|
||||
import org.hamcrest.Matchers.equalTo
|
||||
import org.hamcrest.Matchers.nullValue
|
||||
import org.junit.Test
|
||||
|
||||
class GameConfigTest {
|
||||
@Test
|
||||
fun usesFightSystemDefaults() {
|
||||
assertThat(GameConfig.CheckSchemID, equalTo(0))
|
||||
assertThat(GameConfig.PrepareSchemID, equalTo(0))
|
||||
assertThat(GameConfig.ReplayID, equalTo(0))
|
||||
assertThat(GameConfig.ConfigFile, equalTo("config.yml"))
|
||||
assertThat(GameConfig.EventKampfID, equalTo(0))
|
||||
assertThat(GameConfig.BlueLeader, nullValue())
|
||||
assertThat(GameConfig.RedLeader, nullValue())
|
||||
assertThat(GameConfig.mode, equalTo(ArenaMode.NORMAL))
|
||||
assertThat(GameConfig.test(), equalTo(false))
|
||||
assertThat(GameConfig.replayserver(), equalTo(false))
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package de.steamwar.gamecore.config
|
||||
|
||||
import org.hamcrest.MatcherAssert.assertThat
|
||||
import org.hamcrest.Matchers.equalTo
|
||||
import org.hamcrest.Matchers.nullValue
|
||||
import org.junit.Test
|
||||
import java.util.Properties
|
||||
import java.util.UUID
|
||||
|
||||
class GameRuntimePropertiesTest {
|
||||
@Test
|
||||
fun loadsEveryFightSystemRuntimeProperty() {
|
||||
val blueLeader = UUID.randomUUID()
|
||||
val redLeader = UUID.randomUUID()
|
||||
val properties = Properties().apply {
|
||||
setProperty(GameRuntimeProperties.CHECK_SCHEMATIC_ID, "11")
|
||||
setProperty(GameRuntimeProperties.PREPARE_SCHEMATIC_ID, "12")
|
||||
setProperty(GameRuntimeProperties.REPLAY_ID, "-13")
|
||||
setProperty(GameRuntimeProperties.CONFIG_FILE, "event.yml")
|
||||
setProperty(GameRuntimeProperties.FIGHT_ID, "14")
|
||||
setProperty(GameRuntimeProperties.BLUE_LEADER, blueLeader.toString())
|
||||
setProperty(GameRuntimeProperties.RED_LEADER, redLeader.toString())
|
||||
}
|
||||
|
||||
val runtime = GameRuntimeProperties.load(properties)
|
||||
|
||||
assertThat(runtime.checkSchematicId, equalTo(11))
|
||||
assertThat(runtime.prepareSchematicId, equalTo(12))
|
||||
assertThat(runtime.replayId, equalTo(-13))
|
||||
assertThat(runtime.configFile, equalTo("event.yml"))
|
||||
assertThat(runtime.fightId, equalTo(14))
|
||||
assertThat(runtime.blueLeader, equalTo(blueLeader))
|
||||
assertThat(runtime.redLeader, equalTo(redLeader))
|
||||
assertThat(runtime.isReplayServer, equalTo(true))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun usesFightSystemDefaults() {
|
||||
val runtime = GameRuntimeProperties.load(Properties())
|
||||
|
||||
assertThat(runtime.checkSchematicId, equalTo(0))
|
||||
assertThat(runtime.prepareSchematicId, equalTo(0))
|
||||
assertThat(runtime.replayId, equalTo(0))
|
||||
assertThat(runtime.configFile, equalTo("config.yml"))
|
||||
assertThat(runtime.fightId, equalTo(0))
|
||||
assertThat(runtime.blueLeader, nullValue())
|
||||
assertThat(runtime.redLeader, nullValue())
|
||||
assertThat(runtime.isReplayServer, equalTo(false))
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.misslewars;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.config.GameRuntimeProperties;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.sql.Event;
|
||||
import de.steamwar.sql.EventFight;
|
||||
import de.steamwar.sql.Team;
|
||||
@@ -38,8 +38,7 @@ public class Config {
|
||||
private Config() {
|
||||
}
|
||||
|
||||
public static final GameRuntimeProperties RuntimeProperties = GameRuntimeProperties.load();
|
||||
public static final ArenaMode mode = ArenaMode.from(RuntimeProperties);
|
||||
public static final ArenaMode mode = GameConfig.mode;
|
||||
|
||||
public static final int ArenaMinX;
|
||||
public static final int ArenaMaxX;
|
||||
@@ -113,13 +112,13 @@ public class Config {
|
||||
BluePortalZ = blue.getInt("PortalZ");
|
||||
BlueSpawn = new Location(Bukkit.getWorlds().get(0), blue.getDouble("SpawnX"), blue.getDouble("SpawnY"), blue.getDouble("SpawnZ"), (float) blue.getDouble("SpawnYaw"), (float) blue.getDouble("SpawnPitch"));
|
||||
|
||||
BlueLeader = RuntimeProperties.getBlueLeader();
|
||||
RedLeader = RuntimeProperties.getRedLeader();
|
||||
BlueLeader = GameConfig.BlueLeader;
|
||||
RedLeader = GameConfig.RedLeader;
|
||||
|
||||
Barrier = config.getBoolean("Barrier", false);
|
||||
Space = config.getBoolean("Space", false);
|
||||
|
||||
EventKampfID = RuntimeProperties.getFightId();
|
||||
EventKampfID = GameConfig.EventKampfID;
|
||||
if (EventKampfID >= 1) {
|
||||
EventKampf = EventFight.byId(EventKampfID);
|
||||
if (EventKampf == null) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.tntleague.config
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode
|
||||
import de.steamwar.gamecore.config.GameRuntimeProperties
|
||||
import de.steamwar.gamecore.GameConfig
|
||||
import de.steamwar.message.SubMessage
|
||||
import de.steamwar.sql.Event
|
||||
import de.steamwar.sql.EventFight
|
||||
@@ -34,19 +34,17 @@ import org.bukkit.inventory.meta.Damageable
|
||||
import org.bukkit.inventory.meta.ItemMeta
|
||||
import java.util.*
|
||||
|
||||
private val runtimeProperties = GameRuntimeProperties.load()
|
||||
|
||||
data class TNTLeagueConfig(
|
||||
val startDelay: Int = 10,
|
||||
val gameTime: Int = 60 * 20,
|
||||
|
||||
val prices: Map<Material, Price>,
|
||||
|
||||
val blueLeader: UUID? = runtimeProperties.blueLeader,
|
||||
val redLeader: UUID? = runtimeProperties.redLeader,
|
||||
val blueLeader: UUID? = GameConfig.BlueLeader,
|
||||
val redLeader: UUID? = GameConfig.RedLeader,
|
||||
|
||||
val eventFightId: Int? = runtimeProperties.fightId.takeIf { it != 0 },
|
||||
val arenaMode: ArenaMode = ArenaMode.from(runtimeProperties),
|
||||
val eventFightId: Int? = GameConfig.EventKampfID.takeIf { it != 0 },
|
||||
val arenaMode: ArenaMode = GameConfig.mode,
|
||||
) {
|
||||
lateinit var eventFight: EventFight
|
||||
lateinit var event: Event
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.towerrun.config;
|
||||
|
||||
import de.steamwar.gamecore.ArenaMode;
|
||||
import de.steamwar.gamecore.config.GameRuntimeProperties;
|
||||
import de.steamwar.gamecore.GameConfig;
|
||||
import de.steamwar.sql.Event;
|
||||
import de.steamwar.sql.EventFight;
|
||||
import de.steamwar.towerrun.TowerRun;
|
||||
@@ -37,8 +37,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
@UtilityClass
|
||||
public class Config {
|
||||
public static final GameRuntimeProperties RUNTIME_PROPERTIES = GameRuntimeProperties.load();
|
||||
public static final ArenaMode MODE = ArenaMode.from(RUNTIME_PROPERTIES);
|
||||
public static final ArenaMode MODE = GameConfig.mode;
|
||||
|
||||
public static final int MIN_PLAYERS;
|
||||
public static final int LOBBY_TIMER;
|
||||
@@ -69,7 +68,7 @@ public class Config {
|
||||
GAME_ESCAPE_TIMER = config.getInt("gameEscapeTimer", 60);
|
||||
DESTROYABLE_BLOCKS = EnumSet.copyOf(config.getStringList("destroyable").stream().map(Material::valueOf).collect(Collectors.toSet()));
|
||||
|
||||
EVENT_KAMPF_ID = RUNTIME_PROPERTIES.getFightId();
|
||||
EVENT_KAMPF_ID = GameConfig.EventKampfID;
|
||||
|
||||
if (event()) {
|
||||
EVENT_FIGHT = EventFight.byId(EVENT_KAMPF_ID);
|
||||
|
||||
Reference in New Issue
Block a user