mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Bit of Alchemy cleanup
This commit is contained in:
parent
520f5cb116
commit
f39623c279
@ -33,6 +33,7 @@ public class AlchemyBrewCheckTask extends BukkitRunnable {
|
||||
Alchemy.brewingStandMap.get(brewingStand).cancelBrew();
|
||||
}
|
||||
}
|
||||
|
||||
if (!Alchemy.brewingStandMap.containsKey(brewingStand) && AlchemyPotionBrewer.isValidBrew(player, newInventory)) {
|
||||
Alchemy.brewingStandMap.put(brewingStand, new AlchemyBrewTask(brewingStand, player));
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BrewingStand;
|
||||
@ -42,7 +41,7 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
brewSpeed = catalysis;
|
||||
}
|
||||
@ -82,7 +81,7 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
||||
|
||||
private void finish() {
|
||||
McMMOPlayerBrewEvent event = new McMMOPlayerBrewEvent(player, brewingStand);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
AlchemyPotionBrewer.finishBrewing(brewingStand, player, false);
|
||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.skills.alchemy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BrewingStand;
|
||||
@ -219,22 +218,6 @@ public final class AlchemyPotionBrewer {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void scheduleCheck(Player player, BrewingStand brewingStand) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, new AlchemyBrewCheckTask(player, brewingStand));
|
||||
}
|
||||
|
||||
private static void scheduleUpdate(Inventory inventory) {
|
||||
for (HumanEntity humanEntity : inventory.getViewers()) {
|
||||
if (humanEntity instanceof Player) {
|
||||
scheduleUpdate((Player) humanEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void scheduleUpdate(Player player) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(mcMMO.p, new PlayerUpdateInventoryTask(player));
|
||||
}
|
||||
|
||||
public static void handleInventoryClick(InventoryClickEvent event) {
|
||||
Player player = event.getWhoClicked() instanceof Player ? (Player) event.getWhoClicked() : null;
|
||||
BrewingStand brewingStand = (BrewingStand) event.getInventory().getHolder();
|
||||
@ -355,4 +338,16 @@ public final class AlchemyPotionBrewer {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static void scheduleCheck(Player player, BrewingStand brewingStand) {
|
||||
new AlchemyBrewCheckTask(player, brewingStand).runTask(mcMMO.p);
|
||||
}
|
||||
|
||||
private static void scheduleUpdate(Inventory inventory) {
|
||||
for (HumanEntity humanEntity : inventory.getViewers()) {
|
||||
if (humanEntity instanceof Player) {
|
||||
new PlayerUpdateInventoryTask((Player) humanEntity).runTask(mcMMO.p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user