mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-03 13:05:30 +02:00
Update code style
This commit is contained in:
@@ -13,8 +13,7 @@ public class Repair {
|
||||
anvilMaterial = mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().getRepairAnvilMaterial();
|
||||
|
||||
//TODO: Replace this horrid shit
|
||||
if(mcMMO.isRetroModeEnabled())
|
||||
{
|
||||
if (mcMMO.isRetroModeEnabled()) {
|
||||
repairMasteryMaxBonus = mcMMO.getConfigManager().getConfigRepair().getRepairSubSkills().getRepairMastery().getSettings().getRetro().getMaxBonusPercentage();
|
||||
repairMasteryMaxBonusLevel = mcMMO.getConfigManager().getConfigRepair().getRepairSubSkills().getRepairMastery().getSettings().getRetro().getMaxBonusLevel();
|
||||
} else {
|
||||
@@ -23,9 +22,8 @@ public class Repair {
|
||||
}
|
||||
}
|
||||
|
||||
public static Repair getInstance()
|
||||
{
|
||||
if(instance == null)
|
||||
public static Repair getInstance() {
|
||||
if (instance == null)
|
||||
instance = new Repair();
|
||||
|
||||
return instance;
|
||||
|
@@ -34,7 +34,7 @@ import java.util.Map.Entry;
|
||||
|
||||
public class RepairManager extends SkillManager {
|
||||
private boolean placedAnvil;
|
||||
private int lastClick;
|
||||
private int lastClick;
|
||||
|
||||
public RepairManager(McMMOPlayer mcMMOPlayer) {
|
||||
super(mcMMOPlayer, PrimarySkillType.REPAIR);
|
||||
@@ -62,7 +62,6 @@ public class RepairManager extends SkillManager {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void handleRepair(ItemStack item) {
|
||||
Player player = getPlayer();
|
||||
Repairable repairable = mcMMO.getRepairableManager().getRepairable(item.getType());
|
||||
@@ -97,14 +96,10 @@ public class RepairManager extends SkillManager {
|
||||
boolean foundNonBasicMaterial = false;
|
||||
|
||||
//Find the first compatible repair material
|
||||
for(Material repairMaterialCandidate : repairable.getRepairMaterials())
|
||||
{
|
||||
for(ItemStack is : player.getInventory().getContents())
|
||||
{
|
||||
if(is.getType() == repairMaterialCandidate)
|
||||
{
|
||||
if(is.getItemMeta().getLore().isEmpty())
|
||||
{
|
||||
for (Material repairMaterialCandidate : repairable.getRepairMaterials()) {
|
||||
for (ItemStack is : player.getInventory().getContents()) {
|
||||
if (is.getType() == repairMaterialCandidate) {
|
||||
if (is.getItemMeta().getLore().isEmpty()) {
|
||||
repairMaterial = repairMaterialCandidate;
|
||||
break;
|
||||
} else {
|
||||
@@ -115,8 +110,7 @@ public class RepairManager extends SkillManager {
|
||||
}
|
||||
|
||||
/* Abort the repair if no compatible basic repairing item found */
|
||||
if(repairMaterial == null && foundNonBasicMaterial == true)
|
||||
{
|
||||
if (repairMaterial == null && foundNonBasicMaterial == true) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.NoBasicRepairMatsFound"));
|
||||
return;
|
||||
}
|
||||
@@ -286,7 +280,7 @@ public class RepairManager extends SkillManager {
|
||||
/**
|
||||
* Computes repair bonuses.
|
||||
*
|
||||
* @param durability The durability of the item being repaired
|
||||
* @param durability The durability of the item being repaired
|
||||
* @param repairAmount The base amount of durability repaired to the item
|
||||
* @return The final amount of durability repaired to the item
|
||||
*/
|
||||
@@ -320,7 +314,7 @@ public class RepairManager extends SkillManager {
|
||||
* @return true if bonus granted, false otherwise
|
||||
*/
|
||||
private boolean checkPlayerProcRepair() {
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_SUPER_REPAIR))
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.REPAIR_SUPER_REPAIR))
|
||||
return false;
|
||||
|
||||
if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.REPAIR_SUPER_REPAIR, getPlayer())) {
|
||||
@@ -372,8 +366,7 @@ public class RepairManager extends SkillManager {
|
||||
item.addUnsafeEnchantment(enchantment, enchantLevel - 1);
|
||||
downgraded = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
item.removeEnchantment(enchantment);
|
||||
}
|
||||
}
|
||||
@@ -382,11 +375,9 @@ public class RepairManager extends SkillManager {
|
||||
|
||||
if (newEnchants.isEmpty()) {
|
||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE_FAILED, "Repair.Arcane.Fail");
|
||||
}
|
||||
else if (downgraded || newEnchants.size() < enchants.size()) {
|
||||
} else if (downgraded || newEnchants.size() < enchants.size()) {
|
||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE_FAILED, "Repair.Arcane.Downgrade");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Repair.Arcane.Perfect");
|
||||
}
|
||||
}
|
||||
|
@@ -10,16 +10,16 @@ import java.util.List;
|
||||
public class RepairableManager implements Unload {
|
||||
private HashMap<Material, Repairable> repairables;
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
repairables.clear();
|
||||
}
|
||||
|
||||
public RepairableManager(List<Repairable> repairablesCollection) {
|
||||
this.repairables = new HashMap<>(repairablesCollection.size());
|
||||
registerRepairables(repairablesCollection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
repairables.clear();
|
||||
}
|
||||
|
||||
public void registerRepairable(Repairable repairable) {
|
||||
Material item = repairable.getItemMaterial();
|
||||
repairables.put(item, repairable);
|
||||
|
Reference in New Issue
Block a user