Cache isPluginEnabled

This commit is contained in:
Esophose 2019-08-08 21:44:27 +00:00
parent cd8a53416c
commit e3f5e62c74

View File

@ -54,11 +54,13 @@ public class HopTask extends BukkitRunnable {
private final Map<InventoryHolder, ItemStack> blacklist = new HashMap<>();
private final int hopTicks;
private final boolean hasFabledSkyBlock;
public HopTask(EpicHoppers plug) {
plugin = plug;
this.hopTicks = Math.max(1, Setting.HOP_TICKS.getInt() / 2); // Purposeful integer division. Don't go below 1.
this.runTaskTimer(plugin, 0, 2);
this.hasFabledSkyBlock = Bukkit.getPluginManager().isPluginEnabled("FabledSkyBlock");
}
@Override
@ -244,7 +246,7 @@ public class HopTask extends BukkitRunnable {
}
// Support for FabledSkyBlock stackables.
if (Bukkit.getPluginManager().isPluginEnabled("FabledSkyBlock")) {
if (this.hasFabledSkyBlock) {
StackableManager stackableManager = SkyBlock.getInstance().getStackableManager();
if (stackableManager != null && stackableManager.isStacked(pointingLocation)) {
Stackable stackable = stackableManager.getStack(pointingLocation, pointingLocation.getBlock().getType());