forked from Upstream/CommandPanels
v3.14.2.3
This commit is contained in:
parent
a0d84c3120
commit
99833c01d4
@ -1,6 +1,6 @@
|
||||
# |------------------------------------------------------------------------
|
||||
# | CommandPanels Config File
|
||||
# | By RockyHawk v4.1
|
||||
# | By RockyHawk v4.2
|
||||
# | https://www.spigotmc.org/resources/command-panels-custom-guis.67788/
|
||||
# |------------------------------------------------------------------------
|
||||
config:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# |------------------------------------------------------------------------
|
||||
# | CommandPanels Example File
|
||||
# | By RockyHawk v2.0
|
||||
# | By RockyHawk v2.1
|
||||
# | https://www.spigotmc.org/resources/command-panels-custom-guis.67788/
|
||||
# |------------------------------------------------------------------------
|
||||
panels:
|
||||
@ -99,7 +99,7 @@ panels:
|
||||
- '&fI will teleport you home!'
|
||||
commands:
|
||||
- home
|
||||
- commandpanels:commandpanelclose
|
||||
- cpc
|
||||
- console= title %cp-player-name% times 20 60 20
|
||||
- console= title %cp-player-name% subtitle {"text":"%cp-player-displayname%","color":"green"}
|
||||
- console= title %cp-player-name% title {"text":"Welcome Home"}
|
||||
@ -109,7 +109,7 @@ panels:
|
||||
potion: INSTANT_HEAL
|
||||
commands:
|
||||
- heal
|
||||
- commandpanels:commandpanelclose
|
||||
- cpc
|
||||
'34':
|
||||
material: REDSTONE_BLOCK
|
||||
name: '&cNo Permission'
|
||||
@ -126,7 +126,7 @@ panels:
|
||||
- '&2to creative mode!'
|
||||
commands:
|
||||
- gamemode creative
|
||||
- commandpanels:commandpanelclose
|
||||
- cpc
|
||||
- console= title %cp-player-name% times 20 60 20
|
||||
- console= title %cp-player-name% subtitle {"text":"You are now in creative mode!","color":"green"}
|
||||
- console= title %cp-player-name% title {"text":"Awesome %cp-player-displayname%"}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# |------------------------------------------------------------------------
|
||||
# | CommandPanels Classic Example File
|
||||
# | By RockyHawk v2.0
|
||||
# | CommandPanels Legacy Example File
|
||||
# | By RockyHawk v2.1
|
||||
# | https://www.spigotmc.org/resources/command-panels-custom-guis.67788/
|
||||
# |------------------------------------------------------------------------
|
||||
panels:
|
||||
@ -101,7 +101,7 @@ panels:
|
||||
- '&fI will teleport you home!'
|
||||
commands:
|
||||
- home
|
||||
- commandpanels:commandpanelclose
|
||||
- cpc
|
||||
- console= title %cp-player-name% times 20 60 20
|
||||
- console= title %cp-player-name% subtitle {"text":"%cp-player-displayname%","color":"green"}
|
||||
- console= title %cp-player-name% title {"text":"Welcome Home"}
|
||||
@ -111,7 +111,7 @@ panels:
|
||||
name: '&5&lInstant Health II'
|
||||
commands:
|
||||
- heal
|
||||
- commandpanels:commandpanelclose
|
||||
- cpc
|
||||
'34':
|
||||
material: REDSTONE_BLOCK
|
||||
name: '&cNo Permission'
|
||||
@ -128,7 +128,7 @@ panels:
|
||||
- '&2to creative mode!'
|
||||
commands:
|
||||
- gamemode creative
|
||||
- commandpanels:commandpanelclose
|
||||
- cpc
|
||||
- console= title %cp-player-name% times 20 60 20
|
||||
- console= title %cp-player-name% subtitle {"text":"You are now in creative mode!","color":"green"}
|
||||
- console= title %cp-player-name% title {"text":"Awesome %cp-player-displayname%"}
|
||||
|
@ -1,4 +1,4 @@
|
||||
version: 3.14.2.2
|
||||
version: 3.14.2.3
|
||||
main: me.rockyhawk.commandpanels.CommandPanels
|
||||
name: CommandPanels
|
||||
author: RockyHawk
|
||||
@ -22,10 +22,6 @@ commands:
|
||||
description: Add or remove panels from blocks being looked at.
|
||||
usage: /commandpanelblock
|
||||
aliases: [cpb, cpanelb]
|
||||
commandpanelclose:
|
||||
description: Close current GUI.
|
||||
usage: /commandpanelclose
|
||||
aliases: [cpc, cpanelc]
|
||||
commandpanelgenerate:
|
||||
description: Generate GUI.
|
||||
usage: /commandpanelgenerate
|
||||
|
@ -127,7 +127,6 @@ public class CommandPanels extends JavaPlugin {
|
||||
Objects.requireNonNull(this.getCommand("commandpanelgenerate")).setExecutor(new Commandpanelsgenerate(this));
|
||||
Objects.requireNonNull(this.getCommand("commandpanelreload")).setExecutor(new Commandpanelsreload(this));
|
||||
Objects.requireNonNull(this.getCommand("commandpaneldebug")).setExecutor(new Commandpanelsdebug(this));
|
||||
Objects.requireNonNull(this.getCommand("commandpanelclose")).setExecutor(new Commandpanelclose(this));
|
||||
Objects.requireNonNull(this.getCommand("commandpanelversion")).setExecutor(new Commandpanelversion(this));
|
||||
Objects.requireNonNull(this.getCommand("commandpaneladdons")).setExecutor(new Commandpanelresources(this));
|
||||
Objects.requireNonNull(this.getCommand("commandpanellist")).setExecutor(new Commandpanelslist(this));
|
||||
@ -561,7 +560,6 @@ public class CommandPanels extends JavaPlugin {
|
||||
if (p.hasPermission("commandpanel.addons")) {
|
||||
p.sendMessage(ChatColor.GOLD + "/cpa " + ChatColor.WHITE + "View downloadable panels for CommandPanels.");
|
||||
}
|
||||
p.sendMessage(ChatColor.GOLD + "/cpc " + ChatColor.WHITE + "Close current GUI.");
|
||||
if (p.hasPermission("commandpanel.generate")) {
|
||||
p.sendMessage(ChatColor.GOLD + "/cpg <rows> " + ChatColor.WHITE + "Generate GUI from popup menu.");
|
||||
}
|
||||
@ -569,7 +567,8 @@ public class CommandPanels extends JavaPlugin {
|
||||
p.sendMessage(ChatColor.GOLD + "/cpv " + ChatColor.WHITE + "Display the current version.");
|
||||
}
|
||||
if (p.hasPermission("commandpanel.update")) {
|
||||
p.sendMessage(ChatColor.GOLD + "/cpv [version:latest:cancel]" + ChatColor.WHITE + "Download an update upon server reload/restart.");
|
||||
p.sendMessage(ChatColor.GOLD + "/cpv latest " + ChatColor.WHITE + "Download the latest update upon server reload/restart.");
|
||||
p.sendMessage(ChatColor.GOLD + "/cpv [version:cancel] " + ChatColor.WHITE + "Download an update upon server reload/restart.");
|
||||
}
|
||||
if (p.hasPermission("commandpanel.edit")) {
|
||||
p.sendMessage(ChatColor.GOLD + "/cpe [panel] " + ChatColor.WHITE + "Edit a panel with the Panel Editor.");
|
||||
|
@ -24,8 +24,9 @@ public class CommandTags {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void commandTags(Player p, String command, String commandRAW) {
|
||||
//set cp placeholders, commandRAW is without placeholders
|
||||
if (command.split("\\s")[0].equalsIgnoreCase("server=")) {
|
||||
//commandRAW is without placeholders
|
||||
switch(command.split("\\s")[0]){
|
||||
case "server=":{
|
||||
//this contacts bungee and tells it to send the server change command
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Connect");
|
||||
@ -33,7 +34,14 @@ public class CommandTags {
|
||||
Player player = Bukkit.getPlayerExact(p.getName());
|
||||
assert player != null;
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("open=")) {
|
||||
break;
|
||||
}
|
||||
case "cpc":{
|
||||
//this will close the current inventory
|
||||
p.closeInventory();
|
||||
break;
|
||||
}
|
||||
case "open=":{
|
||||
//if player uses open= it will open the panel, with the option to add custom placeholders
|
||||
String panelName = commandRAW.split("\\s")[1];
|
||||
String cmd = commandRAW.replace("open= " + panelName,"");
|
||||
@ -55,12 +63,21 @@ public class CommandTags {
|
||||
for(String[] tempName : plugin.panelNames){
|
||||
if(tempName[0].equals(panelName)){
|
||||
ConfigurationSection panelConfig = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(tempName[1])))).getConfigurationSection("panels." + panelName);
|
||||
if(plugin.openPanels.hasPanelOpen(p.getName())) {
|
||||
plugin.openPanels.skipPanels.add(p.getName());
|
||||
}
|
||||
plugin.openVoids.openCommandPanel(p,p,panelName,panelConfig,false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("placeholder=")) {
|
||||
break;
|
||||
}
|
||||
case "console=":{
|
||||
//if player uses console= it will perform command in the console
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("console=", "").trim());
|
||||
break;
|
||||
}
|
||||
case "placeholder=":{
|
||||
//if player uses placeholder= it will only change the placeholders for the panel
|
||||
String panelName = commandRAW.split("\\s")[1];
|
||||
String cmd = commandRAW.replace("placeholder= " + panelName,"");
|
||||
@ -78,7 +95,9 @@ public class CommandTags {
|
||||
i = i+contents.length()-1;
|
||||
}
|
||||
}
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("op=")) {
|
||||
break;
|
||||
}
|
||||
case "op=":{
|
||||
//if player uses op= it will perform command as op
|
||||
boolean isop = p.isOp();
|
||||
try {
|
||||
@ -90,7 +109,9 @@ public class CommandTags {
|
||||
plugin.debug(exc);
|
||||
p.sendMessage(plugin.tag + plugin.papi( plugin.config.getString("config.format.error") + " op=: Error in op command!"));
|
||||
}
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("delay=")) {
|
||||
break;
|
||||
}
|
||||
case "delay=":{
|
||||
//if player uses op= it will perform command as op
|
||||
final int delaySeconds = Integer.parseInt(command.split("\\s")[1]);
|
||||
String finalCommand = command.split("\\s",3)[2];
|
||||
@ -101,10 +122,9 @@ public class CommandTags {
|
||||
this.cancel();
|
||||
}
|
||||
}.runTaskTimer(plugin, 20*delaySeconds, 20); //20 ticks == 1 second
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("console=")) {
|
||||
//if player uses console= it will perform command in the console
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("console=", "").trim());
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("buy=")) {
|
||||
break;
|
||||
}
|
||||
case "buy=":{
|
||||
//if player uses buy= it will be eg. buy= <price> <item> <amount of item> <ID>
|
||||
try {
|
||||
if (plugin.econ != null) {
|
||||
@ -139,7 +159,9 @@ public class CommandTags {
|
||||
plugin.debug(buy);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("tokenbuy=")) {
|
||||
break;
|
||||
}
|
||||
case "tokenbuy=":{
|
||||
//if player uses tokenbuy= it will be eg. tokenbuy= <price> <item> <amount of item> <ID>
|
||||
try {
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("TokenManager")) {
|
||||
@ -177,7 +199,9 @@ public class CommandTags {
|
||||
plugin.debug(buy);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("sell=")) {
|
||||
break;
|
||||
}
|
||||
case "sell=":{
|
||||
//if player uses sell= it will be eg. sell= <cashback> <item> <amount of item> [enchanted:KNOCKBACK:1] [potion:JUMP]
|
||||
try {
|
||||
if (plugin.econ != null) {
|
||||
@ -247,7 +271,9 @@ public class CommandTags {
|
||||
plugin.debug(sell);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("tokensell=")) {
|
||||
break;
|
||||
}
|
||||
case "tokensell=":{
|
||||
//if player uses tokensell= it will be eg. tokensell= <cashback> <item> <amount of item> [enchanted:KNOCKBACK:1] [potion:JUMP]
|
||||
try {
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("TokenManager")) {
|
||||
@ -320,10 +346,14 @@ public class CommandTags {
|
||||
plugin.debug(sell);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("msg=")) {
|
||||
break;
|
||||
}
|
||||
case "msg=":{
|
||||
//if player uses msg= it will send the player a message
|
||||
p.sendMessage(command.replace("msg=", "").trim());
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("sound=")) {
|
||||
break;
|
||||
}
|
||||
case "sound=":{
|
||||
//if player uses sound= it will play a sound (sound= [sound])
|
||||
try {
|
||||
p.playSound(p.getLocation(), Sound.valueOf(command.split("\\s")[1]), 1F, 1F);
|
||||
@ -331,7 +361,37 @@ public class CommandTags {
|
||||
plugin.debug(s);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("tokenbuycommand=")) {
|
||||
break;
|
||||
}
|
||||
case "buycommand=":{
|
||||
//if player uses buycommand [price] [command]
|
||||
try {
|
||||
if (plugin.econ != null) {
|
||||
if (plugin.econ.getBalance(p) >= Double.parseDouble(command.split("\\s")[1])) {
|
||||
plugin.econ.withdrawPlayer(p, Double.parseDouble(command.split("\\s")[1]));
|
||||
//execute command under here
|
||||
String commandp = command;
|
||||
commandp = commandp.replace("buycommand=", "").trim();
|
||||
String price = commandp.split(" ", 2)[0];
|
||||
commandp = commandp.split(" ", 2)[1];
|
||||
commandTags(p,commandp,commandRAW);
|
||||
//if the message is empty don't send
|
||||
if(!Objects.requireNonNull(plugin.config.getString("config.format.bought")).isEmpty()) {
|
||||
p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("config.format.bought")).replaceAll("%cp-args%", price)));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needmoney")));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
|
||||
}
|
||||
} catch (Exception buyc) {
|
||||
plugin.debug(buyc);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "tokenbuycommand=":{
|
||||
//if player uses tokenbuycommand [price] [command]
|
||||
try {
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("TokenManager")) {
|
||||
@ -360,33 +420,9 @@ public class CommandTags {
|
||||
plugin.debug(buyc);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("buycommand=")) {
|
||||
//if player uses buycommand [price] [command]
|
||||
try {
|
||||
if (plugin.econ != null) {
|
||||
if (plugin.econ.getBalance(p) >= Double.parseDouble(command.split("\\s")[1])) {
|
||||
plugin.econ.withdrawPlayer(p, Double.parseDouble(command.split("\\s")[1]));
|
||||
//execute command under here
|
||||
String commandp = command;
|
||||
commandp = commandp.replace("buycommand=", "").trim();
|
||||
String price = commandp.split(" ", 2)[0];
|
||||
commandp = commandp.split(" ", 2)[1];
|
||||
commandTags(p,commandp,commandRAW);
|
||||
//if the message is empty don't send
|
||||
if(!Objects.requireNonNull(plugin.config.getString("config.format.bought")).isEmpty()) {
|
||||
p.sendMessage(plugin.papi( plugin.tag + Objects.requireNonNull(plugin.config.getString("config.format.bought")).replaceAll("%cp-args%", price)));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + plugin.config.getString("config.format.needmoney")));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Buying Requires Vault and an Economy to work!"));
|
||||
}
|
||||
} catch (Exception buyc) {
|
||||
plugin.debug(buyc);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("teleport=")) {
|
||||
case "teleport=":{
|
||||
//if player uses teleport= x y z (optional other player)
|
||||
if (command.split("\\s").length == 6) {
|
||||
float x, y, z, yaw, pitch; //pitch is the heads Y axis and yaw is the X axis
|
||||
@ -415,7 +451,19 @@ public class CommandTags {
|
||||
p.sendMessage(plugin.tag + plugin.config.getString("config.format.notitem"));
|
||||
}
|
||||
}
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("stopsound=")) {
|
||||
break;
|
||||
}
|
||||
case "sudo=":{
|
||||
//if player uses sudo= [command] to send a command as them
|
||||
p.chat( "/" + command.replaceAll("sudo=", "").trim());
|
||||
break;
|
||||
}
|
||||
case "send=":{
|
||||
//if player uses send= [message] to send a message as them
|
||||
p.chat( command.replaceAll("send=", "").trim());
|
||||
break;
|
||||
}
|
||||
case "stopsound=":{
|
||||
//if player uses stopsound= [sound]
|
||||
try {
|
||||
p.stopSound(Sound.valueOf(command.split("\\s")[1]));
|
||||
@ -423,13 +471,9 @@ public class CommandTags {
|
||||
plugin.debug(ss);
|
||||
p.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
}
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("send=")) {
|
||||
//if player uses send= [message] to send a message as them
|
||||
p.chat( command.replaceAll("send=", "").trim());
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("sudo=")) {
|
||||
//if player uses sudo= [command] to send a command as them
|
||||
p.chat( "/" + command.replaceAll("sudo=", "").trim());
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Bukkit.dispatchCommand(p, command);
|
||||
}
|
||||
}
|
||||
@ -437,7 +481,8 @@ public class CommandTags {
|
||||
@SuppressWarnings("deprecation")
|
||||
public int commandPayWall(Player p, String command) { //return 0 means no funds, 1 is they passed and 2 means paywall is not this command
|
||||
String tag = plugin.config.getString("config.format.tag") + " ";
|
||||
if (command.split("\\s")[0].equalsIgnoreCase("paywall=")) {
|
||||
switch(command.split("\\s")[0]){
|
||||
case "paywall=": {
|
||||
//if player uses paywall= [price]
|
||||
try {
|
||||
if (plugin.econ != null) {
|
||||
@ -461,7 +506,8 @@ public class CommandTags {
|
||||
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
return 0;
|
||||
}
|
||||
} else if (command.split("\\s")[0].equalsIgnoreCase("tokenpaywall=")) {
|
||||
}
|
||||
case "tokenpaywall=": {
|
||||
//if player uses tokenpaywall= [price]
|
||||
try {
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("TokenManager")) {
|
||||
@ -488,7 +534,8 @@ public class CommandTags {
|
||||
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
return 0;
|
||||
}
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("item-paywall=")) {
|
||||
}
|
||||
case "item-paywall=": {
|
||||
//if player uses item-paywall= [Material] [Amount] [Id]
|
||||
try {
|
||||
short id = 0;
|
||||
@ -531,7 +578,8 @@ public class CommandTags {
|
||||
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
return 0;
|
||||
}
|
||||
}else if (command.split("\\s")[0].equalsIgnoreCase("xp-paywall=")) {
|
||||
}
|
||||
case "xp-paywall=": {
|
||||
//if player uses xp-paywall= [price]
|
||||
try {
|
||||
int balance = p.getLevel();
|
||||
@ -551,8 +599,8 @@ public class CommandTags {
|
||||
p.sendMessage(plugin.papi( tag + plugin.config.getString("config.format.error") + " " + "commands: " + command));
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,11 +325,20 @@ public class OpenEditorGuis {
|
||||
|
||||
temp = new ItemStack(Material.BOOK, 1);
|
||||
lore.clear();
|
||||
lore.add(ChatColor.GRAY + "- To refresh changes use");
|
||||
lore.add(ChatColor.GRAY + " /cp " + panelName + " item");
|
||||
lore.add(ChatColor.GRAY + "- Hotbar items will need a");
|
||||
lore.add(ChatColor.GRAY + " name to work properly.");
|
||||
plugin.setName(temp, ChatColor.WHITE + "Hotbar Item Tips", lore, p, true, true);
|
||||
lore.add(ChatColor.GRAY + "Execute commands from Hotbar Item");
|
||||
lore.add(ChatColor.GRAY + "- Left click to add command");
|
||||
lore.add(ChatColor.GRAY + "- Right click to remove command");
|
||||
lore.add(ChatColor.GRAY + "If commands are added, the item will");
|
||||
lore.add(ChatColor.GRAY + "no longer automatically open the panel");
|
||||
if (cf.contains("open-with-item.commands")) {
|
||||
lore.add(ChatColor.WHITE + "-------------------------------");
|
||||
int count = 1;
|
||||
for (String tempLore : cf.getStringList("open-with-item.commands")) {
|
||||
lore.add(ChatColor.WHITE + Integer.toString(count) + ") " + tempLore);
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
plugin.setName(temp, ChatColor.WHITE + "Hotbar Item Commands", lore, p, true, true);
|
||||
i.setItem(44, temp);
|
||||
}
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
package me.rockyhawk.commandpanels.commands;
|
||||
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class Commandpanelclose implements CommandExecutor {
|
||||
CommandPanels plugin;
|
||||
public Commandpanelclose(CommandPanels pl) { this.plugin = pl; }
|
||||
|
||||
@EventHandler
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
|
||||
return true;
|
||||
}
|
||||
Player p = (Player)sender;
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("cpc") || cmd.getName().equalsIgnoreCase("commandpanelclose") && sender instanceof Player || cmd.getName().equalsIgnoreCase("cpanelc") && sender instanceof Player) {
|
||||
p.closeInventory();
|
||||
return true;
|
||||
}
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpc"));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@ public class Commandpanelsreload implements CommandExecutor {
|
||||
//empty
|
||||
}
|
||||
plugin.config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder() + File.separator + "config.yml"));
|
||||
plugin.blockConfig = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder() + File.separator + "blocks.yml"));
|
||||
|
||||
//check for duplicates
|
||||
plugin.checkDuplicatePanel(sender);
|
||||
|
@ -31,16 +31,16 @@ public class Commandpanelversion implements CommandExecutor {
|
||||
if (sender.hasPermission("commandpanel.update")) {
|
||||
if (args[0].equals("cancel")) {
|
||||
plugin.updater.downloadVersionManually = null;
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Will not download a new version on reload or restart."));
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Will not download a new version on restart."));
|
||||
} else {
|
||||
plugin.updater.downloadVersionManually = args[0];
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Downloading version " + ChatColor.GRAY + args[0] + ChatColor.GREEN + " upon server reload or restart."));
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.GREEN + "Downloading version " + ChatColor.GRAY + args[0] + ChatColor.GREEN + " upon server restart."));
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + plugin.config.getString("config.format.perms")));
|
||||
}
|
||||
}else{
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpv [update]"));
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Usage: /cpv [update:latest:cancel]"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -429,6 +429,38 @@ public class EditorUserInput implements Listener {
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed lore line " + e.getMessage()));
|
||||
break;
|
||||
case "panel.hotbar.commands.add":
|
||||
List<String> commandAdd = new ArrayList<>();
|
||||
if(cf.contains("open-with-item.commands")){
|
||||
commandAdd = cf.getStringList("open-with-item.commands");
|
||||
}
|
||||
commandAdd.add(e.getMessage());
|
||||
cf.set("open-with-item.commands", commandAdd);
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Added new command: " + e.getMessage()));
|
||||
break;
|
||||
case "panel.hotbar.commands.remove":
|
||||
List<String> commandRemove;
|
||||
if(cf.contains("open-with-item.commands")){
|
||||
commandRemove = cf.getStringList("open-with-item.commands");
|
||||
}else{
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "No commands found to remove!"));
|
||||
break;
|
||||
}
|
||||
try {
|
||||
commandRemove.remove(Integer.parseInt(e.getMessage())-1);
|
||||
}catch (Exception ex){
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.RED + "Could not find command!"));
|
||||
break;
|
||||
}
|
||||
if(commandRemove.size() == 0){
|
||||
cf.set("open-with-item.commands", null);
|
||||
}else{
|
||||
cf.set("open-with-item.commands", commandRemove);
|
||||
}
|
||||
savePanelFile(cf, cfile, panelName, panelFile);
|
||||
p.sendMessage(plugin.papi( plugin.tag + ChatColor.GREEN + "Removed command line " + e.getMessage()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.rockyhawk.commandpanels.ingameeditor;
|
||||
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -494,6 +493,17 @@ public class EditorUtils implements Listener {
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter Location (1 to 9)"));
|
||||
p.closeInventory();
|
||||
}
|
||||
if(e.getSlot() == 44 && hotbarItems){
|
||||
//adds abilities to add and remove lines
|
||||
if(e.getClick().isLeftClick()) {
|
||||
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.commands.add"});
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter New Item Command"));
|
||||
}else{
|
||||
plugin.editorInputStrings.add(new String[]{p.getName(),panelName,"panel.hotbar.commands.remove"});
|
||||
p.sendMessage(plugin.papi(plugin.tag + ChatColor.WHITE + "Enter command line to remove (must be an integer)"));
|
||||
}
|
||||
p.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -8,7 +8,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
@ -109,7 +109,7 @@ public class OpenPanelsLoader {
|
||||
}
|
||||
}
|
||||
if (plugin.config.contains("config.panel-snooper")) {
|
||||
if (Objects.requireNonNull(plugin.config.getString("config.panel-snooper")).trim().equalsIgnoreCase("true")) {
|
||||
if (Objects.requireNonNull(plugin.config.getString("config.panel-snooper")).equalsIgnoreCase("true")) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels] " + playerName + " Closed " + panelName);
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,13 @@ public class HotbarItemLoader {
|
||||
if(openPanel) {
|
||||
String panelName = plugin.panelNames.get(temp[1])[0];
|
||||
ConfigurationSection tempFile = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(plugin.panelNames.get(temp[1])[1])))).getConfigurationSection("panels." + panelName);
|
||||
//only open panel automatically if there are no commands
|
||||
if(tempFile.contains("open-with-item.commands")){
|
||||
for(String command : tempFile.getStringList("open-with-item.commands")){
|
||||
plugin.commandTags.commandTags(p,plugin.papi(p,command),command);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (plugin.openPanels.hasPanelOpen(p.getName())) {
|
||||
plugin.openPanels.skipPanels.add(p.getName());
|
||||
}
|
||||
@ -69,6 +76,13 @@ public class HotbarItemLoader {
|
||||
}
|
||||
if(panelItem.isSimilar(invItem)){
|
||||
if(openPanel) {
|
||||
//only open panel automatically if there are no commands
|
||||
if(tempFile.contains("open-with-item.commands")){
|
||||
for(String command : tempFile.getStringList("open-with-item.commands")){
|
||||
plugin.commandTags.commandTags(p,plugin.papi(p,command),command);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (plugin.openPanels.hasPanelOpen(p.getName())) {
|
||||
plugin.openPanels.skipPanels.add(p.getName());
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class Commandpanelblocks implements CommandExecutor {
|
||||
@EventHandler
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (label.equalsIgnoreCase("cpb") || label.equalsIgnoreCase("commandpanelsblock") || label.equalsIgnoreCase("cpanelb")) {
|
||||
if(args.length == 2) {
|
||||
if(args.length >= 2) {
|
||||
if (args[0].equalsIgnoreCase("add")) {
|
||||
if(!(sender instanceof Player)) {
|
||||
sender.sendMessage(plugin.papi(plugin.tag + ChatColor.RED + "Please execute command as a Player!"));
|
||||
@ -52,7 +52,9 @@ public class Commandpanelblocks implements CommandExecutor {
|
||||
}
|
||||
Location blockLocation = blockType.getLocation();
|
||||
String configValue = "blocks." + Objects.requireNonNull(blockLocation.getWorld()).getName().replaceAll("_", "%dash%") + "_" + blockLocation.getBlockX() + "_" + blockLocation.getBlockY() + "_" + blockLocation.getBlockZ() + ".panel";
|
||||
plugin.blockConfig.set(configValue, args[1]);
|
||||
//this is simply getting all of the args values after the add
|
||||
String panelValue = String.join(" ", args).replace("add ", "");
|
||||
plugin.blockConfig.set(configValue, panelValue);
|
||||
try {
|
||||
plugin.blockConfig.save(new File(plugin.getDataFolder() + File.separator + "blocks.yml"));
|
||||
} catch (IOException e) {
|
||||
|
@ -3,14 +3,12 @@ package me.rockyhawk.commandpanels.panelblocks;
|
||||
import me.rockyhawk.commandpanels.CommandPanels;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
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.PlayerInteractEvent;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PanelBlockOnClick implements Listener {
|
||||
@ -41,16 +39,15 @@ public class PanelBlockOnClick implements Listener {
|
||||
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);
|
||||
for(String[] temp : plugin.panelNames){
|
||||
if(temp[0].equals(plugin.blockConfig.getString("blocks." + configLocation + ".panel"))){
|
||||
String panelName = temp[0];
|
||||
YamlConfiguration cf = YamlConfiguration.loadConfiguration(new File(plugin.panelsf + File.separator + plugin.panelFiles.get(Integer.parseInt(temp[1]))));
|
||||
if(!plugin.openPanels.hasPanelOpen(p.getName())) {
|
||||
plugin.openVoids.openCommandPanel(p, p, panelName, cf.getConfigurationSection("panels." + panelName), false);
|
||||
if(plugin.blockConfig.contains("blocks." + configLocation + ".commands")){
|
||||
for(String command : plugin.blockConfig.getStringList("blocks." + configLocation + ".commands")){
|
||||
plugin.commandTags.commandTags(p,plugin.papi(p,command),command);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
//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.commandTags(p, plugin.papi(p, command), command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ public class Updater {
|
||||
if(sendMessages) {
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.GOLD + " ================================================");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.AQUA + " An update for CommandPanels is available.");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + " Download CommandPanels " + ChatColor.GOLD + gitVersion + ChatColor.WHITE + " here:");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.AQUA + " https://www.spigotmc.org/resources/command-panels-custom-guis.67788/");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + " Download CommandPanels " + ChatColor.GOLD + gitVersion + ChatColor.WHITE + " using the");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.WHITE + " following command:" + ChatColor.AQUA + " /cpv latest" + ChatColor.WHITE + " and restart the server");
|
||||
Bukkit.getConsoleSender().sendMessage("[CommandPanels]" + ChatColor.GOLD + " ================================================");
|
||||
}
|
||||
}
|
||||
@ -79,8 +79,8 @@ public class Updater {
|
||||
return;
|
||||
}
|
||||
|
||||
if(latestVersion.equals(thisVersion)){
|
||||
//no need to update
|
||||
if(latestVersion.equals(thisVersion) || thisVersion.contains("-")){
|
||||
//no need to update or running custom version
|
||||
return;
|
||||
}
|
||||
if(Objects.equals(plugin.config.getString("config.updater.minor-updates-only"), "true")){
|
||||
|
Loading…
Reference in New Issue
Block a user