mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
commit
e97841e797
@ -8,16 +8,21 @@ Key:
|
||||
- Removal
|
||||
|
||||
Version 1.5.01-dev
|
||||
+ Added new child skill; Salvage
|
||||
+ Added new feature to Herbalism. Instantly-regrown crops are protected from being broken for 1 second
|
||||
+ Added option to config.yml to show the /mcstats scoreboard automatically after logging in
|
||||
+ Added option to config.yml for Alchemy. Skills.Alchemy.Prevent_Hopper_Transfer_Bottles
|
||||
+ Added support for `MATERIAL|data` format in treasures.yml
|
||||
+ Added API to experience events to get XP gain reason
|
||||
+ Added API to check if an entity is bleeding
|
||||
= Fixed bug where the Updater was running on the main thread.
|
||||
= Fixed bug when players would use /ptp without being in a party
|
||||
= Fixed bug where player didn't have a mcMMOPlayer object in AsyncPlayerChatEvent
|
||||
= Fixed bug where dodge would check the wrong player skill level
|
||||
= Fixed bug which causes /party teleport to stop working
|
||||
! Vanished players no longer get hit by AoE effects
|
||||
! Changed Alchemy config option 'Prevent_Hopper_Transfer' renamed to 'Prevent_Hopper_Transfer_Ingredients'
|
||||
- Removed salvage ability from Repair, salvage has it's own (child) skill now
|
||||
|
||||
Version 1.5.00
|
||||
+ Added Podzol & Red Sand to Excavation
|
||||
|
@ -1,9 +1,11 @@
|
||||
package com.gmail.nossr50.api;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public final class AbilityAPI {
|
||||
@ -80,4 +82,8 @@ public final class AbilityAPI {
|
||||
public static void setTreeFellerCooldown(Player player, long cooldown) {
|
||||
UserManager.getPlayer(player).setAbilityDATS(AbilityType.TREE_FELLER, cooldown);
|
||||
}
|
||||
|
||||
public static boolean isBleeding(LivingEntity entity) {
|
||||
return BleedTimerTask.isBleeding(entity);
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public final class PartyAPI {
|
||||
}
|
||||
|
||||
public static boolean hasAlly(String partyName) {
|
||||
return PartyManager.getParty(partyName).getAlly() != null;
|
||||
return getAllyName(partyName) != null;
|
||||
}
|
||||
|
||||
public static String getAllyName(String partyName) {
|
||||
|
@ -9,11 +9,11 @@ import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
@ -115,9 +115,13 @@ public class PtpCommand implements TabExecutor {
|
||||
|
||||
if (matches.size() == 0) {
|
||||
Player player = (Player) sender;
|
||||
Party party = UserManager.getPlayer(player).getParty();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
List<String> playerNames = party.getOnlinePlayerNames(player);
|
||||
if (!mcMMOPlayer.inParty()) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
List<String> playerNames = mcMMOPlayer.getParty().getOnlinePlayerNames(player);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
@ -26,7 +27,6 @@ public class RepairCommand extends SkillCommand {
|
||||
private boolean canSuperRepair;
|
||||
private boolean canMasterRepair;
|
||||
private boolean canArcaneForge;
|
||||
private boolean canSalvage;
|
||||
private boolean canRepairStone;
|
||||
private boolean canRepairIron;
|
||||
private boolean canRepairGold;
|
||||
@ -77,14 +77,13 @@ public class RepairCommand extends SkillCommand {
|
||||
canSuperRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SUPER_REPAIR);
|
||||
canMasterRepair = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.REPAIR_MASTERY);
|
||||
canArcaneForge = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_FORGING);
|
||||
canSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE);
|
||||
canRepairDiamond = Permissions.repairDiamond(player);
|
||||
canRepairGold = Permissions.repairGold(player);
|
||||
canRepairIron = Permissions.repairIron(player);
|
||||
canRepairStone = Permissions.repairStone(player);
|
||||
canRepairString = Permissions.repairString(player);
|
||||
canRepairLeather = Permissions.repairLeather(player);
|
||||
canRepairWood = Permissions.repairWood(player);
|
||||
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
|
||||
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
|
||||
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);
|
||||
canRepairStone = Permissions.repairMaterialType(player, MaterialType.STONE);
|
||||
canRepairString = Permissions.repairMaterialType(player, MaterialType.STRING);
|
||||
canRepairLeather = Permissions.repairMaterialType(player, MaterialType.LEATHER);
|
||||
canRepairWood = Permissions.repairMaterialType(player, MaterialType.WOOD);
|
||||
arcaneBypass = Permissions.arcaneBypass(player);
|
||||
}
|
||||
|
||||
@ -122,10 +121,6 @@ public class RepairCommand extends SkillCommand {
|
||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.6", diamondLevel), LocaleLoader.getString("Repair.Effect.7")));
|
||||
}
|
||||
|
||||
if (canSalvage && Repair.salvageUnlockLevel > 0) {
|
||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.16", Repair.salvageUnlockLevel), LocaleLoader.getString("Repair.Effect.17")));
|
||||
}
|
||||
|
||||
if (canArcaneForge) {
|
||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Repair.Effect.8"), LocaleLoader.getString("Repair.Effect.9")));
|
||||
}
|
||||
|
@ -0,0 +1,79 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class SalvageCommand extends SkillCommand {
|
||||
private boolean canAdvancedSalvage;
|
||||
private boolean canArcaneSalvage;
|
||||
|
||||
public SalvageCommand() {
|
||||
super(SkillType.SALVAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue, boolean isLucky) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canAdvancedSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ADVANCED_SALVAGE);
|
||||
canArcaneSalvage = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.ARCANE_SALVAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> effectsDisplay() {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canAdvancedSalvage) {
|
||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Salvage.Effect.0"), LocaleLoader.getString("Salvage.Effect.1")));
|
||||
}
|
||||
|
||||
if (canArcaneSalvage) {
|
||||
messages.add(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Salvage.Effect.2"), LocaleLoader.getString("Salvage.Effect.3")));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
|
||||
|
||||
if (canAdvancedSalvage) {
|
||||
if (skillValue < Salvage.advancedSalvageUnlockLevel) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Salvage.Ability.Locked.0", Salvage.advancedSalvageUnlockLevel)));
|
||||
}
|
||||
else {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Ability.Bonus.0"), LocaleLoader.getString("Salvage.Ability.Bonus.1", percent.format(salvageManager.getMaxSalvagePercentage()))));
|
||||
}
|
||||
}
|
||||
|
||||
if (canArcaneSalvage) {
|
||||
messages.add(LocaleLoader.getString("Salvage.Arcane.Rank", salvageManager.getArcaneSalvageRank(), Salvage.Tier.values().length));
|
||||
|
||||
if (Salvage.arcaneSalvageEnchantLoss) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Arcane.ExtractFull"), percent.format(salvageManager.getExtractFullEnchantChance() / 100)));
|
||||
}
|
||||
|
||||
if (Salvage.arcaneSalvageDowngrades) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Arcane.ExtractPartial"), percent.format(salvageManager.getExtractPartialEnchantChance() / 100)));
|
||||
}
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||
import com.gmail.nossr50.skills.mining.BlastMining;
|
||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.smelting.Smelting;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
@ -378,10 +379,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
reason.add("Skills.Repair.SuperRepair.MaxBonusLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getSalvageUnlockLevel() < 0) {
|
||||
reason.add("Skills.Repair.Salvage.UnlockLevel should be at least 0!");
|
||||
}
|
||||
|
||||
List<ArcaneForging.Tier> arcaneForgingTierList = Arrays.asList(ArcaneForging.Tier.values());
|
||||
|
||||
for (ArcaneForging.Tier tier : arcaneForgingTierList) {
|
||||
@ -414,6 +411,51 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
/* SALVAGE */
|
||||
if (getSalvageMaxPercentage() < 1) {
|
||||
reason.add("Skills.Salvage.MaxPercentage should be at least 1!");
|
||||
}
|
||||
|
||||
if (getSalvageMaxPercentageLevel() < 1) {
|
||||
reason.add("Skills.Salvage.MaxPercentageLevel should be at least 1!");
|
||||
}
|
||||
|
||||
if (getAdvancedSalvageUnlockLevel() < 1) {
|
||||
reason.add("Skills.Salvage.AdvancedSalvage.UnlockLevel should be at least 1!");
|
||||
}
|
||||
|
||||
List<Salvage.Tier> salvageTierList = Arrays.asList(Salvage.Tier.values());
|
||||
|
||||
for (Salvage.Tier tier : salvageTierList) {
|
||||
if (getArcaneSalvageRankLevel(tier) < 0) {
|
||||
reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + tier.toNumerical() + " should be at least 0!");
|
||||
}
|
||||
|
||||
if (getArcaneSalvageExtractFullEnchantsChance(tier) < 0 || getArcaneSalvageExtractFullEnchantsChance(tier) > 100) {
|
||||
reason.add("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + tier.toNumerical() + " only accepts values from 0 to 100!");
|
||||
}
|
||||
|
||||
if (getArcaneSalvageExtractPartialEnchantsChance(tier) < 0 || getArcaneSalvageExtractPartialEnchantsChance(tier) > 100) {
|
||||
reason.add("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + tier.toNumerical() + " only accepts values from 0 to 100!");
|
||||
}
|
||||
|
||||
if (tier != Salvage.Tier.EIGHT) {
|
||||
Salvage.Tier nextTier = salvageTierList.get(salvageTierList.indexOf(tier) - 1);
|
||||
|
||||
if (getArcaneSalvageRankLevel(tier) >= getArcaneSalvageRankLevel(nextTier)) {
|
||||
reason.add("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + tier.toNumerical() + " should be less than Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + nextTier.toNumerical() + "!");
|
||||
}
|
||||
|
||||
if (getArcaneSalvageExtractFullEnchantsChance(tier) > getArcaneSalvageExtractFullEnchantsChance(nextTier)) {
|
||||
reason.add("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + nextTier.toNumerical() + "!");
|
||||
}
|
||||
|
||||
if (getArcaneSalvageExtractPartialEnchantsChance(tier) > getArcaneSalvageExtractPartialEnchantsChance(nextTier)) {
|
||||
reason.add("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + tier.toNumerical() + " should be less than or equal to Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + nextTier.toNumerical() + "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* SMELTING */
|
||||
if (getBurnModifierMaxLevel() < 1) {
|
||||
reason.add("Skills.Smelting.FuelEfficiency.MaxBonusLevel should be at least 1!");
|
||||
@ -725,7 +767,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
/* REPAIR */
|
||||
public double getRepairMasteryMaxBonus() { return config.getDouble("Skills.Repair.RepairMastery.MaxBonusPercentage", 200.0D); }
|
||||
public int getRepairMasteryMaxLevel() { return config.getInt("Skills.Repair.RepairMastery.MaxBonusLevel", 1000); }
|
||||
public int getSalvageUnlockLevel() { return config.getInt("Skills.Repair.Salvage.UnlockLevel", 600); }
|
||||
|
||||
/* Arcane Forging */
|
||||
public int getArcaneForgingRankLevel(ArcaneForging.Tier tier) { return config.getInt("Skills.Repair.ArcaneForging.Rank_Levels.Rank_" + tier.toNumerical()); }
|
||||
@ -736,6 +777,19 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Skills.Repair.ArcaneForging.Downgrades_Enabled", true); }
|
||||
public double getArcaneForgingDowngradeChance(ArcaneForging.Tier tier) { return config.getDouble("Skills.Repair.ArcaneForging.Downgrades_Chance.Rank_" + tier.toNumerical()); }
|
||||
|
||||
/* SALVAGE */
|
||||
public double getSalvageMaxPercentage() { return config.getDouble("Skills.Salvage.MaxPercentage", 100.0D); }
|
||||
public int getSalvageMaxPercentageLevel() { return config.getInt("Skills.Salvage.MaxPercentageLevel", 1000); }
|
||||
|
||||
public int getAdvancedSalvageUnlockLevel() { return config.getInt("Skills.Salvage.AdvancedSalvage.UnlockLevel", 350); }
|
||||
|
||||
public boolean getArcaneSalvageEnchantDowngradeEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantDowngradeEnabled", true); }
|
||||
public boolean getArcaneSalvageEnchantLossEnabled() { return config.getBoolean("Skills.Salvage.ArcaneSalvage.EnchantLossEnabled", true); }
|
||||
|
||||
public int getArcaneSalvageRankLevel(Salvage.Tier tier) { return config.getInt("Skills.Salvage.ArcaneSalvage.Rank_Levels.Rank_" + tier.toNumerical()); }
|
||||
public double getArcaneSalvageExtractFullEnchantsChance(Salvage.Tier tier) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractFullEnchant.Rank_" + tier.toNumerical()); }
|
||||
public double getArcaneSalvageExtractPartialEnchantsChance(Salvage.Tier tier) { return config.getDouble("Skills.Salvage.ArcaneSalvage.ExtractPartialEnchant.Rank_" + tier.toNumerical()); }
|
||||
|
||||
/* SMELTING */
|
||||
public int getBurnModifierMaxLevel() { return config.getInt("Skills.Smelting.FuelEfficiency.MaxBonusLevel", 1000); }
|
||||
public double getBurnTimeMultiplier() { return config.getDouble("Skills.Smelting.FuelEfficiency.Multiplier", 3.0D); }
|
||||
|
@ -448,7 +448,8 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
|
||||
/* Alchemy */
|
||||
public boolean getEnabledForHoppers() { return config.getBoolean("Skills.Alchemy.Enabled_for_Hoppers", true); }
|
||||
public boolean getPreventHopperTransfer() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer", false); }
|
||||
public boolean getPreventHopperTransferIngredients() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Ingredients", false); }
|
||||
public boolean getPreventHopperTransferBottles() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Bottles", false); }
|
||||
|
||||
/* Fishing */
|
||||
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }
|
||||
@ -463,11 +464,15 @@ public class Config extends AutoUpdateConfigLoader {
|
||||
public boolean getRepairAnvilPlaceSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Placed_Sounds", true); }
|
||||
public boolean getRepairAnvilUseSoundsEnabled() { return config.getBoolean("Skills.Repair.Anvil_Use_Sounds", true); }
|
||||
public Material getRepairAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Anvil_Material", "IRON_BLOCK")); }
|
||||
public Material getSalvageAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Repair.Salvage_Anvil_Material", "GOLD_BLOCK")); }
|
||||
public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); }
|
||||
public boolean getSalvageArmor() { return config.getBoolean("Skills.Repair.Salvage_armor", true); }
|
||||
public boolean getRepairConfirmRequired() { return config.getBoolean("Skills.Repair.Confirm_Required", true); }
|
||||
|
||||
/* Salvage */
|
||||
public boolean getSalvageAnvilMessagesEnabled() { return config.getBoolean("Skills.Salvage.Anvil_Messages", true); }
|
||||
public boolean getSalvageAnvilPlaceSoundsEnabled() { return config.getBoolean("Skills.Salvage.Anvil_Placed_Sounds", true); }
|
||||
public boolean getSalvageAnvilUseSoundsEnabled() { return config.getBoolean("Skills.Salvage.Anvil_Use_Sounds", true); }
|
||||
public Material getSalvageAnvilMaterial() { return Material.matchMaterial(config.getString("Skills.Salvage.Anvil_Material", "GOLD_BLOCK")); }
|
||||
public boolean getSalvageConfirmRequired() { return config.getBoolean("Skills.Salvage.Confirm_Required", true); }
|
||||
|
||||
/* Unarmed */
|
||||
public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
|
||||
|
||||
|
@ -11,8 +11,8 @@ import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
@ -157,7 +157,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
/* Curve values */
|
||||
public double getMultiplier(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier"); }
|
||||
public int getBase(FormulaType type) { return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base"); }
|
||||
public double getExponent(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) +"_Values.exponent"); }
|
||||
public double getExponent(FormulaType type) { return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent"); }
|
||||
|
||||
/* Global modifier */
|
||||
public double getExperienceGainsGlobalMultiplier() { return config.getDouble("Experience_Formula.Multiplier.Global", 1.0); }
|
||||
@ -308,7 +308,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
|
||||
/* Repair */
|
||||
public double getRepairXPBase() { return config.getDouble("Experience.Repair.Base", 1000.0); }
|
||||
public double getRepairXP(RepairMaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
||||
public double getRepairXP(MaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
|
||||
|
||||
/* Taming */
|
||||
public int getTamingXPHorse() { return config.getInt("Experience.Taming.Animal_Taming.Horse", 1000); }
|
||||
|
@ -9,11 +9,11 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class CustomArmorConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
@ -79,7 +79,7 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
|
||||
if (repairable) {
|
||||
byte repairData = (byte) config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Value", -1);
|
||||
int repairQuantity = Repair.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
||||
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
||||
|
||||
if (repairQuantity == 0) {
|
||||
repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Quantity", 2);
|
||||
@ -91,7 +91,7 @@ public class CustomArmorConfig extends ConfigLoader {
|
||||
durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 70);
|
||||
}
|
||||
|
||||
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, 0, repairQuantity, durability, RepairItemType.ARMOR, RepairMaterialType.OTHER, 1.0));
|
||||
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, 0, repairQuantity, durability, ItemType.ARMOR, MaterialType.OTHER, 1.0));
|
||||
}
|
||||
|
||||
materialList.add(armorMaterial);
|
||||
|
@ -11,11 +11,11 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class CustomToolConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
@ -87,7 +87,7 @@ public class CustomToolConfig extends ConfigLoader {
|
||||
|
||||
if (repairable) {
|
||||
byte repairData = (byte) config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Value", -1);
|
||||
int repairQuantity = Repair.getRepairAndSalvageQuantities(new ItemStack(toolMaterial), repairMaterial, repairData);
|
||||
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(toolMaterial), repairMaterial, repairData);
|
||||
|
||||
if (repairQuantity == 0) {
|
||||
repairQuantity = config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Quantity", 2);
|
||||
@ -99,7 +99,7 @@ public class CustomToolConfig extends ConfigLoader {
|
||||
durability = (short) config.getInt(toolType + "." + toolName + ".Durability", 60);
|
||||
}
|
||||
|
||||
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, 0, repairQuantity, durability, RepairItemType.TOOL, RepairMaterialType.OTHER, 1.0));
|
||||
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, 0, repairQuantity, durability, ItemType.TOOL, MaterialType.OTHER, 1.0));
|
||||
}
|
||||
|
||||
double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);
|
||||
|
@ -9,12 +9,12 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairItemType;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairMaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class RepairConfig extends ConfigLoader {
|
||||
private List<Repairable> repairables;
|
||||
@ -48,37 +48,37 @@ public class RepairConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
// Repair Material Type
|
||||
RepairMaterialType repairMaterialType = RepairMaterialType.OTHER;
|
||||
MaterialType repairMaterialType = MaterialType.OTHER;
|
||||
String repairMaterialTypeString = config.getString("Repairables." + key + ".MaterialType", "OTHER");
|
||||
|
||||
if (!config.contains("Repairables." + key + ".MaterialType") && itemMaterial != null) {
|
||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||
|
||||
if (ItemUtils.isWoodTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.WOOD;
|
||||
repairMaterialType = MaterialType.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.STONE;
|
||||
repairMaterialType = MaterialType.STONE;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.STRING;
|
||||
repairMaterialType = MaterialType.STRING;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.LEATHER;
|
||||
repairMaterialType = MaterialType.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.IRON;
|
||||
repairMaterialType = MaterialType.IRON;
|
||||
}
|
||||
else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.GOLD;
|
||||
repairMaterialType = MaterialType.GOLD;
|
||||
}
|
||||
else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) {
|
||||
repairMaterialType = RepairMaterialType.DIAMOND;
|
||||
repairMaterialType = MaterialType.DIAMOND;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
repairMaterialType = RepairMaterialType.valueOf(repairMaterialTypeString);
|
||||
repairMaterialType = MaterialType.valueOf(repairMaterialTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid MaterialType of " + repairMaterialTypeString);
|
||||
@ -87,7 +87,7 @@ public class RepairConfig extends ConfigLoader {
|
||||
|
||||
// Repair Material
|
||||
String repairMaterialName = config.getString("Repairables." + key + ".RepairMaterial");
|
||||
Material repairMaterial = (repairMaterialName == null ? repairMaterialType.getDefaultRepairMaterial() : Material.matchMaterial(repairMaterialName));
|
||||
Material repairMaterial = (repairMaterialName == null ? repairMaterialType.getDefaultMaterial() : Material.matchMaterial(repairMaterialName));
|
||||
|
||||
if (repairMaterial == null) {
|
||||
reason.add(key + " has an invalid repair material: " + repairMaterialName);
|
||||
@ -105,22 +105,22 @@ public class RepairConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
// Item Type
|
||||
RepairItemType repairItemType = RepairItemType.OTHER;
|
||||
ItemType repairItemType = ItemType.OTHER;
|
||||
String repairItemTypeString = config.getString("Repairables." + key + ".ItemType", "OTHER");
|
||||
|
||||
if (!config.contains("Repairables." + key + ".ItemType") && itemMaterial != null) {
|
||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||
|
||||
if (ItemUtils.isMinecraftTool(repairItem)) {
|
||||
repairItemType = RepairItemType.TOOL;
|
||||
repairItemType = ItemType.TOOL;
|
||||
}
|
||||
else if (ItemUtils.isArmor(repairItem)) {
|
||||
repairItemType = RepairItemType.ARMOR;
|
||||
repairItemType = ItemType.ARMOR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
repairItemType = RepairItemType.valueOf(repairItemTypeString);
|
||||
repairItemType = ItemType.valueOf(repairItemTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid ItemType of " + repairItemTypeString);
|
||||
@ -136,7 +136,7 @@ public class RepairConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
// Minimum Quantity
|
||||
int minimumQuantity = (itemMaterial != null ? Repair.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), repairMaterial, repairMetadata) : config.getInt("Repairables." + key + ".MinimumQuantity", 2));
|
||||
int minimumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), repairMaterial, repairMetadata) : config.getInt("Repairables." + key + ".MinimumQuantity", 2));
|
||||
|
||||
if (minimumQuantity <= 0 && itemMaterial != null) {
|
||||
minimumQuantity = config.getInt("Repairables." + key + ".MinimumQuantity", 2);
|
||||
|
@ -0,0 +1,165 @@
|
||||
package com.gmail.nossr50.config.skills.salvage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class SalvageConfig extends ConfigLoader {
|
||||
private List<Salvageable> salvageables;
|
||||
|
||||
public SalvageConfig(String fileName) {
|
||||
super(fileName);
|
||||
loadKeys();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadKeys() {
|
||||
salvageables = new ArrayList<Salvageable>();
|
||||
|
||||
ConfigurationSection section = config.getConfigurationSection("Salvageables");
|
||||
Set<String> keys = section.getKeys(false);
|
||||
|
||||
for (String key : keys) {
|
||||
// Validate all the things!
|
||||
List<String> reason = new ArrayList<String>();
|
||||
|
||||
// Item Material
|
||||
Material itemMaterial = Material.matchMaterial(key);
|
||||
|
||||
if (itemMaterial == null) {
|
||||
reason.add("Invalid material: " + key);
|
||||
}
|
||||
|
||||
// Salvage Material Type
|
||||
MaterialType salvageMaterialType = MaterialType.OTHER;
|
||||
String salvageMaterialTypeString = config.getString("Salvageables." + key + ".MaterialType", "OTHER");
|
||||
|
||||
if (!config.contains("Salvageables." + key + ".MaterialType") && itemMaterial != null) {
|
||||
ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||
|
||||
if (ItemUtils.isWoodTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.STONE;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.STRING;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.IRON;
|
||||
}
|
||||
else if (ItemUtils.isGoldArmor(salvageItem) || ItemUtils.isGoldTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.GOLD;
|
||||
}
|
||||
else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.DIAMOND;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid MaterialType of " + salvageMaterialTypeString);
|
||||
}
|
||||
}
|
||||
|
||||
// Salvage Material
|
||||
String salvageMaterialName = config.getString("Salvageables." + key + ".SalvageMaterial");
|
||||
Material salvageMaterial = (salvageMaterialName == null ? salvageMaterialType.getDefaultMaterial() : Material.matchMaterial(salvageMaterialName));
|
||||
|
||||
if (salvageMaterial == null) {
|
||||
reason.add(key + " has an invalid salvage material: " + salvageMaterialName);
|
||||
}
|
||||
|
||||
// Maximum Durability
|
||||
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Salvageables." + key + ".MaximumDurability"));
|
||||
|
||||
// Item Type
|
||||
ItemType salvageItemType = ItemType.OTHER;
|
||||
String salvageItemTypeString = config.getString("Salvageables." + key + ".ItemType", "OTHER");
|
||||
|
||||
if (!config.contains("Salvageables." + key + ".ItemType") && itemMaterial != null) {
|
||||
ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||
|
||||
if (ItemUtils.isMinecraftTool(salvageItem)) {
|
||||
salvageItemType = ItemType.TOOL;
|
||||
}
|
||||
else if (ItemUtils.isArmor(salvageItem)) {
|
||||
salvageItemType = ItemType.ARMOR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
salvageItemType = ItemType.valueOf(salvageItemTypeString);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
reason.add(key + " has an invalid ItemType of " + salvageItemTypeString);
|
||||
}
|
||||
}
|
||||
|
||||
byte salvageMetadata = (byte) config.getInt("Salvageables." + key + ".SalvageMaterialMetadata", -1);
|
||||
int minimumLevel = config.getInt("Salvageables." + key + ".MinimumLevel");
|
||||
double xpMultiplier = config.getDouble("Salvageables." + key + ".XpMultiplier", 1);
|
||||
|
||||
if (minimumLevel < 0) {
|
||||
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
||||
}
|
||||
|
||||
// Maximum Quantity
|
||||
int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata) : config.getInt("Salvageables." + key + ".MaximumQuantity", 2));
|
||||
|
||||
if (maximumQuantity <= 0 && itemMaterial != null) {
|
||||
maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 2);
|
||||
}
|
||||
|
||||
int configMaximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", -1);
|
||||
|
||||
if (configMaximumQuantity > 0) {
|
||||
maximumQuantity = configMaximumQuantity;
|
||||
}
|
||||
|
||||
if (maximumQuantity <= 0) {
|
||||
reason.add("Maximum quantity of " + key + " must be greater than 0!");
|
||||
}
|
||||
|
||||
if (noErrorsInSalvageable(reason)) {
|
||||
Salvageable salvageable = SalvageableFactory.getSalvageable(itemMaterial, salvageMaterial, salvageMetadata, minimumLevel, maximumQuantity, maximumDurability, salvageItemType, salvageMaterialType, xpMultiplier);
|
||||
salvageables.add(salvageable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected List<Salvageable> getLoadedSalvageables() {
|
||||
return salvageables == null ? new ArrayList<Salvageable>() : salvageables;
|
||||
}
|
||||
|
||||
private boolean noErrorsInSalvageable(List<String> issues) {
|
||||
if (!issues.isEmpty()) {
|
||||
plugin.getLogger().warning("Errors have been found in: " + fileName);
|
||||
plugin.getLogger().warning("The following issues were found:");
|
||||
}
|
||||
|
||||
for (String issue : issues) {
|
||||
plugin.getLogger().warning(issue);
|
||||
}
|
||||
|
||||
return issues.isEmpty();
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.gmail.nossr50.config.skills.salvage;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||
|
||||
public class SalvageConfigManager {
|
||||
private final List<Salvageable> salvageables = new ArrayList<Salvageable>();
|
||||
|
||||
public SalvageConfigManager(mcMMO plugin) {
|
||||
Pattern pattern = Pattern.compile("salvage\\.(?:.+)\\.yml");
|
||||
File dataFolder = plugin.getDataFolder();
|
||||
File vanilla = new File(dataFolder, "salvage.vanilla.yml");
|
||||
|
||||
if (!vanilla.exists()) {
|
||||
plugin.saveResource("salvage.vanilla.yml", false);
|
||||
}
|
||||
|
||||
for (String fileName : dataFolder.list()) {
|
||||
if (!pattern.matcher(fileName).matches()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
File file = new File(dataFolder, fileName);
|
||||
|
||||
if (file.isDirectory()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SalvageConfig salvageConfig = new SalvageConfig(fileName);
|
||||
salvageables.addAll(salvageConfig.getLoadedSalvageables());
|
||||
}
|
||||
}
|
||||
|
||||
public List<Salvageable> getLoadedSalvageables() {
|
||||
return salvageables;
|
||||
}
|
||||
}
|
@ -185,7 +185,7 @@ public class Party {
|
||||
|
||||
public String getXpToLevelPercentage() {
|
||||
DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
return percent.format( this.getXp() / getXpToLevel());
|
||||
return percent.format(this.getXp() / getXpToLevel());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
@ -25,6 +24,7 @@ import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
@ -41,6 +41,7 @@ import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
@ -224,6 +225,10 @@ public class McMMOPlayer {
|
||||
return (RepairManager) skillManagers.get(SkillType.REPAIR);
|
||||
}
|
||||
|
||||
public SalvageManager getSalvageManager() {
|
||||
return (SalvageManager) skillManagers.get(SkillType.SALVAGE);
|
||||
}
|
||||
|
||||
public SmeltingManager getSmeltingManager() {
|
||||
return (SmeltingManager) skillManagers.get(SkillType.SMELTING);
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
public enum ItemType {
|
||||
ARMOR,
|
||||
TOOL,
|
||||
OTHER;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum MaterialType {
|
||||
STRING,
|
||||
LEATHER,
|
||||
WOOD,
|
||||
STONE,
|
||||
IRON,
|
||||
GOLD,
|
||||
DIAMOND,
|
||||
OTHER;
|
||||
|
||||
public Material getDefaultMaterial() {
|
||||
switch (this) {
|
||||
case STRING:
|
||||
return Material.STRING;
|
||||
|
||||
case LEATHER:
|
||||
return Material.LEATHER;
|
||||
|
||||
case WOOD:
|
||||
return Material.WOOD;
|
||||
|
||||
case STONE:
|
||||
return Material.COBBLESTONE;
|
||||
|
||||
case IRON:
|
||||
return Material.IRON_INGOT;
|
||||
|
||||
case GOLD:
|
||||
return Material.GOLD_INGOT;
|
||||
|
||||
case DIAMOND:
|
||||
return Material.DIAMOND;
|
||||
|
||||
case OTHER:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -46,9 +46,12 @@ public enum SecondaryAbility {
|
||||
/* Repair */
|
||||
ARCANE_FORGING,
|
||||
REPAIR_MASTERY,
|
||||
SALVAGE,
|
||||
SUPER_REPAIR,
|
||||
|
||||
/* Salvage */
|
||||
ADVANCED_SALVAGE,
|
||||
ARCANE_SALVAGE,
|
||||
|
||||
/* Smelting */
|
||||
FLUX_MINING,
|
||||
FUEL_EFFICIENCY,
|
||||
|
@ -23,6 +23,7 @@ import com.gmail.nossr50.skills.fishing.FishingManager;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.skills.swords.SwordsManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
@ -43,7 +44,8 @@ public enum SkillType {
|
||||
FISHING(FishingManager.class, Color.NAVY, ImmutableList.of(SecondaryAbility.FISHERMANS_DIET, SecondaryAbility.FISHING_TREASURE_HUNTER, SecondaryAbility.ICE_FISHING, SecondaryAbility.MAGIC_HUNTER, SecondaryAbility.MASTER_ANGLER, SecondaryAbility.SHAKE)),
|
||||
HERBALISM(HerbalismManager.class, Color.GREEN, AbilityType.GREEN_TERRA, ToolType.HOE, ImmutableList.of(SecondaryAbility.FARMERS_DIET, SecondaryAbility.GREEN_THUMB_PLANT, SecondaryAbility.GREEN_THUMB_BLOCK, SecondaryAbility.HERBALISM_DOUBLE_DROPS, SecondaryAbility.HYLIAN_LUCK, SecondaryAbility.SHROOM_THUMB)),
|
||||
MINING(MiningManager.class, Color.GRAY, AbilityType.SUPER_BREAKER, ToolType.PICKAXE, ImmutableList.of(SecondaryAbility.MINING_DOUBLE_DROPS)),
|
||||
REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SecondaryAbility.ARCANE_FORGING, SecondaryAbility.REPAIR_MASTERY, SecondaryAbility.SALVAGE, SecondaryAbility.SUPER_REPAIR)),
|
||||
REPAIR(RepairManager.class, Color.SILVER, ImmutableList.of(SecondaryAbility.ARCANE_FORGING, SecondaryAbility.REPAIR_MASTERY, SecondaryAbility.SUPER_REPAIR)),
|
||||
SALVAGE(SalvageManager.class, Color.ORANGE, ImmutableList.of(SecondaryAbility.ADVANCED_SALVAGE, SecondaryAbility.ARCANE_SALVAGE)),
|
||||
SMELTING(SmeltingManager.class, Color.YELLOW, ImmutableList.of(SecondaryAbility.FLUX_MINING, SecondaryAbility.FUEL_EFFICIENCY, SecondaryAbility.SECOND_SMELT)),
|
||||
SWORDS(SwordsManager.class, Color.fromRGB(178, 34, 34), AbilityType.SERRATED_STRIKES, ToolType.SWORD, ImmutableList.of(SecondaryAbility.BLEED, SecondaryAbility.COUNTER)),
|
||||
TAMING(TamingManager.class, Color.PURPLE, ImmutableList.of(SecondaryAbility.BEAST_LORE, SecondaryAbility.CALL_OF_THE_WILD, SecondaryAbility.ENVIROMENTALLY_AWARE, SecondaryAbility.FAST_FOOD, SecondaryAbility.GORE, SecondaryAbility.HOLY_HOUND, SecondaryAbility.SHARPENED_CLAWS, SecondaryAbility.SHOCK_PROOF, SecondaryAbility.THICK_FUR)),
|
||||
@ -63,7 +65,7 @@ public enum SkillType {
|
||||
|
||||
public static final List<SkillType> COMBAT_SKILLS = ImmutableList.of(ARCHERY, AXES, SWORDS, TAMING, UNARMED);
|
||||
public static final List<SkillType> GATHERING_SKILLS = ImmutableList.of(EXCAVATION, FISHING, HERBALISM, MINING, WOODCUTTING);
|
||||
public static final List<SkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SMELTING);
|
||||
public static final List<SkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING);
|
||||
|
||||
static {
|
||||
List<SkillType> childSkills = new ArrayList<SkillType>();
|
||||
@ -182,6 +184,7 @@ public enum SkillType {
|
||||
// TODO: This is a little "hacky", we probably need to add something to distinguish child skills in the enum, or to use another enum for them
|
||||
public boolean isChildSkill() {
|
||||
switch (this) {
|
||||
case SALVAGE:
|
||||
case SMELTING:
|
||||
return true;
|
||||
|
||||
|
@ -5,8 +5,8 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
/**
|
||||
|
@ -2,8 +2,8 @@ package com.gmail.nossr50.events.experience;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
|
||||
/**
|
||||
* Called when a user levels change
|
||||
|
@ -2,8 +2,8 @@ package com.gmail.nossr50.events.experience;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
|
||||
/**
|
||||
* Called when a user loses levels in a skill
|
||||
|
@ -2,8 +2,8 @@ package com.gmail.nossr50.events.experience;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
|
||||
/**
|
||||
* Called when a user levels up in a skill
|
||||
|
@ -2,8 +2,8 @@ package com.gmail.nossr50.events.experience;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
|
||||
/**
|
||||
* Called when a player gains XP in a skill
|
||||
|
@ -9,6 +9,6 @@ import org.bukkit.event.entity.EntityTameEvent;
|
||||
*/
|
||||
public class FakeEntityTameEvent extends EntityTameEvent {
|
||||
public FakeEntityTameEvent(LivingEntity entity, AnimalTamer owner) {
|
||||
super (entity, owner);
|
||||
super(entity, owner);
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ import com.gmail.nossr50.skills.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||
import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.smelting.SmeltingManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
@ -121,8 +123,13 @@ public class BlockListener implements Listener {
|
||||
mcMMO.getPlaceStore().setTrue(blockState);
|
||||
}
|
||||
|
||||
if (BlockUtils.isMcMMOAnvil(blockState)) {
|
||||
UserManager.getPlayer(player).getRepairManager().placedAnvilCheck(blockState.getType());
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (blockState.getType() == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player)) {
|
||||
mcMMOPlayer.getRepairManager().placedAnvilCheck();
|
||||
}
|
||||
else if (blockState.getType() == Salvage.anvilMaterial && SkillType.SALVAGE.getPermissions(player)) {
|
||||
mcMMOPlayer.getSalvageManager().placedAnvilCheck();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -125,6 +126,9 @@ public class EntityListener implements Listener {
|
||||
mcMMO.getPlaceStore().setTrue(block);
|
||||
}
|
||||
}
|
||||
else if ((block.getType() == Material.REDSTONE_ORE || block.getType() == Material.GLOWING_REDSTONE_ORE) && (event.getTo() == Material.REDSTONE_ORE || event.getTo() == Material.GLOWING_REDSTONE_ORE)) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (mcMMO.getPlaceStore().isTrue(block)) {
|
||||
mcMMO.getPlaceStore().setFalse(block);
|
||||
|
@ -51,7 +51,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||
Block furnaceBlock = processInventoryOpenorCloseEvent(event.getInventory());
|
||||
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||
|
||||
if (furnaceBlock == null || furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
||||
return;
|
||||
@ -68,7 +68,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
Block furnaceBlock = processInventoryOpenorCloseEvent(event.getInventory());
|
||||
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||
|
||||
if (furnaceBlock == null || furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
||||
return;
|
||||
@ -295,7 +295,12 @@ public class InventoryListener implements Listener {
|
||||
|
||||
ItemStack item = event.getItem();
|
||||
|
||||
if (Config.getInstance().getPreventHopperTransfer() && item.getType() != Material.POTION) {
|
||||
if (Config.getInstance().getPreventHopperTransferIngredients() && item.getType() != Material.POTION) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getPreventHopperTransferBottles() && item.getType() == Material.POTION) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -327,7 +332,7 @@ public class InventoryListener implements Listener {
|
||||
new PlayerUpdateInventoryTask((Player) whoClicked).runTaskLater(plugin, 0);
|
||||
}
|
||||
|
||||
private Block processInventoryOpenorCloseEvent(Inventory inventory) {
|
||||
private Block processInventoryOpenOrCloseEvent(Inventory inventory) {
|
||||
if (!(inventory instanceof FurnaceInventory)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
@ -49,6 +48,8 @@ import com.gmail.nossr50.skills.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
import com.gmail.nossr50.skills.salvage.SalvageManager;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.skills.unarmed.Unarmed;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
@ -451,24 +452,24 @@ public class PlayerListener implements Listener {
|
||||
|
||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||
/* REPAIR CHECKS */
|
||||
if (type == Repair.repairAnvilMaterial && SkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||
if (type == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||
event.setCancelled(true);
|
||||
|
||||
// Make sure the player knows what he's doing when trying to repair an enchanted item
|
||||
if (!(heldItem.getEnchantments().size() > 0) || repairManager.checkConfirmation(type, true)) {
|
||||
if (!(heldItem.getEnchantments().size() > 0) || repairManager.checkConfirmation(true)) {
|
||||
repairManager.handleRepair(heldItem);
|
||||
player.updateInventory();
|
||||
}
|
||||
}
|
||||
/* SALVAGE CHECKS */
|
||||
else if (type == Repair.salvageAnvilMaterial && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE) && Repair.isSalvageable(heldItem)) {
|
||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||
else if (type == Salvage.anvilMaterial && SkillType.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) {
|
||||
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 (!(heldItem.getEnchantments().size() > 0) || repairManager.checkConfirmation(type, true)) {
|
||||
repairManager.handleSalvage(block.getLocation(), heldItem);
|
||||
if (!(heldItem.getEnchantments().size() > 0) || salvageManager.checkConfirmation(true)) {
|
||||
salvageManager.handleSalvage(block.getLocation(), heldItem);
|
||||
player.updateInventory();
|
||||
}
|
||||
}
|
||||
@ -490,22 +491,22 @@ public class PlayerListener implements Listener {
|
||||
|
||||
if ((Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && player.isSneaking()) || !Config.getInstance().getAbilitiesOnlyActivateWhenSneaking()) {
|
||||
/* REPAIR CHECKS */
|
||||
if (type == Repair.repairAnvilMaterial && SkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||
if (type == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||
|
||||
// Cancel repairing an enchanted item
|
||||
if (repairManager.checkConfirmation(type, false) && Config.getInstance().getRepairConfirmRequired()) {
|
||||
repairManager.setLastAnvilUse(Repair.repairAnvilMaterial, 0);
|
||||
if (repairManager.checkConfirmation(false)) {
|
||||
repairManager.setLastAnvilUse(0);
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Cancelled", LocaleLoader.getString("Repair.Pretty.Name")));
|
||||
}
|
||||
}
|
||||
/* SALVAGE CHECKS */
|
||||
else if (type == Repair.salvageAnvilMaterial && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.SALVAGE) && Repair.isSalvageable(heldItem)) {
|
||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||
else if (type == Salvage.anvilMaterial && SkillType.SALVAGE.getPermissions(player) && mcMMO.getSalvageableManager().isSalvageable(heldItem)) {
|
||||
SalvageManager salvageManager = mcMMOPlayer.getSalvageManager();
|
||||
|
||||
// Cancel salvaging an enchanted item
|
||||
if (repairManager.checkConfirmation(type, false) && Config.getInstance().getRepairConfirmRequired()) {
|
||||
repairManager.setLastAnvilUse(Repair.salvageAnvilMaterial, 0);
|
||||
if (salvageManager.checkConfirmation(false)) {
|
||||
salvageManager.setLastAnvilUse(0);
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Cancelled", LocaleLoader.getString("Salvage.Pretty.Name")));
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import com.gmail.nossr50.config.mods.EntityConfigManager;
|
||||
import com.gmail.nossr50.config.mods.ToolConfigManager;
|
||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||
import com.gmail.nossr50.config.skills.repair.RepairConfigManager;
|
||||
import com.gmail.nossr50.config.skills.salvage.SalvageConfigManager;
|
||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||
import com.gmail.nossr50.database.DatabaseManager;
|
||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||
@ -44,6 +45,9 @@ import com.gmail.nossr50.skills.child.ChildConfig;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairableManager;
|
||||
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager;
|
||||
import com.gmail.nossr50.util.ChimaeraWing;
|
||||
import com.gmail.nossr50.util.HolidayManager;
|
||||
import com.gmail.nossr50.util.LogFilter;
|
||||
@ -61,12 +65,13 @@ import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||
|
||||
public class mcMMO extends JavaPlugin {
|
||||
/* Managers */
|
||||
private static ChunkManager placeStore;
|
||||
private static RepairableManager repairableManager;
|
||||
private static ModManager modManager;
|
||||
private static DatabaseManager databaseManager;
|
||||
private static FormulaManager formulaManager;
|
||||
private static HolidayManager holidayManager;
|
||||
private static ChunkManager placeStore;
|
||||
private static RepairableManager repairableManager;
|
||||
private static SalvageableManager salvageableManager;
|
||||
private static ModManager modManager;
|
||||
private static DatabaseManager databaseManager;
|
||||
private static FormulaManager formulaManager;
|
||||
private static HolidayManager holidayManager;
|
||||
|
||||
/* File Paths */
|
||||
private static String mainDirectory;
|
||||
@ -292,6 +297,10 @@ public class mcMMO extends JavaPlugin {
|
||||
return repairableManager;
|
||||
}
|
||||
|
||||
public static SalvageableManager getSalvageableManager() {
|
||||
return salvageableManager;
|
||||
}
|
||||
|
||||
public static DatabaseManager getDatabaseManager() {
|
||||
return databaseManager;
|
||||
}
|
||||
@ -391,6 +400,7 @@ public class mcMMO extends JavaPlugin {
|
||||
new ChildConfig();
|
||||
|
||||
List<Repairable> repairables = new ArrayList<Repairable>();
|
||||
List<Salvageable> salvageables = new ArrayList<Salvageable>();
|
||||
|
||||
if (Config.getInstance().getToolModsEnabled()) {
|
||||
new ToolConfigManager(this);
|
||||
@ -413,6 +423,12 @@ public class mcMMO extends JavaPlugin {
|
||||
repairables.addAll(modManager.getLoadedRepairables());
|
||||
repairableManager = new SimpleRepairableManager(repairables.size());
|
||||
repairableManager.registerRepairables(repairables);
|
||||
|
||||
// Load salvage configs, make manager and register them at this time
|
||||
SalvageConfigManager sManager = new SalvageConfigManager(this);
|
||||
salvageables.addAll(sManager.getLoadedSalvageables());
|
||||
salvageableManager = new SimpleSalvageableManager(salvageables.size());
|
||||
salvageableManager.registerSalvageables(salvageables);
|
||||
}
|
||||
|
||||
private void registerEvents() {
|
||||
|
@ -34,7 +34,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
|
||||
displayBoard();
|
||||
}
|
||||
|
||||
if (useChat){
|
||||
if (useChat) {
|
||||
displayChat();
|
||||
}
|
||||
}
|
||||
|
@ -28,5 +28,5 @@ public class DatabaseConversionTask extends BukkitRunnable {
|
||||
sender.sendMessage(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (Iterator<Entry<LivingEntity, Integer>> bleedIterator = bleedList.entrySet().iterator(); bleedIterator.hasNext();) {
|
||||
for (Iterator<Entry<LivingEntity, Integer>> bleedIterator = bleedList.entrySet().iterator(); bleedIterator.hasNext(); ) {
|
||||
Entry<LivingEntity, Integer> entry = bleedIterator.next();
|
||||
LivingEntity entity = entry.getKey();
|
||||
|
||||
@ -107,4 +107,8 @@ public class BleedTimerTask extends BukkitRunnable {
|
||||
bleedList.put(entity, Math.min(newTicks, MAX_BLEED_TICKS));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isBleeding(LivingEntity entity) {
|
||||
return bleedList.containsKey(entity);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
@ -43,6 +42,7 @@ import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.treasure.EnchantmentTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.Rarity;
|
||||
@ -70,6 +70,7 @@ public class FishingManager extends SkillManager {
|
||||
private Location fishingTarget;
|
||||
private Item fishingCatch;
|
||||
private Location hookLocation;
|
||||
|
||||
public FishingManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.FISHING);
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import org.bukkit.material.Crops;
|
||||
import org.bukkit.material.NetherWarts;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
@ -27,6 +26,7 @@ import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.skills.HerbalismBlockUpdaterTask;
|
||||
@ -115,8 +115,6 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*/
|
||||
public void herbalismBlockCheck(BlockState blockState) {
|
||||
|
@ -10,13 +10,13 @@ import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
|
@ -1,108 +1,13 @@
|
||||
package com.gmail.nossr50.skills.repair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
|
||||
public class Repair {
|
||||
public static int repairMasteryMaxBonusLevel = AdvancedConfig.getInstance().getRepairMasteryMaxLevel();
|
||||
public static double repairMasteryMaxBonus = AdvancedConfig.getInstance().getRepairMasteryMaxBonus();
|
||||
|
||||
public static int salvageUnlockLevel = AdvancedConfig.getInstance().getSalvageUnlockLevel();
|
||||
|
||||
public static Material salvageAnvilMaterial = Config.getInstance().getSalvageAnvilMaterial();
|
||||
public static Material repairAnvilMaterial = Config.getInstance().getRepairAnvilMaterial();
|
||||
public static boolean anvilMessagesEnabled = Config.getInstance().getRepairAnvilMessagesEnabled();
|
||||
|
||||
/**
|
||||
* Checks if the item is salvageable.
|
||||
*
|
||||
* @param item Item to check
|
||||
*
|
||||
* @return true if the item is salvageable, false otherwise
|
||||
*/
|
||||
public static boolean isSalvageable(ItemStack item) {
|
||||
return (Config.getInstance().getSalvageTools() && ItemUtils.isMinecraftTool(item)) || (Config.getInstance().getSalvageArmor() && !ItemUtils.isChainmailArmor(item) && ItemUtils.isMinecraftArmor(item));
|
||||
}
|
||||
|
||||
public static String getAnvilMessage(Material type) {
|
||||
if (type == repairAnvilMaterial) {
|
||||
return LocaleLoader.getString("Repair.Listener.Anvil");
|
||||
}
|
||||
|
||||
if (type == salvageAnvilMaterial) {
|
||||
return LocaleLoader.getString("Repair.Listener.Anvil2");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
protected static Material getRepairAndSalvageItem(ItemStack inHand) {
|
||||
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
|
||||
return Material.DIAMOND;
|
||||
}
|
||||
else if (ItemUtils.isGoldTool(inHand) || ItemUtils.isGoldArmor(inHand)) {
|
||||
return Material.GOLD_INGOT;
|
||||
}
|
||||
else if (ItemUtils.isIronTool(inHand) || ItemUtils.isIronArmor(inHand)) {
|
||||
return Material.IRON_INGOT;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(inHand)) {
|
||||
return Material.COBBLESTONE;
|
||||
}
|
||||
else if (ItemUtils.isWoodTool(inHand)) {
|
||||
return Material.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(inHand)) {
|
||||
return Material.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(inHand)) {
|
||||
return Material.STRING;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getRepairAndSalvageQuantities(ItemStack item) {
|
||||
return getRepairAndSalvageQuantities(item, getRepairAndSalvageItem(item), (byte) -1);
|
||||
}
|
||||
|
||||
public static int getRepairAndSalvageQuantities(ItemStack item, Material repairMaterial, byte repairMetadata) {
|
||||
int quantity = 0;
|
||||
MaterialData repairData = repairMaterial != null ? new MaterialData(repairMaterial, repairMetadata) : null;
|
||||
List<Recipe> recipes = mcMMO.p.getServer().getRecipesFor(item);
|
||||
|
||||
if (!recipes.isEmpty()) {
|
||||
Recipe recipe = recipes.get(0);
|
||||
|
||||
if (recipe instanceof ShapelessRecipe) {
|
||||
for (ItemStack ingredient : ((ShapelessRecipe) recipe).getIngredientList()) {
|
||||
if (ingredient != null && (repairMaterial == null || ingredient.getType() == repairMaterial) && (repairMetadata == -1 || ingredient.getData().equals(repairData))) {
|
||||
quantity += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (recipe instanceof ShapedRecipe) {
|
||||
for (ItemStack ingredient : ((ShapedRecipe) recipe).getIngredientMap().values()) {
|
||||
if (ingredient != null && (repairMaterial == null || ingredient.getType() == repairMaterial) && (repairMetadata == -1 || ingredient.getData().equals(repairData))) {
|
||||
quantity += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return quantity;
|
||||
}
|
||||
public static Material anvilMaterial = Config.getInstance().getRepairAnvilMaterial();
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.repair;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -12,13 +11,13 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.repair.ArcaneForging.Tier;
|
||||
@ -30,10 +29,8 @@ import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class RepairManager extends SkillManager {
|
||||
private boolean placedRepairAnvil;
|
||||
private int lastRepairClick;
|
||||
private boolean placedSalvageAnvil;
|
||||
private int lastSalvageClick;
|
||||
private boolean placedAnvil;
|
||||
private int lastClick;
|
||||
|
||||
public RepairManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.REPAIR);
|
||||
@ -41,25 +38,23 @@ public class RepairManager extends SkillManager {
|
||||
|
||||
/**
|
||||
* Handles notifications for placing an anvil.
|
||||
*
|
||||
* @param anvilType The {@link Material} of the anvil block
|
||||
*/
|
||||
public void placedAnvilCheck(Material anvilType) {
|
||||
public void placedAnvilCheck() {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (getPlacedAnvil(anvilType)) {
|
||||
if (getPlacedAnvil()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Repair.anvilMessagesEnabled) {
|
||||
player.sendMessage(Repair.getAnvilMessage(anvilType));
|
||||
if (Config.getInstance().getRepairAnvilMessagesEnabled()) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Listener.Anvil"));
|
||||
}
|
||||
|
||||
if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) {
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
}
|
||||
|
||||
togglePlacedAnvil(anvilType);
|
||||
togglePlacedAnvil();
|
||||
}
|
||||
|
||||
public void handleRepair(ItemStack item) {
|
||||
@ -67,12 +62,12 @@ public class RepairManager extends SkillManager {
|
||||
Repairable repairable = mcMMO.getRepairableManager().getRepairable(item.getType());
|
||||
|
||||
// Permissions checks on material and item types
|
||||
if (!repairable.getRepairItemType().getPermissions(player)) {
|
||||
if (!Permissions.repairMaterialType(player, repairable.getRepairMaterialType())) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!repairable.getRepairMaterialType().getPermissions(player)) {
|
||||
if (!Permissions.repairMaterialType(player, repairable.getRepairMaterialType())) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return;
|
||||
}
|
||||
@ -91,7 +86,7 @@ public class RepairManager extends SkillManager {
|
||||
Material repairMaterial = repairable.getRepairMaterial();
|
||||
byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
|
||||
ItemStack toRemove = new MaterialData(repairMaterial, repairMaterialMetadata).toItemStack(1);
|
||||
|
||||
|
||||
short startDurability = item.getDurability();
|
||||
|
||||
// Do not repair if at full durability
|
||||
@ -99,7 +94,7 @@ public class RepairManager extends SkillManager {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FullDurability"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check if they have the proper material to repair with
|
||||
if (!inventory.contains(repairMaterial)) {
|
||||
String message = LocaleLoader.getString("Skills.NeedMore", StringUtils.getPrettyItemString(repairMaterial));
|
||||
@ -160,39 +155,14 @@ public class RepairManager extends SkillManager {
|
||||
return ((startDurability - newDurability) / (float) totalDurability);
|
||||
}
|
||||
|
||||
public void handleSalvage(Location location, ItemStack item) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (getSkillLevel() < Repair.salvageUnlockLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getDurability() == 0) {
|
||||
player.setItemInHand(new ItemStack(Material.AIR));
|
||||
location.setY(location.getY() + 1);
|
||||
|
||||
Misc.dropItems(location, new ItemStack(Repair.getRepairAndSalvageItem(item)), Repair.getRepairAndSalvageQuantities(item) * item.getAmount());
|
||||
|
||||
if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.NotFullDurability"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player has tried to use an Anvil before.
|
||||
*
|
||||
* @return true if the player has confirmed using an Anvil
|
||||
*/
|
||||
public boolean checkConfirmation(Material anvilType, boolean actualize) {
|
||||
public boolean checkConfirmation(boolean actualize) {
|
||||
Player player = getPlayer();
|
||||
long lastUse = getLastAnvilUse(anvilType);
|
||||
long lastUse = getLastAnvilUse();
|
||||
|
||||
if (!SkillUtils.cooldownExpired(lastUse, 3) || !Config.getInstance().getRepairConfirmRequired()) {
|
||||
return true;
|
||||
@ -202,14 +172,8 @@ public class RepairManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
actualizeLastAnvilUse(anvilType);
|
||||
|
||||
if (anvilType == Repair.repairAnvilMaterial) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.ConfirmOrCancel", LocaleLoader.getString("Repair.Pretty.Name")));
|
||||
}
|
||||
else if (anvilType == Repair.salvageAnvilMaterial) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.ConfirmOrCancel", LocaleLoader.getString("Salvage.Pretty.Name")));
|
||||
}
|
||||
actualizeLastAnvilUse();
|
||||
player.sendMessage(LocaleLoader.getString("Skills.ConfirmOrCancel", LocaleLoader.getString("Repair.Pretty.Name")));
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -368,61 +332,27 @@ public class RepairManager extends SkillManager {
|
||||
* Repair Anvil Placement
|
||||
*/
|
||||
|
||||
public boolean getPlacedAnvil(Material anvilType) {
|
||||
if (anvilType == Repair.repairAnvilMaterial) {
|
||||
return placedRepairAnvil;
|
||||
}
|
||||
|
||||
if (anvilType == Repair.salvageAnvilMaterial) {
|
||||
return placedSalvageAnvil;
|
||||
}
|
||||
|
||||
return true;
|
||||
public boolean getPlacedAnvil() {
|
||||
return placedAnvil;
|
||||
}
|
||||
|
||||
public void togglePlacedAnvil(Material anvilType) {
|
||||
if (anvilType == Repair.repairAnvilMaterial) {
|
||||
placedRepairAnvil = !placedRepairAnvil;
|
||||
}
|
||||
|
||||
if (anvilType == Repair.salvageAnvilMaterial) {
|
||||
placedSalvageAnvil = !placedSalvageAnvil;
|
||||
}
|
||||
public void togglePlacedAnvil() {
|
||||
placedAnvil = !placedAnvil;
|
||||
}
|
||||
|
||||
/*
|
||||
* Repair Anvil Usage
|
||||
*/
|
||||
|
||||
public int getLastAnvilUse(Material anvilType) {
|
||||
if (anvilType == Repair.repairAnvilMaterial) {
|
||||
return lastRepairClick;
|
||||
}
|
||||
|
||||
if (anvilType == Repair.salvageAnvilMaterial) {
|
||||
return lastSalvageClick;
|
||||
}
|
||||
|
||||
return 0;
|
||||
public int getLastAnvilUse() {
|
||||
return lastClick;
|
||||
}
|
||||
|
||||
public void setLastAnvilUse(Material anvilType, int value) {
|
||||
if (anvilType == Repair.repairAnvilMaterial) {
|
||||
lastRepairClick = value;
|
||||
}
|
||||
|
||||
if (anvilType == Repair.salvageAnvilMaterial) {
|
||||
lastSalvageClick = value;
|
||||
}
|
||||
public void setLastAnvilUse(int value) {
|
||||
lastClick = value;
|
||||
}
|
||||
|
||||
public void actualizeLastAnvilUse(Material anvilType) {
|
||||
if (anvilType == Repair.repairAnvilMaterial) {
|
||||
lastRepairClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
|
||||
if (anvilType == Repair.salvageAnvilMaterial) {
|
||||
lastSalvageClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
public void actualizeLastAnvilUse() {
|
||||
lastClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public enum RepairItemType {
|
||||
ARMOR,
|
||||
TOOL,
|
||||
OTHER;
|
||||
|
||||
/**
|
||||
* Get the base permissions associated with this RepairItemType.
|
||||
*
|
||||
* @param player The player to check the permissions for
|
||||
* @return true if the player has permissions, false otherwise
|
||||
*/
|
||||
public boolean getPermissions(Player player) {
|
||||
switch (this) {
|
||||
case ARMOR:
|
||||
return Permissions.repairArmor(player);
|
||||
|
||||
case TOOL:
|
||||
return Permissions.repairTools(player);
|
||||
|
||||
case OTHER:
|
||||
return Permissions.repairOtherItems(player);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public enum RepairMaterialType {
|
||||
STRING,
|
||||
LEATHER,
|
||||
WOOD,
|
||||
STONE,
|
||||
IRON,
|
||||
GOLD,
|
||||
DIAMOND,
|
||||
OTHER;
|
||||
|
||||
/**
|
||||
* Get the base permissions associated with this RepairMaterialType.
|
||||
*
|
||||
* @param player The player to check the permissions for
|
||||
*
|
||||
* @return true if the player has permissions, false otherwise
|
||||
*/
|
||||
public boolean getPermissions(Player player) {
|
||||
switch (this) {
|
||||
case STRING:
|
||||
return Permissions.repairString(player);
|
||||
|
||||
case LEATHER:
|
||||
return Permissions.repairLeather(player);
|
||||
|
||||
case WOOD:
|
||||
return Permissions.repairWood(player);
|
||||
|
||||
case STONE:
|
||||
return Permissions.repairStone(player);
|
||||
|
||||
case IRON:
|
||||
return Permissions.repairIron(player);
|
||||
|
||||
case GOLD:
|
||||
return Permissions.repairGold(player);
|
||||
|
||||
case DIAMOND:
|
||||
return Permissions.repairDiamond(player);
|
||||
|
||||
case OTHER:
|
||||
return Permissions.repairOtherMaterials(player);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Material getDefaultRepairMaterial() {
|
||||
switch (this) {
|
||||
case STRING:
|
||||
return Material.STRING;
|
||||
|
||||
case LEATHER:
|
||||
return Material.LEATHER;
|
||||
|
||||
case WOOD:
|
||||
return Material.WOOD;
|
||||
|
||||
case STONE:
|
||||
return Material.COBBLESTONE;
|
||||
|
||||
case IRON:
|
||||
return Material.IRON_INGOT;
|
||||
|
||||
case GOLD:
|
||||
return Material.GOLD_INGOT;
|
||||
|
||||
case DIAMOND:
|
||||
return Material.DIAMOND;
|
||||
|
||||
case OTHER:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,9 @@ package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
|
||||
|
||||
public interface Repairable {
|
||||
/**
|
||||
@ -30,14 +33,14 @@ public interface Repairable {
|
||||
*
|
||||
* @return the RepairItemType for this repairable
|
||||
*/
|
||||
public RepairItemType getRepairItemType();
|
||||
public ItemType getRepairItemType();
|
||||
|
||||
/**
|
||||
* Gets the RepairMaterialType value for this repairable item
|
||||
*
|
||||
* @return the RepairMaterialType for this repairable
|
||||
*/
|
||||
public RepairMaterialType getRepairMaterialType();
|
||||
public MaterialType getRepairMaterialType();
|
||||
|
||||
/**
|
||||
* Gets the minimum quantity of repair materials ignoring all other repair bonuses
|
||||
|
@ -2,13 +2,16 @@ package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
|
||||
|
||||
public class RepairableFactory {
|
||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumQuantity, short maximumDurability) {
|
||||
return getRepairable(itemMaterial, repairMaterial, repairMetadata, 0, minimumQuantity, maximumDurability, RepairItemType.OTHER, RepairMaterialType.OTHER, 1);
|
||||
return getRepairable(itemMaterial, repairMaterial, repairMetadata, 0, minimumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
|
||||
}
|
||||
|
||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType, double xpMultiplier) {
|
||||
public static Repairable getRepairable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||
// TODO: Add in loading from config what type of repairable we want.
|
||||
return new SimpleRepairable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, minimumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||
}
|
||||
|
@ -2,17 +2,20 @@ package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
|
||||
|
||||
public class SimpleRepairable implements Repairable {
|
||||
private final Material itemMaterial, repairMaterial;
|
||||
private final int minimumQuantity, minimumLevel;
|
||||
private final short maximumDurability, baseRepairDurability;
|
||||
private final byte repairMetadata;
|
||||
private final RepairItemType repairItemType;
|
||||
private final RepairMaterialType repairMaterialType;
|
||||
private final ItemType repairItemType;
|
||||
private final MaterialType repairMaterialType;
|
||||
private final double xpMultiplier;
|
||||
|
||||
protected SimpleRepairable(Material type, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, RepairItemType repairItemType, RepairMaterialType repairMaterialType, double xpMultiplier) {
|
||||
protected SimpleRepairable(Material type, Material repairMaterial, byte repairMetadata, int minimumLevel, int minimumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||
this.itemMaterial = type;
|
||||
this.repairMaterial = repairMaterial;
|
||||
this.repairMetadata = repairMetadata;
|
||||
@ -41,12 +44,12 @@ public class SimpleRepairable implements Repairable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepairItemType getRepairItemType() {
|
||||
public ItemType getRepairItemType() {
|
||||
return repairItemType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RepairMaterialType getRepairMaterialType() {
|
||||
public MaterialType getRepairMaterialType() {
|
||||
return repairMaterialType;
|
||||
}
|
||||
|
||||
|
58
src/main/java/com/gmail/nossr50/skills/salvage/Salvage.java
Normal file
58
src/main/java/com/gmail/nossr50/skills/salvage/Salvage.java
Normal file
@ -0,0 +1,58 @@
|
||||
package com.gmail.nossr50.skills.salvage;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
|
||||
public class Salvage {
|
||||
// The order of the values is extremely important, a few methods depend on it to work properly
|
||||
public enum Tier {
|
||||
EIGHT(8),
|
||||
SEVEN(7),
|
||||
SIX(6),
|
||||
FIVE(5),
|
||||
FOUR(4),
|
||||
THREE(3),
|
||||
TWO(2),
|
||||
ONE(1);
|
||||
|
||||
int numerical;
|
||||
|
||||
private Tier(int numerical) {
|
||||
this.numerical = numerical;
|
||||
}
|
||||
|
||||
public int toNumerical() {
|
||||
return numerical;
|
||||
}
|
||||
|
||||
protected int getLevel() {
|
||||
return AdvancedConfig.getInstance().getArcaneSalvageRankLevel(this);
|
||||
}
|
||||
|
||||
protected double getExtractFullEnchantChance() {
|
||||
return AdvancedConfig.getInstance().getArcaneSalvageExtractFullEnchantsChance(this);
|
||||
}
|
||||
|
||||
protected double getExtractPartialEnchantChance() {
|
||||
return AdvancedConfig.getInstance().getArcaneSalvageExtractPartialEnchantsChance(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static Material anvilMaterial = Config.getInstance().getSalvageAnvilMaterial();
|
||||
|
||||
public static int salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel();
|
||||
public static double salvageMaxPercentage = AdvancedConfig.getInstance().getSalvageMaxPercentage();
|
||||
|
||||
public static int advancedSalvageUnlockLevel = AdvancedConfig.getInstance().getAdvancedSalvageUnlockLevel();
|
||||
|
||||
public static boolean arcaneSalvageDowngrades = AdvancedConfig.getInstance().getArcaneSalvageEnchantDowngradeEnabled();
|
||||
public static boolean arcaneSalvageEnchantLoss = AdvancedConfig.getInstance().getArcaneSalvageEnchantLossEnabled();
|
||||
|
||||
protected static int calculateSalvageableAmount(short currentDurability, short maxDurability, int baseAmount) {
|
||||
double percentDamaged = (maxDurability <= 0) ? 1D : (double) (maxDurability - currentDurability) / maxDurability;
|
||||
|
||||
return (int) Math.floor(baseAmount * percentDamaged);
|
||||
}
|
||||
}
|
@ -0,0 +1,270 @@
|
||||
package com.gmail.nossr50.skills.salvage;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage.Tier;
|
||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class SalvageManager extends SkillManager {
|
||||
private boolean placedAnvil;
|
||||
private int lastClick;
|
||||
|
||||
public SalvageManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, SkillType.SALVAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles notifications for placing an anvil.
|
||||
*/
|
||||
public void placedAnvilCheck() {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (getPlacedAnvil()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getSalvageAnvilMessagesEnabled()) {
|
||||
player.sendMessage(LocaleLoader.getString("Salvage.Listener.Anvil"));
|
||||
}
|
||||
|
||||
if (Config.getInstance().getSalvageAnvilPlaceSoundsEnabled()) {
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_LAND, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
}
|
||||
|
||||
togglePlacedAnvil();
|
||||
}
|
||||
|
||||
public void handleSalvage(Location location, ItemStack item) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (player.getGameMode() != GameMode.SURVIVAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Salvageable salvageable = mcMMO.getSalvageableManager().getSalvageable(item.getType());
|
||||
|
||||
// Permissions checks on material and item types
|
||||
if (!Permissions.salvageItemType(player, salvageable.getSalvageItemType())) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Permissions.salvageMaterialType(player, salvageable.getSalvageMaterialType())) {
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||
return;
|
||||
}
|
||||
|
||||
int skillLevel = getSkillLevel();
|
||||
int minimumSalvageableLevel = salvageable.getMinimumLevel();
|
||||
|
||||
// Level check
|
||||
if (skillLevel < minimumSalvageableLevel) {
|
||||
player.sendMessage(LocaleLoader.getString("Salvage.Skills.Adept.Level", minimumSalvageableLevel, StringUtils.getPrettyItemString(item.getType())));
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.getDurability() != 0 && (getSkillLevel() < Salvage.advancedSalvageUnlockLevel || !Permissions.advancedSalvage(player))) {
|
||||
player.sendMessage(LocaleLoader.getString("Salvage.Skills.Adept.Damaged"));
|
||||
return;
|
||||
}
|
||||
|
||||
byte salvageMaterialMetadata = salvageable.getSalvageMaterialMetadata();
|
||||
|
||||
int salvageableAmount = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
|
||||
|
||||
if (salvageableAmount == 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Salvage.Skills.TooDamaged"));
|
||||
return;
|
||||
}
|
||||
|
||||
salvageableAmount = Math.max((int) (salvageableAmount * getMaxSalvagePercentage()), 1); // Always get at least something back, if you're capable of salvaging it.
|
||||
|
||||
player.setItemInHand(new ItemStack(Material.AIR));
|
||||
location.add(0, 1, 0);
|
||||
|
||||
Map<Enchantment, Integer> enchants = item.getEnchantments();
|
||||
|
||||
if (!enchants.isEmpty()) {
|
||||
ItemStack enchantBook = arcaneSalvageCheck(enchants);
|
||||
|
||||
if (enchantBook != null) {
|
||||
Misc.dropItem(location, enchantBook);
|
||||
}
|
||||
}
|
||||
|
||||
Misc.dropItems(location, new MaterialData(salvageable.getSalvageMaterial(), salvageMaterialMetadata).toItemStack(salvageableAmount), 1);
|
||||
|
||||
// BWONG BWONG BWONG - CLUNK!
|
||||
if (Config.getInstance().getSalvageAnvilUseSoundsEnabled()) {
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, Misc.ANVIL_USE_VOLUME, Misc.ANVIL_USE_PITCH);
|
||||
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Salvage.Skills.Success"));
|
||||
}
|
||||
|
||||
public double getMaxSalvagePercentage() {
|
||||
return Math.min((((Salvage.salvageMaxPercentage / Salvage.salvageMaxPercentageLevel) * getSkillLevel()) / 100.0D), Salvage.salvageMaxPercentage / 100.0D);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Arcane Salvage rank
|
||||
*
|
||||
* @return the current Arcane Salvage rank
|
||||
*/
|
||||
public int getArcaneSalvageRank() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.toNumerical();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getExtractFullEnchantChance() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getExtractFullEnchantChance();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getExtractPartialEnchantChance() {
|
||||
int skillLevel = getSkillLevel();
|
||||
|
||||
for (Tier tier : Tier.values()) {
|
||||
if (skillLevel >= tier.getLevel()) {
|
||||
return tier.getExtractPartialEnchantChance();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private ItemStack arcaneSalvageCheck(Map<Enchantment, Integer> enchants) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (getArcaneSalvageRank() == 0 || !Permissions.arcaneSalvage(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Salvage.Skills.ArcaneFailed"));
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack book = new ItemStack(Material.ENCHANTED_BOOK);
|
||||
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) book.getItemMeta();
|
||||
|
||||
boolean downgraded = false;
|
||||
|
||||
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
||||
int successChance = Misc.getRandom().nextInt(activationChance);
|
||||
|
||||
if (!Salvage.arcaneSalvageEnchantLoss || getExtractFullEnchantChance() > successChance) {
|
||||
enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue(), true);
|
||||
}
|
||||
else if (enchant.getValue() > 1 && Salvage.arcaneSalvageDowngrades && getExtractPartialEnchantChance() > successChance) {
|
||||
enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue() - 1, true);
|
||||
downgraded = true;
|
||||
}
|
||||
else {
|
||||
downgraded = true;
|
||||
}
|
||||
}
|
||||
|
||||
Map<Enchantment, Integer> newEnchants = enchantMeta.getStoredEnchants();
|
||||
|
||||
if (newEnchants.isEmpty()) {
|
||||
player.sendMessage(LocaleLoader.getString("Salvage.Skills.ArcaneFailed"));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (downgraded || newEnchants.size() < enchants.size()) {
|
||||
player.sendMessage(LocaleLoader.getString("Salvage.Skills.ArcanePartial"));
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Salvage.Skills.ArcaneSuccess"));
|
||||
}
|
||||
|
||||
book.setItemMeta(enchantMeta);
|
||||
return book;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player has tried to use an Anvil before.
|
||||
* @param actualize
|
||||
*
|
||||
* @return true if the player has confirmed using an Anvil
|
||||
*/
|
||||
public boolean checkConfirmation(boolean actualize) {
|
||||
Player player = getPlayer();
|
||||
long lastUse = getLastAnvilUse();
|
||||
|
||||
if (!SkillUtils.cooldownExpired(lastUse, 3) || !Config.getInstance().getSalvageConfirmRequired()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!actualize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
actualizeLastAnvilUse();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.ConfirmOrCancel", LocaleLoader.getString("Salvage.Pretty.Name")));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Salvage Anvil Placement
|
||||
*/
|
||||
|
||||
public boolean getPlacedAnvil() {
|
||||
return placedAnvil;
|
||||
}
|
||||
|
||||
public void togglePlacedAnvil() {
|
||||
placedAnvil = !placedAnvil;
|
||||
}
|
||||
|
||||
/*
|
||||
* Salvage Anvil Usage
|
||||
*/
|
||||
|
||||
public int getLastAnvilUse() {
|
||||
return lastClick;
|
||||
}
|
||||
|
||||
public void setLastAnvilUse(int value) {
|
||||
lastClick = value;
|
||||
}
|
||||
|
||||
public void actualizeLastAnvilUse() {
|
||||
lastClick = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package com.gmail.nossr50.skills.salvage.salvageables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
|
||||
public interface Salvageable {
|
||||
/**
|
||||
* Gets the type of this repairable item
|
||||
*
|
||||
* @return the type of this repairable
|
||||
*/
|
||||
public Material getItemMaterial();
|
||||
|
||||
/**
|
||||
* Gets the id of the material used to repair this item
|
||||
*
|
||||
* @return the id of the repair material
|
||||
*/
|
||||
public Material getSalvageMaterial();
|
||||
|
||||
/**
|
||||
* Gets the metadata byte value of the material used to repair this item
|
||||
*
|
||||
* @return the byte metadata of the repair material
|
||||
*/
|
||||
public byte getSalvageMaterialMetadata();
|
||||
|
||||
/**
|
||||
* Gets the RepairItemType value for this repairable item
|
||||
*
|
||||
* @return the RepairItemType for this repairable
|
||||
*/
|
||||
public ItemType getSalvageItemType();
|
||||
|
||||
/**
|
||||
* Gets the RepairMaterialType value for this repairable item
|
||||
*
|
||||
* @return the RepairMaterialType for this repairable
|
||||
*/
|
||||
public MaterialType getSalvageMaterialType();
|
||||
|
||||
/**
|
||||
* Gets the maximum quantity of salvage materials ignoring all other salvage bonuses
|
||||
*
|
||||
* This is typically set to the number of items needed to create that item, for example 5 for helmets or 2 for swords
|
||||
*
|
||||
* @return the maximum number of items
|
||||
*/
|
||||
public int getMaximumQuantity();
|
||||
|
||||
/**
|
||||
* Gets the maximum durability of this item before it breaks
|
||||
*
|
||||
* @return the maximum durability
|
||||
*/
|
||||
public short getMaximumDurability();
|
||||
|
||||
/**
|
||||
* Gets the base repair durability on which to calculate bonuses.
|
||||
*
|
||||
* This is actually the maximum durability divided by the minimum quantity
|
||||
*
|
||||
* @return the base repair durability
|
||||
*/
|
||||
public short getBaseSalvageDurability();
|
||||
|
||||
/**
|
||||
* Gets the minimum repair level needed to repair this item
|
||||
*
|
||||
* @return the minimum level to repair this item, or 0 for no minimum
|
||||
*/
|
||||
public int getMinimumLevel();
|
||||
|
||||
/**
|
||||
* Gets the xpMultiplier for this repairable
|
||||
*
|
||||
* @return the xpMultiplier of this repairable
|
||||
*/
|
||||
public double getXpMultiplier();
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.gmail.nossr50.skills.salvage.salvageables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
|
||||
public class SalvageableFactory {
|
||||
public static Salvageable getSalvageable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int maximumQuantity, short maximumDurability) {
|
||||
return getSalvageable(itemMaterial, repairMaterial, repairMetadata, 0, maximumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
|
||||
}
|
||||
|
||||
public static Salvageable getSalvageable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||
// TODO: Add in loading from config what type of repairable we want.
|
||||
return new SimpleSalvageable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, maximumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.gmail.nossr50.skills.salvage.salvageables;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface SalvageableManager {
|
||||
/**
|
||||
* Register a salvageable with the SalvageManager
|
||||
*
|
||||
* @param salvageable Salvageable to register
|
||||
*/
|
||||
public void registerSalvageable(Salvageable salvageable);
|
||||
|
||||
/**
|
||||
* Register a list of salvageables with the SalvageManager
|
||||
*
|
||||
* @param salvageables List<Salvageable> to register
|
||||
*/
|
||||
public void registerSalvageables(List<Salvageable> salvageables);
|
||||
|
||||
/**
|
||||
* Checks if an item is salvageable
|
||||
*
|
||||
* @param type Material to check if salvageable
|
||||
*
|
||||
* @return true if salvageable, false if not
|
||||
*/
|
||||
public boolean isSalvageable(Material type);
|
||||
|
||||
/**
|
||||
* Checks if an item is salvageable
|
||||
*
|
||||
* @param itemStack Item to check if salvageable
|
||||
*
|
||||
* @return true if salvageable, false if not
|
||||
*/
|
||||
public boolean isSalvageable(ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Gets the salvageable with this type
|
||||
*
|
||||
* @param type Material of the salvageable to look for
|
||||
*
|
||||
* @return the salvageable, can be null
|
||||
*/
|
||||
public Salvageable getSalvageable(Material type);
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.gmail.nossr50.skills.salvage.salvageables;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
|
||||
|
||||
public class SimpleSalvageable implements Salvageable {
|
||||
private final Material itemMaterial, salvageMaterial;
|
||||
private final int maximumQuantity, minimumLevel;
|
||||
private final short maximumDurability, baseSalvageDurability;
|
||||
private final byte salvageMetadata;
|
||||
private final ItemType salvageItemType;
|
||||
private final MaterialType salvageMaterialType;
|
||||
private final double xpMultiplier;
|
||||
|
||||
protected SimpleSalvageable(Material type, Material salvageMaterial, byte salvageMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType salvageItemType, MaterialType salvageMaterialType, double xpMultiplier) {
|
||||
this.itemMaterial = type;
|
||||
this.salvageMaterial = salvageMaterial;
|
||||
this.salvageMetadata = salvageMetadata;
|
||||
this.salvageItemType = salvageItemType;
|
||||
this.salvageMaterialType = salvageMaterialType;
|
||||
this.minimumLevel = minimumLevel;
|
||||
this.maximumQuantity = maximumQuantity;
|
||||
this.maximumDurability = maximumDurability;
|
||||
this.baseSalvageDurability = (short) (maximumDurability / maximumQuantity);
|
||||
this.xpMultiplier = xpMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getItemMaterial() {
|
||||
return itemMaterial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getSalvageMaterial() {
|
||||
return salvageMaterial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getSalvageMaterialMetadata() {
|
||||
return salvageMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemType getSalvageItemType() {
|
||||
return salvageItemType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialType getSalvageMaterialType() {
|
||||
return salvageMaterialType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumQuantity() {
|
||||
return maximumQuantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getMaximumDurability() {
|
||||
return maximumDurability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getBaseSalvageDurability() {
|
||||
return baseSalvageDurability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumLevel() {
|
||||
return minimumLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getXpMultiplier() {
|
||||
return xpMultiplier;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.gmail.nossr50.skills.salvage.salvageables;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class SimpleSalvageableManager implements SalvageableManager {
|
||||
private HashMap<Material, Salvageable> salvageables;
|
||||
|
||||
public SimpleSalvageableManager() {
|
||||
this(55);
|
||||
}
|
||||
|
||||
public SimpleSalvageableManager(int salvageablesSize) {
|
||||
this.salvageables = new HashMap<Material, Salvageable>(salvageablesSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerSalvageable(Salvageable salvageable) {
|
||||
Material item = salvageable.getItemMaterial();
|
||||
salvageables.put(item, salvageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerSalvageables(List<Salvageable> salvageables) {
|
||||
for (Salvageable salvageable : salvageables) {
|
||||
registerSalvageable(salvageable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSalvageable(Material type) {
|
||||
return salvageables.containsKey(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSalvageable(ItemStack itemStack) {
|
||||
return isSalvageable(itemStack.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Salvageable getSalvageable(Material type) {
|
||||
return salvageables.get(type);
|
||||
}
|
||||
}
|
@ -6,11 +6,11 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
|
@ -67,7 +67,7 @@ public class Taming {
|
||||
|
||||
case WOLF:
|
||||
return LocaleLoader.getString("Taming.Summon.Fail.Wolf");
|
||||
|
||||
|
||||
case HORSE:
|
||||
return LocaleLoader.getString("Taming.Summon.Fail.Horse");
|
||||
|
||||
|
@ -10,13 +10,13 @@ import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
||||
import com.gmail.nossr50.events.skills.secondaryabilities.SecondaryAbilityWeightedActivationCheckEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
@ -26,7 +26,7 @@ public class Unarmed {
|
||||
if (inventory.containsAtLeast(dropStack, 1)) {
|
||||
int nextSlot = 0;
|
||||
|
||||
for (ItemStack itemstack: inventory) {
|
||||
for (ItemStack itemstack : inventory) {
|
||||
if (dropStack.isSimilar(itemstack)) {
|
||||
int itemAmount = itemstack.getAmount();
|
||||
int itemMax = itemstack.getMaxStackSize();
|
||||
@ -57,7 +57,7 @@ public class Unarmed {
|
||||
if (firstEmpty == inventory.getHeldItemSlot()) {
|
||||
int nextSlot = firstEmpty + 1;
|
||||
|
||||
for (Iterator<ItemStack> iterator = inventory.iterator(nextSlot); iterator.hasNext();) {
|
||||
for (Iterator<ItemStack> iterator = inventory.iterator(nextSlot); iterator.hasNext(); ) {
|
||||
ItemStack itemstack = iterator.next();
|
||||
|
||||
if (itemstack == null) {
|
||||
|
@ -11,13 +11,13 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Tree;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.skills.woodcutting.Woodcutting.ExperienceGainMethod;
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.material.SmoothBrick;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.repair.Repair;
|
||||
import com.gmail.nossr50.skills.salvage.Salvage;
|
||||
|
||||
public final class BlockUtils {
|
||||
private BlockUtils() {}
|
||||
@ -304,7 +305,7 @@ public final class BlockUtils {
|
||||
public static boolean isMcMMOAnvil(BlockState blockState) {
|
||||
Material type = blockState.getType();
|
||||
|
||||
return type == Repair.repairAnvilMaterial || type == Repair.salvageAnvilMaterial;
|
||||
return type == Repair.anvilMaterial || type == Salvage.anvilMaterial;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,7 @@ public final class ChimaeraWing {
|
||||
long lastTeleport = mcMMOPlayer.getChimeraWingLastUse();
|
||||
int cooldown = Config.getInstance().getChimaeraCooldown();
|
||||
|
||||
if (cooldown > 0 ) {
|
||||
if (cooldown > 0) {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(lastTeleport * Misc.TIME_CONVERSION_FACTOR, cooldown, player);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
@ -142,7 +142,7 @@ public final class ChimaeraWing {
|
||||
if (Config.getInstance().getChimaeraSoundEnabled()) {
|
||||
player.playSound(location, Sound.BAT_TAKEOFF, Misc.BAT_VOLUME, Misc.BAT_PITCH);
|
||||
}
|
||||
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
|
||||
}
|
||||
|
||||
|
@ -10,13 +10,13 @@ import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.XPGainReason;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelChangeEvent;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelDownEvent;
|
||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent;
|
||||
|
@ -342,7 +342,8 @@ public final class HolidayManager {
|
||||
return mcMMO.getHolidayManager().getDateRange(day.getTime(), start.getTime(), end.getTime());
|
||||
}
|
||||
|
||||
public void handleStatisticEvent(PlayerStatisticIncrementEvent event) {Player player = event.getPlayer();
|
||||
public void handleStatisticEvent(PlayerStatisticIncrementEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Statistic statistic = event.getStatistic();
|
||||
int newValue = event.getNewValue();
|
||||
|
||||
|
@ -11,6 +11,8 @@ import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
|
||||
@ -162,18 +164,19 @@ public final class Permissions {
|
||||
public static boolean superBreaker(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.mining.superbreaker"); }
|
||||
|
||||
/* REPAIR */
|
||||
public static boolean repairArmor(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.armorrepair"); }
|
||||
public static boolean repairTools(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.toolrepair"); }
|
||||
public static boolean repairOtherItems(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.otherrepair"); }
|
||||
public static boolean repairItemType(Permissible permissible, ItemType repairItemType) { return permissible.hasPermission("mcmmo.ability.repair." + repairItemType.toString().toLowerCase() + "repair"); }
|
||||
public static boolean repairMaterialType(Permissible permissible, MaterialType repairMaterialType) { return permissible.hasPermission("mcmmo.ability.repair." + repairMaterialType.toString().toLowerCase() + "repair"); }
|
||||
|
||||
public static boolean repairDiamond(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.diamondrepair"); }
|
||||
public static boolean repairGold(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.goldrepair"); }
|
||||
public static boolean repairIron(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.ironrepair"); }
|
||||
public static boolean repairLeather(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.leatherrepair"); }
|
||||
public static boolean repairOtherMaterials(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.othermaterialrepair"); }
|
||||
public static boolean repairString(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.stringrepair"); }
|
||||
public static boolean repairStone(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.stonerepair"); }
|
||||
public static boolean repairWood(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.repair.woodrepair"); }
|
||||
/* SALVAGE */
|
||||
public static boolean advancedSalvage(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.salvage.advancedsalvage"); }
|
||||
public static boolean arcaneSalvage(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.salvage.arcanesalvage"); }
|
||||
|
||||
public static boolean salvageItemType(Permissible permissible, ItemType salvageItemType) { return permissible.hasPermission("mcmmo.ability.salvage." + salvageItemType.toString().toLowerCase() + "salvage"); }
|
||||
public static boolean salvageMaterialType(Permissible permissible, MaterialType salvageMaterialType) { return permissible.hasPermission("mcmmo.ability.salvage." + salvageMaterialType.toString().toLowerCase() + "salvage"); }
|
||||
|
||||
/* SMELTING */
|
||||
public static boolean fluxMining(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.smelting.fluxmining"); }
|
||||
public static boolean fuelEfficiency(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.smelting.fuelefficiency"); }
|
||||
|
||||
/* SWORDS */
|
||||
public static boolean serratedStrikes(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.swords.serratedstrikes"); }
|
||||
|
@ -29,7 +29,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
public synchronized void closeAll() {
|
||||
for (UUID uid : regionFiles.keySet()) {
|
||||
HashMap<Long, McMMOSimpleRegionFile> worldRegions = regionFiles.get(uid);
|
||||
for (Iterator<McMMOSimpleRegionFile> worldRegionIterator = worldRegions.values().iterator(); worldRegionIterator.hasNext();) {
|
||||
for (Iterator<McMMOSimpleRegionFile> worldRegionIterator = worldRegions.values().iterator(); worldRegionIterator.hasNext(); ) {
|
||||
McMMOSimpleRegionFile rf = worldRegionIterator.next();
|
||||
if (rf != null) {
|
||||
rf.close();
|
||||
|
@ -43,6 +43,7 @@ import com.gmail.nossr50.commands.skills.FishingCommand;
|
||||
import com.gmail.nossr50.commands.skills.HerbalismCommand;
|
||||
import com.gmail.nossr50.commands.skills.MiningCommand;
|
||||
import com.gmail.nossr50.commands.skills.RepairCommand;
|
||||
import com.gmail.nossr50.commands.skills.SalvageCommand;
|
||||
import com.gmail.nossr50.commands.skills.SmeltingCommand;
|
||||
import com.gmail.nossr50.commands.skills.SwordsCommand;
|
||||
import com.gmail.nossr50.commands.skills.TamingCommand;
|
||||
@ -109,6 +110,10 @@ public final class CommandRegistrationManager {
|
||||
command.setExecutor(new RepairCommand());
|
||||
break;
|
||||
|
||||
case SALVAGE:
|
||||
command.setExecutor(new SalvageCommand());
|
||||
break;
|
||||
|
||||
case SMELTING:
|
||||
command.setExecutor(new SmeltingCommand());
|
||||
break;
|
||||
|
@ -90,7 +90,7 @@ public class FormulaManager {
|
||||
experience -= experienceToNextLevel;
|
||||
}
|
||||
|
||||
return new int[]{newLevel, remainder};
|
||||
return new int[]{ newLevel, remainder };
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -494,12 +494,10 @@ public class ScoreboardWrapper {
|
||||
|
||||
// Calculate power level here
|
||||
int powerLevel = 0;
|
||||
for (SkillType skill : SkillType.values()) { // Include child skills, but not in power level
|
||||
for (SkillType skill : SkillType.NON_CHILD_SKILLS) { // Don't include child skills, makes the list too long
|
||||
int level = newProfile.getSkillLevel(skill);
|
||||
|
||||
if (!skill.isChildSkill()) {
|
||||
powerLevel += level;
|
||||
}
|
||||
powerLevel += level;
|
||||
|
||||
// TODO: Verify that this is what we want - calculated in power level but not displayed
|
||||
if (!skill.getPermissions(player)) {
|
||||
|
@ -8,7 +8,11 @@ import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
@ -219,4 +223,68 @@ public class SkillUtils {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static Material getRepairAndSalvageItem(ItemStack inHand) {
|
||||
if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
|
||||
return Material.DIAMOND;
|
||||
}
|
||||
else if (ItemUtils.isGoldTool(inHand) || ItemUtils.isGoldArmor(inHand)) {
|
||||
return Material.GOLD_INGOT;
|
||||
}
|
||||
else if (ItemUtils.isIronTool(inHand) || ItemUtils.isIronArmor(inHand)) {
|
||||
return Material.IRON_INGOT;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(inHand)) {
|
||||
return Material.COBBLESTONE;
|
||||
}
|
||||
else if (ItemUtils.isWoodTool(inHand)) {
|
||||
return Material.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(inHand)) {
|
||||
return Material.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(inHand)) {
|
||||
return Material.STRING;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getRepairAndSalvageQuantities(ItemStack item) {
|
||||
return getRepairAndSalvageQuantities(item, getRepairAndSalvageItem(item), (byte) -1);
|
||||
}
|
||||
|
||||
public static int getRepairAndSalvageQuantities(ItemStack item, Material repairMaterial, byte repairMetadata) {
|
||||
// Workaround for Bukkit bug where damaged items would not return any recipes
|
||||
item = item.clone();
|
||||
item.setDurability((short) 0);
|
||||
|
||||
int quantity = 0;
|
||||
MaterialData repairData = repairMaterial != null ? new MaterialData(repairMaterial, repairMetadata) : null;
|
||||
List<Recipe> recipes = mcMMO.p.getServer().getRecipesFor(item);
|
||||
|
||||
if (recipes.isEmpty()) {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
Recipe recipe = recipes.get(0);
|
||||
|
||||
if (recipe instanceof ShapelessRecipe) {
|
||||
for (ItemStack ingredient : ((ShapelessRecipe) recipe).getIngredientList()) {
|
||||
if (ingredient != null && (repairMaterial == null || ingredient.getType() == repairMaterial) && (repairMetadata == -1 || ingredient.getData().equals(repairData))) {
|
||||
quantity += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (recipe instanceof ShapedRecipe) {
|
||||
for (ItemStack ingredient : ((ShapedRecipe) recipe).getIngredientMap().values()) {
|
||||
if (ingredient != null && (repairMaterial == null || ingredient.getType() == repairMaterial) && (repairMetadata == -1 || ingredient.getData().equals(repairData))) {
|
||||
quantity += ingredient.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return quantity;
|
||||
}
|
||||
}
|
||||
|
@ -314,10 +314,6 @@ Skills:
|
||||
ChanceMax: 100.0
|
||||
MaxBonusLevel: 1000
|
||||
|
||||
Salvage:
|
||||
# UnlockLevel: Level when Salvage become available
|
||||
UnlockLevel: 600
|
||||
|
||||
ArcaneForging:
|
||||
May_Lose_Enchants: true
|
||||
Rank_Levels:
|
||||
@ -349,6 +345,55 @@ Skills:
|
||||
Rank_7: 15.0
|
||||
Rank_8: 10.0
|
||||
#
|
||||
# Settings for Salvage
|
||||
###
|
||||
Salvage:
|
||||
# MaxPercentage: Maximum percentage of materials to be returned when Salvaging
|
||||
# MaxPercentageLevel: On this level, the Salvage percentage will be <MaxPercentage>
|
||||
MaxPercentage: 100.0
|
||||
MaxPercentageLevel: 1000
|
||||
|
||||
# AdvancedSalvage_UnlockLevel: The level at which Advance Salvage become available
|
||||
AdvancedSalvage:
|
||||
UnlockLevel: 350
|
||||
|
||||
ArcaneSalvage:
|
||||
# EnchantLossEnabled: When salvaging enchanted items, the enchants may be lost
|
||||
# EnchantDowngradeEnabled: When salvaging enchanted items, the enchants may be downgraded
|
||||
EnchantLossEnabled: true
|
||||
EnchantDowngradeEnabled: true
|
||||
Rank_Levels:
|
||||
Rank_1: 125
|
||||
Rank_2: 250
|
||||
Rank_3: 375
|
||||
Rank_4: 500
|
||||
Rank_5: 625
|
||||
Rank_6: 750
|
||||
Rank_7: 875
|
||||
Rank_8: 1000
|
||||
|
||||
# ExtractFullEnchant: Chance to extract the full enchant at each ArcaneSalvage rank
|
||||
ExtractFullEnchant:
|
||||
Rank_1: 2.5
|
||||
Rank_2: 5.0
|
||||
Rank_3: 7.5
|
||||
Rank_4: 10.0
|
||||
Rank_5: 12.5
|
||||
Rank_6: 17.5
|
||||
Rank_7: 25.0
|
||||
Rank_8: 32.5
|
||||
|
||||
# ExtractPartialEnchant: Chance to extract the partial enchant at each ArcaneSalvage rank
|
||||
ExtractPartialEnchant:
|
||||
Rank_1: 2.0
|
||||
Rank_2: 2.5
|
||||
Rank_3: 5.0
|
||||
Rank_4: 7.5
|
||||
Rank_5: 10.0
|
||||
Rank_6: 12.5
|
||||
Rank_7: 15.0
|
||||
Rank_8: 17.5
|
||||
#
|
||||
# Settings for Smelting
|
||||
###
|
||||
Smelting:
|
||||
|
@ -8,6 +8,9 @@
|
||||
# WARNING: THIS IS NOT SUPPORTED, IF YOU DO SO YOU ARE RESPONSIBLE FOR THE ISSUES THAT MAY ARISE. That said, watch out for circular dependencies, those are bad.
|
||||
#
|
||||
#####
|
||||
Salvage:
|
||||
- Fishing
|
||||
- Repair
|
||||
Smelting:
|
||||
- Mining
|
||||
- Repair
|
@ -277,7 +277,9 @@ Skills:
|
||||
# Allow Hoppers to transfer ingredients and brew Rank 1 Alchemy potions
|
||||
Enabled_for_Hoppers: true
|
||||
# Prevent Hoppers from transferring ingredients into Brewing Stands
|
||||
Prevent_Hopper_Transfer: false
|
||||
Prevent_Hopper_Transfer_Ingredients: false
|
||||
# Prevent Hoppers from transferring bottles into Brewing Stands
|
||||
Prevent_Hopper_Transfer_Bottles: false
|
||||
Level_Cap: 0
|
||||
Archery:
|
||||
Enabled_For_PVP: true
|
||||
@ -307,11 +309,16 @@ Skills:
|
||||
Anvil_Placed_Sounds: true
|
||||
Anvil_Use_Sounds: true
|
||||
Anvil_Material: IRON_BLOCK
|
||||
Salvage_Anvil_Material: GOLD_BLOCK
|
||||
Salvage_tools: true
|
||||
Salvage_armor: true
|
||||
# Ask for a confirmation when a player tries to repair an enchanted item
|
||||
Confirm_Required: true
|
||||
Salvage:
|
||||
Level_Cap: 0
|
||||
Anvil_Messages: true
|
||||
Anvil_Placed_Sounds: true
|
||||
Anvil_Use_Sounds: true
|
||||
Anvil_Material: GOLD_BLOCK
|
||||
# Ask for a confirmation when a player tries to salvage an enchanted item
|
||||
Confirm_Required: true
|
||||
Smelting:
|
||||
Level_Cap: 0
|
||||
Swords:
|
||||
@ -447,4 +454,4 @@ Particles:
|
||||
# These settings determine if fireworks should get launched when a player levels-up,
|
||||
# this will happen by default for every 100 levels.
|
||||
LevelUp_Enabled: true
|
||||
LevelUp_Tier: 100
|
||||
LevelUp_Tier: 100
|
||||
|
@ -234,14 +234,10 @@ Repair.Effect.6=Diamond Repair ({0}+ SKILL)
|
||||
Repair.Effect.7=Repair Diamond Tools & Armor
|
||||
Repair.Effect.8=Arcane Forging
|
||||
Repair.Effect.9=Repair magic items
|
||||
Repair.Effect.16=Salvage ({0}+ SKILL)
|
||||
Repair.Effect.17=Salvage Tools & Armor
|
||||
Repair.Error=[[DARK_RED]]mcMMO encountered an error attempting to repair this item!
|
||||
Repair.Listener.Anvil=[[DARK_RED]]You have placed an anvil, anvils can repair tools and armor.
|
||||
Repair.Listener.Anvil2=[[DARK_RED]]You have placed a Salvage anvil, use this to Salvage tools and armor.
|
||||
Repair.Listener=Repair:
|
||||
Repair.SkillName=REPAIR
|
||||
Repair.Skills.AdeptSalvage=[[DARK_RED]]You're not skilled enough to Salvage items.
|
||||
Repair.Skills.AdeptDiamond=[[DARK_RED]]You're not skilled enough to repair Diamond.
|
||||
Repair.Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold.
|
||||
Repair.Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron.
|
||||
@ -249,14 +245,11 @@ Repair.Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone.
|
||||
Repair.Skills.Adept=[[RED]]You must be level [[YELLOW]]{0}[[RED]] to repair [[YELLOW]]{1}
|
||||
Repair.Skills.FeltEasy=[[GRAY]]That felt easy.
|
||||
Repair.Skills.FullDurability=[[GRAY]]That is at full durability.
|
||||
Repair.Skills.SalvageSuccess=[[GRAY]]Item salvaged!
|
||||
Repair.Skills.NotFullDurability=[[DARK_RED]]You can't salvage damaged items.
|
||||
Repair.Skills.Mastery=[[RED]]Repair Mastery: [[YELLOW]]Extra {0} durability restored
|
||||
Repair.Skills.StackedItems=[[DARK_RED]]You can't repair stacked items.
|
||||
Repair.Skills.Super.Chance=[[RED]]Super Repair Chance: [[YELLOW]]{0}
|
||||
Repair.Skillup=[[YELLOW]]Repair skill increased by {0}. Total ({1})
|
||||
Repair.Pretty.Name=Repair
|
||||
Salvage.Pretty.Name=Salvage
|
||||
|
||||
#Arcane Forging
|
||||
Repair.Arcane.Chance.Downgrade=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}%
|
||||
@ -267,6 +260,29 @@ Repair.Arcane.Lost=[[RED]]You were not skilled enough to keep any enchantments.
|
||||
Repair.Arcane.Perfect=[[GREEN]]You have sustained the arcane energies in this item.
|
||||
Repair.Arcane.Rank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/{1}
|
||||
|
||||
#SALVAGE
|
||||
Salvage.Pretty.Name=Salvage
|
||||
Salvage.Effect.0=Advanced Salvage
|
||||
Salvage.Effect.1=Salvage damaged items
|
||||
Salvage.Effect.2=Arcane Salvaging
|
||||
Salvage.Effect.3=Extract enchantments from items
|
||||
Salvage.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (ADVANCED SALVAGE)
|
||||
Salvage.Ability.Bonus.0=Advanced Salvage
|
||||
Salvage.Ability.Bonus.1=Max yield {0} item destroyed
|
||||
Salvage.Arcane.Rank=[[RED]]Arcane Salvaging: [[YELLOW]]Rank {0}/{1}
|
||||
Salvage.Arcane.ExtractFull=[[GRAY]]AS Full-Enchant Chance
|
||||
Salvage.Arcane.ExtractPartial=[[GRAY]]AS Partial-Enchant Chance
|
||||
Salvage.Skills.Success=[[GREEN]]Item salvaged!
|
||||
Salvage.Skills.Adept.Damaged=[[DARK_RED]]You aren't skilled enough to salvage damaged items.
|
||||
Salvage.Skills.Adept.Level=[[RED]]You must be level [[YELLOW]]{0}[[RED]] to salvage [[YELLOW]]{1}
|
||||
Salvage.Skills.TooDamaged=[[DARK_RED]]This item is too damaged to be salvaged.
|
||||
Salvage.Skills.ArcaneFailed=[[RED]]You were unable to extract the knowledge contained within this item.
|
||||
Salvage.Skills.ArcanePartial=[[YELLOW]]You were only able to extract some of the knowledge contained within this item.
|
||||
Salvage.Skills.ArcaneSuccess=[[GREEN]]You able to extract all of the knowledge contained within this item!
|
||||
Salvage.Listener.Anvil=[[DARK_RED]]You have placed a Salvage anvil, use this to Salvage tools and armor.
|
||||
Salvage.Listener=Salvage:
|
||||
Salvage.SkillName=SALVAGE
|
||||
|
||||
#SWORDS
|
||||
Swords.Ability.Lower=[[GRAY]]**YOU LOWER YOUR SWORD**
|
||||
Swords.Ability.Ready=[[GREEN]]**YOU READY YOUR SWORD**
|
||||
@ -757,12 +773,21 @@ Guides.Mining.Section.4=[[DARK_AQUA]]How to use Blast Mining:\n[[YELLOW]]With a
|
||||
Guides.Mining.Section.5=[[DARK_AQUA]]How does Blast Mining work?\n[[YELLOW]]Blast Mining is an ability with a cooldown tied to the Mining\n[[YELLOW]]skill. It gives bonuses when mining with TNT and allows you\n[[YELLOW]]to remote detonate TNT. There are three parts to Blast Mining.\n[[YELLOW]]The first part is Bigger Bombs, which increases blast radius.\n[[YELLOW]]The second is Demolitions Expert, which decreases damage\n[[YELLOW]]from TNT explosions. The third part simply increases the\n[[YELLOW]]amount of ores dropped from TNT and decreases the\n[[YELLOW]]debris dropped.
|
||||
|
||||
##Repair
|
||||
Guides.Repair.Section.0=[[DARK_AQUA]]About Repair:\n[[YELLOW]]Repair allows you to use an iron block to repair armor and\n[[YELLOW]]tools, or a gold block to salvage armor and tools.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]Repair tools or armor using the mcMMO Anvil. This is an\n[[YELLOW]]iron block by default and should not be confused with\n[[YELLOW]]the Vanilla Minecraft Anvil.
|
||||
Guides.Repair.Section.0=[[DARK_AQUA]]About Repair:\n[[YELLOW]]Repair allows you to use an iron block to repair armor and\n[[YELLOW]]tools.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]Repair tools or armor using the mcMMO Anvil. This is an\n[[YELLOW]]iron block by default and should not be confused with\n[[YELLOW]]the Vanilla Minecraft Anvil.
|
||||
Guides.Repair.Section.1=[[DARK_AQUA]]How can I use Repair?\n[[YELLOW]]Place down a mcMMO Anvil and right-click to repair the item \n[[YELLOW]]you're currently holding. This consumes 1 item on every use.
|
||||
Guides.Repair.Section.2=[[DARK_AQUA]]How does Repair Mastery work?\n[[YELLOW]]Repair Mastery increases the repair amount. The extra amount\n[[YELLOW]]repaired is influenced by your Repair skill level.
|
||||
Guides.Repair.Section.3=[[DARK_AQUA]]How does Super Repair work?\n[[YELLOW]]Super Repair is a passive ability. When repairing an item,\n[[YELLOW]]it grants players a chance to repair an item with\n[[YELLOW]]double effectiveness.
|
||||
Guides.Repair.Section.4=[[DARK_AQUA]]How does Arcane Forging work?\n[[YELLOW]]This passive ability allows you to repair items with a certain\n[[YELLOW]]chance of maintaining its enchantments. The enchants may be\n[[YELLOW]]kept at their existing levels, downgraded to a lower level,\n[[YELLOW]]or lost entirely.
|
||||
Guides.Repair.Section.5=[[DARK_AQUA]]How does Salvage work?\n[[YELLOW]]Place down a mcMMO Salvage Anvil and right-click to salvage\n[[YELLOW]]the item you're currently holding.\n[[YELLOW]]This will break the item apart en give back the used ingots.\n[[YELLOW]]Note: You can only salvage fully repaired tools or armor.
|
||||
|
||||
##Salvage
|
||||
Guides.Salvage.Section.0=[[DARK_AQUA]]About Salvage:\n[[YELLOW]]Salvage allows you to use an gold block to salvage armor and\n[[YELLOW]]tools.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]Salvage is a child skill of Repair and Fishing, your Salvage\n[[YELLOW]]skill level is based on your Fishing and Repair skill levels.
|
||||
Guides.Salvage.Section.1=[[DARK_AQUA]]How can I use Salvage?\n[[YELLOW]]Place down a mcMMO Salvage Anvil and right-click to salvage\n[[YELLOW]]the item you're currently holding. This will break apart the item,\n[[YELLOW]]and give back materials used to craft the item.\n\n[[YELLOW]]For example, salvaging an iron pickaxe will give you iron bars.
|
||||
Guides.Salvage.Section.2=[[DARK_AQUA]]How does Advanced Salvage work?\n[[YELLOW]]When unlocked, this ability allows you to salvage damaged items.\n[[YELLOW]]The yield percentage increases as you level up. A higher yield\n[[YELLOW]]means that you can get more materials back.\n[[YELLOW]]With advanced salvage you will always get 1 material back,\n[[YELLOW]]unless the item is too damaged. So you don't have to worry\n[[YELLOW]]about destroying items without getting anything in return.
|
||||
Guides.Salvage.Section.3=[[DARK_AQUA]]To illustrate how this works, here's an example:\n[[YELLOW]]Let's say we salvage a gold pickaxe which is damaged for 20%,\n[[YELLOW]]this means that the maximum amount you could get is only 2\n[[YELLOW]](because the pick is crafted with 3 ingots - each worth\n[[YELLOW]]33,33% durability) which is equal to 66%. If your yield\n[[YELLOW]]percentage is below 66% you are not able to get 2 ingots.\n[[YELLOW]]If it is above this value you are able to gain the "full amount",\n[[YELLOW]]which means that you will get 2 ingots.
|
||||
Guides.Salvage.Section.4=[[DARK_AQUA]]How does Arcane Salvage work?\n[[YELLOW]]This ability allows you to get enchanted books when salvaging\n[[YELLOW]]enchanted items. Depending on your level the chance of\n[[YELLOW]]successfully extracting a full or partial enchantment varies.\n\n[[YELLOW]]When an enchantment is partially extracted, the enchantment\n[[YELLOW]]book will have a lower level enchantment compared to what\n[[YELLOW]]it was on the item.
|
||||
|
||||
##Smelting
|
||||
Guides.Smelting.Section.0=Coming soon...
|
||||
|
||||
##Swords
|
||||
Guides.Swords.Section.0=[[DARK_AQUA]]About Swords:\n[[YELLOW]]This skill awards combat bonuses to anyone fighting with a\n[[YELLOW]]sword.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]XP is gained based on the amount of damage dealt to mobs or \n[[YELLOW]]other players when wielding a sword.
|
||||
@ -770,9 +795,6 @@ Guides.Swords.Section.1=[[DARK_AQUA]]How does Serrated Strikes work?\n[[YELLOW]]
|
||||
Guides.Swords.Section.2=[[DARK_AQUA]]How does Counter Attack work?\n[[YELLOW]]Counter Attack is an active ability. When blocking and taking\n[[YELLOW]]hits from mobs, you will have a chance to reflect 50% of \n[[YELLOW]]the damage that was taken.
|
||||
Guides.Swords.Section.3=[[DARK_AQUA]]How does Bleed work?\n[[YELLOW]]Bleed causes enemies to take damage every two seconds. The \n[[YELLOW]]target will bleed until the effect wears off, or death, \n[[YELLOW]]whichever comes first.\n[[YELLOW]]The duration of the bleed is increased by your sword skill.
|
||||
|
||||
##Smelting
|
||||
Guides.Smelting.Section.0=Coming soon...
|
||||
|
||||
##Taming
|
||||
Guides.Taming.Section.0=[[DARK_AQUA]]About Taming:\n[[YELLOW]]Taming will give players various combat bonuses when using\n[[YELLOW]]tamed wolves.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]To gain XP in this skill, you need to tame wolves/ocelots or\n[[YELLOW]]get into combat with your wolves.
|
||||
Guides.Taming.Section.1=[[DARK_AQUA]]How does Call of the Wild work?\n[[YELLOW]]Call of the Wild is an active ability that will allow you to summon\n[[YELLOW]]a wolf or an ocelot by your side. You can do this by\n[[YELLOW]]left-clicking while holding bones or fish.
|
||||
|
@ -91,6 +91,8 @@ commands:
|
||||
description: Detailed mcMMO skill info
|
||||
alchemy:
|
||||
description: Detailed mcMMO skill info
|
||||
salvage:
|
||||
description: Detailed mcMMO skill info
|
||||
adminchat:
|
||||
aliases: [ac, a]
|
||||
description: Toggle Admin chat or send admin chat messages
|
||||
@ -152,6 +154,7 @@ permissions:
|
||||
mcmmo.ability.herbalism.all: true
|
||||
mcmmo.ability.mining.all: true
|
||||
mcmmo.ability.repair.all: true
|
||||
mcmmo.ability.salvage.all: true
|
||||
mcmmo.ability.smelting.all: true
|
||||
mcmmo.ability.swords.all: true
|
||||
mcmmo.ability.taming.all: true
|
||||
@ -398,7 +401,6 @@ permissions:
|
||||
mcmmo.ability.repair.otherrepair: true
|
||||
mcmmo.ability.repair.repairbonus: true
|
||||
mcmmo.ability.repair.repairmastery: true
|
||||
mcmmo.ability.repair.salvage: true
|
||||
mcmmo.ability.repair.stonerepair: true
|
||||
mcmmo.ability.repair.stringrepair: true
|
||||
mcmmo.ability.repair.toolrepair: true
|
||||
@ -423,8 +425,6 @@ permissions:
|
||||
description: Allows access to Super Repair bonus
|
||||
mcmmo.ability.repair.repairmastery:
|
||||
description: Allows access to Repair Mastery
|
||||
mcmmo.ability.repair.salvage:
|
||||
description: Allows access to the Salvage ability
|
||||
mcmmo.ability.repair.stonerepair:
|
||||
description: Allows ability to repair Stone tools
|
||||
mcmmo.ability.repair.stringrepair:
|
||||
@ -433,6 +433,53 @@ permissions:
|
||||
description: Allows ability to repair tools
|
||||
mcmmo.ability.repair.woodrepair:
|
||||
description: Allows ability to repair Wood tools
|
||||
mcmmo.ability.salvage.*:
|
||||
default: false
|
||||
description: Allows access to all Salvage abilities
|
||||
children:
|
||||
mcmmo.ability.salvage.all: true
|
||||
mcmmo.ability.salvage.all:
|
||||
description: Allows access to all Smelting abilities
|
||||
children:
|
||||
mcmmo.ability.salvage.advancedsalvage: true
|
||||
mcmmo.ability.salvage.arcanesalvage: true
|
||||
mcmmo.ability.salvage.armorsalvage: true
|
||||
mcmmo.ability.salvage.diamondsalvage: true
|
||||
mcmmo.ability.salvage.goldsalvage: true
|
||||
mcmmo.ability.salvage.ironsalvage: true
|
||||
mcmmo.ability.salvage.leathersalvage: true
|
||||
mcmmo.ability.salvage.othermaterialsalvage: true
|
||||
mcmmo.ability.salvage.othersalvage: true
|
||||
mcmmo.ability.salvage.stonesalvage: true
|
||||
mcmmo.ability.salvage.stringsalvage: true
|
||||
mcmmo.ability.salvage.toolsalvage: true
|
||||
mcmmo.ability.salvage.woodsalvage: true
|
||||
mcmmo.ability.salvage.advancedsalvage:
|
||||
description: Allows access to the Advanced Salvage ability
|
||||
mcmmo.ability.salvage.arcanesalvage:
|
||||
description: Allows access to the Arcane Salvage ability
|
||||
mcmmo.ability.salvage.armorsalvage:
|
||||
description: Allows ability to salvage armor
|
||||
mcmmo.ability.salvage.diamondsalvage:
|
||||
description: Allows ability to salvage Diamond tools & armor
|
||||
mcmmo.ability.salvage.goldsalvage:
|
||||
description: Allows ability to salvage Gold tools & armor
|
||||
mcmmo.ability.salvage.ironsalvage:
|
||||
description: Allows ability to salvage Iron tools & armor
|
||||
mcmmo.ability.salvage.leathersalvage:
|
||||
description: Allows ability to salvage Leather armor
|
||||
mcmmo.ability.salvage.othermaterialsalvage:
|
||||
description: Allows ability to salvage items of material type OTHER
|
||||
mcmmo.ability.salvage.othersalvage:
|
||||
description: Allows ability to salvage items of type OTHER
|
||||
mcmmo.ability.salvage.stonesalvage:
|
||||
description: Allows ability to salvage Stone tools
|
||||
mcmmo.ability.salvage.stringsalvage:
|
||||
description: Allows ability to salvage Bow and Fishing rod
|
||||
mcmmo.ability.salvage.toolsalvage:
|
||||
description: Allows ability to salvage tools
|
||||
mcmmo.ability.salvage.woodsalvage:
|
||||
description: Allows ability to salvage Wood tools
|
||||
mcmmo.ability.smelting.*:
|
||||
default: false
|
||||
description: Allows access to all Smelting abilities
|
||||
@ -656,6 +703,7 @@ permissions:
|
||||
mcmmo.commands.party.all: true
|
||||
mcmmo.commands.ptp.all: true
|
||||
mcmmo.commands.repair: true
|
||||
mcmmo.commands.salvage: true
|
||||
mcmmo.commands.smelting: true
|
||||
mcmmo.commands.swords: true
|
||||
mcmmo.commands.taming: true
|
||||
@ -844,6 +892,7 @@ permissions:
|
||||
mcmmo.commands.mctop.herbalism: true
|
||||
mcmmo.commands.mctop.mining: true
|
||||
mcmmo.commands.mctop.repair: true
|
||||
mcmmo.commands.mctop.salvage: true
|
||||
mcmmo.commands.mctop.smelting: true
|
||||
mcmmo.commands.mctop.swords: true
|
||||
mcmmo.commands.mctop.taming: true
|
||||
@ -869,6 +918,8 @@ permissions:
|
||||
description: Allows access to the mctop command for mining
|
||||
mcmmo.commands.mctop.repair:
|
||||
description: Allows access to the mctop command for repair
|
||||
mcmmo.commands.mctop.salvage:
|
||||
description: Allows access to the mctop command for salvage
|
||||
mcmmo.commands.mctop.smelting:
|
||||
description: Allows access to the mctop command for smelting
|
||||
mcmmo.commands.mctop.swords:
|
||||
@ -1014,6 +1065,7 @@ permissions:
|
||||
mcmmo.commands.skillreset.mining: true
|
||||
mcmmo.commands.skillreset.others.all: true
|
||||
mcmmo.commands.skillreset.repair: true
|
||||
mcmmo.commands.skillreset.salvage: true
|
||||
mcmmo.commands.skillreset.smelting: true
|
||||
mcmmo.commands.skillreset.swords: true
|
||||
mcmmo.commands.skillreset.taming: true
|
||||
@ -1055,6 +1107,7 @@ permissions:
|
||||
mcmmo.commands.skillreset.others.herbalism: true
|
||||
mcmmo.commands.skillreset.others.mining: true
|
||||
mcmmo.commands.skillreset.others.repair: true
|
||||
mcmmo.commands.skillreset.others.salvage: true
|
||||
mcmmo.commands.skillreset.others.smelting: true
|
||||
mcmmo.commands.skillreset.others.swords: true
|
||||
mcmmo.commands.skillreset.others.taming: true
|
||||
@ -1080,6 +1133,8 @@ permissions:
|
||||
description: Allows access to the skillreset command for mining for other players
|
||||
mcmmo.commands.skillreset.others.repair:
|
||||
description: Allows access to the skillreset command for repair for other players
|
||||
mcmmo.commands.skillreset.others.salvage:
|
||||
description: Allows access to the skillreset command for salvage for other players
|
||||
mcmmo.commands.skillreset.others.smelting:
|
||||
description: Allows access to the skillreset command for smelting for other players
|
||||
mcmmo.commands.skillreset.others.swords:
|
||||
@ -1092,6 +1147,8 @@ permissions:
|
||||
description: Allows access to the skillreset command for woodcutting for other players
|
||||
mcmmo.commands.skillreset.repair:
|
||||
description: Allows access to the skillreset command for repair
|
||||
mcmmo.commands.skillreset.salvage:
|
||||
description: Allows access to the skillreset command for smelting
|
||||
mcmmo.commands.skillreset.smelting:
|
||||
description: Allows access to the skillreset command for smelting
|
||||
mcmmo.commands.skillreset.swords:
|
||||
@ -1102,6 +1159,8 @@ permissions:
|
||||
description: Allows access to the skillreset command for unarmed
|
||||
mcmmo.commands.skillreset.woodcutting:
|
||||
description: Allows access to the skillreset command for woodcutting
|
||||
mcmmo.commands.salvage:
|
||||
description: Allows access to the salvage command
|
||||
mcmmo.commands.smelting:
|
||||
description: Allows access to the smelting command
|
||||
mcmmo.commands.swords:
|
||||
@ -1264,6 +1323,7 @@ permissions:
|
||||
mcmmo.perks.lucky.herbalism: true
|
||||
mcmmo.perks.lucky.mining: true
|
||||
mcmmo.perks.lucky.repair: true
|
||||
mcmmo.perks.lucky.salvage: true
|
||||
mcmmo.perks.lucky.smelting: true
|
||||
mcmmo.perks.lucky.swords: true
|
||||
mcmmo.perks.lucky.taming: true
|
||||
@ -1296,6 +1356,9 @@ permissions:
|
||||
mcmmo.perks.lucky.repair:
|
||||
default: false
|
||||
description: Gives Repair abilities & skills a 33.3% better chance to activate.
|
||||
mcmmo.perks.lucky.salvage:
|
||||
default: false
|
||||
description: Gives Salvage abilities & skills a 33.3% better chance to activate.
|
||||
mcmmo.perks.lucky.smelting:
|
||||
default: false
|
||||
description: Gives Smelting abilities & skills a 33.3% better chance to activate.
|
||||
@ -1840,6 +1903,7 @@ permissions:
|
||||
mcmmo.skills.herbalism: true
|
||||
mcmmo.skills.mining: true
|
||||
mcmmo.skills.repair: true
|
||||
mcmmo.skills.salvage: true
|
||||
mcmmo.skills.swords: true
|
||||
mcmmo.skills.smelting: true
|
||||
mcmmo.skills.taming: true
|
||||
|
@ -210,4 +210,4 @@ Repairables:
|
||||
XpMultiplier: .5
|
||||
CARROT_STICK:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
XpMultiplier: .5
|
||||
|
213
src/main/resources/salvage.vanilla.yml
Normal file
213
src/main/resources/salvage.vanilla.yml
Normal file
@ -0,0 +1,213 @@
|
||||
#
|
||||
# Salvage configuration
|
||||
# Last updated on ${project.version}-b${BUILD_NUMBER}
|
||||
#
|
||||
# Any file named salvage.*.yml in the mcmmmo folder will be loaded as a salvage config
|
||||
# All salvage configs have a main section titled "Salvageables"
|
||||
# Afterwards, all sub-items are considered a Salvageable to be loaded. The names of each subitem should be the exact material name.
|
||||
# The bare minimum of a Salvageable is that it has a minimumLevel and XpMultiplier.
|
||||
#
|
||||
# ItemType: This is the type of item to be repaired, this is only important to permissions.
|
||||
## Valid values are ARMOR, TOOL, and OTHER.
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
# MaterialType: This is the type of the material of the item to be salvaged, this is only important for permissions.
|
||||
## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
# SalvageMaterial: This is the material name of the item used to salvage this item.
|
||||
## This is required to be set for non craftable items, if not set mcMMO checks the crafting recipe to see which items
|
||||
## should be dropped when salvaging the item.
|
||||
#
|
||||
# SalvageMaterialMetadata: This is the metadata of the item used to salvage this item.
|
||||
## A value of -1 means to ignore all metadata when repairing.
|
||||
## This defaults to -1
|
||||
#
|
||||
# MaximumDurability: This is the maximum durability of the item.
|
||||
#
|
||||
# MinimumLevel: This is the minimum repair level needed to salvage this item.
|
||||
## Valid values are => 0
|
||||
## This defaults to 0
|
||||
#
|
||||
# MaximumQuantity: This is the maximum number of items yield after salvaging the item, ignoring all other salvage bonuses.
|
||||
## This is typically the number of the salvage material needed to create a new item, for example for a sword it is 2, for an axe it is 3
|
||||
## This defaults to 2
|
||||
#
|
||||
# XpMultiplier: This is the amount to multiply the xp bonus by.
|
||||
## This defaults to 1
|
||||
#
|
||||
#
|
||||
# The following is the default salvage config that ships with mcMMO, it contains all vanilla items that are salvageable.
|
||||
#
|
||||
#
|
||||
###
|
||||
Salvageables:
|
||||
#
|
||||
# Wooden salvageables
|
||||
###
|
||||
# Tools
|
||||
WOOD_SWORD:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .25
|
||||
WOOD_SPADE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .16
|
||||
WOOD_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
WOOD_AXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
WOOD_HOE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .25
|
||||
#
|
||||
# Stone salvageables
|
||||
###
|
||||
# Tools
|
||||
STONE_SWORD:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .25
|
||||
STONE_SPADE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .16
|
||||
STONE_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
STONE_AXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
STONE_HOE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .25
|
||||
#
|
||||
# Iron salvageables
|
||||
###
|
||||
# Tools
|
||||
IRON_SWORD:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
IRON_SPADE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .3
|
||||
IRON_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
IRON_AXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
IRON_HOE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
SHEARS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
FLINT_AND_STEEL:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .3
|
||||
# Armor
|
||||
IRON_HELMET:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 2
|
||||
IRON_CHESTPLATE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 2
|
||||
IRON_LEGGINGS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 2
|
||||
IRON_BOOTS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 2
|
||||
#
|
||||
# Gold salvageables
|
||||
###
|
||||
# Tools
|
||||
GOLD_SWORD:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
GOLD_SPADE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 2.6
|
||||
GOLD_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 8
|
||||
GOLD_AXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 8
|
||||
GOLD_HOE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
# Armor
|
||||
GOLD_HELMET:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
GOLD_CHESTPLATE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
GOLD_LEGGINGS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
GOLD_BOOTS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
#
|
||||
# Diamond salvageables
|
||||
###
|
||||
# Tools
|
||||
DIAMOND_SWORD:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: .5
|
||||
DIAMOND_SPADE:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: .3
|
||||
DIAMOND_PICKAXE:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 1
|
||||
DIAMOND_AXE:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 1
|
||||
DIAMOND_HOE:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: .5
|
||||
# Armor
|
||||
DIAMOND_HELMET:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 6
|
||||
DIAMOND_CHESTPLATE:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 6
|
||||
DIAMOND_LEGGINGS:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 6
|
||||
DIAMOND_BOOTS:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 6
|
||||
#
|
||||
# Leather salvageables
|
||||
###
|
||||
# Armor
|
||||
LEATHER_HELMET:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
LEATHER_CHESTPLATE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
LEATHER_LEGGINGS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
LEATHER_BOOTS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
#
|
||||
# String salvageables
|
||||
###
|
||||
# Tools
|
||||
FISHING_ROD:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
BOW:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
CARROT_STICK:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
Loading…
Reference in New Issue
Block a user