mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-03 08:03:26 +01:00
Add integration with EnderContainers
This commit is contained in:
parent
036c4fd68a
commit
f9cdebb243
@ -487,7 +487,8 @@ public class ChestSortListener implements Listener {
|
||||
|| belongsToChestLikeBlock(event.getClickedInventory())
|
||||
|| LlamaUtils.belongsToLlama(event.getClickedInventory())
|
||||
|| minepacksHook.isMinepacksBackpack(event.getClickedInventory())
|
||||
|| plugin.playerVaultsHook.isPlayerVault(event.getClickedInventory())) {
|
||||
|| plugin.playerVaultsHook.isPlayerVault(event.getClickedInventory())
|
||||
|| plugin.enderContainersHook.isEnderchest(event.getClickedInventory())) {
|
||||
|
||||
|
||||
if (!p.hasPermission("chestsort.use")) {
|
||||
|
@ -42,6 +42,7 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import de.jeff_media.ChestSort.config.Config;
|
||||
import de.jeff_media.ChestSort.hooks.EnderContainersHook;
|
||||
import de.jeff_media.ChestSort.hooks.GenericGUIHook;
|
||||
import de.jeff_media.ChestSort.hooks.PlayerVaultsHook;
|
||||
import de.jeff_media.ChestSort.placeholders.ChestSortPlaceholders;
|
||||
@ -86,7 +87,8 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
|
||||
public GenericGUIHook genericHook;
|
||||
public PlayerVaultsHook playerVaultsHook;
|
||||
|
||||
public EnderContainersHook enderContainersHook;
|
||||
|
||||
private static long updateCheckInterval = 4*60*60; // in seconds. We check on startup and every 4 hours
|
||||
|
||||
String mcVersion; // 1.13.2 = 1_13_R2
|
||||
@ -519,6 +521,7 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
||||
updateCheckInterval = (int) (getConfig().getDouble("check-interval")*60*60);
|
||||
sortingMethod = getConfig().getString("sorting-method");
|
||||
playerVaultsHook = new PlayerVaultsHook(this);
|
||||
enderContainersHook = new EnderContainersHook(this);
|
||||
getServer().getPluginManager().registerEvents(listener, this);
|
||||
getServer().getPluginManager().registerEvents(settingsGUI, this);
|
||||
ChestSortChestSortCommand chestsortCommandExecutor = new ChestSortChestSortCommand(this);
|
||||
|
@ -0,0 +1,23 @@
|
||||
package de.jeff_media.ChestSort.hooks;
|
||||
|
||||
import de.jeff_media.ChestSort.ChestSortPlugin;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class EnderContainersHook {
|
||||
|
||||
private static final String CLASS_NAME = "fr.utarwyn.endercontainers.inventory.EnderChestInventory";
|
||||
|
||||
private final ChestSortPlugin main;
|
||||
|
||||
public EnderContainersHook(ChestSortPlugin main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
public boolean isEnderchest(Inventory inv) {
|
||||
if (inv == null) return false;
|
||||
if (inv.getHolder() == null) return false;
|
||||
if (!main.getConfig().getBoolean("hook-endercontainers", true)) return false;
|
||||
return inv.getHolder().getClass().getName().equals(CLASS_NAME);
|
||||
}
|
||||
|
||||
}
|
@ -234,6 +234,11 @@ hook-minepacks: true
|
||||
# player vaults just like regular chests.
|
||||
hook-playervaults: true
|
||||
|
||||
##### EnderContainers ##### -> https://www.spigotmc.org/resources/endercontainers.4750/
|
||||
# When EnderContainers version 2+ is installed, ChestSort can detect your
|
||||
# enderchests and sort them like a regular chest.
|
||||
hook-endercontainers: true
|
||||
|
||||
##### CrateReloaded #####
|
||||
# Prevents the player from using hotkeys on a crate
|
||||
hook-cratereloaded: true
|
||||
|
Loading…
Reference in New Issue
Block a user