This commit is contained in:
rockyhawk64 2022-01-26 10:33:26 +11:00
parent a4943de958
commit ef819bc34f
8 changed files with 88 additions and 158 deletions

View File

@ -1,7 +1,7 @@
<component name="libraryTable">
<library name="spigot-api-1.18-rc3-R0.1-SNAPSHOT">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../../Intellij Plugin Testers/Plugin Tester 1.18/bundler/libraries/spigot-api-1.18-rc3-R0.1-SNAPSHOT.jar!/" />
<root url="jar://$PROJECT_DIR$/../../../Intellij Plugin Testers/Plugin Tester 1.18.1/bundler/libraries/spigot-api-1.18-rc3-R0.1-SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View File

@ -20,7 +20,7 @@
<orderEntry type="library" name="MMOItems-6.6.1" level="project" />
<orderEntry type="library" name="MythicLib-1.1.3" level="project" />
<orderEntry type="library" name="spigot-api-1.18-rc3-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="spigot-1.13.2" level="project" />
<orderEntry type="library" name="spigot" level="project" />
<orderEntry type="library" name="spigot-1.13.2" level="project" />
</component>
</module>

View File

@ -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:

View File

@ -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"

View File

@ -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'

View File

@ -1,4 +1,4 @@
version: 3.17.2.2
version: 3.17.3.0
main: me.rockyhawk.commandpanels.CommandPanels
name: CommandPanels
author: RockyHawk

View File

@ -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<String,Object> oldKeys = panel.getConfig().getValues(true);
Map<String,Object> newKeys = new HashMap<>();
for(Map.Entry<String,Object> key : oldKeys.entrySet()){
ArrayList<String> 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<String,Object> 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);
}
}

View File

@ -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= <player> <fadeIn> <stay> <fadeOut>
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) {