Merge pull request 'Add optional Material to SchematicType' (#144) from SchemTypeMaterial into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #144 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
99cc770c3b
@ -20,6 +20,8 @@
|
|||||||
package de.steamwar.sql;
|
package de.steamwar.sql;
|
||||||
|
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
|
import de.steamwar.inventory.SWItem;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -27,7 +29,7 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class SchematicType {
|
public class SchematicType {
|
||||||
public static final SchematicType Normal = new SchematicType("Normal", "", Type.NORMAL, null); //Has to stay publicly availible
|
public static final SchematicType Normal = new SchematicType("Normal", "", Type.NORMAL, null, SWItem.getMaterial("STONE_BUTTON")); //Has to stay publicly availible
|
||||||
|
|
||||||
private static final Map<String, SchematicType> fromDB;
|
private static final Map<String, SchematicType> fromDB;
|
||||||
private static final List<SchematicType> types;
|
private static final List<SchematicType> types;
|
||||||
@ -54,14 +56,15 @@ public class SchematicType {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
SchematicType checktype = null;
|
SchematicType checktype = null;
|
||||||
|
Material material = SWItem.getMaterial(config.getString("Schematic.Material", "STONE_BUTTON"));
|
||||||
|
|
||||||
if(!config.getStringList("CheckQuestions").isEmpty()) {
|
if(!config.getStringList("CheckQuestions").isEmpty()) {
|
||||||
checktype = new SchematicType("C" + type, "C" + shortcut, Type.CHECK_TYPE, null);
|
checktype = new SchematicType("C" + type, "C" + shortcut, Type.CHECK_TYPE, null, material);
|
||||||
tmpTypes.add(checktype);
|
tmpTypes.add(checktype);
|
||||||
tmpFromDB.put(checktype.toDB(), checktype);
|
tmpFromDB.put(checktype.toDB(), checktype);
|
||||||
}
|
}
|
||||||
|
|
||||||
SchematicType current = new SchematicType(type, shortcut, config.isConfigurationSection("Server") ? Type.FIGHT_TYPE : Type.NORMAL, checktype);
|
SchematicType current = new SchematicType(type, shortcut, config.isConfigurationSection("Server") ? Type.FIGHT_TYPE : Type.NORMAL, checktype, material);
|
||||||
tmpTypes.add(current);
|
tmpTypes.add(current);
|
||||||
tmpFromDB.put(type.toLowerCase(), current);
|
tmpFromDB.put(type.toLowerCase(), current);
|
||||||
}
|
}
|
||||||
@ -75,12 +78,14 @@ public class SchematicType {
|
|||||||
private final String kuerzel;
|
private final String kuerzel;
|
||||||
private final Type type;
|
private final Type type;
|
||||||
private final SchematicType checkType;
|
private final SchematicType checkType;
|
||||||
|
private final Material material;
|
||||||
|
|
||||||
private SchematicType(String name, String kuerzel, Type type, SchematicType checkType){
|
private SchematicType(String name, String kuerzel, Type type, SchematicType checkType, Material material){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.kuerzel = kuerzel;
|
this.kuerzel = kuerzel;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.checkType = checkType;
|
this.checkType = checkType;
|
||||||
|
this.material = material;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAssignable(){
|
public boolean isAssignable(){
|
||||||
@ -111,6 +116,10 @@ public class SchematicType {
|
|||||||
return kuerzel;
|
return kuerzel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Material getMaterial() {
|
||||||
|
return material;
|
||||||
|
}
|
||||||
|
|
||||||
public String toDB(){
|
public String toDB(){
|
||||||
return name.toLowerCase();
|
return name.toLowerCase();
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren