Skip to content

Commit

Permalink
Fix multiline lore: use \n instead of /n for line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
galaipa committed Jun 22, 2019
1 parent 537e2bd commit a054020
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/io/github/galaipa/sr/Methods.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,28 @@ public static void setName(ItemStack item, String name){
//Set a one line lore
public static void setLore(ItemStack itemStack, String name){
String lore = ChatColor.translateAlternateColorCodes('&', name);
String[] loreArray = lore.split("/n");
String[] loreArray = lore.split("\\\\n");

ItemMeta itemStackMeta = itemStack.getItemMeta();
itemStackMeta.setLore(Arrays.asList(loreArray));
itemStack.setItemMeta(itemStackMeta);
}
//Add a new lore line
public static void addLore(ItemStack itemStack, String name){
String[] splittedName = name.split("/n");
public static void addLore(ItemStack itemStack, String name){
List<String> lore = itemStack.getItemMeta().getLore();
if(lore == null){
setLore(itemStack, name);
}
else {
String[] splittedName = name.split("\\\\n");
for(String s : splittedName){
lore.add(ChatColor.translateAlternateColorCodes('&', s));
}
ItemMeta itemStackMeta = itemStack.getItemMeta();
itemStackMeta.setLore(lore);
itemStack.setItemMeta(itemStackMeta);
}
}
}
// Set book author
public static void setBookAuthor(ItemStack book, String name){
BookMeta meta = (BookMeta) book.getItemMeta();
Expand Down

0 comments on commit a054020

Please sign in to comment.