forked from Upstream/CommandPanels
3.7.2 Updates
This commit is contained in:
parent
5d57755d77
commit
183761812a
@ -1,4 +1,4 @@
|
|||||||
version: 3.7.1
|
version: 3.7.2
|
||||||
main: me.rockyhawk.commandPanels.commandpanels
|
main: me.rockyhawk.commandPanels.commandpanels
|
||||||
name: CommandPanels
|
name: CommandPanels
|
||||||
author: RockyHawk
|
author: RockyHawk
|
||||||
|
@ -281,12 +281,11 @@ public class commandpanels extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
ItemMeta renamedMeta = renamed.getItemMeta();
|
ItemMeta renamedMeta = renamed.getItemMeta();
|
||||||
//set cp placeholders
|
//set cp placeholders
|
||||||
if(usePlaceholders && useColours){
|
if(usePlaceholders){
|
||||||
customName = papi(p,customName);
|
customName = papiNoColour(p,customName);
|
||||||
}else if(useColours){
|
}
|
||||||
|
if(useColours){
|
||||||
customName = papi(customName);
|
customName = papi(customName);
|
||||||
}else{
|
|
||||||
customName = setCpPlaceholders(p, customName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert renamedMeta != null;
|
assert renamedMeta != null;
|
||||||
@ -295,12 +294,16 @@ public class commandpanels extends JavaPlugin {
|
|||||||
renamedMeta.setDisplayName(customName);
|
renamedMeta.setDisplayName(customName);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> clore = new ArrayList<>();
|
List<String> clore;
|
||||||
if (lore != null) {
|
if (lore != null) {
|
||||||
if(usePlaceholders && useColours){
|
if(usePlaceholders && useColours){
|
||||||
clore = papi(p, lore, true);
|
clore = papi(p, lore, true);
|
||||||
|
}else if(usePlaceholders){
|
||||||
|
clore = papiNoColour(p, lore);
|
||||||
}else if(useColours){
|
}else if(useColours){
|
||||||
clore = papi(p, lore, false);
|
clore = papi(p, lore, false);
|
||||||
|
}else{
|
||||||
|
clore = lore;
|
||||||
}
|
}
|
||||||
renamedMeta.setLore(clore);
|
renamedMeta.setLore(clore);
|
||||||
}
|
}
|
||||||
@ -393,10 +396,10 @@ public class commandpanels extends JavaPlugin {
|
|||||||
//regular string papi
|
//regular string papi
|
||||||
public String papi(Player p, String setpapi) {
|
public String papi(Player p, String setpapi) {
|
||||||
try {
|
try {
|
||||||
|
setpapi = setCpPlaceholders(p,setpapi);
|
||||||
if (this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
if (this.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
|
||||||
setpapi = PlaceholderAPI.setPlaceholders(p, setpapi);
|
setpapi = PlaceholderAPI.setPlaceholders(p, setpapi);
|
||||||
}
|
}
|
||||||
setpapi = setCpPlaceholders(p,setpapi);
|
|
||||||
setpapi = translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', setpapi));
|
setpapi = translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', setpapi));
|
||||||
return setpapi;
|
return setpapi;
|
||||||
}catch(NullPointerException e){
|
}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
|
//regular string papi, but only colours so Player doesn't need to be there
|
||||||
public String papi(String setpapi) {
|
public String papi(String setpapi) {
|
||||||
try {
|
try {
|
||||||
@ -430,13 +446,25 @@ public class commandpanels extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
setpapi.set(tempInt, translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', temp)));
|
setpapi.set(tempInt, translateHexColorCodes(ChatColor.translateAlternateColorCodes('&', temp)));
|
||||||
}catch(NullPointerException ignore){
|
}catch(NullPointerException ignore){
|
||||||
|
|
||||||
}
|
}
|
||||||
tempInt += 1;
|
tempInt += 1;
|
||||||
}
|
}
|
||||||
return setpapi;
|
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) {
|
public void commandTags(Player p, String command) {
|
||||||
String tag = config.getString("config.format.tag") + " ";
|
String tag = config.getString("config.format.tag") + " ";
|
||||||
//set cp placeholders
|
//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")));
|
p.sendMessage(papi(tag + this.config.getString("config.format.error") + " material: " + itemSection.getString("material")));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (placeholders) {
|
this.setName(s, itemSection.getString("name"), itemSection.getStringList("lore"), p, placeholders, colours);
|
||||||
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);
|
|
||||||
}
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user