Explorar el Código

Added option to config.yml to override vanilla Minecraft treasures

TfT_02 hace 11 años
padre
commit
c744974192

+ 1 - 0
Changelog.txt

@@ -14,6 +14,7 @@ Version 1.5.00-dev
  + Added Salmon, Clownfish, and Pufferfish to Fishing XP
  + Added Salmon, Clownfish, and Pufferfish to Fishing XP
  + Added new flowers and grasses to Herbalism XP
  + Added new flowers and grasses to Herbalism XP
  + Added option to config.yml which allows players to always catch fish, even when a treasure is found
  + Added option to config.yml which allows players to always catch fish, even when a treasure is found
+ + Added option to config.yml to override vanilla Minecraft treasures
  ! Fishing XP now depends on the type of fish.
  ! Fishing XP now depends on the type of fish.
  ! Woodcutting XP in experience.yml and Woodcutting double drops in config.yml now use the tree species names. Oak is now Generic, and Spruce is now Redwood.
  ! Woodcutting XP in experience.yml and Woodcutting double drops in config.yml now use the tree species names. Oak is now Generic, and Spruce is now Redwood.
  ! Red_Rose was replaced by Poppy, and so the key in experience.yml has been updated accordingly.
  ! Red_Rose was replaced by Poppy, and so the key in experience.yml has been updated accordingly.

+ 1 - 0
src/main/java/com/gmail/nossr50/config/Config.java

@@ -452,6 +452,7 @@ public class Config extends AutoUpdateConfigLoader {
 
 
     /* Fishing */
     /* Fishing */
     public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
     public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
+    public boolean getFishingOverrideTreasures() { return config.getBoolean("Skills.Fishing.Override_Vanilla_Treasures", true); }
     public boolean getFishingExtraFish() { return config.getBoolean("Skills.Fishing.Extra_Fish", true); }
     public boolean getFishingExtraFish() { return config.getBoolean("Skills.Fishing.Extra_Fish", true); }
 
 
     /* Mining */
     /* Mining */

+ 7 - 0
src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

@@ -223,6 +223,13 @@ public class PlayerListener implements Listener {
                 return;
                 return;
 
 
             case CAUGHT_FISH:
             case CAUGHT_FISH:
+                //TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
+                Item fishingCatch = (Item) event.getCaught();
+
+                if (Config.getInstance().getFishingOverrideTreasures() && fishingCatch.getItemStack().getType() != Material.RAW_FISH) {
+                    fishingCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1));
+                }
+
                 if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) {
                 if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) {
                     event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
                     event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
                 }
                 }

+ 1 - 0
src/main/resources/config.yml

@@ -289,6 +289,7 @@ Skills:
     Fishing:
     Fishing:
         Level_Cap: 0
         Level_Cap: 0
         Drops_Enabled: true
         Drops_Enabled: true
+        Override_Vanilla_Treasures: true
         # Always catch fish, even when treasure is found
         # Always catch fish, even when treasure is found
         Extra_Fish: false
         Extra_Fish: false
     Herbalism:
     Herbalism: