mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-02 04:25:26 +02:00
Code Cleanup Pt 2
This commit is contained in:
@@ -16,7 +16,7 @@ import java.util.Set;
|
||||
|
||||
public final class Fishing {
|
||||
|
||||
protected static final HashMap<Material, List<Enchantment>> ENCHANTABLE_CACHE = new HashMap<Material, List<Enchantment>>();
|
||||
protected static final HashMap<Material, List<Enchantment>> ENCHANTABLE_CACHE = new HashMap<>();
|
||||
|
||||
/*public static int fishermansDietRankLevel1 = AdvancedConfig.getInstance().getFishermanDietRankChange();
|
||||
public static int fishermansDietRankLevel2 = fishermansDietRankLevel1 * 2;
|
||||
|
@@ -53,7 +53,6 @@ public class FishingManager extends SkillManager {
|
||||
private long lastWarned = 0L;
|
||||
private long lastWarnedExhaust = 0L;
|
||||
private BoundingBox lastFishingBoundingBox;
|
||||
private Item fishingCatch;
|
||||
private Location hookLocation;
|
||||
private int fishCaughtCounter = 1;
|
||||
private final float boundingBoxSize;
|
||||
@@ -87,7 +86,7 @@ public class FishingManager extends SkillManager {
|
||||
getPlayer().getInventory().getItemInMainHand().setDurability((short) (getPlayer().getInventory().getItemInMainHand().getDurability() + 5));
|
||||
getPlayer().updateInventory();
|
||||
|
||||
if(lastWarnedExhaust + (1000 * 1) < currentTime)
|
||||
if(lastWarnedExhaust + (1000) < currentTime)
|
||||
{
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Exhausting"));
|
||||
lastWarnedExhaust = currentTime;
|
||||
@@ -114,7 +113,7 @@ public class FishingManager extends SkillManager {
|
||||
long fishHookSpawnCD = fishHookSpawnTimestamp + 1000;
|
||||
boolean hasFished = (currentTime < fishHookSpawnCD);
|
||||
|
||||
if(hasFished && (lastWarned + (1000 * 1) < currentTime))
|
||||
if(hasFished && (lastWarned + (1000) < currentTime))
|
||||
{
|
||||
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scared"));
|
||||
lastWarned = System.currentTimeMillis();
|
||||
@@ -286,7 +285,6 @@ public class FishingManager extends SkillManager {
|
||||
* @param fishingCatch The {@link Item} initially caught
|
||||
*/
|
||||
public void handleFishing(Item fishingCatch) {
|
||||
this.fishingCatch = fishingCatch;
|
||||
int fishXp = ExperienceConfig.getInstance().getXp(PrimarySkillType.FISHING, fishingCatch.getItemStack().getType());
|
||||
int treasureXp = 0;
|
||||
Player player = getPlayer();
|
||||
@@ -294,12 +292,11 @@ public class FishingManager extends SkillManager {
|
||||
|
||||
if (MainConfig.getInstance().getFishingDropsEnabled() && Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_TREASURE_HUNTER)) {
|
||||
treasure = getFishingTreasure();
|
||||
this.fishingCatch = null;
|
||||
}
|
||||
|
||||
if (treasure != null) {
|
||||
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
|
||||
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
||||
Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||
|
||||
if (isMagicHunterEnabled()
|
||||
&& ItemUtils.isEnchantable(treasureDrop)) {
|
||||
@@ -517,7 +514,7 @@ public class FishingManager extends SkillManager {
|
||||
* @return true if the item has been enchanted
|
||||
*/
|
||||
private Map<Enchantment, Integer> handleMagicHunter(ItemStack treasureDrop) {
|
||||
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
||||
Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||
List<EnchantmentTreasure> fishingEnchantments = null;
|
||||
|
||||
double diceRoll = Misc.getRandom().nextDouble() * 100;
|
||||
@@ -547,7 +544,7 @@ public class FishingManager extends SkillManager {
|
||||
}
|
||||
|
||||
List<Enchantment> validEnchantments = getPossibleEnchantments(treasureDrop);
|
||||
List<EnchantmentTreasure> possibleEnchants = new ArrayList<EnchantmentTreasure>();
|
||||
List<EnchantmentTreasure> possibleEnchants = new ArrayList<>();
|
||||
|
||||
for (EnchantmentTreasure enchantmentTreasure : fishingEnchantments) {
|
||||
if (validEnchantments.contains(enchantmentTreasure.getEnchantment())) {
|
||||
@@ -586,7 +583,7 @@ public class FishingManager extends SkillManager {
|
||||
return Fishing.ENCHANTABLE_CACHE.get(dropType);
|
||||
}
|
||||
|
||||
List<Enchantment> possibleEnchantments = new ArrayList<Enchantment>();
|
||||
List<Enchantment> possibleEnchantments = new ArrayList<>();
|
||||
|
||||
for (Enchantment enchantment : Enchantment.values()) {
|
||||
if (enchantment.canEnchantItem(treasureDrop)) {
|
||||
|
Reference in New Issue
Block a user