From 75bb3f181d62337a31639d96d7e56866c78e39f0 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 10 Apr 2019 04:06:06 -0700 Subject: [PATCH] Fishing now always gives fish in addition to treasure (configurable) Fixing salvage oopsies --- Changelog.txt | 1 + .../com/gmail/nossr50/config/MainConfig.java | 4 ---- .../config/experience/ExperienceConfig.java | 10 ---------- .../hocon/skills/fishing/ConfigFishing.java | 11 +++++++++++ .../skills/fishing/ConfigFishingGeneral.java | 18 ++++++++++++++++++ .../nossr50/skills/fishing/FishingManager.java | 4 ++-- .../nossr50/skills/salvage/SalvageManager.java | 6 ------ 7 files changed, 32 insertions(+), 22 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/skills/fishing/ConfigFishingGeneral.java diff --git a/Changelog.txt b/Changelog.txt index 16c26de38..9b6097573 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -25,6 +25,7 @@ Version 2.2.0 All config nodes now include a comment with the default value of the node to use as reference Expanded settings relating to purging users who have not leveled or users who had not logged in for many months Acrobatic's Dodge XP increased from 120 -> 480 + Fishing's always catch fish setting now defaults to true instead of false NOTE: Not every config key that was renamed will be listed here Admins will now be notified if a player trips over-fishing exploit detection 3+ times in a row (Locale: "Fishing.OverFishingDetected") Note: Admins are players who are op or have adminchat permission. diff --git a/src/main/java/com/gmail/nossr50/config/MainConfig.java b/src/main/java/com/gmail/nossr50/config/MainConfig.java index a7c7735c0..42763f064 100644 --- a/src/main/java/com/gmail/nossr50/config/MainConfig.java +++ b/src/main/java/com/gmail/nossr50/config/MainConfig.java @@ -606,10 +606,6 @@ public class MainConfig extends ConfigValidated { return getBooleanValue(SKILLS, FISHING, OVERRIDE_VANILLA_TREASURES); } - public boolean getFishingExtraFish() { - return getBooleanValue(SKILLS, FISHING, EXTRA_FISH); - } - public double getFishingLureModifier() { return getDoubleValue(SKILLS, FISHING, LURE_MODIFIER); } diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index 667cc95bb..8cd3cf498 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -165,13 +165,6 @@ public class ExperienceConfig extends ConfigValidated { reason.add(EXPERIENCE + "." + COMBAT + "." + MULTIPLIER + "." + ANIMALS + " should be at least 0!"); } - /* Fishing */ - // TODO: Add validation for each fish type once enum is available. - - if (getFishingShakeXP() <= 0) { - reason.add(EXPERIENCE + "." + FISHING + "." + SHAKE + " should be greater than 0!"); - } - /* Repair */ if (getRepairXPBase() <= 0) { reason.add(EXPERIENCE + "." + REPAIR + "." + BASE1 + " should be greater than 0!"); @@ -374,9 +367,6 @@ public class ExperienceConfig extends ConfigValidated { return BarStyle.SOLID; } - public int getFishingShakeXP() { - return getIntValue(EXPERIENCE, FISHING, SHAKE); - } /* Repair */ public double getRepairXPBase() { diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/fishing/ConfigFishing.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/fishing/ConfigFishing.java index e830c64c6..83e752ea3 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/skills/fishing/ConfigFishing.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/fishing/ConfigFishing.java @@ -1,8 +1,19 @@ package com.gmail.nossr50.config.hocon.skills.fishing; +import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable public class ConfigFishing { + @Setting(value = "General") + private ConfigFishingGeneral fishingGeneral = new ConfigFishingGeneral(); + + public ConfigFishingGeneral getFishingGeneral() { + return fishingGeneral; + } + + public boolean isAlwaysCatchFish() { + return fishingGeneral.isAlwaysCatchFish(); + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/skills/fishing/ConfigFishingGeneral.java b/src/main/java/com/gmail/nossr50/config/hocon/skills/fishing/ConfigFishingGeneral.java new file mode 100644 index 000000000..6bc2e0f0f --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/skills/fishing/ConfigFishingGeneral.java @@ -0,0 +1,18 @@ +package com.gmail.nossr50.config.hocon.skills.fishing; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigFishingGeneral { + + private static final boolean ALWAYS_CATCH_FISH_DEFAULT = true; + + @Setting(value = "Always-Catch-Fish", comment = "Enables fish to be caught alongside treasure." + + "\nDefault value: "+ALWAYS_CATCH_FISH_DEFAULT) + private boolean alwaysCatchFish = ALWAYS_CATCH_FISH_DEFAULT; + + public boolean isAlwaysCatchFish() { + return alwaysCatchFish; + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index a2dcc4518..270cf1360 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -327,7 +327,7 @@ public class FishingManager extends SkillManager { NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Fishing.Ability.TH.MagicFound"); } - if (MainConfig.getInstance().getFishingExtraFish()) { + if (mcMMO.getConfigManager().getConfigFishing().isAlwaysCatchFish()) { Misc.dropItem(player.getEyeLocation(), fishingCatch.getItemStack()); } @@ -438,7 +438,7 @@ public class FishingManager extends SkillManager { Misc.dropItem(target.getLocation(), drop); CombatUtils.dealDamage(target, Math.min(Math.max(target.getMaxHealth() / 4, 1), 10), EntityDamageEvent.DamageCause.CUSTOM, getPlayer()); // Make it so you can shake a mob no more than 4 times. - applyXpGain(ExperienceConfig.getInstance().getFishingShakeXP(), XPGainReason.PVE); + applyXpGain(mcMMO.getConfigManager().getConfigExperience().getShakeXP(), XPGainReason.PVE); } } diff --git a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java index b384bfbb8..425479234 100644 --- a/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java +++ b/src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java @@ -128,13 +128,7 @@ public class SalvageManager extends SkillManager { Misc.dropItems(location, salvageResults, 1); // BWONG BWONG BWONG - CLUNK! -<<<<<<< HEAD if (mcMMO.getConfigManager().getConfigSalvage().getGeneral().isAnvilUseSounds()) { - SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL); -======= - if (Config.getInstance().getSalvageAnvilUseSoundsEnabled()) { -// SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL); ->>>>>>> f1204f8a2aa8b402dc84a4b76c46665e02edb767 SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK); //player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F);