mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Alchemy cleanup, part 1.
This commit is contained in:
@ -12,8 +12,6 @@ import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
||||
|
||||
public class AlchemyBrewCheckTask extends BukkitRunnable {
|
||||
private final static int INGREDIENT_SLOT = 3;
|
||||
|
||||
private Player player;
|
||||
private BrewingStand brewingStand;
|
||||
private ItemStack[] oldInventory;
|
||||
@ -30,7 +28,7 @@ public class AlchemyBrewCheckTask extends BukkitRunnable {
|
||||
ItemStack[] newInventory = Arrays.copyOfRange(((BrewingStand) block.getState()).getInventory().getContents(), 0, 4);
|
||||
|
||||
if (Alchemy.brewingStandMap.containsKey(brewingStand)) {
|
||||
if (oldInventory[INGREDIENT_SLOT] == null || newInventory[INGREDIENT_SLOT] == null || !oldInventory[INGREDIENT_SLOT].isSimilar(newInventory[INGREDIENT_SLOT]) || !AlchemyPotionBrewer.isValidBrew(player, newInventory)) {
|
||||
if (oldInventory[Alchemy.INGREDIENT_SLOT] == null || newInventory[Alchemy.INGREDIENT_SLOT] == null || !oldInventory[Alchemy.INGREDIENT_SLOT].isSimilar(newInventory[Alchemy.INGREDIENT_SLOT]) || !AlchemyPotionBrewer.isValidBrew(player, newInventory)) {
|
||||
Alchemy.brewingStandMap.get(brewingStand).cancelBrew();
|
||||
}
|
||||
}
|
||||
@ -39,5 +37,4 @@ public class AlchemyBrewCheckTask extends BukkitRunnable {
|
||||
Alchemy.brewingStandMap.put(brewingStand, new AlchemyBrewTask(brewingStand, player));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,14 +34,11 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
||||
brewTimer = DEFAULT_BREW_TICKS;
|
||||
|
||||
if (player != null && !Misc.isNPCEntity(player) && Permissions.secondaryAbilityEnabled(player, SecondaryAbility.CATALYSIS)) {
|
||||
double catalysis = UserManager.getPlayer(player).getAlchemyManager().getBrewSpeed();
|
||||
|
||||
if (Permissions.lucky(player, SkillType.ALCHEMY)) {
|
||||
catalysis = UserManager.getPlayer(player).getAlchemyManager().getBrewSpeedLucky();
|
||||
}
|
||||
double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, SkillType.ALCHEMY));
|
||||
|
||||
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
brewSpeed = catalysis;
|
||||
}
|
||||
|
Reference in New Issue
Block a user