Skip to content

Commit

Permalink
[2.0.0-dev7]所有监听器优先级提升到MONITOR
Browse files Browse the repository at this point in the history
  • Loading branch information
YufiriaMazenta committed Jan 14, 2024
1 parent eaa50a1 commit 925ec65
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import java.text.SimpleDateFormat
version = "2.0.0-dev6"
version = "2.0.0-dev7"

plugins {
`java-library`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public enum AnvilHandler implements Listener {

INSTANCE;

@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.MONITOR)
public void onPrepareAnvil(PrepareAnvilEvent event) {
if (!PluginConfigs.ENABLE_ANVIL_RECIPE.value())
return;
Expand Down Expand Up @@ -68,7 +68,7 @@ public void onPrepareAnvil(PrepareAnvilEvent event) {
event.setResult(result);
}

@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.MONITOR)
public void onClickAnvil(InventoryClickEvent event) {
if (!PluginConfigs.ENABLE_ANVIL_RECIPE.value())
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public enum CraftHandler implements Listener {

INSTANCE;

@EventHandler(priority = EventPriority.LOW)
@EventHandler(priority = EventPriority.MONITOR)
public void dispatchConditions(PrepareItemCraftEvent event) {
if (event.getRecipe() == null)
return;
Expand All @@ -40,7 +40,7 @@ public void dispatchConditions(PrepareItemCraftEvent event) {
}
}

@EventHandler(priority = EventPriority.LOW)
@EventHandler(priority = EventPriority.MONITOR)
public void dispatchActions(CraftItemEvent event) {
if (event.getInventory().getResult() == null) {
event.getInventory().setResult(null);
Expand All @@ -60,7 +60,7 @@ public void dispatchActions(CraftItemEvent event) {
CraftorithmAPI.INSTANCE.arcencielDispatcher().dispatchArcencielFunc(player, actions);
}

@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.MONITOR)
public void checkCannotCraft(PrepareItemCraftEvent event) {
ItemStack[] items = event.getInventory().getMatrix();
boolean containsLore = ItemUtils.hasCannotCraftLore(items);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@BukkitListener
public class FurnaceBurnHandler implements Listener {

@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.MONITOR)
public void onClickFurnace(InventoryClickEvent event) {
if (event.isCancelled())
return;
Expand Down Expand Up @@ -82,7 +82,7 @@ public void onClickFurnace(InventoryClickEvent event) {
}
}

@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.MONITOR)
public void onFurnaceBurn(FurnaceBurnEvent event) {
if (event.isCancelled())
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public enum ItemsAdderHandler implements Listener {
throw new IllegalArgumentException("Can not find ItemsAdder plugin instance");
}

@EventHandler
@EventHandler(priority = EventPriority.MONITOR)
public void onItemsAdderLoaded(ItemsAdderLoadDataEvent event) {
RecipeManager.INSTANCE.reloadRecipeManager();
//注销IA合成监听器
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public enum RandomSmeltHandler implements Listener {
randomFurnaceBlockMap = new HashMap<>();
}

@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.MONITOR)
public void onFurnaceStartSmelt(FurnaceStartSmeltEvent event) {
NamespacedKey recipeKey = event.getRecipe().getKey();
RecipeGroup recipeGroup = RecipeManager.INSTANCE.getRecipeGroup(recipeKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;

Expand All @@ -18,7 +19,7 @@ public enum RecipeUnlockHandler implements Listener {

INSTANCE;

@EventHandler
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
Map<NamespacedKey, Boolean> unlockMap = RecipeManager.INSTANCE.recipeUnlockMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public enum SmithingHandler implements Listener {

INSTANCE;

@EventHandler(priority = EventPriority.LOW)
@EventHandler(priority = EventPriority.MONITOR)
public void onPrepareSmith(PrepareSmithingEvent event) {
NamespacedKey recipeKey = RecipeManager.INSTANCE.getRecipeKey(event.getInventory().getRecipe());
if (recipeKey == null)
Expand All @@ -41,7 +41,7 @@ public void onPrepareSmith(PrepareSmithingEvent event) {
}
}

@EventHandler
@EventHandler(priority = EventPriority.MONITOR)
public void onSmithItem(SmithItemEvent event) {
HumanEntity entity = event.getWhoClicked();
if (!(entity instanceof Player)) {
Expand All @@ -58,7 +58,7 @@ public void onSmithItem(SmithItemEvent event) {
CraftorithmAPI.INSTANCE.arcencielDispatcher().dispatchArcencielFunc(player, actions);
}

@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.MONITOR)
public void checkCannotCraftLore(PrepareSmithingEvent event) {
ItemStack[] items = event.getInventory().getContents();
boolean containsLore = ItemUtils.hasCannotCraftLore(items);
Expand Down

0 comments on commit 925ec65

Please sign in to comment.