forked from Upstream/CommandPanels
3.18.1.0
This commit is contained in:
parent
a429a38e4a
commit
5032e5f218
@ -10,7 +10,7 @@
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="CommandPanels" target="8" />
|
||||
<module name="CommandPanels" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.kyori:adventure-api:4.11.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-api/4.11.0/adventure-api-4.11.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-api/4.11.0/adventure-api-4.11.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-api/4.11.0/adventure-api-4.11.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.kyori:adventure-key:4.11.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-key/4.11.0/adventure-key-4.11.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-key/4.11.0/adventure-key-4.11.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-key/4.11.0/adventure-key-4.11.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.kyori:adventure-text-minimessage:4.11.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-text-minimessage/4.11.0/adventure-text-minimessage-4.11.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-text-minimessage/4.11.0/adventure-text-minimessage-4.11.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/adventure-text-minimessage/4.11.0/adventure-text-minimessage-4.11.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.kyori:examination-api:1.3.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/examination-api/1.3.0/examination-api-1.3.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/examination-api/1.3.0/examination-api-1.3.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/examination-api/1.3.0/examination-api-1.3.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.kyori:examination-string:1.3.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/examination-string/1.3.0/examination-string-1.3.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/examination-string/1.3.0/examination-string-1.3.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/kyori/examination-string/1.3.0/examination-string-1.3.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,13 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.jetbrains:annotations:23.0.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/23.0.0/annotations-23.0.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/23.0.0/annotations-23.0.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/23.0.0/annotations-23.0.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -1,7 +1,7 @@
|
||||
<component name="libraryTable">
|
||||
<library name="spigot-api-1.19-R0.1-SNAPSHOT">
|
||||
<library name="spigot-api-1.19-R0.1-SNAPSHOT1">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../Intellij Plugin Testers/Plugin Tester 1.18.1/bundler/libraries/spigot-api-1.19-R0.1-SNAPSHOT.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/../../../Intellij Plugin Testers/Plugin Tester 1.19/bundler/libraries/spigot-api-1.19-R0.1-SNAPSHOT.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
@ -7,7 +7,7 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="temurin-1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -10,7 +10,7 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/resource_example" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="jdk" jdkName="temurin-1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="HeadDatabaseAPI" level="project" />
|
||||
<orderEntry type="library" name="TokenManager-3.2.4" level="project" />
|
||||
@ -25,12 +25,12 @@
|
||||
<orderEntry type="library" name="spigot-1.13.2" level="project" />
|
||||
<orderEntry type="library" name="spigot" level="project" />
|
||||
<orderEntry type="library" name="CoinsAPI 1.8.9" level="project" />
|
||||
<orderEntry type="library" name="spigot-api-1.19-R0.1-SNAPSHOT1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-text-minimessage:4.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-api:4.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:adventure-key:4.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:examination-api:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.kyori:examination-string:1.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jetbrains:annotations:23.0.0" level="project" />
|
||||
<orderEntry type="library" name="spigot-api-1.19-R0.1-SNAPSHOT" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -20,7 +20,7 @@ config:
|
||||
update-notifications: true
|
||||
panel-snooper: false
|
||||
format:
|
||||
tag: '&6[&bCommandPanels&6]'
|
||||
tag: '&6[&bCommandPanels&6] '
|
||||
perms: '&cNo permission.'
|
||||
reload: '&aReloaded.'
|
||||
nopanel: '&cPanel not found.'
|
||||
@ -48,7 +48,7 @@ placeholders:
|
||||
start: '{'
|
||||
end: '}'
|
||||
updater:
|
||||
auto-update: true
|
||||
auto-update: false
|
||||
minor-updates-only: true
|
||||
update-checks: true
|
||||
purchase:
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: 3.18.0.0
|
||||
version: 3.18.1.0
|
||||
main: me.rockyhawk.commandpanels.CommandPanels
|
||||
name: CommandPanels
|
||||
author: RockyHawk
|
||||
|
@ -15,6 +15,7 @@ panels:
|
||||
stack: 1
|
||||
name: '&cExit'
|
||||
commands:
|
||||
- event= CommandPanels_EditorClosed
|
||||
- cpc
|
||||
'4':
|
||||
material: CHEST
|
||||
@ -28,11 +29,11 @@ panels:
|
||||
name: '&fItem Settings'
|
||||
commands:
|
||||
- "event= CommandPanels_OpenItemSettings"
|
||||
'8':
|
||||
material: COMPASS
|
||||
stack: 1
|
||||
name: '&fItem Sections'
|
||||
lore:
|
||||
- "&cIN PROGRESS"
|
||||
commands:
|
||||
- "event= CommandPanels_OpenItemSections"
|
||||
#'8':
|
||||
# material: COMPASS
|
||||
# stack: 1
|
||||
# name: '&fItem Sections'
|
||||
# lore:
|
||||
# - "&cIN PROGRESS"
|
||||
# commands:
|
||||
# - "event= CommandPanels_OpenItemSections"
|
@ -79,7 +79,7 @@ panels:
|
||||
- cpc
|
||||
player-input:
|
||||
- "event= CPEditor_itemnbt %cp-player-input%"
|
||||
'0':
|
||||
'18':
|
||||
material: LAVA_BUCKET
|
||||
name: '&cDelete Item'
|
||||
lore:
|
||||
@ -98,7 +98,7 @@ panels:
|
||||
- cpc
|
||||
player-input:
|
||||
- "event= CPEditor_itemslot %cp-player-input%"
|
||||
'18':
|
||||
'0':
|
||||
material: ENDER_CHEST
|
||||
name: '&fMove Item'
|
||||
lore:
|
||||
|
@ -86,6 +86,16 @@ public class Utils implements Listener {
|
||||
//the panels proper position
|
||||
panel = plugin.openPanels.getOpenPanel(p.getName(),position);
|
||||
|
||||
//this will cancel click on editor open and then change the slot clicked
|
||||
if(plugin.editorMain.settings.containsKey(p.getUniqueId())) {
|
||||
if (plugin.editorMain.settings.get(p.getUniqueId()).hasEditorOpen && position == PanelPosition.Top) {
|
||||
plugin.editorMain.settings.get(p.getUniqueId()).slotSelected = String.valueOf(e.getSlot());
|
||||
plugin.editorMain.openGuiPage(plugin.editorMain.settings.get(p.getUniqueId()).menuOpen, p, PanelPosition.Middle);
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//this loops through all the items in the panel
|
||||
boolean foundSlot = false;
|
||||
for(String slot : Objects.requireNonNull(panel.getConfig().getConfigurationSection("item")).getKeys(false)){
|
||||
|
@ -6,7 +6,6 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
public class SerializerUtils {
|
||||
|
||||
public static Component serializeText(String msg){
|
||||
Component parsedText = MiniMessage.miniMessage().deserialize(msg);
|
||||
return parsedText;
|
||||
return MiniMessage.miniMessage().deserialize(msg);
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,9 @@ public class Commandpanelsreload implements CommandExecutor {
|
||||
//reloadHotbarSlots
|
||||
plugin.hotbar.reloadHotbarSlots();
|
||||
|
||||
//reload tag
|
||||
plugin.tag = plugin.tex.colour(plugin.config.getString("config.format.tag"));
|
||||
|
||||
//add custom commands to commands.yml
|
||||
if(plugin.config.getString("config.auto-register-commands").equalsIgnoreCase("true")) {
|
||||
registerCommands();
|
||||
|
@ -66,7 +66,7 @@ public class SpecialTags implements Listener {
|
||||
plugin.openPanels.closePanelForLoader(e.p.getName(),PanelPosition.Bottom);
|
||||
}else if(position == PanelPosition.Top && plugin.openPanels.hasPanelOpen(e.p.getName(),position)){
|
||||
//closing top closes all
|
||||
e.p.closeInventory();
|
||||
plugin.commandTags.runCommand(e.panel,e.pos,e.p,"cpc");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import me.rockyhawk.commandpanels.classresources.SerializerUtils;
|
||||
import me.rockyhawk.commandpanels.commandtags.CommandTagEvent;
|
||||
import me.rockyhawk.commandpanels.ioclasses.legacy.MinecraftVersions;
|
||||
import me.rockyhawk.commandpanels.openpanelsmanager.PanelOpenType;
|
||||
import me.rockyhawk.commandpanels.openpanelsmanager.PanelPosition;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -24,8 +25,18 @@ public class BasicTags implements Listener {
|
||||
public void commandTag(CommandTagEvent e){
|
||||
if(e.name.equalsIgnoreCase("cpc")){
|
||||
e.commandTagUsed();
|
||||
|
||||
//unclosable panels are at the Top only
|
||||
if(plugin.openPanels.getOpenPanel(e.p.getName(),PanelPosition.Top).getConfig().contains("panelType")){
|
||||
if(plugin.openPanels.getOpenPanel(e.p.getName(),PanelPosition.Top).getConfig().getStringList("panelType").contains("unclosable")){
|
||||
plugin.openPanels.closePanelForLoader(e.p.getName(),PanelPosition.Top);
|
||||
plugin.openPanels.skipPanelClose.add(e.p.getName());
|
||||
}
|
||||
}
|
||||
|
||||
//this will close the current inventory
|
||||
e.p.closeInventory();
|
||||
plugin.openPanels.skipPanelClose.remove(e.p.getName());
|
||||
return;
|
||||
}
|
||||
if(e.name.equalsIgnoreCase("refresh")) {
|
||||
|
@ -195,7 +195,11 @@ public class CPEventHandler implements Listener {
|
||||
panel.getConfig().set("title", playerInput);
|
||||
break;
|
||||
case "panelrows":
|
||||
panel.getConfig().set("rows", playerInput);
|
||||
if(isNumeric(playerInput)){
|
||||
panel.getConfig().set("rows", Integer.parseInt(playerInput));
|
||||
}else {
|
||||
panel.getConfig().set("rows", playerInput);
|
||||
}
|
||||
break;
|
||||
case "panelrefreshdelay":
|
||||
panel.getConfig().set("refresh-delay", playerInput);
|
||||
|
@ -56,7 +56,6 @@ public class GenUtils implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
void generatePanel(Player p, Inventory inv){
|
||||
ArrayList<String> apanels = new ArrayList();
|
||||
for(Panel panel : plugin.panelList){
|
||||
|
@ -77,18 +77,26 @@ public class OpenPanelsLoader {
|
||||
|
||||
//close all of the panels for a player currently open
|
||||
public void closePanelForLoader(String playerName, PanelPosition position){
|
||||
if(!openPanels.containsKey(playerName) || skipPanelClose.contains(playerName)){
|
||||
//close if not panel
|
||||
if(!plugin.openPanels.openPanels.containsKey(playerName) || plugin.openPanels.skipPanelClose.contains(playerName)){
|
||||
return;
|
||||
}
|
||||
panelCloseCommands(playerName,position,openPanels.get(playerName).getPanel(position));
|
||||
|
||||
//snooper
|
||||
if (plugin.config.contains("config.panel-snooper")) {
|
||||
if (Objects.requireNonNull(plugin.config.getString("config.panel-snooper")).equalsIgnoreCase("true")) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels] " + playerName + " Closed " + openPanels.get(playerName).getPanel(position).getName() + " at " + position);
|
||||
}
|
||||
}
|
||||
|
||||
//panel instance
|
||||
Panel panel = openPanels.get(playerName).getPanel(position);
|
||||
|
||||
//run close commands once panel is closed
|
||||
panelCloseCommands(playerName,position,panel);
|
||||
|
||||
//fire PanelClosedEvent
|
||||
PanelClosedEvent closedEvent = new PanelClosedEvent(Bukkit.getPlayer(playerName),openPanels.get(playerName).getPanel(position),position);
|
||||
PanelClosedEvent closedEvent = new PanelClosedEvent(Bukkit.getPlayer(playerName),panel,position);
|
||||
Bukkit.getPluginManager().callEvent(closedEvent);
|
||||
|
||||
openPanels.get(playerName).setPanel(null,position);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.rockyhawk.commandpanels.openpanelsmanager;
|
||||
|
||||
import me.realized.tokenmanager.command.commands.subcommands.TopCommand;
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.api.Panel;
|
||||
import me.rockyhawk.commandpanels.api.PanelClosedEvent;
|
||||
@ -40,7 +41,34 @@ public class UtilsPanelsLoader implements Listener {
|
||||
//tell panel loader that player has closed the panel (there is also one of these in EditorUtils)
|
||||
@EventHandler
|
||||
public void onPlayerClosePanel(InventoryCloseEvent e){
|
||||
//only do this if editor is disabled as it will disabled this code
|
||||
String playerName = e.getPlayer().getName();
|
||||
|
||||
//close if not panel
|
||||
if(!plugin.openPanels.openPanels.containsKey(playerName) || plugin.openPanels.skipPanelClose.contains(playerName)){
|
||||
return;
|
||||
}
|
||||
|
||||
//check for panelType unclosable (unclosable is Top only)
|
||||
if(plugin.openPanels.getOpenPanel(playerName,PanelPosition.Top).getConfig().contains("panelType")){
|
||||
if(plugin.openPanels.getOpenPanel(playerName,PanelPosition.Top).getConfig().getStringList("panelType").contains("unclosable")){
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
public void run() {
|
||||
plugin.openPanels.getOpenPanel(playerName,PanelPosition.Top).open(Bukkit.getPlayer(playerName), PanelPosition.Top);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//run commands-on-close for panels
|
||||
if(plugin.openPanels.hasPanelOpen(e.getPlayer().getName(),PanelPosition.Bottom)){
|
||||
plugin.openPanels.panelCloseCommands(playerName,PanelPosition.Bottom,plugin.openPanels.getOpenPanel(playerName,PanelPosition.Bottom));
|
||||
}
|
||||
if(plugin.openPanels.hasPanelOpen(e.getPlayer().getName(),PanelPosition.Middle)){
|
||||
plugin.openPanels.panelCloseCommands(playerName,PanelPosition.Middle,plugin.openPanels.getOpenPanel(playerName,PanelPosition.Middle));
|
||||
}
|
||||
|
||||
//close panels and run commands for Top panel
|
||||
plugin.openPanels.closePanelForLoader(e.getPlayer().getName(),PanelPosition.Top);
|
||||
}
|
||||
|
||||
|
@ -64,9 +64,8 @@ public class Commandpanelblocks implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
//make the material name look okay
|
||||
String materialNameFormatted = blockType.getType().toString().substring(0, 1).toUpperCase() + blockType.getType().toString().substring(1).toLowerCase();
|
||||
materialNameFormatted = materialNameFormatted.replaceAll("_"," ");
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag + ChatColor.WHITE + args[1] + ChatColor.GREEN + " will now open when right clicking " + ChatColor.WHITE + materialNameFormatted));
|
||||
String coordinates = blockLocation.getBlockX() + ", " + blockLocation.getBlockY() + ", " + blockLocation.getBlockZ();
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag + ChatColor.WHITE + args[1] + ChatColor.GREEN + "will now open when right clicking a block in the coordinates " + ChatColor.WHITE + coordinates));
|
||||
}else{
|
||||
sender.sendMessage(plugin.tex.colour(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
}
|
||||
|
@ -3,11 +3,11 @@ package me.rockyhawk.commandpanels.panelblocks;
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.openpanelsmanager.PanelPosition;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
@ -17,41 +17,50 @@ public class PanelBlockOnClick implements Listener {
|
||||
public PanelBlockOnClick(CommandPanels pl) {
|
||||
this.plugin = pl;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent e){
|
||||
if(e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock() != null) {
|
||||
e.setCancelled(blockClickEventTrigger(e.getClickedBlock().getLocation(), e.getPlayer()));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteractEntity(PlayerInteractEntityEvent e){
|
||||
if(!e.getPlayer().isSneaking()) {
|
||||
e.setCancelled(blockClickEventTrigger(e.getRightClicked().getLocation().getBlock().getLocation(), e.getPlayer()));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean blockClickEventTrigger(Location location, Player p){
|
||||
//if panel blocks are disabled return
|
||||
if(Objects.requireNonNull(plugin.config.getString("config.panel-blocks")).equalsIgnoreCase("false")){
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if(e.getAction() != Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
Block block = e.getClickedBlock();
|
||||
Player p = e.getPlayer();
|
||||
assert block != null;
|
||||
if(!plugin.blockConfig.contains("blocks")){
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if(plugin.openPanels.hasPanelOpen(p.getName(), PanelPosition.Top)) {
|
||||
//some blocks run this event twice, skip if panel already open
|
||||
//as blocks cannot be clicked obviously if a panel is open
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
for (String configLocation : Objects.requireNonNull(plugin.blockConfig.getConfigurationSection("blocks")).getKeys(false)) {
|
||||
String[] loc = configLocation.split("_");
|
||||
Location tempLocation = new Location(plugin.getServer().getWorld(loc[0].replaceAll("%dash%","_")),Double.parseDouble(loc[1]),Double.parseDouble(loc[2]),Double.parseDouble(loc[3]));
|
||||
if(tempLocation.equals(block.getLocation())){
|
||||
e.setCancelled(true);
|
||||
if(tempLocation.equals(location)){
|
||||
if(plugin.blockConfig.contains("blocks." + configLocation + ".commands")){
|
||||
for(String command : plugin.blockConfig.getStringList("blocks." + configLocation + ".commands")){
|
||||
plugin.commandTags.runCommand(null,PanelPosition.Top,p, command);
|
||||
}
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
//uses the open= tag because it will open a panel with panel names, but also works with open= features like placeholders
|
||||
String command = "open= " + plugin.blockConfig.getString("blocks." + configLocation + ".panel");
|
||||
plugin.commandTags.runCommand(null,PanelPosition.Top,p, command);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user