Increased event priorities of exp sources

This commit is contained in:
Jules 2023-11-05 23:21:58 +01:00
parent c8f1f9fefd
commit 44d0785f73
6 changed files with 7 additions and 8 deletions

View File

@ -46,7 +46,7 @@ public class BrewPotionExperienceSource extends ExperienceSource<PotionMeta> {
public ExperienceSourceManager<BrewPotionExperienceSource> newManager() { public ExperienceSourceManager<BrewPotionExperienceSource> newManager() {
return new ExperienceSourceManager<BrewPotionExperienceSource>() { return new ExperienceSourceManager<BrewPotionExperienceSource>() {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void a(BrewEvent event) { public void a(BrewEvent event) {
Optional<Player> playerOpt = getNearbyPlayer(event.getBlock().getLocation()); Optional<Player> playerOpt = getNearbyPlayer(event.getBlock().getLocation());
if (!playerOpt.isPresent()) if (!playerOpt.isPresent())

View File

@ -43,7 +43,7 @@ public class EnchantItemExperienceSource extends ExperienceSource<Void> {
public ExperienceSourceManager<EnchantItemExperienceSource> newManager() { public ExperienceSourceManager<EnchantItemExperienceSource> newManager() {
return new ExperienceSourceManager<EnchantItemExperienceSource>() { return new ExperienceSourceManager<EnchantItemExperienceSource>() {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void a(EnchantItemEvent event) { public void a(EnchantItemEvent event) {
PlayerData player = PlayerData.get(event.getEnchanter()); PlayerData player = PlayerData.get(event.getEnchanter());
for (EnchantItemExperienceSource source : getSources()) for (EnchantItemExperienceSource source : getSources())

View File

@ -27,7 +27,7 @@ public class FishItemExperienceSource extends SpecificExperienceSource<ItemStack
public ExperienceSourceManager<FishItemExperienceSource> newManager() { public ExperienceSourceManager<FishItemExperienceSource> newManager() {
return new ExperienceSourceManager<FishItemExperienceSource>() { return new ExperienceSourceManager<FishItemExperienceSource>() {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void a(PlayerFishEvent event) { public void a(PlayerFishEvent event) {
if (event.getState() == State.CAUGHT_FISH) { if (event.getState() == State.CAUGHT_FISH) {
ItemStack caught = ((Item) event.getCaught()).getItemStack(); ItemStack caught = ((Item) event.getCaught()).getItemStack();

View File

@ -46,7 +46,7 @@ public class RepairItemExperienceSource extends ExperienceSource<ItemStack> {
private class CustomExperienceManager extends ExperienceSourceManager<RepairItemExperienceSource> { private class CustomExperienceManager extends ExperienceSourceManager<RepairItemExperienceSource> {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void a(InventoryClickEvent event) { public void a(InventoryClickEvent event) {
if (event.getInventory() == null || event.getInventory().getType() != InventoryType.ANVIL || event.getSlot() != 2) if (event.getInventory() == null || event.getInventory().getType() != InventoryType.ANVIL || event.getSlot() != 2)
return; return;

View File

@ -29,7 +29,7 @@ public class SmeltItemExperienceSource extends SpecificExperienceSource<ItemStac
public ExperienceSourceManager<SmeltItemExperienceSource> newManager() { public ExperienceSourceManager<SmeltItemExperienceSource> newManager() {
return new ExperienceSourceManager<SmeltItemExperienceSource>() { return new ExperienceSourceManager<SmeltItemExperienceSource>() {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void a(BlockCookEvent event) { public void a(BlockCookEvent event) {
Optional<Player> player = getNearestPlayer(event.getBlock().getLocation()); Optional<Player> player = getNearestPlayer(event.getBlock().getLocation());
if (!player.isPresent()) if (!player.isPresent())

View File

@ -10,10 +10,9 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf; import org.bukkit.entity.Wolf;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import static org.bukkit.event.EventPriority.HIGHEST;
public class TameExperienceSource extends SpecificExperienceSource { public class TameExperienceSource extends SpecificExperienceSource {
public TameExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) { public TameExperienceSource(ExperienceDispenser dispenser, MMOLineConfig config) {
super(dispenser, config); super(dispenser, config);
@ -23,7 +22,7 @@ public class TameExperienceSource extends SpecificExperienceSource {
public ExperienceSourceManager<TameExperienceSource> newManager() { public ExperienceSourceManager<TameExperienceSource> newManager() {
return new ExperienceSourceManager<TameExperienceSource>() { return new ExperienceSourceManager<TameExperienceSource>() {
@EventHandler(priority = HIGHEST,ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST,ignoreCancelled = true)
public void onWolfHit(EntityDamageByEntityEvent e) { public void onWolfHit(EntityDamageByEntityEvent e) {
if(e.getDamager() instanceof Wolf) { if(e.getDamager() instanceof Wolf) {
Wolf wolf= (Wolf) e.getDamager(); Wolf wolf= (Wolf) e.getDamager();