Преглед изворни кода

Better way to handle ink sacks, allows for dropping of multiple types.

GJ пре 11 година
родитељ
комит
1a88b0b944

+ 14 - 3
src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java

@@ -111,7 +111,18 @@ public class TreasureConfig extends ConfigLoader {
             /*
              * Material, Amount, and Data
              */
-            Material material = treasureName.contains("POTION") ? Material.POTION : Material.matchMaterial(treasureName);
+            Material material;
+
+            if (treasureName.contains("POTION")) {
+                material = Material.POTION;
+            }
+            else if (treasureName.contains("INK_SACK")) {
+                material = Material.INK_SACK;
+            }
+            else {
+                material = Material.matchMaterial(treasureName);
+            }
+
             int amount = config.getInt(type + "." + treasureName + ".Amount");
             int data = config.getInt(type + "." + treasureName + ".Data");
 
@@ -179,8 +190,8 @@ public class TreasureConfig extends ConfigLoader {
                     reason.add("Invalid Potion_Type: " + potionType);
                 }
             }
-            else if (config.contains(type + "." + treasureName + ".Dye_Color")) {
-                String color = config.getString("Fishing." + treasureName + ".Dye_Color");
+            else if (treasureName.contains("INK_SACK")) {
+                String color = treasureName.substring(9);
 
                 try {
                     Dye dye = new Dye();

+ 3 - 6
src/main/resources/treasures.yml

@@ -345,8 +345,7 @@ Fishing:
         Drop_Chance: 40.0
         Drop_Level: 800
         Max_Level: -1
-    INK_SACK:
-        Dye_Color: BLUE
+    INK_SACK_BLUE:
         Amount: 20
         XP: 200
         Drop_Chance: 40.0
@@ -464,8 +463,7 @@ Excavation:
         Drop_Chance: 0.13
         Drop_Level: 350
         Drops_From: [Dirt, Grass, Sand, Gravel, Clay, Mycelium, Soul_Sand]
-    INK_SACK:
-        Dye_Color: BROWN
+    INK_SACK_BROWN:
         Amount: 1
         XP: 100
         Drop_Chance: 1.33
@@ -487,8 +485,7 @@ Hylian_Luck:
         Drop_Chance: 100.0
         Drop_Level: 0
         Drops_From: [Bushes]
-    INK_SACK:
-        Dye_Color: BROWN
+    INK_SACK_BROWN:
         Amount: 1
         XP: 0
         Drop_Chance: 100.0