From ef819bc34fd108526f8571de3aa21d2d284145d1 Mon Sep 17 00:00:00 2001 From: rockyhawk64 Date: Wed, 26 Jan 2022 10:33:26 +1100 Subject: [PATCH] 3.17.3.0 --- .../spigot_api_1_18_rc3_R0_1_SNAPSHOT.xml | 2 +- CommandPanels.iml | 2 +- resource/example_bottom.yml | 12 +-- resource/example_middle_two.yml | 90 +++++++++--------- resource/example_top.yml | 16 ++-- resource/plugin.yml | 2 +- .../commands/Commandpanelsdebug.java | 95 ------------------- .../commandtags/tags/other/SpecialTags.java | 27 ++++++ 8 files changed, 88 insertions(+), 158 deletions(-) diff --git a/.idea/libraries/spigot_api_1_18_rc3_R0_1_SNAPSHOT.xml b/.idea/libraries/spigot_api_1_18_rc3_R0_1_SNAPSHOT.xml index 43ca72b..53e159c 100644 --- a/.idea/libraries/spigot_api_1_18_rc3_R0_1_SNAPSHOT.xml +++ b/.idea/libraries/spigot_api_1_18_rc3_R0_1_SNAPSHOT.xml @@ -1,7 +1,7 @@ - + diff --git a/CommandPanels.iml b/CommandPanels.iml index 7e2177e..4a9e9fe 100644 --- a/CommandPanels.iml +++ b/CommandPanels.iml @@ -20,7 +20,7 @@ - + \ No newline at end of file diff --git a/resource/example_bottom.yml b/resource/example_bottom.yml index 91c6d9d..ea6eb89 100644 --- a/resource/example_bottom.yml +++ b/resource/example_bottom.yml @@ -30,16 +30,16 @@ panels: lore: - '&7The Player Browser requires' - '&7PlaceholderAPI with the Math extension' - hasvalue0: - compare: '%math_0:_1+1%' - value: '2' + has1: + compare0: '%math_0:_1+1%' + value0: '2' material: ENDER_PEARL name: '&bOpen Player Browser' commands: - open= example_middle_two {Middle} - hasvalue: - compare: '%cp-data-example_item%' - value: true + has0: + compare0: '%cp-data-example_item%' + value0: true material: COOKED_PORKCHOP name: '&fSecret Item' lore: diff --git a/resource/example_middle_two.yml b/resource/example_middle_two.yml index 38ff8ae..fe693d6 100644 --- a/resource/example_middle_two.yml +++ b/resource/example_middle_two.yml @@ -25,135 +25,135 @@ panels: '10': material: 'cps= $cp-player-online-%math_1+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_1+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '$cp-player-online-%math_1+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '$cp-player-online-%math_1+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '11': material: 'cps= $cp-player-online-%math_2+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_2+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_2+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_2+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '12': material: 'cps= $cp-player-online-%math_3+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_3+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_3+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_3+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '13': material: 'cps= $cp-player-online-%math_4+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_4+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_4+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_4+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '14': material: 'cps= $cp-player-online-%math_5+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_5+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_5+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_5+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '15': material: 'cps= $cp-player-online-%math_6+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_6+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_6+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_6+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '16': material: 'cps= $cp-player-online-%math_7+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_7+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_7+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_7+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '19': material: 'cps= $cp-player-online-%math_8+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_8+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_8+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_8+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '20': material: 'cps= $cp-player-online-%math_9+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_9+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_9+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_9+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '21': material: 'cps= $cp-player-online-%math_10+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_10+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_10+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_10+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '22': material: 'cps= $cp-player-online-%math_11+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_11+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_11+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_11+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '23': material: 'cps= $cp-player-online-%math_12+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_12+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_12+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_12+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '24': material: 'cps= $cp-player-online-%math_13+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_13+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_13+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_13+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '25': material: 'cps= $cp-player-online-%math_14+14*{cp-data-onlinepage}%$' name: '&e$cp-player-online-%math_14+14*{cp-data-onlinepage}%$' - hasvalue: - compare: '&e$cp-player-online-%math_14+14*{cp-data-onlinepage}%$' - value: 'Offline' + has0: + compare0: '&e$cp-player-online-%math_14+14*{cp-data-onlinepage}%$' + value0: 'Offline' material: cps= eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZmMyNzEwNTI3MTllZjY0MDc5ZWU4YzE0OTg5NTEyMzhhNzRkYWM0YzI3Yjk1NjQwZGI2ZmJkZGMyZDZiNWI2ZSJ9fX0= stack: 1 name: '&7&l????' '2': material: LIGHT_BLUE_STAINED_GLASS_PANE name: "&f" - hasgreater: - compare: '$cp-data-onlinepage$' - value: 1 + has0: + value0: 'NOT 0 ISGREATER' + compare0: '$cp-data-onlinepage$' material: STICK stack: 1 name: "&c&lLast Page" diff --git a/resource/example_top.yml b/resource/example_top.yml index ed7dbd9..073d0f9 100644 --- a/resource/example_top.yml +++ b/resource/example_top.yml @@ -64,10 +64,10 @@ panels: commands: - placeholder= [item:GOLDEN_APPLE] - refresh - hasvalue: + has0: material: GOLDEN_APPLE - compare: '%cp-item%' - value: GOLDEN_APPLE + compare0: '%cp-item%' + value0: GOLDEN_APPLE name: '&fClick me to change item' commands: - placeholder= [item:APPLE] @@ -105,9 +105,9 @@ panels: - set-data= example_item true - msg= &fThis message can only be sent one time - refresh - hasvalue: - compare: '%cp-data-example_item%' - value: true + has0: + compare0: '%cp-data-example_item%' + value0: true material: BARRIER name: '&cItem has been used!' '30': @@ -116,9 +116,7 @@ panels: commands: - home - 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"} + - title= %cp-player-name% 20 60 20 &eWelcome Home/n/&2%cp-player-displayname% '33': material: ARROW name: '&fItems can be stacked' diff --git a/resource/plugin.yml b/resource/plugin.yml index def1ec8..a6bafc3 100644 --- a/resource/plugin.yml +++ b/resource/plugin.yml @@ -1,4 +1,4 @@ -version: 3.17.2.2 +version: 3.17.3.0 main: me.rockyhawk.commandpanels.CommandPanels name: CommandPanels author: RockyHawk diff --git a/src/me/rockyhawk/commandpanels/commands/Commandpanelsdebug.java b/src/me/rockyhawk/commandpanels/commands/Commandpanelsdebug.java index b86e442..a22887a 100644 --- a/src/me/rockyhawk/commandpanels/commands/Commandpanelsdebug.java +++ b/src/me/rockyhawk/commandpanels/commands/Commandpanelsdebug.java @@ -1,20 +1,13 @@ package me.rockyhawk.commandpanels.commands; import me.rockyhawk.commandpanels.CommandPanels; -import me.rockyhawk.commandpanels.api.Panel; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import java.io.File; -import java.io.IOException; -import java.util.*; - public class Commandpanelsdebug implements CommandExecutor { CommandPanels plugin; public Commandpanelsdebug(CommandPanels pl) { this.plugin = pl; } @@ -39,21 +32,6 @@ public class Commandpanelsdebug implements CommandExecutor { sender.sendMessage(plugin.tex.colour(plugin.tag + ChatColor.GREEN + "Personal Debug Mode Enabled!")); } }else{ - //START - if(args.length == 1) { - if(args[0].equals("converteverything")){ - sender.sendMessage(plugin.tex.colour(plugin.tag + ChatColor.GREEN + "Converting Everything")); - for(Panel panel : plugin.panelList){ - convertPanel(panel.getName(), sender); - } - return true; - } - //temporary panel converter from 3.16.x.x to 3.17.x.x - sender.sendMessage(plugin.tex.colour(plugin.tag + ChatColor.GREEN + "Converting panel " + args[0])); - convertPanel(args[0], sender); - return true; - } - //END sender.sendMessage(plugin.tex.colour(plugin.tag + ChatColor.RED + "Usage: /cpd")); } }else{ @@ -61,77 +39,4 @@ public class Commandpanelsdebug implements CommandExecutor { } return true; } - - //temporary converter - public void convertPanel(String name, CommandSender sender){ - Panel panel = null; - for(Panel pan : plugin.panelList){ - if(pan.getName().equals(name)){ - panel = pan; - } - } - if(panel == null){ - return; - } - Map oldKeys = panel.getConfig().getValues(true); - Map newKeys = new HashMap<>(); - for(Map.Entry key : oldKeys.entrySet()){ - ArrayList newKey = new ArrayList<>(); - String[] subKeys = key.getKey().split("\\."); - for(String subKey : subKeys){ - if(subKey.startsWith("hasvalue")){ - newKey.add(addNumber("hasvalue",subKey)); - continue; - } - if(subKey.startsWith("hasperm")){ - newKey.add(addNumber("hasperm",subKey)); - continue; - } - if(subKey.equals("perm")){ - if(subKeys.length != 1) { - newKey.add("value0"); - continue; - } - } - if(subKey.startsWith("hasgreater")){ - newKey.add(addNumber("hasgreater",subKey)); - continue; - } - if(subKey.equals("value")){ - newKey.add("value0"); - continue; - } - if(subKey.equals("compare")){ - newKey.add("compare0"); - continue; - } - newKey.add(subKey); - } - newKeys.put(String.join(".", newKey),key.getValue()); - } - YamlConfiguration newConfig = new YamlConfiguration(); - if(new File(panel.getFile().getPath().replaceFirst("panels","CONVERTED_PANELS")).exists()){ - newConfig = YamlConfiguration.loadConfiguration(new File(panel.getFile().getPath().replaceFirst("panels","CONVERTED_PANELS"))); - } - for(Map.Entry key : newKeys.entrySet()){ - if(key.getValue() instanceof ConfigurationSection){ - continue; - } - newConfig.set("panels." + panel.getName() + "." + key.getKey(),key.getValue()); - } - try { - newConfig.save(new File(panel.getFile().getPath().replaceFirst("panels","CONVERTED_PANELS"))); - sender.sendMessage(ChatColor.WHITE + panel.getFile().getName() + ChatColor.GREEN + " File saved to the CommandPanels plugin folder, please check it is correct before overwriting it."); - } catch (IOException s) { - plugin.debug(s,null); - } - } - public String addNumber(String word,String str){ - if(str.equals(word)){ - return (str + "0"); - } - int number = Integer.parseInt(str.replace(word,"")); - number += 1; - return (word + number); - } } \ No newline at end of file diff --git a/src/me/rockyhawk/commandpanels/commandtags/tags/other/SpecialTags.java b/src/me/rockyhawk/commandpanels/commandtags/tags/other/SpecialTags.java index 4473b4b..50682ef 100644 --- a/src/me/rockyhawk/commandpanels/commandtags/tags/other/SpecialTags.java +++ b/src/me/rockyhawk/commandpanels/commandtags/tags/other/SpecialTags.java @@ -70,6 +70,33 @@ public class SpecialTags implements Listener { } return; } + if(e.name.equalsIgnoreCase("title=")) { + e.commandTagUsed(); + //added into the 1.11 API + //will send a title to the player title= + if(e.args.length >= 5){ + Player p = Bukkit.getPlayer(e.args[0]); + StringBuilder message = new StringBuilder(); + for(int i = 4; i < e.args.length; i++){ + message.append(e.args[i]).append(" "); + } + message.deleteCharAt(message.length()-1); + String title; + String subtitle = ""; + if(message.toString().contains("/n/")) { + title = plugin.tex.placeholders(e.panel, e.pos, e.p, message.toString().split("/n/")[0]); + subtitle = plugin.tex.placeholders(e.panel, e.pos, e.p, message.toString().split("/n/")[1]); + }else{ + title = plugin.tex.placeholders(e.panel, e.pos, e.p, message.toString().trim()); + } + try{ + p.sendTitle(title, subtitle, Integer.parseInt(e.args[1]), Integer.parseInt(e.args[2]), Integer.parseInt(e.args[3])); + }catch(Exception ex) { + plugin.debug(ex, e.p); + } + } + return; + } if(e.name.equalsIgnoreCase("teleport=")) { e.commandTagUsed(); if (e.args.length == 5) {