Misc code fixes

This commit is contained in:
nossr50
2020-07-13 11:39:03 -07:00
parent 428c093ae4
commit 7eae59a0b3
153 changed files with 1139 additions and 1474 deletions

View File

@ -32,9 +32,9 @@ public class AcrobaticsManager extends SkillManager {
}
private long rollXPCooldown = 0;
private long rollXPInterval = (1000 * 3); //1 Minute
private final long rollXPInterval = (1000 * 3); //1 Minute
private long rollXPIntervalLengthen = (1000 * 10); //10 Seconds
private LimitedSizeList fallLocationMap;
private final LimitedSizeList fallLocationMap;
public boolean hasFallenInLocationBefore(Location location)
{

View File

@ -64,9 +64,7 @@ public final class Alchemy {
public static void finishAllBrews() {
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
List<AlchemyBrewTask> toFinish = new ArrayList<AlchemyBrewTask>();
toFinish.addAll(brewingStandMap.values());
List<AlchemyBrewTask> toFinish = new ArrayList<AlchemyBrewTask>(brewingStandMap.values());
for (AlchemyBrewTask alchemyBrewTask : toFinish) {
alchemyBrewTask.finishImmediately();

View File

@ -15,7 +15,7 @@ import java.util.Iterator;
import java.util.List;
public class Archery {
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
private static final List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();

View File

@ -7,8 +7,8 @@ import org.bukkit.scheduler.BukkitRunnable;
import java.util.UUID;
public class TrackedEntity extends BukkitRunnable {
private LivingEntity livingEntity;
private UUID id;
private final LivingEntity livingEntity;
private final UUID id;
private int arrowCount;
protected TrackedEntity(LivingEntity livingEntity) {

View File

@ -8,7 +8,7 @@ import java.util.HashMap;
import java.util.Set;
public class FamilyTree {
private static HashMap<PrimarySkillType, Set<PrimarySkillType>> tree = new HashMap<PrimarySkillType, Set<PrimarySkillType>>();
private static final HashMap<PrimarySkillType, Set<PrimarySkillType>> tree = new HashMap<PrimarySkillType, Set<PrimarySkillType>>();
public static Set<PrimarySkillType> getParents(PrimarySkillType childSkill) {
enforceChildSkill(childSkill);

View File

@ -12,35 +12,35 @@ public interface Repairable {
*
* @return the type of this repairable
*/
public Material getItemMaterial();
Material getItemMaterial();
/**
* Gets the id of the material used to repair this item
*
* @return the id of the repair material
*/
public Material getRepairMaterial();
Material getRepairMaterial();
/**
* Gets the pretty name of the material used to repair this item
*
* @return the pretty name of the repair material
*/
public String getRepairMaterialPrettyName();
String getRepairMaterialPrettyName();
/**
* Gets the RepairItemType value for this repairable item
*
* @return the RepairItemType for this repairable
*/
public ItemType getRepairItemType();
ItemType getRepairItemType();
/**
* Gets the RepairMaterialType value for this repairable item
*
* @return the RepairMaterialType for this repairable
*/
public MaterialType getRepairMaterialType();
MaterialType getRepairMaterialType();
/**
* Gets the minimum quantity of repair materials ignoring all other repair bonuses
@ -49,14 +49,14 @@ public interface Repairable {
*
* @return the minimum number of items
*/
public int getMinimumQuantity();
int getMinimumQuantity();
/**
* Gets the maximum durability of this item before it breaks
*
* @return the maximum durability
*/
public short getMaximumDurability();
short getMaximumDurability();
/**
* Gets the base repair durability on which to calculate bonuses.
@ -65,19 +65,19 @@ public interface Repairable {
*
* @return the base repair durability
*/
public short getBaseRepairDurability(ItemStack itemStack);
short getBaseRepairDurability(ItemStack itemStack);
/**
* 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();
int getMinimumLevel();
/**
* Gets the xpMultiplier for this repairable
*
* @return the xpMultiplier of this repairable
*/
public double getXpMultiplier();
double getXpMultiplier();
}

View File

@ -11,14 +11,14 @@ public interface RepairableManager {
*
* @param repairable Repairable to register
*/
public void registerRepairable(Repairable repairable);
void registerRepairable(Repairable repairable);
/**
* Register a list of repairables with the RepairManager
*
* @param repairables List<Repairable> to register
*/
public void registerRepairables(List<Repairable> repairables);
void registerRepairables(List<Repairable> repairables);
/**
* Checks if an item is repairable
@ -27,7 +27,7 @@ public interface RepairableManager {
*
* @return true if repairable, false if not
*/
public boolean isRepairable(Material type);
boolean isRepairable(Material type);
/**
* Checks if an item is repairable
@ -36,7 +36,7 @@ public interface RepairableManager {
*
* @return true if repairable, false if not
*/
public boolean isRepairable(ItemStack itemStack);
boolean isRepairable(ItemStack itemStack);
/**
* Gets the repairable with this type
@ -45,5 +45,5 @@ public interface RepairableManager {
*
* @return the repairable, can be null
*/
public Repairable getRepairable(Material type);
Repairable getRepairable(Material type);
}

View File

@ -11,7 +11,7 @@ public class SimpleRepairable implements Repairable {
private final Material itemMaterial, repairMaterial;
private final int minimumLevel;
private final short maximumDurability;
private String repairMaterialPrettyName;
private final String repairMaterialPrettyName;
private final ItemType repairItemType;
private final MaterialType repairMaterialType;
private final double xpMultiplier;

View File

@ -7,7 +7,7 @@ import java.util.HashMap;
import java.util.List;
public class SimpleRepairableManager implements RepairableManager {
private HashMap<Material, Repairable> repairables;
private final HashMap<Material, Repairable> repairables;
public SimpleRepairableManager() {
this(55);

View File

@ -10,28 +10,28 @@ public interface Salvageable {
*
* @return the type of this salvageable
*/
public Material getItemMaterial();
Material getItemMaterial();
/**
* Gets the material of the items dropped when salvaging this item
*
* @return the material of the salvage drop
*/
public Material getSalvageMaterial();
Material getSalvageMaterial();
/**
* Gets the ItemType value for this salvageable item
*
* @return the ItemType for this salvageable
*/
public ItemType getSalvageItemType();
ItemType getSalvageItemType();
/**
* Gets the MaterialType value for this salvageable item
*
* @return the MaterialType for this salvageable
*/
public MaterialType getSalvageMaterialType();
MaterialType getSalvageMaterialType();
/**
* Gets the maximum quantity of salvage materials ignoring all other salvage bonuses
@ -40,14 +40,14 @@ public interface Salvageable {
*
* @return the maximum number of items
*/
public int getMaximumQuantity();
int getMaximumQuantity();
/**
* Gets the maximum durability of this item before it breaks
*
* @return the maximum durability
*/
public short getMaximumDurability();
short getMaximumDurability();
/**
* Gets the base salvage durability on which to calculate bonuses.
@ -56,19 +56,19 @@ public interface Salvageable {
*
* @return the base salvage durability
*/
public short getBaseSalvageDurability();
short getBaseSalvageDurability();
/**
* Gets the minimum salvage level needed to salvage this item
*
* @return the minimum level to salvage this item, or 0 for no minimum
*/
public int getMinimumLevel();
int getMinimumLevel();
/**
* Gets the xpMultiplier for this salvageable
*
* @return the xpMultiplier of this salvageable
*/
public double getXpMultiplier();
double getXpMultiplier();
}

View File

@ -11,14 +11,14 @@ public interface SalvageableManager {
*
* @param salvageable Salvageable to register
*/
public void registerSalvageable(Salvageable salvageable);
void registerSalvageable(Salvageable salvageable);
/**
* Register a list of salvageables with the SalvageManager
*
* @param salvageables List<Salvageable> to register
*/
public void registerSalvageables(List<Salvageable> salvageables);
void registerSalvageables(List<Salvageable> salvageables);
/**
* Checks if an item is salvageable
@ -27,7 +27,7 @@ public interface SalvageableManager {
*
* @return true if salvageable, false if not
*/
public boolean isSalvageable(Material type);
boolean isSalvageable(Material type);
/**
* Checks if an item is salvageable
@ -36,7 +36,7 @@ public interface SalvageableManager {
*
* @return true if salvageable, false if not
*/
public boolean isSalvageable(ItemStack itemStack);
boolean isSalvageable(ItemStack itemStack);
/**
* Gets the salvageable with this type
@ -45,5 +45,5 @@ public interface SalvageableManager {
*
* @return the salvageable, can be null
*/
public Salvageable getSalvageable(Material type);
Salvageable getSalvageable(Material type);
}

View File

@ -8,7 +8,7 @@ import java.util.List;
public class SimpleSalvageableManager implements SalvageableManager {
private HashMap<Material, Salvageable> salvageables;
private final HashMap<Material, Salvageable> salvageables;
public SimpleSalvageableManager() {
this(55);

View File

@ -13,9 +13,9 @@ import org.bukkit.scheduler.BukkitRunnable;
import java.util.UUID;
public class TrackedTamingEntity extends BukkitRunnable {
private LivingEntity livingEntity;
private final LivingEntity livingEntity;
private final CallOfTheWildType callOfTheWildType;
private UUID id;
private final UUID id;
private int length;
private final TamingManager tamingManagerRef;