From 44d0785f73d180ef82b9e0fb7c25ea4628b80355 Mon Sep 17 00:00:00 2001 From: Jules Date: Sun, 5 Nov 2023 23:21:58 +0100 Subject: [PATCH] Increased event priorities of exp sources --- .../experience/source/BrewPotionExperienceSource.java | 2 +- .../experience/source/EnchantItemExperienceSource.java | 2 +- .../mmocore/experience/source/FishItemExperienceSource.java | 2 +- .../experience/source/RepairItemExperienceSource.java | 2 +- .../mmocore/experience/source/SmeltItemExperienceSource.java | 2 +- .../mmocore/experience/source/TameExperienceSource.java | 5 ++--- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java index f0a1aea1..fb9f7847 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/BrewPotionExperienceSource.java @@ -46,7 +46,7 @@ public class BrewPotionExperienceSource extends ExperienceSource { public ExperienceSourceManager newManager() { return new ExperienceSourceManager() { - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void a(BrewEvent event) { Optional playerOpt = getNearbyPlayer(event.getBlock().getLocation()); if (!playerOpt.isPresent()) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java index 7f4e1915..a58b5414 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/EnchantItemExperienceSource.java @@ -43,7 +43,7 @@ public class EnchantItemExperienceSource extends ExperienceSource { public ExperienceSourceManager newManager() { return new ExperienceSourceManager() { - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void a(EnchantItemEvent event) { PlayerData player = PlayerData.get(event.getEnchanter()); for (EnchantItemExperienceSource source : getSources()) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java index 09089af3..b6bd2f57 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/FishItemExperienceSource.java @@ -27,7 +27,7 @@ public class FishItemExperienceSource extends SpecificExperienceSource newManager() { return new ExperienceSourceManager() { - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void a(PlayerFishEvent event) { if (event.getState() == State.CAUGHT_FISH) { ItemStack caught = ((Item) event.getCaught()).getItemStack(); diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java index 96a65a21..3753f423 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/RepairItemExperienceSource.java @@ -46,7 +46,7 @@ public class RepairItemExperienceSource extends ExperienceSource { private class CustomExperienceManager extends ExperienceSourceManager { - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void a(InventoryClickEvent event) { if (event.getInventory() == null || event.getInventory().getType() != InventoryType.ANVIL || event.getSlot() != 2) return; diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java index 50423dd9..b6256a2a 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/SmeltItemExperienceSource.java @@ -29,7 +29,7 @@ public class SmeltItemExperienceSource extends SpecificExperienceSource newManager() { return new ExperienceSourceManager() { - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void a(BlockCookEvent event) { Optional player = getNearestPlayer(event.getBlock().getLocation()); if (!player.isPresent()) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java index 40d562cd..35c5148d 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/experience/source/TameExperienceSource.java @@ -10,10 +10,9 @@ import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageByEntityEvent; -import static org.bukkit.event.EventPriority.HIGHEST; - public class TameExperienceSource extends SpecificExperienceSource { public TameExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) { super(dispenser, config); @@ -23,7 +22,7 @@ public class TameExperienceSource extends SpecificExperienceSource { public ExperienceSourceManager newManager() { return new ExperienceSourceManager() { - @EventHandler(priority = HIGHEST,ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGHEST,ignoreCancelled = true) public void onWolfHit(EntityDamageByEntityEvent e) { if(e.getDamager() instanceof Wolf) { Wolf wolf= (Wolf) e.getDamager();