mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Fix repair command
This commit is contained in:
parent
278efc8e37
commit
43ca43cc48
@ -1,7 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -27,19 +25,19 @@ public class RepairCommand extends SkillCommand {
|
|||||||
private boolean canSuperRepair;
|
private boolean canSuperRepair;
|
||||||
private boolean canMasterRepair;
|
private boolean canMasterRepair;
|
||||||
private boolean canArcaneForge;
|
private boolean canArcaneForge;
|
||||||
private boolean canRepairStone;
|
// private boolean canRepairStone;
|
||||||
private boolean canRepairIron;
|
// private boolean canRepairIron;
|
||||||
private boolean canRepairGold;
|
// private boolean canRepairGold;
|
||||||
private boolean canRepairDiamond;
|
// private boolean canRepairDiamond;
|
||||||
private boolean canRepairString;
|
// private boolean canRepairString;
|
||||||
private boolean canRepairLeather;
|
// private boolean canRepairLeather;
|
||||||
private boolean canRepairWood;
|
// private boolean canRepairWood;
|
||||||
private boolean arcaneBypass;
|
private boolean arcaneBypass;
|
||||||
|
|
||||||
private int diamondLevel;
|
// private int diamondLevel;
|
||||||
private int goldLevel;
|
// private int goldLevel;
|
||||||
private int ironLevel;
|
// private int ironLevel;
|
||||||
private int stoneLevel;
|
// private int stoneLevel;
|
||||||
|
|
||||||
public RepairCommand() {
|
public RepairCommand() {
|
||||||
super(PrimarySkillType.REPAIR);
|
super(PrimarySkillType.REPAIR);
|
||||||
@ -54,14 +52,17 @@ public class RepairCommand extends SkillCommand {
|
|||||||
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
|
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
|
||||||
|
|
||||||
// TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0
|
// TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0
|
||||||
diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
|
// diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
|
||||||
goldLevel = (goldRepairable == null) ? 0 : goldRepairable.getMinimumLevel();
|
// goldLevel = (goldRepairable == null) ? 0 : goldRepairable.getMinimumLevel();
|
||||||
ironLevel = (ironRepairable == null) ? 0 : ironRepairable.getMinimumLevel();
|
// ironLevel = (ironRepairable == null) ? 0 : ironRepairable.getMinimumLevel();
|
||||||
stoneLevel = (stoneRepairable == null) ? 0 : stoneRepairable.getMinimumLevel();
|
// stoneLevel = (stoneRepairable == null) ? 0 : stoneRepairable.getMinimumLevel();
|
||||||
|
|
||||||
// REPAIR MASTERY
|
// REPAIR MASTERY
|
||||||
if (canMasterRepair) {
|
if (canMasterRepair) {
|
||||||
repairMasteryBonus = percent.format(Math.min(((AdvancedConfig.getInstance().getRepairMasteryMaxBonus() / AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.REPAIR_REPAIR_MASTERY)) * skillValue), AdvancedConfig.getInstance().getRepairMasteryMaxBonus()) / 100D);
|
double maxBonus = mcMMO.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonus(SubSkillType.REPAIR_REPAIR_MASTERY);
|
||||||
|
int maxBonusLevel = mcMMO.getDynamicSettingsManager().getSkillPropertiesManager().getMaxBonusLevel(SubSkillType.REPAIR_REPAIR_MASTERY);
|
||||||
|
|
||||||
|
repairMasteryBonus = percent.format(Math.min(((maxBonus / maxBonusLevel) * skillValue), maxBonus) / 100D);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SUPER REPAIR
|
// SUPER REPAIR
|
||||||
@ -77,13 +78,13 @@ public class RepairCommand extends SkillCommand {
|
|||||||
canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR);
|
canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||||
canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
|
canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
|
||||||
canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING);
|
canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING);
|
||||||
canRepairDiamond = Permissions.repairMaterialType(player, ItemMaterialCategory.DIAMOND);
|
// canRepairDiamond = Permissions.repairMaterialType(player, ItemMaterialCategory.DIAMOND);
|
||||||
canRepairGold = Permissions.repairMaterialType(player, ItemMaterialCategory.GOLD);
|
// canRepairGold = Permissions.repairMaterialType(player, ItemMaterialCategory.GOLD);
|
||||||
canRepairIron = Permissions.repairMaterialType(player, ItemMaterialCategory.IRON);
|
// canRepairIron = Permissions.repairMaterialType(player, ItemMaterialCategory.IRON);
|
||||||
canRepairStone = Permissions.repairMaterialType(player, ItemMaterialCategory.STONE);
|
// canRepairStone = Permissions.repairMaterialType(player, ItemMaterialCategory.STONE);
|
||||||
canRepairString = Permissions.repairMaterialType(player, ItemMaterialCategory.STRING);
|
// canRepairString = Permissions.repairMaterialType(player, ItemMaterialCategory.STRING);
|
||||||
canRepairLeather = Permissions.repairMaterialType(player, ItemMaterialCategory.LEATHER);
|
// canRepairLeather = Permissions.repairMaterialType(player, ItemMaterialCategory.LEATHER);
|
||||||
canRepairWood = Permissions.repairMaterialType(player, ItemMaterialCategory.WOOD);
|
// canRepairWood = Permissions.repairMaterialType(player, ItemMaterialCategory.WOOD);
|
||||||
arcaneBypass = (Permissions.arcaneBypass(player) || Permissions.hasRepairEnchantBypassPerk(player));
|
arcaneBypass = (Permissions.arcaneBypass(player) || Permissions.hasRepairEnchantBypassPerk(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
double skillValue = mcMMOPlayer.getSkillLevel(skill);
|
double skillValue = mcMMOPlayer.getSkillLevel(skill);
|
||||||
|
|
||||||
//Send the players a few blank lines to make finding the top of the skill command easier
|
//Send the players a few blank lines to make finding the top of the skill command easier
|
||||||
if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
|
if (mcMMO.getConfigManager().getConfigCommands().isSendBlankLines())
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
player.sendMessage("");
|
player.sendMessage("");
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@ public class ConfigCommands {
|
|||||||
@Setting(value = "Inspect", comment = "Settings related to the inspect command.")
|
@Setting(value = "Inspect", comment = "Settings related to the inspect command.")
|
||||||
private ConfigCommandsInspect inspect = new ConfigCommandsInspect();
|
private ConfigCommandsInspect inspect = new ConfigCommandsInspect();
|
||||||
|
|
||||||
|
@Setting(value = "Skills", comment = "Settings related to skill commands like /mining or /herbalism")
|
||||||
|
private ConfigCommandsSkills skills = new ConfigCommandsSkills();
|
||||||
|
|
||||||
public ConfigCommandsAdminChat getAdminChat() {
|
public ConfigCommandsAdminChat getAdminChat() {
|
||||||
return adminChat;
|
return adminChat;
|
||||||
}
|
}
|
||||||
@ -39,4 +42,12 @@ public class ConfigCommands {
|
|||||||
public boolean isAllowInspectOnOfflinePlayers() {
|
public boolean isAllowInspectOnOfflinePlayers() {
|
||||||
return getInspect().isAllowInspectOnOfflinePlayers();
|
return getInspect().isAllowInspectOnOfflinePlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConfigCommandsSkills getSkills() {
|
||||||
|
return skills;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSendBlankLines() {
|
||||||
|
return skills.isSendBlankLines();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.gmail.nossr50.config.hocon.commands;
|
||||||
|
|
||||||
|
import ninja.leaping.configurate.objectmapping.Setting;
|
||||||
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
|
@ConfigSerializable
|
||||||
|
public class ConfigCommandsSkills {
|
||||||
|
|
||||||
|
private static final boolean SEND_BLANK_LINES_DEFAULT = true;
|
||||||
|
|
||||||
|
@Setting(value = "Send-Blank-Lines", comment = "If set to true, mcMMO will send a few blank lines when players use skill commands to make them more readable.")
|
||||||
|
private boolean sendBlankLines = SEND_BLANK_LINES_DEFAULT;
|
||||||
|
|
||||||
|
public boolean isSendBlankLines() {
|
||||||
|
return sendBlankLines;
|
||||||
|
}
|
||||||
|
}
|
@ -57,7 +57,7 @@ public class SkillPropertiesManager {
|
|||||||
return maxBonusMap.get(subSkillType);
|
return maxBonusMap.get(subSkillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMaxBonusLevel(SubSkillType subSkillType) {
|
public int getMaxBonusLevel(SubSkillType subSkillType) {
|
||||||
return maxBonusLevelMap.get(subSkillType);
|
return maxBonusLevelMap.get(subSkillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user