forked from SteamWar/SteamWar
Hotfix CheckCommand
Remove uneeded stuff in SQLWrapper
This commit is contained in:
@@ -36,8 +36,5 @@ public interface SQLWrapper<M> {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
default void processSchematicType(GameModeConfig<?, String> gameModeConfig) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void additionalExceptionMetadata(StringBuilder builder);
|
void additionalExceptionMetadata(StringBuilder builder);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ package de.steamwar.sql;
|
|||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
import de.steamwar.velocitycore.VelocityCore;
|
import de.steamwar.velocitycore.VelocityCore;
|
||||||
import de.steamwar.velocitycore.commands.CheckCommand;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@@ -38,15 +37,6 @@ public class SQLWrapperImpl implements SQLWrapper<String> {
|
|||||||
return new GameModeConfig<>(file, GameModeConfig.ToString, GameModeConfig.ToString, GameModeConfig.ToInternalName, true);
|
return new GameModeConfig<>(file, GameModeConfig.ToString, GameModeConfig.ToString, GameModeConfig.ToInternalName, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void processSchematicType(GameModeConfig<?, String> gameModeConfig) {
|
|
||||||
SchematicType type = gameModeConfig.Schematic.Type;
|
|
||||||
if (type.checkType() != null) {
|
|
||||||
CheckCommand.setCheckQuestions(type.checkType(), gameModeConfig.CheckQuestions);
|
|
||||||
CheckCommand.addFightType(type.checkType(), type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void additionalExceptionMetadata(StringBuilder builder) {
|
public void additionalExceptionMetadata(StringBuilder builder) {
|
||||||
builder.append("\nServers: ");
|
builder.append("\nServers: ");
|
||||||
|
|||||||
@@ -48,20 +48,9 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
public class CheckCommand extends SWCommand {
|
public class CheckCommand extends SWCommand {
|
||||||
private static final Map<SchematicType, SchematicType> fightTypes = new HashMap<>();
|
|
||||||
private static final Map<SchematicType, List<String>> checkQuestions = new HashMap<>();
|
|
||||||
|
|
||||||
private static final Map<UUID, CheckSession> currentCheckers = new HashMap<>();
|
private static final Map<UUID, CheckSession> currentCheckers = new HashMap<>();
|
||||||
private static final Map<Integer, CheckSession> currentSchems = new HashMap<>();
|
private static final Map<Integer, CheckSession> currentSchems = new HashMap<>();
|
||||||
|
|
||||||
public static void setCheckQuestions(SchematicType checkType, List<String> checkQuestions) {
|
|
||||||
CheckCommand.checkQuestions.put(checkType, checkQuestions);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addFightType(SchematicType checkType, SchematicType fightType) {
|
|
||||||
fightTypes.put(checkType, fightType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isChecking(Player player){
|
public static boolean isChecking(Player player){
|
||||||
return currentCheckers.containsKey(player.getUniqueId());
|
return currentCheckers.containsKey(player.getUniqueId());
|
||||||
}
|
}
|
||||||
@@ -248,9 +237,9 @@ public class CheckCommand extends SWCommand {
|
|||||||
this.checker = checker;
|
this.checker = checker;
|
||||||
this.schematic = schematic;
|
this.schematic = schematic;
|
||||||
this.startTime = Timestamp.from(Instant.now());
|
this.startTime = Timestamp.from(Instant.now());
|
||||||
this.checkList = checkQuestions.get(schematic.getSchemtype()).listIterator();
|
this.checkList = GameModeConfig.getBySchematicType(schematic.getSchemtype()).CheckQuestions.listIterator();
|
||||||
|
|
||||||
GameModeConfig<String, String> mode = ArenaMode.getBySchemType(fightTypes.get(schematic.getSchemtype()));
|
GameModeConfig<String, String> mode = GameModeConfig.getBySchematicType(schematic.getSchemtype());
|
||||||
new ServerStarter().test(mode, mode.getRandomMap(), checker.getPlayer()).check(schematic.getId()).callback(subserver -> {
|
new ServerStarter().test(mode, mode.getRandomMap(), checker.getPlayer()).check(schematic.getId()).callback(subserver -> {
|
||||||
currentCheckers.put(checker.user().getUUID(), this);
|
currentCheckers.put(checker.user().getUUID(), this);
|
||||||
currentSchems.put(schematic.getId(), this);
|
currentSchems.put(schematic.getId(), this);
|
||||||
@@ -304,7 +293,7 @@ public class CheckCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void accept(){
|
private void accept(){
|
||||||
concludeCheckSession("freigegeben", fightTypes.get(schematic.getSchemtype()), () -> {
|
concludeCheckSession("freigegeben", GameModeConfig.getBySchematicType(schematic.getSchemtype()).Schematic.Type, () -> {
|
||||||
Chatter owner = Chatter.of(SteamwarUser.byId(schematic.getOwner()).getUUID());
|
Chatter owner = Chatter.of(SteamwarUser.byId(schematic.getOwner()).getUUID());
|
||||||
owner.withPlayerOrOffline(
|
owner.withPlayerOrOffline(
|
||||||
player -> owner.system("CHECK_ACCEPTED", schematic.getSchemtype().name(), schematic.getName()),
|
player -> owner.system("CHECK_ACCEPTED", schematic.getSchemtype().name(), schematic.getName()),
|
||||||
|
|||||||
Reference in New Issue
Block a user