mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-03 08:03:26 +01:00
Merge pull request #103 from xmssss/master
Compatiblity with GoldenCrates plugin
This commit is contained in:
commit
88ba548215
@ -1,6 +1,7 @@
|
||||
package de.jeff_media.ChestSort;
|
||||
|
||||
import de.jeff_media.ChestSort.hooks.CrateReloadedHook;
|
||||
import de.jeff_media.ChestSort.hooks.GoldenCratesHook;
|
||||
import de.jeff_media.ChestSort.hooks.HeadDatabaseHook;
|
||||
import de.jeff_media.ChestSort.hooks.MinepacksHook;
|
||||
import de.jeff_media.ChestSort.utils.LlamaUtils;
|
||||
@ -36,12 +37,14 @@ public class ChestSortListener implements Listener {
|
||||
final MinepacksHook minepacksHook;
|
||||
final HeadDatabaseHook headDatabaseHook;
|
||||
final CrateReloadedHook crateReloadedHook;
|
||||
final GoldenCratesHook goldenCratesHook;
|
||||
|
||||
ChestSortListener(ChestSortPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.minepacksHook = new MinepacksHook(plugin);
|
||||
this.headDatabaseHook = new HeadDatabaseHook(plugin);
|
||||
this.crateReloadedHook = new CrateReloadedHook(plugin);
|
||||
this.goldenCratesHook = new GoldenCratesHook(plugin);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -545,6 +548,13 @@ public class ChestSortListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
// GoldenCrates hook
|
||||
if(goldenCratesHook.isCrate(e.getClickedInventory())
|
||||
|| goldenCratesHook.isCrate(e.getInventory())) {
|
||||
//if(plugin.debug) plugin.getLogger().info("Aborting hotkey because this is a CrateReloaded crate");
|
||||
return;
|
||||
}
|
||||
|
||||
// Detect generic GUIs
|
||||
if(!isAPICall(e.getInventory()) && !isAPICall(e.getClickedInventory()) &&
|
||||
(plugin.genericHook.isPluginGUI(e.getInventory())
|
||||
|
@ -0,0 +1,23 @@
|
||||
package de.jeff_media.ChestSort.hooks;
|
||||
|
||||
import de.jeff_media.ChestSort.ChestSortPlugin;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import sun.awt.Win32GraphicsConfig;
|
||||
|
||||
public class GoldenCratesHook {
|
||||
|
||||
ChestSortPlugin main;
|
||||
|
||||
public GoldenCratesHook(ChestSortPlugin main) {
|
||||
this.main=main;
|
||||
}
|
||||
|
||||
|
||||
public boolean isCrate(Inventory inv) {
|
||||
if(inv==null) return false;
|
||||
if(inv.getHolder()==null) return false;
|
||||
if(!main.getConfig().getBoolean("hook-goldencrates",true)) return false;
|
||||
return inv.getHolder().getClass().getName().contains("crate") || inv.getHolder().getClass().getName().contains("crates") || inv.getHolder().getClass().getName().contains("preview") || inv.getHolder().getClass().getName().contains("golden");
|
||||
}
|
||||
|
||||
}
|
@ -229,6 +229,10 @@ hook-minepacks: true
|
||||
# Prevents the player from using hotkeys on a crate
|
||||
hook-cratereloaded: true
|
||||
|
||||
##### GoldenCrates #####
|
||||
# Prevents the player from using hotkeys on a crate
|
||||
hook-goldencrates: true
|
||||
|
||||
##### HeadDatabase #####
|
||||
# Prevents the player from using hotkeys on the HeadDatabase GUI
|
||||
hook-headdatabase: true
|
||||
|
Loading…
Reference in New Issue
Block a user