mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-02 17:00:19 +01:00
Fix announcer getter for 1.14+
This commit is contained in:
parent
df0d01d101
commit
acedb05f55
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user