forked from Upstream/CommandPanels
v3.15.1.3
This commit is contained in:
parent
3dc7758bc2
commit
9dd653f1bb
@ -1,4 +1,4 @@
|
||||
version: 3.15.1.2
|
||||
version: 3.15.1.3
|
||||
main: me.rockyhawk.commandpanels.CommandPanels
|
||||
name: CommandPanels
|
||||
author: RockyHawk
|
||||
|
@ -1,6 +1,7 @@
|
||||
package me.rockyhawk.commandpanels;
|
||||
|
||||
import me.rockyhawk.commandpanels.api.Panel;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -132,8 +133,19 @@ public class Utils implements Listener {
|
||||
} catch (Exception mate) {
|
||||
commands.set(i, commands.get(i).replaceAll("%cp-clicked%", "Air"));
|
||||
}
|
||||
|
||||
//end custom command PlaceHolders
|
||||
String command = plugin.papi(p,commands.get(i));
|
||||
|
||||
//do placeholders
|
||||
String command;
|
||||
if(commands.get(i).split("\\s")[0].equalsIgnoreCase("nopapi=")){
|
||||
//won't parse PAPI placeholders
|
||||
command = plugin.papi(plugin.placeholders.setCpPlaceholders(p,commands.get(i))).replace("nopapi=","").trim();
|
||||
}else{
|
||||
//will parse every placeholder
|
||||
command = plugin.papi(p,commands.get(i));
|
||||
}
|
||||
|
||||
int val = plugin.commandTags.commandPayWall(p,command);
|
||||
if(val == 0){
|
||||
return;
|
||||
|
@ -29,7 +29,7 @@ public class Commandpanelsgenerate implements CommandExecutor {
|
||||
//command /cpg
|
||||
try {
|
||||
if (Integer.parseInt(args[0]) >= 1 && Integer.parseInt(args[0]) <= 6) {
|
||||
Inventory i = Bukkit.createInventory((InventoryHolder) null, Integer.parseInt(args[0]) * 9, "Generate New Panel");
|
||||
Inventory i = Bukkit.createInventory(null, Integer.parseInt(args[0]) * 9, "Generate New Panel");
|
||||
p.openInventory(i);
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Please use integer from 1-6."));
|
||||
|
@ -32,7 +32,7 @@ public class GenUtils implements Listener {
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent e) {
|
||||
Player p = (Player)e.getPlayer();
|
||||
if (!ChatColor.stripColor(e.getView().getTitle()).equals("Generate New Panel")){
|
||||
if(!ChatColor.stripColor(e.getView().getTitle()).equals("Generate New Panel")){
|
||||
return;
|
||||
}
|
||||
//reload panel files to avoid conflicts
|
||||
@ -56,7 +56,7 @@ public class GenUtils implements Listener {
|
||||
public void onInventoryOpenEvent(InventoryOpenEvent e) {
|
||||
HumanEntity h = e.getPlayer();
|
||||
Player p = Bukkit.getPlayer(h.getName());
|
||||
if ((e.getInventory().getHolder() instanceof Chest || e.getInventory().getHolder() instanceof DoubleChest) && this.plugin.generateMode.contains(p)) {
|
||||
if (this.plugin.generateMode.contains(p)) {
|
||||
this.plugin.generateMode.remove(p);
|
||||
generatePanel(p,e.getInventory());
|
||||
}
|
||||
@ -91,7 +91,13 @@ public class GenUtils implements Listener {
|
||||
File folder = new File(plugin.getDataFolder() + File.separator + "panels");
|
||||
file = YamlConfiguration.loadConfiguration(new File(folder + File.separator + date + ".yml"));
|
||||
file.set("panels." + date + ".perm", "default");
|
||||
file.set("panels." + date + ".rows", inv.getSize()/9);
|
||||
|
||||
if(inv.getHolder() instanceof Chest || inv.getHolder() instanceof DoubleChest){
|
||||
file.set("panels." + date + ".rows", inv.getSize()/9);
|
||||
}else{
|
||||
file.set("panels." + date + ".rows", inv.getType().toString());
|
||||
}
|
||||
|
||||
file.set("panels." + date + ".title", "&8Generated " + date);
|
||||
file.addDefault("panels." + date + ".command", date);
|
||||
if(plugin.legacy.isLegacy()) {
|
||||
|
@ -35,11 +35,12 @@ public class UtilsOpenWithItem implements Listener {
|
||||
//get the item clicked, then loop through panel names after action isn't nothing
|
||||
if(e.getAction() == InventoryAction.NOTHING){return;}
|
||||
if(e.getSlot() == -999){return;}
|
||||
if(e.getClickedInventory().getType() != InventoryType.PLAYER){return;}
|
||||
if(plugin.hotbar.stationaryExecute(e.getSlot(),p,true)){
|
||||
e.setCancelled(true);
|
||||
p.updateInventory();
|
||||
return;
|
||||
if(e.getClickedInventory().getType() == InventoryType.PLAYER) {
|
||||
if (plugin.hotbar.stationaryExecute(e.getSlot(), p, true)) {
|
||||
e.setCancelled(true);
|
||||
p.updateInventory();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (plugin.hotbar.itemCheckExecute(e.getCurrentItem(), p, false,true) || plugin.hotbar.itemCheckExecute(e.getCursor(), p, false,true) || plugin.hotbar.stationaryExecute(e.getHotbarButton(), p, false)) {
|
||||
e.setCancelled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user