mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Auto-refresh shop sign when the shop chest interface is closed
This commit is contained in:
1 parent
56a672b97d
commit
1c681b1c6c
1 file changed
+24
@@ -1,15 +1,19 @@
|
||||
package org.maxgamer.quickshop.Listeners;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.Event.Result;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Shop.Shop;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
public class InventoryListener implements Listener {
|
||||
@@ -34,6 +38,26 @@ public class InventoryListener implements Listener {
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
final Inventory inventory = event.getInventory();
|
||||
if (inventory == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Location location = inventory.getLocation();
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Shop shop = plugin.getShopManager().getShop(location);
|
||||
if (shop == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
shop.setSignText();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
|
||||
Reference in new issue
Block a user