3.7.2 Updates

This commit is contained in:
rockyhawk64 2020-08-01 17:37:59 +10:00
parent 5d57755d77
commit 183761812a
2 changed files with 38 additions and 14 deletions

View File

@ -1,4 +1,4 @@
version: 3.7.1
version: 3.7.2
main: me.rockyhawk.commandPanels.commandpanels
name: CommandPanels
author: RockyHawk

View File

@ -281,12 +281,11 @@ public class commandpanels extends JavaPlugin {
try {
ItemMeta renamedMeta = renamed.getItemMeta();
//set cp placeholders
if(usePlaceholders && useColours){
customName = papi(p,customName);
}else if(useColours){
if(usePlaceholders){
customName = papiNoColour(p,customName);
}
if(useColours){
customName = papi(customName);
}else{
customName = setCpPlaceholders(p, customName);
}
assert renamedMeta != null;
@ -295,12 +294,16 @@ public class commandpanels extends JavaPlugin {
renamedMeta.setDisplayName(customName);
}
List<String> clore = new ArrayList<>();
List<String> clore;
if (lore != null) {
if(usePlaceholders && useColours){
clore = papi(p, lore, true);
}else if(usePlaceholders){
clore = papiNoColour(p, lore);
}else if(useColours){
clore = papi(p, lore, false);
}else{
clore = lore;
}
renamedMeta.setLore(clore);
}
@ -393,10 +396,10 @@ public class commandpanels extends JavaPlugin {
//regular string papi
public String papi(Player p, String setpapi) {
try {
setpapi = setCpPlaceholders(p,setpapi);
if (this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
setpapi = PlaceholderAPI.setPlaceholders(p, setpapi);
}
setpapi = setCpPlaceholders(p,setpapi);
setpapi = translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', setpapi));
return setpapi;
}catch(NullPointerException e){
@ -404,6 +407,19 @@ public class commandpanels extends JavaPlugin {
}
}
//string papi with no colours
public String papiNoColour(Player p, String setpapi) {
try {
setpapi = setCpPlaceholders(p,setpapi);
if (this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
setpapi = PlaceholderAPI.setPlaceholders(p, setpapi);
}
return setpapi;
}catch(NullPointerException e){
return setpapi;
}
}
//regular string papi, but only colours so Player doesn't need to be there
public String papi(String setpapi) {
try {
@ -430,13 +446,25 @@ public class commandpanels extends JavaPlugin {
try {
setpapi.set(tempInt, translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', temp)));
}catch(NullPointerException ignore){
}
tempInt += 1;
}
return setpapi;
}
//papi except if it is a String List
public List<String> papiNoColour(Player p, List<String> setpapi) {
try {
if (this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
setpapi = PlaceholderAPI.setPlaceholders(p, setpapi);
}
}catch(Exception ignore){
//this will be ignored as it is probably a null
return null;
}
return setpapi;
}
public void commandTags(Player p, String command) {
String tag = config.getString("config.format.tag") + " ";
//set cp placeholders
@ -1709,11 +1737,7 @@ public class commandpanels extends JavaPlugin {
p.sendMessage(papi(tag + this.config.getString("config.format.error") + " material: " + itemSection.getString("material")));
return null;
}
if (placeholders) {
this.setName(s, papi(p, itemSection.getString("name")), papi(p, itemSection.getStringList("lore"),true), p, true, colours);
}else{
this.setName(s, itemSection.getString("name"), itemSection.getStringList("lore"), p, false, colours);
}
this.setName(s, itemSection.getString("name"), itemSection.getStringList("lore"), p, placeholders, colours);
return s;
}