This commit is contained in:
rockyhawk64 2021-01-04 10:30:15 +11:00
parent 2fb64f9eb4
commit aabdd8a839
8 changed files with 54 additions and 4 deletions

View File

@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="ChestSort">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/ChestSort.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -18,5 +18,6 @@
<orderEntry type="library" name="spigot-1.16.4" level="project" />
<orderEntry type="library" name="spigot-1.13.2" level="project" />
<orderEntry type="library" name="CustomItemsAPI_PLACEHOLDER" level="project" />
<orderEntry type="library" name="ChestSort" level="project" />
</component>
</module>

View File

@ -4,7 +4,7 @@ name: CommandPanels
author: RockyHawk
api-version: '1.13'
description: Fully Custom GUIs. Make your Server Professional.
softdepend: [PlaceholderAPI, Vault, HeadDatabase, TokenManager, VotingPlugin, MMOItems, CustomItems]
softdepend: [PlaceholderAPI, Vault, HeadDatabase, TokenManager, VotingPlugin, MMOItems, CustomItems, ChestSort]
commands:
commandpanel:
description: Open a command panel.

View File

@ -31,6 +31,7 @@ import me.rockyhawk.commandpanels.openpanelsmanager.OpenPanelsLoader;
import me.rockyhawk.commandpanels.openpanelsmanager.UtilsPanelsLoader;
import me.rockyhawk.commandpanels.openwithitem.HotbarItemLoader;
import me.rockyhawk.commandpanels.openwithitem.SwapItemEvent;
import me.rockyhawk.commandpanels.openwithitem.UtilsChestSortEvent;
import me.rockyhawk.commandpanels.openwithitem.UtilsOpenWithItem;
import me.rockyhawk.commandpanels.panelblocks.BlocksTabComplete;
import me.rockyhawk.commandpanels.panelblocks.Commandpanelblocks;
@ -84,7 +85,6 @@ public class CommandPanels extends JavaPlugin {
public File panelsf;
public YamlConfiguration blockConfig; //where panel block locations are stored
public YamlConfiguration dataConfig; //where arbitrary data is stored for players
public void onEnable() {
Bukkit.getLogger().info("[CommandPanels] RockyHawk's CommandPanels v" + this.getDescription().getVersion() + " Plugin Loading...");
@ -170,6 +170,11 @@ public class CommandPanels extends JavaPlugin {
this.getServer().getPluginManager().registerEvents(new SwapItemEvent(this), this);
}
//if plugin ChestSort is enabled
if(getServer().getPluginManager().isPluginEnabled("ChestSort")){
this.getServer().getPluginManager().registerEvents(new UtilsChestSortEvent(this), this);
}
//save the example.yml file and the template.yml file
if (!this.panelsf.exists() || Objects.requireNonNull(this.panelsf.list()).length == 0) {
try {

View File

@ -7,6 +7,7 @@ import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

View File

@ -6,8 +6,6 @@ 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.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.Objects;

View File

@ -32,6 +32,14 @@ public class HotbarItemLoader {
}
}
public ArrayList<Integer> getStationaryItemSlots(){
ArrayList<Integer> tempItems = new ArrayList<>();
for(int[] tempItem : stationaryItems){
tempItems.add(tempItem[0]);
}
return tempItems;
}
//return true if found
public boolean stationaryExecute(int slot, Player p, boolean openPanel){
for(int[] temp : stationaryItems){

View File

@ -0,0 +1,28 @@
package me.rockyhawk.commandpanels.openwithitem;
import de.jeff_media.ChestSortAPI.ChestSortEvent;
import me.rockyhawk.commandpanels.CommandPanels;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryType;
public class UtilsChestSortEvent implements Listener {
CommandPanels plugin;
public UtilsChestSortEvent(CommandPanels pl) {
this.plugin = pl;
}
@EventHandler
public void onChestSortEvent(ChestSortEvent e){
if(!plugin.openWithItem){
//if none of the panels have open-with-item
return;
}
//If the ChestSort plugin triggers an event
plugin.getServer().getConsoleSender().sendMessage(e.getInventory().getType().toString());
if(e.getInventory().getType() == InventoryType.PLAYER){
for(int slot : plugin.hotbar.getStationaryItemSlots()){
e.setUnmovable(slot);
}
}
}
}