mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 21:56:47 +01:00
d052d7a3ce
Convert Herbalism ability to use BlockState instead of Block. Move all block checks back to BlockChecks. Don't need this if we're using BlockState Convert Excavation to BlockState. We don't need to return booleans here because we never edit the block state.Switch ModCheck.getCustomBlock to use BlockState More work on the conversion to BlockState More conversion to BlockState Better way to handle mining drops, I believe. Remove useless imports. A test of making the diff look nicer BlockChecks diff cleanup Herbalism diff cleanup Gotta update the block states here. Moar blockstate. Little more blockState stuff. Even more blockstate.
72 lines
2.3 KiB
Java
72 lines
2.3 KiB
Java
package com.gmail.nossr50.skills.smelting;
|
|
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
|
import org.bukkit.event.inventory.FurnaceExtractEvent;
|
|
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
|
|
|
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
|
import com.gmail.nossr50.skills.SkillManager;
|
|
import com.gmail.nossr50.skills.utilities.SkillType;
|
|
import com.gmail.nossr50.util.Misc;
|
|
import com.gmail.nossr50.util.Permissions;
|
|
|
|
public class SmeltingManager extends SkillManager {
|
|
|
|
public SmeltingManager(McMMOPlayer mcMMOPlayer) {
|
|
super(mcMMOPlayer, SkillType.SMELTING);
|
|
}
|
|
|
|
/**
|
|
* Increases burn time for furnace fuel.
|
|
*
|
|
* @param event The {@link FurnaceBurnEvent} to modify.
|
|
*/
|
|
public void fuelEfficiency(FurnaceBurnEvent event) {
|
|
Player player = mcMMOPlayer.getPlayer();
|
|
|
|
if (Misc.isNPCEntity(player) || !Permissions.fuelEfficiency(player)) {
|
|
return;
|
|
}
|
|
|
|
FuelEfficiencyEventHandler eventHandler = new FuelEfficiencyEventHandler(this, event);
|
|
eventHandler.calculateBurnModifier();
|
|
eventHandler.modifyBurnTime();
|
|
}
|
|
|
|
public void smeltProcessing(FurnaceSmeltEvent event) {
|
|
Player player = mcMMOPlayer.getPlayer();
|
|
|
|
if (Misc.isNPCEntity(player)) {
|
|
return;
|
|
}
|
|
|
|
SmeltResourceEventHandler eventHandler = new SmeltResourceEventHandler(this, event);
|
|
|
|
if (Permissions.skillEnabled(player, skill)) {
|
|
eventHandler.handleXPGain();
|
|
}
|
|
|
|
if (!Permissions.doubleDrops(player, skill)) {
|
|
return;
|
|
}
|
|
|
|
eventHandler.calculateSkillModifier();
|
|
|
|
double chance = (Smelting.secondSmeltMaxChance / Smelting.secondSmeltMaxLevel) * eventHandler.skillModifier;
|
|
if (chance > Misc.getRandom().nextInt(activationChance)) {
|
|
eventHandler.handleBonusSmelts();
|
|
}
|
|
}
|
|
|
|
public void vanillaXPBoost(FurnaceExtractEvent event) {
|
|
if (skillLevel < Smelting.vanillaXPBoostRank1Level || !Permissions.vanillaXpBoost(mcMMOPlayer.getPlayer(), skill)) {
|
|
return;
|
|
}
|
|
|
|
SmeltingVanillaXPEventHandler eventHandler = new SmeltingVanillaXPEventHandler(this, event);
|
|
eventHandler.calculateModifier();
|
|
eventHandler.modifyVanillaXP();
|
|
}
|
|
}
|