mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Potential fix for #3005
This commit is contained in:
parent
c40af913f4
commit
89fa26d0eb
@ -66,13 +66,10 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile doesn't exist
|
||||
if(UserManager.getOfflinePlayer(offlinePlayer) == null) {
|
||||
return;
|
||||
}
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
|
||||
|
||||
boolean debugMode = player.isOnline() && UserManager.getPlayer(player).isDebugMode();
|
||||
if(mmoPlayer != null) {
|
||||
boolean debugMode = player.isOnline() && mmoPlayer.isDebugMode();
|
||||
|
||||
if(debugMode) {
|
||||
player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT");
|
||||
@ -81,15 +78,20 @@ public class InventoryListener implements Listener {
|
||||
player.sendMessage("Burn Length before Fuel Efficiency is applied - "+event.getBurnTime());
|
||||
}
|
||||
|
||||
event.setBurnTime(UserManager.getPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime()));
|
||||
event.setBurnTime(mmoPlayer.getSmeltingManager().fuelEfficiency(event.getBurnTime()));
|
||||
|
||||
if(debugMode) {
|
||||
player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime());
|
||||
player.sendMessage("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Potential fix for #3005
|
||||
if (event.getBurnTime() > 0 && !event.isBurning()) {
|
||||
event.setBurning(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
|
@ -23,93 +23,28 @@ public class SmeltingManager extends SkillManager {
|
||||
super(mcMMOPlayer, PrimarySkillType.SMELTING);
|
||||
}
|
||||
|
||||
/*public boolean canUseFluxMining(BlockState blockState) {
|
||||
return getSkillLevel() >= Smelting.fluxMiningUnlockLevel
|
||||
&& BlockUtils.affectedByFluxMining(blockState)
|
||||
&& Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.SMELTING_FLUX_MINING)
|
||||
&& !mcMMO.getPlaceStore().isTrue(blockState);
|
||||
}*/
|
||||
|
||||
public boolean isSecondSmeltSuccessful() {
|
||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.SMELTING_SECOND_SMELT)
|
||||
&& 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
|
||||
* @return true if the ability was successful, false otherwise
|
||||
*/
|
||||
/*public boolean processFluxMining(BlockState blockState) {
|
||||
Player player = getPlayer();
|
||||
|
||||
if (RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.SMELTING_FLUX_MINING, true)) {
|
||||
ItemStack item = null;
|
||||
|
||||
switch (blockState.getType()) {
|
||||
case IRON_ORE:
|
||||
item = new ItemStack(Material.IRON_INGOT);
|
||||
break;
|
||||
|
||||
case GOLD_ORE:
|
||||
item = new ItemStack(Material.GOLD_INGOT);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EventUtils.simulateBlockBreak(blockState.getBlock(), player, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We need to distribute Mining XP here, because the block break event gets cancelled
|
||||
applyXpGain(Mining.getBlockXp(blockState), XPGainReason.PVE, XPGainSource.PASSIVE);
|
||||
|
||||
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage());
|
||||
|
||||
Misc.dropItems(Misc.getBlockCenter(blockState), item, isSecondSmeltSuccessful() ? 2 : 1);
|
||||
|
||||
blockState.setType(Material.AIR);
|
||||
|
||||
if (Config.getInstance().getFluxPickaxeSoundEnabled()) {
|
||||
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
|
||||
}
|
||||
|
||||
ParticleEffectUtils.playFluxEffect(blockState.getLocation());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Increases burn time for furnace fuel.
|
||||
*
|
||||
* @param burnTime The initial burn time from the {@link FurnaceBurnEvent}
|
||||
*/
|
||||
public int fuelEfficiency(int burnTime) {
|
||||
return burnTime * getFuelEfficiencyMultiplier();
|
||||
return Math.max(1, burnTime * getFuelEfficiencyMultiplier());
|
||||
}
|
||||
|
||||
public int getFuelEfficiencyMultiplier()
|
||||
{
|
||||
switch(RankUtils.getRank(getPlayer(), SubSkillType.SMELTING_FUEL_EFFICIENCY))
|
||||
{
|
||||
case 1:
|
||||
return 2;
|
||||
case 2:
|
||||
return 3;
|
||||
case 3:
|
||||
return 4;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return switch (RankUtils.getRank(getPlayer(), SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
|
||||
case 1 -> 2;
|
||||
case 2 -> 3;
|
||||
case 3 -> 4;
|
||||
default -> 1;
|
||||
};
|
||||
}
|
||||
|
||||
public void smeltProcessing(@NotNull FurnaceSmeltEvent furnaceSmeltEvent, @NotNull Furnace furnace) {
|
||||
|
Loading…
Reference in New Issue
Block a user