move inv close event to misc listener class

This commit is contained in:
Ryder Belserion 2024-10-11 14:38:32 -04:00
parent 13895ff528
commit 7bd79b19ed
No known key found for this signature in database
3 changed files with 24 additions and 9 deletions

View File

@ -13,6 +13,7 @@ import com.badbones69.crazyauctions.commands.AuctionCommand;
import com.badbones69.crazyauctions.commands.AuctionTab;
import com.badbones69.crazyauctions.controllers.GuiListener;
import com.badbones69.crazyauctions.controllers.MarcoListener;
import com.badbones69.crazyauctions.controllers.MiscListener;
import com.badbones69.crazyauctions.currency.VaultSupport;
import com.ryderbelserion.vital.paper.Vital;
import com.ryderbelserion.vital.paper.api.files.FileManager;
@ -127,6 +128,7 @@ public class CrazyAuctions extends Vital {
manager.registerEvents(new ExpiredMenu(), this); // register expired menu
manager.registerEvents(new GuiListener(), this);
manager.registerEvents(new MiscListener(), this);
manager.registerEvents(new MarcoListener(), this);
registerCommand(getCommand("crazyauctions"), new AuctionTab(), new AuctionCommand());

View File

@ -391,15 +391,6 @@ public class GuiListener implements Listener {
} catch (Exception ignored) {}
}
@EventHandler
public void onInvClose(InventoryCloseEvent e) {
FileConfiguration config = Files.config.getConfiguration();
Player player = (Player) e.getPlayer();
if (e.getView().getTitle().contains(Methods.strip(config.getString("Settings.Bidding-On-Item")))) HolderManager.removeBidding(player);
}
@EventHandler
public void onInvClick(InventoryClickEvent e) {
FileConfiguration config = Files.config.getConfiguration();

View File

@ -0,0 +1,22 @@
package com.badbones69.crazyauctions.controllers;
import com.badbones69.crazyauctions.Methods;
import com.badbones69.crazyauctions.api.enums.misc.Files;
import com.badbones69.crazyauctions.api.guis.HolderManager;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCloseEvent;
public class MiscListener implements Listener {
@EventHandler
public void onInvClose(InventoryCloseEvent event) {
FileConfiguration config = Files.config.getConfiguration();
Player player = (Player) event.getPlayer();
if (event.getView().getTitle().contains(Methods.strip(config.getString("Settings.Bidding-On-Item")))) HolderManager.removeBidding(player);
}
}