mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
New salvage enchant bypass permission node
This commit is contained in:
parent
f6e01ea910
commit
d542098f8a
@ -10,8 +10,13 @@ Key:
|
||||
Version 2.1.42
|
||||
Fixed McMMOPlayerNotFoundException being thrown instead of null
|
||||
(API) UserManager.getPlayer() returns null again (oopsie)
|
||||
Added new perk permission node `mcmmo.perks.bypass.salvageenchant` - guarantees full enchantment return for Salvage
|
||||
Added alternative permission node `mcmmo.perks.bypass.repairenchant` - guarantees full enchantment return for Repair
|
||||
Added new wildcard perk `mcmmo.perks.bypass.*` and `mcmmo.perks.bypass.all` (either of these will grant all new mcmmo.perks.bypass perk permissions)
|
||||
|
||||
NOTE: Sorry about that, when trying to improve Bungee Cord compatibility I made a big oopsie!
|
||||
NOTE: Repair's new perk permission works in the exact same way as mcmmo.bypass.arcanebypass, bypass perk permissions will all eventually be moved to `mcmmo.perks.bypass`
|
||||
NOTE: Expect perk permissions to all be moved to `mcmmo.perks.X` in the near future
|
||||
|
||||
Version 2.1.41
|
||||
Fixed NullPointerException errors when trying to grab PlayerProfiles for players who have not loaded
|
||||
|
@ -86,7 +86,7 @@ public class RepairCommand extends SkillCommand {
|
||||
canRepairString = Permissions.repairMaterialType(player, MaterialType.STRING);
|
||||
canRepairLeather = Permissions.repairMaterialType(player, MaterialType.LEATHER);
|
||||
canRepairWood = Permissions.repairMaterialType(player, MaterialType.WOOD);
|
||||
arcaneBypass = Permissions.arcaneBypass(player);
|
||||
arcaneBypass = (Permissions.arcaneBypass(player) || Permissions.hasRepairEnchantBypassPerk(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,7 +139,7 @@ public class RepairManager extends SkillManager {
|
||||
}
|
||||
|
||||
// Handle the enchants
|
||||
if (ArcaneForging.arcaneForgingEnchantLoss) {
|
||||
if (ArcaneForging.arcaneForgingEnchantLoss && !Permissions.hasRepairEnchantBypassPerk(player)) {
|
||||
addEnchants(item);
|
||||
}
|
||||
|
||||
|
@ -182,6 +182,9 @@ public class SalvageManager extends SkillManager {
|
||||
}*/
|
||||
|
||||
public double getExtractFullEnchantChance() {
|
||||
if(Permissions.hasSalvageEnchantBypassPerk(getPlayer()))
|
||||
return 100.0D;
|
||||
|
||||
return AdvancedConfig.getInstance().getArcaneSalvageExtractFullEnchantsChance(getArcaneSalvageRank());
|
||||
}
|
||||
|
||||
@ -205,6 +208,7 @@ public class SalvageManager extends SkillManager {
|
||||
|
||||
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
||||
if (!Salvage.arcaneSalvageEnchantLoss
|
||||
|| Permissions.hasSalvageEnchantBypassPerk(player)
|
||||
|| RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getExtractFullEnchantChance(), getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE))) {
|
||||
enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue(), true);
|
||||
}
|
||||
|
@ -106,6 +106,11 @@ public final class Permissions {
|
||||
* PERKS
|
||||
*/
|
||||
|
||||
/* BYPASS PERKS */
|
||||
|
||||
public static boolean hasRepairEnchantBypassPerk(Permissible permissible) { return permissible.hasPermission("mcmmo.perks.bypass.repairenchant"); }
|
||||
public static boolean hasSalvageEnchantBypassPerk(Permissible permissible) { return permissible.hasPermission("mcmmo.perks.bypass.salvageenchant"); }
|
||||
|
||||
public static boolean lucky(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.lucky." + skill.toString().toLowerCase()); }
|
||||
|
||||
/* XP PERKS */
|
||||
|
@ -1328,6 +1328,8 @@ permissions:
|
||||
default: false
|
||||
description: implies access to all mcmmo perks
|
||||
children:
|
||||
mcmmo.perks.bypass.salvageenchant: true
|
||||
mcmmo.perks.bypass.repairenchant: true
|
||||
mcmmo.perks.activationtime.all: true
|
||||
mcmmo.perks.cooldowns.all: true
|
||||
mcmmo.perks.lucky.all: true
|
||||
@ -1344,6 +1346,23 @@ permissions:
|
||||
mcmmo.perks.activationtime.eightseconds: true
|
||||
mcmmo.perks.activationtime.fourseconds: true
|
||||
mcmmo.perks.activationtime.twelveseconds: true
|
||||
mcmmo.perks.bypass.*:
|
||||
default: false
|
||||
description: Perks that bypass certain RNG elements and guarantee success
|
||||
children:
|
||||
mcmmo.perks.bypass.all: true
|
||||
mcmmo.perks.bypass.all:
|
||||
default: false
|
||||
description: Perks that bypass certain RNG elements and guarantee success
|
||||
children:
|
||||
mcmmo.perks.bypass.repairenchant: true
|
||||
mcmmo.perks.bypass.salvageenchant: true
|
||||
mcmmo.perks.bypass.repairenchant:
|
||||
default: false
|
||||
description: Guarantees repairing without enchantment degradation
|
||||
mcmmo.perks.bypass.salvageenchant:
|
||||
default: false
|
||||
description: Guarantees salvage will return the best legal enchantment book
|
||||
mcmmo.perks.activationtime.eightseconds:
|
||||
default: false
|
||||
description: Increases activation time by 8 seconds
|
||||
|
Loading…
Reference in New Issue
Block a user