forked from SteamWar/SteamWar
Improve GameModeConfig
This commit is contained in:
@@ -21,7 +21,6 @@ package de.steamwar.sql;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.commands.CheckCommand;
|
||||
|
||||
@@ -35,7 +34,8 @@ public class SQLWrapperImpl implements SQLWrapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSchematicType(GameModeConfig<String, String, String> gameModeConfig, SchematicType type) {
|
||||
public void processSchematicType(GameModeConfig<String, String> gameModeConfig) {
|
||||
SchematicType type = gameModeConfig.Schematic.Type;
|
||||
if (type.checkType() != null) {
|
||||
CheckCommand.setCheckQuestions(type.checkType(), gameModeConfig.CheckQuestions);
|
||||
CheckCommand.addFightType(type.checkType(), type);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore;
|
||||
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.UtilityClass;
|
||||
@@ -30,11 +30,11 @@ import java.util.*;
|
||||
@UtilityClass
|
||||
public class ArenaMode {
|
||||
|
||||
private static final Map<String, GameModeConfig<String, SchematicType, String>> byChat = new HashMap<>();
|
||||
private static final Map<String, GameModeConfig<String, SchematicType, String>> byInternal = new HashMap<>();
|
||||
private static final Map<SchematicType, GameModeConfig<String, SchematicType, String>> bySchemType = new HashMap<>();
|
||||
private static final Map<String, GameModeConfig<String, String>> byChat = new HashMap<>();
|
||||
private static final Map<String, GameModeConfig<String, String>> byInternal = new HashMap<>();
|
||||
private static final Map<SchematicType, GameModeConfig<String, String>> bySchemType = new HashMap<>();
|
||||
@Getter
|
||||
private static final List<GameModeConfig<String, SchematicType, String>> allModes = new LinkedList<>();
|
||||
private static final List<GameModeConfig<String, String>> allModes = new LinkedList<>();
|
||||
|
||||
static {
|
||||
init();
|
||||
@@ -51,7 +51,7 @@ public class ArenaMode {
|
||||
return;
|
||||
|
||||
for(File file : Arrays.stream(folder.listFiles((file, name) -> name.endsWith(".yml") && !name.endsWith(".kits.yml"))).sorted().toList()) {
|
||||
GameModeConfig<String, SchematicType, String> gameModeConfig = new GameModeConfig<>(file, GameModeConfig.ToString, GameModeConfig.ToSchematicType, GameModeConfig.ToString, GameModeConfig.ToInternalName);
|
||||
GameModeConfig<String, String> gameModeConfig = new GameModeConfig<>(file, GameModeConfig.ToString, GameModeConfig.ToString, GameModeConfig.ToInternalName);
|
||||
if (!gameModeConfig.Server.loaded) continue;
|
||||
|
||||
allModes.add(gameModeConfig);
|
||||
@@ -65,24 +65,24 @@ public class ArenaMode {
|
||||
}
|
||||
}
|
||||
|
||||
public static GameModeConfig<String, SchematicType, String> getByChat(String name){
|
||||
public static GameModeConfig<String, String> getByChat(String name){
|
||||
return byChat.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
public static GameModeConfig<String, SchematicType, String> getByInternal(String name){
|
||||
public static GameModeConfig<String, String> getByInternal(String name){
|
||||
return byInternal.get(name);
|
||||
}
|
||||
|
||||
public static List<String> getAllChatNames(boolean historic) {
|
||||
List<String> chatNames = new LinkedList<>();
|
||||
for(GameModeConfig<String, SchematicType, String> mode : byInternal.values()){
|
||||
for(GameModeConfig<String, String> mode : byInternal.values()){
|
||||
if(mode.isActive() && historic == mode.Server.Historic)
|
||||
chatNames.addAll(mode.Server.ChatNames);
|
||||
}
|
||||
return chatNames;
|
||||
}
|
||||
|
||||
public static GameModeConfig<String, SchematicType, String> getBySchemType(SchematicType schemType){
|
||||
public static GameModeConfig<String, String> getBySchemType(SchematicType schemType){
|
||||
return bySchemType.get(schemType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ package de.steamwar.velocitycore;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.velocity.platform.VelocityViaConfig;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.persistent.Arenaserver;
|
||||
import de.steamwar.persistent.Bauserver;
|
||||
@@ -80,7 +80,7 @@ public class ServerStarter {
|
||||
private final Set<Player> playersToSend = new HashSet<>();
|
||||
private final Map<String, String> arguments = new HashMap<>();
|
||||
|
||||
public ServerStarter arena(GameModeConfig<String, SchematicType, String> mode, String map) {
|
||||
public ServerStarter arena(GameModeConfig<String, String> mode, String map) {
|
||||
portrange = ARENA_PORTS;
|
||||
serverNameProvider = port -> mode.GameName + (port - portrange.start);
|
||||
version = ServerVersion.from(mode);
|
||||
@@ -116,7 +116,7 @@ public class ServerStarter {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ServerStarter test(GameModeConfig<String, SchematicType, String> mode, String map, Player owner) {
|
||||
public ServerStarter test(GameModeConfig<String, String> mode, String map, Player owner) {
|
||||
arena(mode, map);
|
||||
buildWithTemp(owner);
|
||||
portrange = BAU_PORTS;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.velocitycore;
|
||||
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -115,7 +115,7 @@ public enum ServerVersion {
|
||||
|
||||
private static final Pattern terminatingNumber = Pattern.compile("(\\d+)$");
|
||||
|
||||
public static ServerVersion from(GameModeConfig<String, SchematicType, String> type) {
|
||||
public static ServerVersion from(GameModeConfig<String, String> type) {
|
||||
Matcher matcher = terminatingNumber.matcher(type.Server.Folder);
|
||||
matcher.find();
|
||||
return ServerVersion.valueOf((type.Server.Spigot ? "SPIGOT_" : "PAPER_") + matcher.group(1));
|
||||
|
||||
@@ -23,7 +23,7 @@ import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
@@ -240,7 +240,7 @@ public class BauCommand extends SWCommand {
|
||||
|
||||
@Register("test")
|
||||
@Register("testarena")
|
||||
public void testarena(PlayerChatter sender, @Mapper("nonHistoricArenaMode") @OptionalValue("") @AllowNull GameModeConfig<String, SchematicType, String> arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
|
||||
public void testarena(PlayerChatter sender, @Mapper("nonHistoricArenaMode") @OptionalValue("") @AllowNull GameModeConfig<String, String> arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
|
||||
FightCommand.createArena(sender, "/bau testarena ", false, arenaMode, map, false, (chatter, mode, m) ->
|
||||
new ServerStarter().test(mode, m, sender.getPlayer()).start()
|
||||
);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import de.steamwar.velocitycore.ArenaMode;
|
||||
@@ -87,7 +87,7 @@ public class BuilderCloudCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "deploy", description = "BUILDERCLOUD_DEPLOY_USAGE")
|
||||
public void deploy(Chatter sender, @Mapper("nonHistoricArenaMode") GameModeConfig<String, SchematicType, String> arenaMode, @ErrorMessage("BUILDERCLOUD_VERSION") ServerVersion version, @Mapper("map") String map) {
|
||||
public void deploy(Chatter sender, @Mapper("nonHistoricArenaMode") GameModeConfig<String, String> arenaMode, @ErrorMessage("BUILDERCLOUD_VERSION") ServerVersion version, @Mapper("map") String map) {
|
||||
if(!mapFile(version, map).exists()) {
|
||||
sender.system("BUILDERCLOUD_UNKNOWN_MAP");
|
||||
return;
|
||||
|
||||
@@ -22,7 +22,7 @@ package de.steamwar.velocitycore.commands;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
@@ -31,7 +31,6 @@ import de.steamwar.messages.PlayerChatter;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
import de.steamwar.sql.IgnoreSystem;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import de.steamwar.velocitycore.ArenaMode;
|
||||
import de.steamwar.velocitycore.ServerStarter;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
||||
@@ -48,7 +47,7 @@ public class ChallengeCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "CHALLENGE_USAGE")
|
||||
public void challenge(@Validator("arenaPlayer") PlayerChatter sender, @Validator("target") Player target, @Mapper("nonHistoricArenaMode") @OptionalValue("") @AllowNull GameModeConfig<String, SchematicType, String> arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
|
||||
public void challenge(@Validator("arenaPlayer") PlayerChatter sender, @Validator("target") Player target, @Mapper("nonHistoricArenaMode") @OptionalValue("") @AllowNull GameModeConfig<String, String> arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
|
||||
FightCommand.createArena(sender, "/challenge " + target.getUsername() + " ", false, arenaMode, map, false, (chatter, mode, m) -> {
|
||||
Player p = sender.getPlayer();
|
||||
if(challenges.containsKey(target) && challenges.get(target).contains(p)){
|
||||
|
||||
@@ -21,7 +21,7 @@ package de.steamwar.velocitycore.commands;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
@@ -221,7 +221,7 @@ public class CheckCommand extends SWCommand {
|
||||
this.startTime = Timestamp.from(Instant.now());
|
||||
this.checkList = checkQuestions.get(schematic.getSchemtype()).listIterator();
|
||||
|
||||
GameModeConfig<String, SchematicType, String> mode = ArenaMode.getBySchemType(fightTypes.get(schematic.getSchemtype()));
|
||||
GameModeConfig<String, String> mode = ArenaMode.getBySchemType(fightTypes.get(schematic.getSchemtype()));
|
||||
new ServerStarter().test(mode, mode.getRandomMap(), checker.getPlayer()).check(schematic.getId()).callback(subserver -> {
|
||||
currentCheckers.put(checker.user().getUUID(), this);
|
||||
currentSchems.put(schematic.getId(), this);
|
||||
|
||||
@@ -21,7 +21,7 @@ package de.steamwar.velocitycore.commands;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
@@ -50,7 +50,7 @@ public class FightCommand extends SWCommand {
|
||||
|
||||
private static void getModes(Chatter sender, String precommand, boolean historic){
|
||||
Component start = Component.empty();
|
||||
for(GameModeConfig<String, SchematicType, String> mode : ArenaMode.getAllModes()){
|
||||
for(GameModeConfig<String, String> mode : ArenaMode.getAllModes()){
|
||||
if (!mode.isActive() || mode.Server.Historic != historic)
|
||||
continue;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class FightCommand extends SWCommand {
|
||||
sender.sendMessage(start);
|
||||
}
|
||||
|
||||
static void createArena(PlayerChatter sender, String precommand, boolean allowMerging, GameModeConfig<String, SchematicType, String> arenaMode, String map, boolean historic, FightCallback callback) {
|
||||
static void createArena(PlayerChatter sender, String precommand, boolean allowMerging, GameModeConfig<String, String> arenaMode, String map, boolean historic, FightCallback callback) {
|
||||
if (arenaMode == null) {
|
||||
getModes(sender, precommand, historic);
|
||||
return;
|
||||
@@ -82,7 +82,7 @@ public class FightCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private static void suggestMerging(PlayerChatter sender, GameModeConfig<String, SchematicType, String> mode, String map, FightCallback declineMerge) {
|
||||
private static void suggestMerging(PlayerChatter sender, GameModeConfig<String, String> mode, String map, FightCallback declineMerge) {
|
||||
Arenaserver mergable = null;
|
||||
synchronized (Subserver.getServerList()) {
|
||||
for (Subserver subserver : Subserver.getServerList()) {
|
||||
@@ -120,7 +120,7 @@ public class FightCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register
|
||||
public void fight(@Validator("arenaPlayer") PlayerChatter sender, @Mapper("nonHistoricArenaMode") @OptionalValue("") @AllowNull GameModeConfig<String, SchematicType, String> arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
|
||||
public void fight(@Validator("arenaPlayer") PlayerChatter sender, @Mapper("nonHistoricArenaMode") @OptionalValue("") @AllowNull GameModeConfig<String, String> arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
|
||||
createArena(sender, "/fight ", true, arenaMode, map, false,
|
||||
(p, mode, m) -> new ServerStarter().arena(mode, m).blueLeader(p.getPlayer()).callback(
|
||||
arena -> Chatter.broadcast().system("FIGHT_BROADCAST", new Message("FIGHT_BROADCAST_HOVER", p.getPlayer().getUsername()), ClickEvent.runCommand("/arena " + arena.getServer().getName()), mode.GameName, p.getPlayer().getUsername())
|
||||
@@ -129,6 +129,6 @@ public class FightCommand extends SWCommand {
|
||||
}
|
||||
|
||||
public interface FightCallback {
|
||||
void run(PlayerChatter player, GameModeConfig<String, SchematicType, String> mode, String map);
|
||||
void run(PlayerChatter player, GameModeConfig<String, String> mode, String map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,14 +20,13 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import de.steamwar.velocitycore.ArenaMode;
|
||||
import de.steamwar.velocitycore.ServerStarter;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
||||
@@ -39,7 +38,7 @@ public class HistoricCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register
|
||||
public void historic(@Validator("arenaPlayer") PlayerChatter player, @Mapper("historicArenaMode") @OptionalValue("") @AllowNull GameModeConfig<String, SchematicType, String> arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
|
||||
public void historic(@Validator("arenaPlayer") PlayerChatter player, @Mapper("historicArenaMode") @OptionalValue("") @AllowNull GameModeConfig<String, String> arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
|
||||
FightCommand.createArena(player, "/historic ", true, arenaMode, map, true, (p, mode, m) -> new ServerStarter().arena(mode, m).blueLeader(p.getPlayer()).callback(
|
||||
arena -> Chatter.broadcast().system("HISTORIC_BROADCAST", new Message("HISTORIC_BROADCAST_HOVER", p), ClickEvent.runCommand("/arena " + arena.getServer().getName()), mode.GameName, p.getPlayer())
|
||||
).start());
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
@@ -48,7 +48,7 @@ public class RankCommand extends SWCommand {
|
||||
if (!sender.user().equals(user))
|
||||
sender.prefixless("RANK_PLAYER_FOUND", user);
|
||||
|
||||
for(GameModeConfig<String, SchematicType, String> mode : ArenaMode.getAllModes()) {
|
||||
for(GameModeConfig<String, String> mode : ArenaMode.getAllModes()) {
|
||||
if (!mode.Server.Ranked)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.velocitycore.commands;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.EventMode;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Message;
|
||||
@@ -69,7 +69,7 @@ public class ReplayCommand extends SWCommand {
|
||||
if (PunishmentCommand.isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer))
|
||||
return;
|
||||
|
||||
GameModeConfig<String, SchematicType, String> mode = ArenaMode.getBySchemType(fight.getSchemType());
|
||||
GameModeConfig<String, String> mode = ArenaMode.getBySchemType(fight.getSchemType());
|
||||
ServerStarter starter = new ServerStarter().replay(fight.getFightID()).blueLeader(sender.getPlayer());
|
||||
|
||||
String map = mode.getRandomMap();
|
||||
|
||||
@@ -23,7 +23,7 @@ import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.PlayerChatter;
|
||||
import de.steamwar.sql.Punishment;
|
||||
@@ -47,11 +47,11 @@ public class TypeMappers {
|
||||
return (sender, player, messageSender) -> !PunishmentCommand.isPunishedWithMessage(player, Punishment.PunishmentType.NoFightServer);
|
||||
}
|
||||
|
||||
private static TypeMapper<GameModeConfig<String, SchematicType, String>> arenaModeTypeMapper(boolean historic) {
|
||||
private static TypeMapper<GameModeConfig<String, String>> arenaModeTypeMapper(boolean historic) {
|
||||
return new TypeMapper<>() {
|
||||
@Override
|
||||
public GameModeConfig<String, SchematicType, String> map(Chatter sender, PreviousArguments previousArguments, String s) {
|
||||
GameModeConfig<String, SchematicType, String> arenaMode = ArenaMode.getByChat(s);
|
||||
public GameModeConfig<String, String> map(Chatter sender, PreviousArguments previousArguments, String s) {
|
||||
GameModeConfig<String, String> arenaMode = ArenaMode.getByChat(s);
|
||||
if (arenaMode == null) return null;
|
||||
if (arenaMode.Server.Historic != historic) return null;
|
||||
if (!arenaMode.isActive()) return null;
|
||||
@@ -76,7 +76,7 @@ public class TypeMappers {
|
||||
@Override
|
||||
public Collection<String> tabCompletes(Chatter sender, PreviousArguments previousArguments, String s) {
|
||||
if (previousArguments.userArgs.length == 0) return null;
|
||||
GameModeConfig<String, SchematicType, String> arenaMode = ArenaMode.getByChat(previousArguments.userArgs[previousArguments.userArgs.length - 1]);
|
||||
GameModeConfig<String, String> arenaMode = ArenaMode.getByChat(previousArguments.userArgs[previousArguments.userArgs.length - 1]);
|
||||
if (arenaMode == null) return null;
|
||||
return arenaMode.Server.Maps;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.velocitypowered.api.proxy.ConsoleCommandSource;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.ChatterGroup;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.velocitycore.network.handlers;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.network.packets.PacketHandler;
|
||||
@@ -56,7 +56,7 @@ public class EloPlayerHandler extends PacketHandler {
|
||||
@Handler
|
||||
public void handle(FightEndsPacket fightEndsPacket) {
|
||||
SchematicType schematicType = SchematicType.fromDB(fightEndsPacket.getGameMode());
|
||||
GameModeConfig<String, SchematicType, String> arenaMode;
|
||||
GameModeConfig<String, String> arenaMode;
|
||||
if (schematicType == null) {
|
||||
arenaMode = ArenaMode.getByInternal(fightEndsPacket.getGameMode());
|
||||
} else {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package de.steamwar.velocitycore.network.handlers;
|
||||
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.network.packets.PacketHandler;
|
||||
import de.steamwar.network.packets.common.FightEndsPacket;
|
||||
@@ -46,7 +46,7 @@ public class EloSchemHandler extends PacketHandler {
|
||||
public void handle(FightEndsPacket fightEndsPacket) {
|
||||
SchematicType type = SchematicType.fromDB(fightEndsPacket.getGameMode());
|
||||
if (type == null) return;
|
||||
GameModeConfig<String, SchematicType, String> arenaMode = ArenaMode.getBySchemType(type);
|
||||
GameModeConfig<String, String> arenaMode = ArenaMode.getBySchemType(type);
|
||||
if (!arenaMode.Server.Ranked) return;
|
||||
|
||||
if (publicVsPrivate(fightEndsPacket))
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package de.steamwar.velocitycore.network.handlers;
|
||||
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.steamwar.data.GameModeConfig;
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.network.packets.PacketHandler;
|
||||
import de.steamwar.network.packets.client.PrepareSchemPacket;
|
||||
@@ -37,7 +37,7 @@ public class PrepareSchemHandler extends PacketHandler {
|
||||
public void handle(PrepareSchemPacket packet) {
|
||||
Player player = VelocityCore.getProxy().getPlayer(SteamwarUser.get(packet.getPlayer()).getUUID()).orElse(null);
|
||||
int schematicID = packet.getSchem();
|
||||
GameModeConfig<String, SchematicType, String> mode = ArenaMode.getBySchemType(SchematicType.fromDB(packet.getSchemType()));
|
||||
GameModeConfig<String, String> mode = ArenaMode.getBySchemType(SchematicType.fromDB(packet.getSchemType()));
|
||||
|
||||
new ServerStarter().test(mode, mode.getRandomMap(), player).prepare(schematicID).start();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user