From acedb05f55a404c9554916d1b0087ebcb46ee6ad Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Tue, 4 Jun 2019 17:18:27 +0200 Subject: [PATCH] Fix announcer getter for 1.14+ --- .../java/de/erethon/dungeonsxl/announcer/AnnouncerCache.java | 4 ++-- .../de/erethon/dungeonsxl/announcer/AnnouncerListener.java | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/de/erethon/dungeonsxl/announcer/AnnouncerCache.java b/core/src/main/java/de/erethon/dungeonsxl/announcer/AnnouncerCache.java index 4f55f7e5..01153458 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/announcer/AnnouncerCache.java +++ b/core/src/main/java/de/erethon/dungeonsxl/announcer/AnnouncerCache.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryView; /** * Announcer instance manager. @@ -70,7 +70,7 @@ public class AnnouncerCache { * @param gui the gui * @return the announcer that has the GUI */ - public Announcer getByGUI(Inventory gui) { + public Announcer getByGUI(InventoryView gui) { for (Announcer announcer : announcers) { if ((ChatColor.DARK_RED + announcer.getName()).equals(gui.getTitle())) { return announcer; diff --git a/core/src/main/java/de/erethon/dungeonsxl/announcer/AnnouncerListener.java b/core/src/main/java/de/erethon/dungeonsxl/announcer/AnnouncerListener.java index e8c3b464..41360c3a 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/announcer/AnnouncerListener.java +++ b/core/src/main/java/de/erethon/dungeonsxl/announcer/AnnouncerListener.java @@ -22,7 +22,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; /** @@ -43,9 +42,8 @@ public class AnnouncerListener implements Listener { } Player player = (Player) event.getWhoClicked(); - Inventory gui = event.getInventory(); ItemStack button = event.getCurrentItem(); - Announcer announcer = announcers.getByGUI(gui); + Announcer announcer = announcers.getByGUI(event.getView()); if (announcer != null && button != null && Category.WOOL.containsMaterial(button.getType())) { announcer.clickGroupButton(player, button); }