mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-02 12:35:27 +02:00
Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into tridentsxbows
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
@@ -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,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<>(brewingStandMap.values());
|
||||
|
||||
for (AlchemyBrewTask alchemyBrewTask : toFinish) {
|
||||
alchemyBrewTask.finishImmediately();
|
||||
|
@@ -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);
|
||||
|
@@ -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<>();
|
||||
|
||||
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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<>();
|
||||
|
||||
public static Set<PrimarySkillType> getParents(PrimarySkillType childSkill) {
|
||||
enforceChildSkill(childSkill);
|
||||
|
@@ -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) {
|
||||
|
@@ -61,7 +61,7 @@ public class ExcavationManager extends SkillManager {
|
||||
}
|
||||
|
||||
public int getExperienceOrbsReward() {
|
||||
return 1 * getArchaeologyRank();
|
||||
return getArchaeologyRank();
|
||||
}
|
||||
|
||||
public double getArchaelogyExperienceOrbChance() {
|
||||
|
@@ -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;
|
||||
|
@@ -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)) {
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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()) {
|
||||
|
@@ -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();
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -7,14 +7,14 @@ 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);
|
||||
}
|
||||
|
||||
public SimpleRepairableManager(int repairablesSize) {
|
||||
this.repairables = new HashMap<Material, Repairable>(repairablesSize);
|
||||
this.repairables = new HashMap<>(repairablesSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -8,14 +8,14 @@ import java.util.List;
|
||||
|
||||
|
||||
public class SimpleSalvageableManager implements SalvageableManager {
|
||||
private HashMap<Material, Salvageable> salvageables;
|
||||
private final HashMap<Material, Salvageable> salvageables;
|
||||
|
||||
public SimpleSalvageableManager() {
|
||||
this(55);
|
||||
}
|
||||
|
||||
public SimpleSalvageableManager(int salvageablesSize) {
|
||||
this.salvageables = new HashMap<Material, Salvageable>(salvageablesSize);
|
||||
this.salvageables = new HashMap<>(salvageablesSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -4,19 +4,25 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.FurnaceInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class Smelting {
|
||||
|
||||
public static int getRank(Player player)
|
||||
{
|
||||
return RankUtils.getRank(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART);
|
||||
}
|
||||
|
||||
//public static int fluxMiningUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.SMELTING_FLUX_MINING);
|
||||
|
||||
protected static int getResourceXp(ItemStack smelting) {
|
||||
return mcMMO.getModManager().isCustomOre(smelting.getType()) ? mcMMO.getModManager().getBlock(smelting.getType()).getSmeltingXpGain() : ExperienceConfig.getInstance().getXp(PrimarySkillType.SMELTING, smelting.getType());
|
||||
}
|
||||
|
@@ -11,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;
|
||||
|
||||
@@ -32,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) {
|
||||
@@ -110,9 +109,11 @@ public class SmeltingManager extends SkillManager {
|
||||
}
|
||||
|
||||
public ItemStack smeltProcessing(ItemStack smelting, ItemStack result) {
|
||||
|
||||
applyXpGain(Smelting.getResourceXp(smelting), XPGainReason.PVE, XPGainSource.PASSIVE);
|
||||
|
||||
if (Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.SMELTING, result.getType()) && isSecondSmeltSuccessful()) {
|
||||
if (Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.SMELTING, result.getType())
|
||||
&& isSecondSmeltSuccessful()) {
|
||||
ItemStack newResult = result.clone();
|
||||
|
||||
newResult.setAmount(result.getAmount() + 1);
|
||||
|
@@ -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()));
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user