forked from Upstream/CommandPanels
3.3.1 Updates
This commit is contained in:
parent
665bc5cb75
commit
21c2a01e7a
@ -1,4 +1,4 @@
|
|||||||
version: 3.3.0
|
version: 3.3.1
|
||||||
main: me.rockyhawk.commandPanels.commandpanels
|
main: me.rockyhawk.commandPanels.commandpanels
|
||||||
name: CommandPanels
|
name: CommandPanels
|
||||||
author: RockyHawk
|
author: RockyHawk
|
||||||
|
@ -54,6 +54,7 @@ public class commandpanels extends JavaPlugin {
|
|||||||
public Economy econ = null;
|
public Economy econ = null;
|
||||||
public boolean update = false;
|
public boolean update = false;
|
||||||
public boolean debug = false;
|
public boolean debug = false;
|
||||||
|
public boolean openWithItem = false; //this will be true if there is a panel with open-with-item
|
||||||
public List<String> panelRunning = new ArrayList();
|
public List<String> panelRunning = new ArrayList();
|
||||||
public List<String[]> userInputStrings = new ArrayList();
|
public List<String[]> userInputStrings = new ArrayList();
|
||||||
public List<String[]> editorInputStrings = new ArrayList();
|
public List<String[]> editorInputStrings = new ArrayList();
|
||||||
@ -415,8 +416,8 @@ public class commandpanels extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pconfig.contains("panels." + panels + ".item." + item.split("\\s")[c] + section + ".stack")) {
|
if (pconfig.contains("panels." + panels + ".item." + item.split("\\s")[c] + section + ".stack")) {
|
||||||
//change the stack amount
|
//change the stack amount (placeholders accepted)
|
||||||
s.setAmount(Integer.parseInt(Objects.requireNonNull(pconfig.getString("panels." + panels + ".item." + item.split("\\s")[c] + section + ".stack"))));
|
s.setAmount(Integer.parseInt(Objects.requireNonNull(papi(p,pconfig.getString("panels." + panels + ".item." + item.split("\\s")[c] + section + ".stack")))));
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException | NullPointerException var33) {
|
} catch (IllegalArgumentException | NullPointerException var33) {
|
||||||
debug(var33);
|
debug(var33);
|
||||||
@ -1145,6 +1146,17 @@ public class commandpanels extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
//this bit will set openWithItem to false/true upson reload
|
||||||
|
YamlConfiguration tempFile;
|
||||||
|
String tempName;
|
||||||
|
openWithItem = false;
|
||||||
|
for(String[] panelName : panelNames){
|
||||||
|
tempFile = YamlConfiguration.loadConfiguration(new File(panelsf + File.separator + panelFiles.get(Integer.parseInt(panelName[1]))));
|
||||||
|
tempName = panelName[0];
|
||||||
|
if(tempFile.contains("panels." + tempName + ".open-with-item")) {
|
||||||
|
openWithItem = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (NullPointerException noPanels) {
|
} catch (NullPointerException noPanels) {
|
||||||
this.getServer().getConsoleSender().sendMessage("[CommandPanels] No panels found to load!");
|
this.getServer().getConsoleSender().sendMessage("[CommandPanels] No panels found to load!");
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
package me.rockyhawk.commandPanels.commands;
|
package me.rockyhawk.commandPanels.commands;
|
||||||
|
|
||||||
import me.rockyhawk.commandPanels.commandpanels;
|
import me.rockyhawk.commandPanels.commandpanels;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class commandpanelsreload implements CommandExecutor {
|
public class commandpanelsreload implements CommandExecutor {
|
||||||
commandpanels plugin;
|
commandpanels plugin;
|
||||||
|
@ -26,6 +26,10 @@ public class utils implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onAnyClick(InventoryClickEvent e) {
|
public void onAnyClick(InventoryClickEvent e) {
|
||||||
//on a click when in any inventory
|
//on a click when in any inventory
|
||||||
|
if(!plugin.openWithItem){
|
||||||
|
//if none of the panels have open-with-item
|
||||||
|
return;
|
||||||
|
}
|
||||||
ItemStack clicked = e.getCurrentItem();
|
ItemStack clicked = e.getCurrentItem();
|
||||||
Player p = (Player)e.getWhoClicked();
|
Player p = (Player)e.getWhoClicked();
|
||||||
//get the item clicked, then loop through panel names after action isn't nothing
|
//get the item clicked, then loop through panel names after action isn't nothing
|
||||||
@ -282,6 +286,10 @@ public class utils implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerUse(PlayerInteractEvent e){
|
public void onPlayerUse(PlayerInteractEvent e){
|
||||||
//item right or left clicked
|
//item right or left clicked
|
||||||
|
if(!plugin.openWithItem){
|
||||||
|
//if none of the panels have open-with-item
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if(e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK && Objects.requireNonNull(e.getItem()).getType() == Material.AIR){
|
if(e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK && Objects.requireNonNull(e.getItem()).getType() == Material.AIR){
|
||||||
return;
|
return;
|
||||||
@ -294,9 +302,11 @@ public class utils implements Listener {
|
|||||||
}
|
}
|
||||||
ItemStack clicked = e.getItem();
|
ItemStack clicked = e.getItem();
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
|
YamlConfiguration tempFile;
|
||||||
|
String tempName;
|
||||||
for(String[] panelName : plugin.panelNames){
|
for(String[] panelName : plugin.panelNames){
|
||||||
YamlConfiguration tempFile = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(panelName[1]))));
|
tempFile = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(panelName[1]))));
|
||||||
String tempName = panelName[0];
|
tempName = panelName[0];
|
||||||
if(tempFile.contains("panels." + tempName + ".open-with-item")) {
|
if(tempFile.contains("panels." + tempName + ".open-with-item")) {
|
||||||
try{
|
try{
|
||||||
assert clicked != null;
|
assert clicked != null;
|
||||||
@ -332,6 +342,10 @@ public class utils implements Listener {
|
|||||||
for this to take effect. I don't want to delete the item on the wrong world
|
for this to take effect. I don't want to delete the item on the wrong world
|
||||||
because then it might overwrite one of their actual slots upon rejoining the enabled world.
|
because then it might overwrite one of their actual slots upon rejoining the enabled world.
|
||||||
*/
|
*/
|
||||||
|
if(!plugin.openWithItem){
|
||||||
|
//if none of the panels have open-with-item
|
||||||
|
return;
|
||||||
|
}
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
try {
|
try {
|
||||||
if (plugin.panelFiles == null) {
|
if (plugin.panelFiles == null) {
|
||||||
@ -377,6 +391,10 @@ public class utils implements Listener {
|
|||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent e){
|
public void onPlayerRespawn(PlayerRespawnEvent e){
|
||||||
|
if(!plugin.openWithItem){
|
||||||
|
//if none of the panels have open-with-item
|
||||||
|
return;
|
||||||
|
}
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
try {
|
try {
|
||||||
if (plugin.panelFiles == null) {
|
if (plugin.panelFiles == null) {
|
||||||
@ -420,6 +438,10 @@ public class utils implements Listener {
|
|||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDeath(PlayerDeathEvent e){
|
public void onPlayerDeath(PlayerDeathEvent e){
|
||||||
|
if(!plugin.openWithItem){
|
||||||
|
//if none of the panels have open-with-item
|
||||||
|
return;
|
||||||
|
}
|
||||||
Player p = (Player)e.getEntity();
|
Player p = (Player)e.getEntity();
|
||||||
try {
|
try {
|
||||||
if (plugin.panelFiles == null) {
|
if (plugin.panelFiles == null) {
|
||||||
@ -464,6 +486,10 @@ public class utils implements Listener {
|
|||||||
p.sendMessage(ChatColor.RED + "https://www.spigotmc.org/resources/command-panels-custom-guis.67788/");
|
p.sendMessage(ChatColor.RED + "https://www.spigotmc.org/resources/command-panels-custom-guis.67788/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!plugin.openWithItem){
|
||||||
|
//if none of the panels have open-with-item
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (plugin.panelFiles == null) {
|
if (plugin.panelFiles == null) {
|
||||||
return;
|
return;
|
||||||
@ -524,6 +550,10 @@ public class utils implements Listener {
|
|||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent e){
|
public void onPlayerDropItem(PlayerDropItemEvent e){
|
||||||
|
if(!plugin.openWithItem){
|
||||||
|
//if none of the panels have open-with-item
|
||||||
|
return;
|
||||||
|
}
|
||||||
//if item dropped
|
//if item dropped
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
try {
|
try {
|
||||||
@ -573,6 +603,10 @@ public class utils implements Listener {
|
|||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent e){
|
public void onPlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent e){
|
||||||
|
if(!plugin.openWithItem){
|
||||||
|
//if none of the panels have open-with-item
|
||||||
|
return;
|
||||||
|
}
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
try {
|
try {
|
||||||
if (plugin.panelFiles == null) {
|
if (plugin.panelFiles == null) {
|
||||||
@ -620,6 +654,10 @@ public class utils implements Listener {
|
|||||||
}
|
}
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInteractEntity(PlayerInteractEntityEvent e){
|
public void onInteractEntity(PlayerInteractEntityEvent e){
|
||||||
|
if(!plugin.openWithItem){
|
||||||
|
//if none of the panels have open-with-item
|
||||||
|
return;
|
||||||
|
}
|
||||||
//cancel everything if holding item (item frames eg)
|
//cancel everything if holding item (item frames eg)
|
||||||
Player p = (Player)e.getPlayer();
|
Player p = (Player)e.getPlayer();
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user