55import java .util .HashMap ;
66import java .util .List ;
77import java .util .Map ;
8+ import java .util .Set ;
89
910import org .bukkit .Material ;
1011import org .bukkit .configuration .file .YamlConfiguration ;
@@ -16,7 +17,7 @@ public class ChestItems {
1617 private static Map <String , List <ItemStack >> chests = new HashMap <>();
1718
1819 public static void save () {
19- YamlConfiguration config = YamlConfiguration . loadConfiguration ( chest );
20+ YamlConfiguration config = new YamlConfiguration ( );
2021
2122 for (Map .Entry <String , List <ItemStack >> entry : chests .entrySet ()) {
2223 List <Object > simplifiedItems = new ArrayList <>();
@@ -49,28 +50,26 @@ public static void load() {
4950 private static void loadItems (List <ItemStack > arr , List <?> data ) {
5051 if (data == null ) return ;
5152 for (Object entry : data ) {
52- if (entry instanceof ItemStack ) {
53+ if (entry instanceof ItemStack )
5354 arr .add ((ItemStack ) entry );
54- }
5555 else if (entry instanceof String ) {
5656 Material m = Material .getMaterial ((String ) entry );
57- if (m != null ) {
57+ if (m != null )
5858 arr .add (new ItemStack (m ));
59- }
6059 }
6160 }
6261 }
6362
64- public static ArrayList <String > getChestNames () {
65- return new ArrayList <>( chests .keySet () );
63+ public static Set <String > getChestNames () {
64+ return chests .keySet ();
6665 }
6766
68- public static List <ItemStack > getChest (String chestType ) {
67+ public static List <ItemStack > getChest (String chestType ) {
6968 return chests .get (chestType );
7069 }
7170
7271 public static boolean fillChest (Inventory inv , String chestType ) {
73- List <ItemStack > ch = getChest (chestType );
72+ List <ItemStack > ch = getChest (chestType );
7473
7574 final int max = Oneblock .rnd .nextInt (3 ) + 2 ;
7675 try { for (int i = 0 ; i < max ; i ++) {
0 commit comments