forked from Upstream/CommandPanels
v3.13.1
This commit is contained in:
parent
b72dcb4956
commit
b6afddae20
@ -6,7 +6,6 @@
|
||||
panels:
|
||||
example:
|
||||
perm: admin
|
||||
panelType: default
|
||||
rows: 4
|
||||
title: '&6[&bExample Panel&6]&f Welcome!'
|
||||
commands:
|
||||
|
@ -6,7 +6,6 @@
|
||||
panels:
|
||||
example:
|
||||
perm: admin
|
||||
panelType: default
|
||||
rows: 4
|
||||
title: '&6[&bExample Panel&6]&f Welcome!'
|
||||
commands:
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: 3.13.0
|
||||
version: 3.13.1
|
||||
main: me.rockyhawk.commandpanels.CommandPanels
|
||||
name: CommandPanels
|
||||
author: RockyHawk
|
||||
|
@ -224,6 +224,22 @@ public class OpenEditorGuis {
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Commands", lore, p,true, true);
|
||||
i.setItem(15, temp);
|
||||
|
||||
temp = new ItemStack(Material.STRING, 1);
|
||||
lore.clear();
|
||||
lore.add(ChatColor.GRAY + "Special panel types");
|
||||
lore.add(ChatColor.GRAY + "- Left click to add panel type");
|
||||
lore.add(ChatColor.GRAY + "- Right click to remove panel type");
|
||||
if (cf.contains("panelType")) {
|
||||
lore.add(ChatColor.WHITE + "-----------------------------");
|
||||
int count = 1;
|
||||
for (String tempLore : cf.getStringList("panelType")) {
|
||||
lore.add(ChatColor.WHITE + Integer.toString(count) + ") " + tempLore);
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Panel Types", lore, p,true, true);
|
||||
i.setItem(17, temp);
|
||||
|
||||
temp = new ItemStack(Material.ITEM_FRAME, 1);
|
||||
lore.clear();
|
||||
lore.add(ChatColor.GRAY + "Code name to open panel");
|
||||
|
@ -11,7 +11,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class Commandpanel implements CommandExecutor {
|
||||
CommandPanels plugin;
|
||||
@ -42,6 +41,12 @@ public class Commandpanel implements CommandExecutor {
|
||||
sender.sendMessage(plugin.papi(tag + plugin.config.getString("config.format.nopanel")));
|
||||
return true;
|
||||
}
|
||||
if(cf.contains("panelType")) {
|
||||
if (cf.getStringList("panelType").contains("nocommand")) {
|
||||
//do not allow command with noCommand
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//below will start the command, once it got the right file and panel
|
||||
if (cmd.getName().equalsIgnoreCase("cp") || cmd.getName().equalsIgnoreCase("commandpanel") || cmd.getName().equalsIgnoreCase("cpanel")) {
|
||||
if(!(sender instanceof Player)) {
|
||||
@ -49,19 +54,17 @@ public class Commandpanel implements CommandExecutor {
|
||||
if(args.length == 2){
|
||||
if(!args[1].equals("item")){
|
||||
plugin.openVoids.openCommandPanel(sender,plugin.getServer().getPlayer(args[1]),panelName,cf,true);
|
||||
return true;
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cp <panel> [item] [player]"));
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}else if(args.length == 3){
|
||||
if (args[1].equals("item")) {
|
||||
plugin.openVoids.giveHotbarItem(sender,plugin.getServer().getPlayer(args[2]),cf,true);
|
||||
return true;
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(tag + ChatColor.RED + "Usage: /cp <panel> item [player]"));
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage(plugin.papi( tag + ChatColor.RED + "Please execute command directed to a Player!"));
|
||||
return true;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.rockyhawk.commandpanels.commands;
|
||||
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import me.rockyhawk.commandpanels.customcommands.Commandpanelcustom;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
@ -38,6 +38,13 @@ public class CpTabComplete implements TabCompleter {
|
||||
continue;
|
||||
}
|
||||
if (sender.hasPermission("commandpanel.panel." + temp.getString("panels." + key + ".perm"))) {
|
||||
if(temp.contains("panels." + key + ".panelType")) {
|
||||
if (temp.getStringList("panels." + key + ".panelType").contains("nocommand")) {
|
||||
//do not allow command with noCommand
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (temp.contains("panels." + key + ".disabled-worlds")) {
|
||||
List<String> disabledWorlds = temp.getStringList("panels." + key + ".disabled-worlds");
|
||||
if (!disabledWorlds.contains(p.getWorld().getName())) {
|
||||
|
@ -92,7 +92,6 @@ 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 + ".panelType", "default");
|
||||
file.set("panels." + date + ".rows", inv.getSize()/9);
|
||||
file.set("panels." + date + ".title", "&8Generated " + date);
|
||||
file.addDefault("panels." + date + ".command", date);
|
||||
|
@ -42,7 +42,7 @@ public class CpTabCompleteIngame implements TabCompleter {
|
||||
if(temp.contains("panels." + key + ".disabled-worlds")){
|
||||
List<String> disabledWorlds = temp.getStringList("panels." + key + ".disabled-worlds");
|
||||
assert p != null;
|
||||
assert disabledWorlds != null;
|
||||
|
||||
if(!disabledWorlds.contains(p.getWorld().getName())){
|
||||
apanels.add(key);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -222,6 +221,38 @@ public class EditorUserInput implements Listener {
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Sound when opening is now " + tempSound));
|
||||
break;
|
||||
case "panel.panelType.add":
|
||||
List<String> typeAdd = new ArrayList<>();
|
||||
if(cf.contains("panelType")){
|
||||
typeAdd = cf.getStringList("panelType");
|
||||
}
|
||||
typeAdd.add(e.getMessage().toLowerCase());
|
||||
cf.set("panelType", typeAdd);
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Added new panel type: " + e.getMessage().toLowerCase()));
|
||||
break;
|
||||
case "panel.panelType.remove":
|
||||
List<String> typeRemove;
|
||||
if(cf.contains("panelType")){
|
||||
typeRemove = cf.getStringList("panelType");
|
||||
}else{
|
||||
p.sendMessage(plugin.papi( tag + ChatColor.RED + "No types found to remove!"));
|
||||
break;
|
||||
}
|
||||
try {
|
||||
typeRemove.remove(Integer.parseInt(e.getMessage())-1);
|
||||
}catch (Exception ex){
|
||||
p.sendMessage(plugin.papi( tag + ChatColor.RED + "Could not find type!"));
|
||||
break;
|
||||
}
|
||||
if(typeRemove.size() == 0){
|
||||
cf.set("panelType", null);
|
||||
}else{
|
||||
cf.set("panelType", typeRemove);
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( tag + ChatColor.GREEN + "Removed panel type " + e.getMessage()));
|
||||
break;
|
||||
case "panel.commands.add":
|
||||
List<String> commandsAdd = new ArrayList<>();
|
||||
if(cf.contains("commands")){
|
||||
|
@ -429,6 +429,17 @@ public class EditorUtils implements Listener {
|
||||
}
|
||||
p.closeInventory();
|
||||
}
|
||||
if(e.getSlot() == 17){
|
||||
//adds abilities to add and remove types
|
||||
if(e.getClick().isLeftClick()) {
|
||||
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.panelType.add"});
|
||||
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter New Panel type"));
|
||||
}else{
|
||||
plugin.editorInputStrings.add(new String[]{p.getName(), panelName, "panel.panelType.remove"});
|
||||
p.sendMessage(plugin.papi(tag + ChatColor.WHITE + "Enter Panel Type to remove (must be an integer)"));
|
||||
}
|
||||
p.closeInventory();
|
||||
}
|
||||
if(e.getSlot() == 25){
|
||||
//adds abilities to add and remove lines
|
||||
if(e.getClick().isLeftClick()) {
|
||||
|
@ -48,7 +48,7 @@ public class Commandpanelrefresher implements Listener {
|
||||
}
|
||||
|
||||
if(cf.contains("panelType")) {
|
||||
if (cf.getString("panelType").equalsIgnoreCase("temporary")) {
|
||||
if (cf.getStringList("panelType").contains("static")) {
|
||||
//do not update temporary panels, only default panels
|
||||
return;
|
||||
}
|
||||
|
@ -4,9 +4,6 @@ package me.rockyhawk.commandpanels.ioclasses;
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.io.input.CharSequenceReader;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -4,9 +4,6 @@ package me.rockyhawk.commandpanels.ioclasses;
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import org.bukkit.craftbukkit.libs.org.apache.commons.io.IOUtils;
|
||||
import org.bukkit.craftbukkit.libs.org.apache.commons.io.input.CharSequenceReader;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -9,7 +9,6 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user