Dieser Commit ist enthalten in:
Ursprung
4b5ea06616
Commit
975ebf4f33
62
src/de/steamwar/sql/Mod.java
Normale Datei
62
src/de/steamwar/sql/Mod.java
Normale Datei
@ -0,0 +1,62 @@
|
||||
package de.steamwar.sql;
|
||||
|
||||
import de.steamwar.sql.internal.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class Mod {
|
||||
|
||||
static {
|
||||
SqlTypeMapper.ordinalEnumMapper(Platform.class);
|
||||
SqlTypeMapper.ordinalEnumMapper(ModType.class);
|
||||
}
|
||||
|
||||
private static final Table<Mod> table = new Table<>(Mod.class, "Mods");
|
||||
|
||||
private static final SelectStatement<Mod> select = table.select(Table.PRIMARY);
|
||||
private static final SelectStatement<Mod> all = new SelectStatement(table, "SELECT * FROM Mods");
|
||||
private static final SelectStatement<Mod> allUnklassified = new SelectStatement(table, "SELECT * FROM Mods WHERE modType = 0");
|
||||
private static final Statement update = table.update(Table.PRIMARY, "modType");
|
||||
|
||||
public static Mod get(Platform platform, String name) {
|
||||
return select.select(platform, name);
|
||||
}
|
||||
|
||||
public static List<Mod> getAll() {
|
||||
return all.listSelect();
|
||||
}
|
||||
|
||||
public static List<Mod> getAllUnklassified() {
|
||||
return allUnklassified.listSelect();
|
||||
}
|
||||
|
||||
@Field(keys = {Table.PRIMARY})
|
||||
private final Platform platform;
|
||||
@Field(keys = {Table.PRIMARY})
|
||||
private final String modName;
|
||||
@Field(def = "0")
|
||||
private ModType modType;
|
||||
|
||||
public void setModType(ModType modType) {
|
||||
this.modType = modType;
|
||||
update.update(modType, platform, modName);
|
||||
}
|
||||
|
||||
public enum Platform {
|
||||
FORGE,
|
||||
LABYMOD,
|
||||
FABRIC
|
||||
}
|
||||
|
||||
public enum ModType {
|
||||
UNKLASSIFIED,
|
||||
GREEN,
|
||||
YELLOW,
|
||||
RED,
|
||||
YOUTUBER_ONLY;
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren