diff --git a/src/de/steamwar/sql/SchematicType.java b/src/de/steamwar/sql/SchematicType.java index 43cfb44..0ee483a 100644 --- a/src/de/steamwar/sql/SchematicType.java +++ b/src/de/steamwar/sql/SchematicType.java @@ -26,7 +26,7 @@ import java.util.*; public class SchematicType { - public static final SchematicType Normal = new SchematicType("Normal", "", Type.NORMAL, null, "STONE_BUTTON"); + public static final SchematicType Normal = new SchematicType("Normal", "", Type.NORMAL, null, "STONE_BUTTON", false); private static final Map fromDB; private static final List types; @@ -60,25 +60,31 @@ public class SchematicType { private final String material; @Getter private final Date deadline; + @Getter + private final boolean manualCheck; - SchematicType(String name, String kuerzel, Type type, SchematicType checkType, String material){ - this(name, kuerzel, type, checkType, material, null); + SchematicType(String name, String kuerzel, Type type, SchematicType checkType, String material, boolean manualCheck){ + this(name, kuerzel, type, checkType, material, null, manualCheck); } - SchematicType(String name, String kuerzel, Type type, SchematicType checkType, String material, Date deadline){ + SchematicType(String name, String kuerzel, Type type, SchematicType checkType, String material, Date deadline, boolean manualCheck){ this.name = name; this.kuerzel = kuerzel; this.type = type; this.checkType = checkType; this.material = material; this.deadline = deadline; + this.manualCheck = manualCheck; } public boolean isAssignable(){ - return type == Type.NORMAL || (type == Type.FIGHT_TYPE && checkType != null); + return type == Type.NORMAL || (type == Type.FIGHT_TYPE && checkType != null) || !manualCheck; } public SchematicType checkType(){ + if (!manualCheck) { + return this; + } return checkType; } diff --git a/src/de/steamwar/sql/SteamwarUser.java b/src/de/steamwar/sql/SteamwarUser.java index dfdb5cf..211c4da 100644 --- a/src/de/steamwar/sql/SteamwarUser.java +++ b/src/de/steamwar/sql/SteamwarUser.java @@ -36,7 +36,6 @@ public class SteamwarUser { String l = rs.getString(identifier); return l != null ? Locale.forLanguageTag(l) : null; }, (st, index, value) -> st.setString(index, value.toLanguageTag())); - SqlTypeMapper.nameEnumMapper(UserGroup.class); new SqlTypeMapper<>(SteamwarUser.class, null, (rs, identifier) -> { throw new SecurityException("SteamwarUser cannot be used as type (recursive select)"); }, (st, index, value) -> st.setInt(index, value.id)); } @@ -113,10 +112,6 @@ public class SteamwarUser { @Getter @Field private String userName; - @Deprecated - @Getter - @Field(def = "'Member'") - private final UserGroup userGroup; @Getter @Field(def = "0") private int team; @@ -135,11 +130,10 @@ public class SteamwarUser { private Set permissions = null; private UserPerm.Prefix prefix = null; - public SteamwarUser(int id, UUID uuid, String userName, UserGroup userGroup, int team, boolean leader, Locale locale, boolean manualLocale, Long discordId) { + public SteamwarUser(int id, UUID uuid, String userName, int team, boolean leader, Locale locale, boolean manualLocale, Long discordId) { this.id = id; this.uuid = uuid; this.userName = userName; - this.userGroup = userGroup; this.team = team; this.leader = leader; this.locale = locale; diff --git a/src/de/steamwar/sql/UserGroup.java b/src/de/steamwar/sql/UserGroup.java deleted file mode 100644 index 6a2b1ad..0000000 --- a/src/de/steamwar/sql/UserGroup.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2023 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.sql; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Deprecated -@AllArgsConstructor -public enum UserGroup { - Admin("§4", "§e", "Admin", true, true, true, true), - Developer("§3", "§f", "Dev", true, true, true, true), - Moderator("§c", "§f", "Mod", true, true, true, true), - Supporter("§9", "§f", "Sup", false, true, true, true), - Builder("§2", "§f", "Arch", false, true, false, true), - YouTuber("§5", "§f", "YT", false, false, false, true), - Member("§7", "§7", "", false, false, false, false); - - @Getter - private final String colorCode; - @Getter - private final String chatColorCode; - @Getter - private final String chatPrefix; - @Getter - private final boolean adminGroup; - @Getter - private final boolean teamGroup; - @Getter - private final boolean checkSchematics; - @Getter - private final boolean privilegedMods; - - public static UserGroup getUsergroup(String name) { - for(UserGroup group : values()) { - if(group.name().equalsIgnoreCase(name)) - return group; - } - - throw new IllegalArgumentException(name); - } -} \ No newline at end of file diff --git a/src/de/steamwar/sql/UserPerm.java b/src/de/steamwar/sql/UserPerm.java index c23667a..7b78b36 100644 --- a/src/de/steamwar/sql/UserPerm.java +++ b/src/de/steamwar/sql/UserPerm.java @@ -51,14 +51,14 @@ public enum UserPerm { Map p = new EnumMap<>(UserPerm.class); emptyPrefix = new Prefix("§7", ""); p.put(PREFIX_NONE, emptyPrefix); - p.put(PREFIX_YOUTUBER, new Prefix("§5", "YT")); - p.put(PREFIX_GUIDE, new Prefix("§f", "Guide")); + p.put(PREFIX_YOUTUBER, new Prefix("§7", "YT")); + p.put(PREFIX_GUIDE, new Prefix("§a", "Guide")); - p.put(PREFIX_BUILDER, new Prefix("§2", "Arch")); - p.put(PREFIX_SUPPORTER, new Prefix("§9", "Sup")); + p.put(PREFIX_SUPPORTER, new Prefix("§6", "Sup")); p.put(PREFIX_MODERATOR, new Prefix("§6", "Mod")); - p.put(PREFIX_DEVELOPER, new Prefix("§b", "Dev")); - p.put(PREFIX_ADMIN, new Prefix("§4", "Admin")); + p.put(PREFIX_BUILDER, new Prefix("§e", "Arch")); + p.put(PREFIX_DEVELOPER, new Prefix("§e", "Dev")); + p.put(PREFIX_ADMIN, new Prefix("§e", "Admin")); prefixes = Collections.unmodifiableMap(p); }