Browse Source

You can not salvage without 1 rank in Scrap Collector now (unlocks at
level 2)

nossr50 6 years ago
parent
commit
3fe47c939a

+ 4 - 1
Changelog.txt

@@ -1,6 +1,9 @@
 Version 2.1.76
 Version 2.1.76
+    Advanced Salvage has been renamed to Scrap Collector
     Fixed a bug where Repair was repairing too much
     Fixed a bug where Repair was repairing too much
-    Fixed a bug where Arcane Salvage was used to determine how many materials a player could salvage from an item
+    Fixed a bug where Arcane Salvage was used to determine how many materials a player could salvage from an item instead of Scrap Collector (formerly Advanced Salvage)
+    Fixed a bug where messages about an item being too damage to salvage were being sent twice
+    You can not salvage without at least 1 rank in Scrap Collector now (formerly Advanced Salvage)
     Removed the minimum quantity field from the repair config
     Removed the minimum quantity field from the repair config
     Removed the item data (metadata) field from repair config as its not used anymore
     Removed the item data (metadata) field from repair config as its not used anymore
     Salvage will no longer return the max amount of materials possible, instead you are guaranteed one item and then some luck is involved on how many items are returned.
     Salvage will no longer return the max amount of materials possible, instead you are guaranteed one item and then some luck is involved on how many items are returned.

+ 1 - 1
pom.xml

@@ -2,7 +2,7 @@
     <modelVersion>4.0.0</modelVersion>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.gmail.nossr50.mcMMO</groupId>
     <groupId>com.gmail.nossr50.mcMMO</groupId>
     <artifactId>mcMMO</artifactId>
     <artifactId>mcMMO</artifactId>
-    <version>2.1.76-SNAPSHOT</version>
+    <version>2.1.76</version>
     <name>mcMMO</name>
     <name>mcMMO</name>
     <url>https://github.com/mcMMO-Dev/mcMMO</url>
     <url>https://github.com/mcMMO-Dev/mcMMO</url>
     <scm>
     <scm>

+ 2 - 2
src/main/java/com/gmail/nossr50/commands/skills/SalvageCommand.java

@@ -42,8 +42,8 @@ public class SalvageCommand extends SkillCommand {
         if (canScrapCollector) {
         if (canScrapCollector) {
             messages.add(getStatMessage(false, true,
             messages.add(getStatMessage(false, true,
                     SubSkillType.SALVAGE_SCRAP_COLLECTOR,
                     SubSkillType.SALVAGE_SCRAP_COLLECTOR,
-                    String.valueOf(RankUtils.getRank(player, SubSkillType.REPAIR_ARCANE_FORGING)),
-                    RankUtils.getHighestRankStr(SubSkillType.REPAIR_ARCANE_FORGING)));
+                    String.valueOf(RankUtils.getRank(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR)),
+                    RankUtils.getHighestRankStr(SubSkillType.SALVAGE_SCRAP_COLLECTOR)));
         }
         }
 
 
         if (canArcaneSalvage) {
         if (canArcaneSalvage) {

+ 12 - 9
src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

@@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.chat.ChatMode;
 import com.gmail.nossr50.datatypes.party.Party;
 import com.gmail.nossr50.datatypes.party.Party;
 import com.gmail.nossr50.datatypes.player.McMMOPlayer;
 import com.gmail.nossr50.datatypes.player.McMMOPlayer;
 import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
 import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
+import com.gmail.nossr50.datatypes.skills.SubSkillType;
 import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
 import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
 import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.mcMMO;
@@ -25,6 +26,7 @@ import com.gmail.nossr50.skills.salvage.SalvageManager;
 import com.gmail.nossr50.skills.taming.TamingManager;
 import com.gmail.nossr50.skills.taming.TamingManager;
 import com.gmail.nossr50.util.*;
 import com.gmail.nossr50.util.*;
 import com.gmail.nossr50.util.player.UserManager;
 import com.gmail.nossr50.util.player.UserManager;
+import com.gmail.nossr50.util.skills.RankUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.skills.SkillUtils;
 import com.gmail.nossr50.util.sounds.SoundManager;
 import com.gmail.nossr50.util.sounds.SoundManager;
 import com.gmail.nossr50.util.sounds.SoundType;
 import com.gmail.nossr50.util.sounds.SoundType;
@@ -619,17 +621,18 @@ public class PlayerListener implements Listener {
                     /* SALVAGE CHECKS */
                     /* SALVAGE CHECKS */
                     else if (type == Salvage.anvilMaterial
                     else if (type == Salvage.anvilMaterial
                             && PrimarySkillType.SALVAGE.getPermissions(player)
                             && PrimarySkillType.SALVAGE.getPermissions(player)
+                            && RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR)
                             && mcMMO.getSalvageableManager().isSalvageable(heldItem)
                             && mcMMO.getSalvageableManager().isSalvageable(heldItem)
                             && heldItem.getAmount() <= 1) {
                             && heldItem.getAmount() <= 1) {
-                        SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
-                        event.setCancelled(true);
-
-                        // Make sure the player knows what he's doing when trying to salvage an enchanted item
-                        if (salvageManager.checkConfirmation(true)) {
-                            SkillUtils.handleAbilitySpeedDecrease(player);
-                            salvageManager.handleSalvage(block.getLocation(), heldItem);
-                            player.updateInventory();
-                        }
+                                SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
+                                event.setCancelled(true);
+
+                                // Make sure the player knows what he's doing when trying to salvage an enchanted item
+                                if (salvageManager.checkConfirmation(true)) {
+                                    SkillUtils.handleAbilitySpeedDecrease(player);
+                                    salvageManager.handleSalvage(block.getLocation(), heldItem);
+                                    player.updateInventory();
+                                }
                     }
                     }
                 }
                 }
                 /* BLAST MINING CHECK */
                 /* BLAST MINING CHECK */

+ 0 - 6
src/main/java/com/gmail/nossr50/skills/salvage/SalvageManager.java

@@ -87,18 +87,12 @@ public class SalvageManager extends SkillManager {
             return;
             return;
         }
         }
 
 
-        if (item.getDurability() != 0 && (!RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR) || !Permissions.advancedSalvage(player))) {
-            NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.Adept.Damaged");
-            return;
-        }
-
         int maxAmountSalvageable = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
         int maxAmountSalvageable = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
 
 
         int salvageableAmount = maxAmountSalvageable;
         int salvageableAmount = maxAmountSalvageable;
 
 
         if (salvageableAmount == 0) {
         if (salvageableAmount == 0) {
             NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.TooDamaged");
             NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.TooDamaged");
-            player.sendMessage(LocaleLoader.getString("Salvage.Skills.TooDamaged"));
             return;
             return;
         }
         }