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
|
||||
name: CommandPanels
|
||||
author: RockyHawk
|
||||
|
@ -54,6 +54,7 @@ public class commandpanels extends JavaPlugin {
|
||||
public Economy econ = null;
|
||||
public boolean update = 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[]> userInputStrings = 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")) {
|
||||
//change the stack amount
|
||||
s.setAmount(Integer.parseInt(Objects.requireNonNull(pconfig.getString("panels." + panels + ".item." + item.split("\\s")[c] + section + ".stack"))));
|
||||
//change the stack amount (placeholders accepted)
|
||||
s.setAmount(Integer.parseInt(Objects.requireNonNull(papi(p,pconfig.getString("panels." + panels + ".item." + item.split("\\s")[c] + section + ".stack")))));
|
||||
}
|
||||
} catch (IllegalArgumentException | NullPointerException var33) {
|
||||
debug(var33);
|
||||
@ -1145,6 +1146,17 @@ public class commandpanels extends JavaPlugin {
|
||||
}
|
||||
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) {
|
||||
this.getServer().getConsoleSender().sendMessage("[CommandPanels] No panels found to load!");
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
package me.rockyhawk.commandPanels.commands;
|
||||
|
||||
import me.rockyhawk.commandPanels.commandpanels;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
public class commandpanelsreload implements CommandExecutor {
|
||||
commandpanels plugin;
|
||||
|
@ -26,6 +26,10 @@ public class utils implements Listener {
|
||||
@EventHandler
|
||||
public void onAnyClick(InventoryClickEvent e) {
|
||||
//on a click when in any inventory
|
||||
if(!plugin.openWithItem){
|
||||
//if none of the panels have open-with-item
|
||||
return;
|
||||
}
|
||||
ItemStack clicked = e.getCurrentItem();
|
||||
Player p = (Player)e.getWhoClicked();
|
||||
//get the item clicked, then loop through panel names after action isn't nothing
|
||||
@ -282,6 +286,10 @@ public class utils implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerUse(PlayerInteractEvent e){
|
||||
//item right or left clicked
|
||||
if(!plugin.openWithItem){
|
||||
//if none of the panels have open-with-item
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if(e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK && Objects.requireNonNull(e.getItem()).getType() == Material.AIR){
|
||||
return;
|
||||
@ -294,9 +302,11 @@ public class utils implements Listener {
|
||||
}
|
||||
ItemStack clicked = e.getItem();
|
||||
Player p = e.getPlayer();
|
||||
YamlConfiguration tempFile;
|
||||
String tempName;
|
||||
for(String[] panelName : plugin.panelNames){
|
||||
YamlConfiguration tempFile = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(panelName[1]))));
|
||||
String tempName = panelName[0];
|
||||
tempFile = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(panelName[1]))));
|
||||
tempName = panelName[0];
|
||||
if(tempFile.contains("panels." + tempName + ".open-with-item")) {
|
||||
try{
|
||||
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
|
||||
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();
|
||||
try {
|
||||
if (plugin.panelFiles == null) {
|
||||
@ -377,6 +391,10 @@ public class utils implements Listener {
|
||||
}
|
||||
@EventHandler
|
||||
public void onPlayerRespawn(PlayerRespawnEvent e){
|
||||
if(!plugin.openWithItem){
|
||||
//if none of the panels have open-with-item
|
||||
return;
|
||||
}
|
||||
Player p = e.getPlayer();
|
||||
try {
|
||||
if (plugin.panelFiles == null) {
|
||||
@ -420,6 +438,10 @@ public class utils implements Listener {
|
||||
}
|
||||
@EventHandler
|
||||
public void onPlayerDeath(PlayerDeathEvent e){
|
||||
if(!plugin.openWithItem){
|
||||
//if none of the panels have open-with-item
|
||||
return;
|
||||
}
|
||||
Player p = (Player)e.getEntity();
|
||||
try {
|
||||
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/");
|
||||
}
|
||||
}
|
||||
if(!plugin.openWithItem){
|
||||
//if none of the panels have open-with-item
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (plugin.panelFiles == null) {
|
||||
return;
|
||||
@ -524,6 +550,10 @@ public class utils implements Listener {
|
||||
}
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent e){
|
||||
if(!plugin.openWithItem){
|
||||
//if none of the panels have open-with-item
|
||||
return;
|
||||
}
|
||||
//if item dropped
|
||||
Player p = e.getPlayer();
|
||||
try {
|
||||
@ -573,6 +603,10 @@ public class utils implements Listener {
|
||||
}
|
||||
@EventHandler
|
||||
public void onPlayerSwapHandItemsEvent(PlayerSwapHandItemsEvent e){
|
||||
if(!plugin.openWithItem){
|
||||
//if none of the panels have open-with-item
|
||||
return;
|
||||
}
|
||||
Player p = e.getPlayer();
|
||||
try {
|
||||
if (plugin.panelFiles == null) {
|
||||
@ -620,6 +654,10 @@ public class utils implements Listener {
|
||||
}
|
||||
@EventHandler
|
||||
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)
|
||||
Player p = (Player)e.getPlayer();
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user