Second Smelt makes use of its own section in Bonus Drops in config.yml

Co-authored-by: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
nossr50
2020-07-13 12:31:30 -07:00
parent 7eae59a0b3
commit fdd951f1f1
176 changed files with 642 additions and 604 deletions

View File

@ -54,7 +54,7 @@ public final class Alchemy {
public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed();
public static double catalysisMaxSpeed = AdvancedConfig.getInstance().getCatalysisMaxSpeed();
public static Map<Location, AlchemyBrewTask> brewingStandMap = new HashMap<Location, AlchemyBrewTask>();
public static Map<Location, AlchemyBrewTask> brewingStandMap = new HashMap<>();
private Alchemy() {}
@ -64,7 +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>(brewingStandMap.values());
List<AlchemyBrewTask> toFinish = new ArrayList<>(brewingStandMap.values());
for (AlchemyBrewTask alchemyBrewTask : toFinish) {
alchemyBrewTask.finishImmediately();

View File

@ -56,19 +56,19 @@ public final class AlchemyPotionBrewer {
}
private static void removeIngredient(BrewerInventory inventory, Player player) {
ItemStack ingredient = inventory.getIngredient() == null ? null : inventory.getIngredient().clone();
if(inventory.getIngredient() == null)
return;
if (isEmpty(ingredient) || !isValidIngredient(player, ingredient)) {
return;
}
else if (ingredient.getAmount() <= 1) {
inventory.setIngredient(null);
return;
}
else {
ingredient.setAmount(ingredient.getAmount() - 1);
inventory.setIngredient(ingredient);
return;
ItemStack ingredient = inventory.getIngredient().clone();
if (isEmpty(ingredient) && !isValidIngredient(player, ingredient)) {
if (ingredient.getAmount() <= 1) {
inventory.setIngredient(null);
}
else {
ingredient.setAmount(ingredient.getAmount() - 1);
inventory.setIngredient(ingredient);
}
}
}
@ -113,7 +113,7 @@ public final class AlchemyPotionBrewer {
return;
}
List<AlchemyPotion> inputList = new ArrayList<AlchemyPotion>();
List<AlchemyPotion> inputList = new ArrayList<>();
for (int i = 0; i < 3; i++) {
ItemStack item = inventory.getItem(i);

View File

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

View File

@ -23,8 +23,11 @@ public class Axes {
public static double skullSplitterModifier = AdvancedConfig.getInstance().getSkullSplitterModifier();
protected static boolean hasArmor(LivingEntity target) {
if(target.getEquipment() == null)
return false;
for (ItemStack itemStack : target.getEquipment().getArmorContents()) {
if (itemStack != null && ItemUtils.isArmor(itemStack)) {
if (ItemUtils.isArmor(itemStack)) {
return true;
}
}

View File

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

View File

@ -22,7 +22,7 @@ public class Excavation {
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
if (TreasureConfig.getInstance().excavationMap.containsKey(friendly))
return TreasureConfig.getInstance().excavationMap.get(friendly);
return new ArrayList<ExcavationTreasure>();
return new ArrayList<>();
}
protected static int getBlockXP(BlockState blockState) {

View File

@ -61,7 +61,7 @@ public class ExcavationManager extends SkillManager {
}
public int getExperienceOrbsReward() {
return 1 * getArchaeologyRank();
return getArchaeologyRank();
}
public double getArchaelogyExperienceOrbChance() {

View File

@ -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 Set<Biome> masterAnglerBiomes = BiomeAdapter.WATER_BIOMES;
public static Set<Biome> iceFishingBiomes = BiomeAdapter.ICE_BIOMES;

View File

@ -89,7 +89,7 @@ public class FishingManager extends SkillManager {
fishingRod.setDurability((short) (fishingRod.getDurability() + 5));
getPlayer().updateInventory();
if(lastWarnedExhaust + (1000 * 1) < currentTime)
if(lastWarnedExhaust + (1000) < currentTime)
{
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Exhausting"));
lastWarnedExhaust = currentTime;
@ -118,7 +118,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 +286,7 @@ public class FishingManager extends SkillManager {
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)) {
@ -505,7 +505,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;
@ -535,7 +535,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())) {
@ -574,7 +574,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)) {

View File

@ -701,7 +701,7 @@ public class HerbalismManager extends SkillManager {
Player player = getPlayer();
PlayerInventory playerInventory = player.getInventory();
Material seed = null;
Material seed;
switch (blockState.getType()) {
case CARROTS:
@ -761,7 +761,7 @@ public class HerbalismManager extends SkillManager {
return false;
}
int finalAge = 0;
int finalAge;
int greenThumbStage = getGreenThumbStage(greenTerra);
//Immature plants will start over at 0

View File

@ -99,7 +99,7 @@ public class BlastMining {
// We can make this assumption because we (should) be the only ones using this exact metadata
Player player = mcMMO.p.getServer().getPlayerExact(tnt.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
if (!player.equals(defender)) {
if (!(player != null && player.equals(defender))) {
return false;
}

View File

@ -159,7 +159,7 @@ public class MiningManager extends SkillManager {
public void blastMiningDropProcessing(float yield, EntityExplodeEvent event) {
//Strip out only stuff that gives mining XP
List<BlockState> ores = new ArrayList<BlockState>();
List<BlockState> ores = new ArrayList<>();
List<BlockState> notOres = new ArrayList<>();
for (Block targetBlock : event.blockList()) {

View File

@ -214,10 +214,10 @@ public class RepairManager extends SkillManager {
return AdvancedConfig.getInstance().getArcaneForgingDowngradeChance(getArcaneForgingRank());
}
/**
* Gets chance of keeping enchantment during repair.
*
* @return The chance of keeping the enchantment
/*
Gets chance of keeping enchantment during repair.
@return The chance of keeping the enchantment
*/
/*public double getKeepEnchantChance() {
int skillLevel = getSkillLevel();
@ -231,10 +231,10 @@ public class RepairManager extends SkillManager {
return 0;
}*/
/**
* Gets chance of enchantment being downgraded during repair.
*
* @return The chance of the enchantment being downgraded
/*
Gets chance of enchantment being downgraded during repair.
@return The chance of the enchantment being downgraded
*/
/*public double getDowngradeEnchantChance() {
int skillLevel = getSkillLevel();

View File

@ -14,7 +14,7 @@ public class SimpleRepairableManager implements RepairableManager {
}
public SimpleRepairableManager(int repairablesSize) {
this.repairables = new HashMap<Material, Repairable>(repairablesSize);
this.repairables = new HashMap<>(repairablesSize);
}
@Override

View File

@ -15,7 +15,7 @@ public class SimpleSalvageableManager implements SalvageableManager {
}
public SimpleSalvageableManager(int salvageablesSize) {
this.salvageables = new HashMap<Material, Salvageable>(salvageablesSize);
this.salvageables = new HashMap<>(salvageablesSize);
}
@Override

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.skills.smelting;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.experience.XPGainSource;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@ -10,7 +11,6 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType;
import org.bukkit.block.BlockState;
import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.inventory.ItemStack;
@ -31,10 +31,10 @@ public class SmeltingManager extends SkillManager {
&& RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.SMELTING_SECOND_SMELT, getPlayer());
}
/**
* Process the Flux Mining ability.
*
* @param blockState The {@link BlockState} to check ability activation for
/*
Process the Flux Mining ability.
@param blockState The {@link BlockState} to check ability activation for
* @return true if the ability was successful, false otherwise
*/
/*public boolean processFluxMining(BlockState blockState) {
@ -109,9 +109,11 @@ public class SmeltingManager extends SkillManager {
}
public ItemStack smeltProcessing(ItemStack smelting, ItemStack result) {
applyXpGain(Smelting.getResourceXp(smelting), XPGainReason.PVE, XPGainSource.PASSIVE);
if (isSecondSmeltSuccessful()) {
if (Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.SMELTING, result.getType())
&& isSecondSmeltSuccessful()) {
ItemStack newResult = result.clone();
newResult.setAmount(result.getAmount() + 1);

View File

@ -64,7 +64,7 @@ public class TamingManager extends SkillManager {
playerSummonedEntities = new HashMap<>();
for(CallOfTheWildType callOfTheWildType : CallOfTheWildType.values()) {
playerSummonedEntities.put(callOfTheWildType, new ArrayList<TrackedTamingEntity>());
playerSummonedEntities.put(callOfTheWildType, new ArrayList<>());
}
}
@ -524,8 +524,7 @@ public class TamingManager extends SkillManager {
//TODO: The way this tracker was written is garbo, I should just rewrite it, I'll save that for a future update
public void removeFromTracker(TrackedTamingEntity trackedEntity) {
if(playerSummonedEntities.get(trackedEntity.getCallOfTheWildType()).contains(trackedEntity))
playerSummonedEntities.get(trackedEntity.getCallOfTheWildType()).remove(trackedEntity);
playerSummonedEntities.get(trackedEntity.getCallOfTheWildType()).remove(trackedEntity);
NotificationManager.sendPlayerInformationChatOnly(getPlayer(), "Taming.Summon.COTW.TimeExpired", StringUtils.getPrettyEntityTypeString(trackedEntity.getLivingEntity().getType()));
}

View File

@ -99,7 +99,7 @@ public class WoodcuttingManager extends SkillManager {
*/
public void processTreeFeller(BlockState blockState) {
Player player = getPlayer();
Set<BlockState> treeFellerBlocks = new HashSet<BlockState>();
Set<BlockState> treeFellerBlocks = new HashSet<>();
treeFellerReachedThreshold = false;
@ -160,7 +160,7 @@ public class WoodcuttingManager extends SkillManager {
* before taking measurements).
*/
private void processTree(BlockState blockState, Set<BlockState> treeFellerBlocks) {
List<BlockState> futureCenterBlocks = new ArrayList<BlockState>();
List<BlockState> futureCenterBlocks = new ArrayList<>();
// Check the block up and take different behavior (smaller search) if it's a log
if (processTreeFellerTargetBlock(blockState.getBlock().getRelative(BlockFace.UP).getState(), futureCenterBlocks, treeFellerBlocks)) {