11package simplexity .simpleprefixes .config ;
22
3+ import me .clip .placeholderapi .PlaceholderAPI ;
4+ import net .kyori .adventure .text .Component ;
5+ import org .bukkit .Material ;
6+ import org .bukkit .inventory .ItemStack ;
7+ import org .bukkit .inventory .meta .ItemMeta ;
38import simplexity .simpleprefixes .SimplePrefixes ;
49import simplexity .simpleprefixes .util .Message ;
510import org .bukkit .configuration .file .FileConfiguration ;
11+ ;
12+ import java .util .ArrayList ;
13+ import java .util .Collections ;
14+ import java .util .List ;
615
716
817public class Config {
@@ -11,6 +20,10 @@ public enum SAVING_TYPE { PDC, FILE }
1120 private static SAVING_TYPE savingType = SAVING_TYPE .PDC ;
1221 private static String defaultPrefix = "<white>[<gray>Player</gray>]</white> " ;
1322 private static String prefixMenuName = "<bold>Prefix Menu</bold>" ;
23+ private static ItemStack headerItem ;
24+ private static String headerName = "<aqua>Click to Reset Prefix</aqua>" ;
25+ private static List <String > headerLore = new ArrayList <>();
26+ private static String headerCount = "1" ;
1427
1528 public static void loadConfig () {
1629 SimplePrefixes .getPlugin ().reloadConfig ();
@@ -22,10 +35,29 @@ public static void loadConfig() {
2235 }
2336 defaultPrefix = config .getString ("default-prefix" , defaultPrefix );
2437 prefixMenuName = config .getString ("prefix-menu-name" , prefixMenuName );
38+ generateBaseHeaderItem ();
39+ headerName = config .getString ("header.name" , "<aqua>Click to Reset Prefix</aqua>" );
40+ headerLore = config .getStringList ("header.lore" );
41+ headerCount = config .getString ("header.count" , "1" );
42+ }
43+
44+ public static void generateBaseHeaderItem () {
45+ FileConfiguration config = SimplePrefixes .getPlugin ().getConfig ();
46+ Material material = Material .getMaterial (config .getString ("header.material" , "ENDER_EYE" ));
47+ headerItem = material != null ? new ItemStack (material ) : new ItemStack (Material .ENDER_EYE );
48+ if (config .isInt ("header.custom-model-data" )) {
49+ ItemMeta meta = headerItem .getItemMeta ();
50+ meta .setCustomModelData (config .getInt ("header.custom-model-data" ));
51+ headerItem .setItemMeta (meta );
52+ }
2553 }
2654
2755 public static SAVING_TYPE getSavingType () { return savingType ; }
2856 public static String getDefaultPrefix () { return defaultPrefix ; }
2957 public static String getPrefixMenuName () { return prefixMenuName ; }
58+ public static ItemStack getHeaderItem () { return headerItem .clone (); }
59+ public static String getHeaderName () { return headerName ; }
60+ public static List <String > getHeaderLore () { return Collections .unmodifiableList (headerLore ); }
61+ public static String getHeaderCount () { return headerCount ; }
3062
3163}
0 commit comments