1
1
package simplexity .simpleprefixes .config ;
2
2
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 ;
3
8
import simplexity .simpleprefixes .SimplePrefixes ;
4
9
import simplexity .simpleprefixes .util .Message ;
5
10
import org .bukkit .configuration .file .FileConfiguration ;
11
+ ;
12
+ import java .util .ArrayList ;
13
+ import java .util .Collections ;
14
+ import java .util .List ;
6
15
7
16
8
17
public class Config {
@@ -11,6 +20,10 @@ public enum SAVING_TYPE { PDC, FILE }
11
20
private static SAVING_TYPE savingType = SAVING_TYPE .PDC ;
12
21
private static String defaultPrefix = "<white>[<gray>Player</gray>]</white> " ;
13
22
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" ;
14
27
15
28
public static void loadConfig () {
16
29
SimplePrefixes .getPlugin ().reloadConfig ();
@@ -22,10 +35,29 @@ public static void loadConfig() {
22
35
}
23
36
defaultPrefix = config .getString ("default-prefix" , defaultPrefix );
24
37
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
+ }
25
53
}
26
54
27
55
public static SAVING_TYPE getSavingType () { return savingType ; }
28
56
public static String getDefaultPrefix () { return defaultPrefix ; }
29
57
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 ; }
30
62
31
63
}
0 commit comments