mirror of
https://github.com/JEFF-Media-GbR/ChestSort.git
synced 2024-12-04 16:44:00 +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())
|
|| belongsToChestLikeBlock(event.getClickedInventory())
|
||||||
|| LlamaUtils.belongsToLlama(event.getClickedInventory())
|
|| LlamaUtils.belongsToLlama(event.getClickedInventory())
|
||||||
|| minepacksHook.isMinepacksBackpack(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")) {
|
if (!p.hasPermission("chestsort.use")) {
|
||||||
|
@ -42,6 +42,7 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import de.jeff_media.ChestSort.config.Config;
|
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.GenericGUIHook;
|
||||||
import de.jeff_media.ChestSort.hooks.PlayerVaultsHook;
|
import de.jeff_media.ChestSort.hooks.PlayerVaultsHook;
|
||||||
import de.jeff_media.ChestSort.placeholders.ChestSortPlaceholders;
|
import de.jeff_media.ChestSort.placeholders.ChestSortPlaceholders;
|
||||||
@ -86,6 +87,7 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
|||||||
|
|
||||||
public GenericGUIHook genericHook;
|
public GenericGUIHook genericHook;
|
||||||
public PlayerVaultsHook playerVaultsHook;
|
public PlayerVaultsHook playerVaultsHook;
|
||||||
|
public EnderContainersHook enderContainersHook;
|
||||||
|
|
||||||
private static long updateCheckInterval = 4*60*60; // in seconds. We check on startup and every 4 hours
|
private static long updateCheckInterval = 4*60*60; // in seconds. We check on startup and every 4 hours
|
||||||
|
|
||||||
@ -519,6 +521,7 @@ public class ChestSortPlugin extends JavaPlugin implements de.jeff_media.ChestSo
|
|||||||
updateCheckInterval = (int) (getConfig().getDouble("check-interval")*60*60);
|
updateCheckInterval = (int) (getConfig().getDouble("check-interval")*60*60);
|
||||||
sortingMethod = getConfig().getString("sorting-method");
|
sortingMethod = getConfig().getString("sorting-method");
|
||||||
playerVaultsHook = new PlayerVaultsHook(this);
|
playerVaultsHook = new PlayerVaultsHook(this);
|
||||||
|
enderContainersHook = new EnderContainersHook(this);
|
||||||
getServer().getPluginManager().registerEvents(listener, this);
|
getServer().getPluginManager().registerEvents(listener, this);
|
||||||
getServer().getPluginManager().registerEvents(settingsGUI, this);
|
getServer().getPluginManager().registerEvents(settingsGUI, this);
|
||||||
ChestSortChestSortCommand chestsortCommandExecutor = new ChestSortChestSortCommand(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.
|
# player vaults just like regular chests.
|
||||||
hook-playervaults: true
|
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 #####
|
##### CrateReloaded #####
|
||||||
# Prevents the player from using hotkeys on a crate
|
# Prevents the player from using hotkeys on a crate
|
||||||
hook-cratereloaded: true
|
hook-cratereloaded: true
|
||||||
|
Loading…
Reference in New Issue
Block a user