Archived
0

Actually fixed command String, renamed variables

This commit is contained in:
Pepich
2017-06-11 20:18:25 +02:00
parent d4f95b7ed5
commit 3137c6efca

View File

@@ -18,7 +18,7 @@ import com.redstoner.modules.Module;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
@Version(major = 2, minor = 1, revision = 1, compatible = 2) @Version(major = 2, minor = 1, revision = 3, compatible = 2)
public class Naming implements Module public class Naming implements Module
{ {
@@ -47,7 +47,7 @@ public class Naming implements Module
} }
@Command(hook = "lore") @Command(hook = "lore")
public void lore(CommandSender sender, boolean append, String name) public void lore(CommandSender sender, boolean append, String lore)
{ {
ItemStack item = ((Player) sender).getInventory().getItemInMainHand(); ItemStack item = ((Player) sender).getInventory().getItemInMainHand();
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
@@ -56,19 +56,18 @@ public class Naming implements Module
Utils.sendErrorMessage(sender, null, "You can not change the lore of that item!"); Utils.sendErrorMessage(sender, null, "You can not change the lore of that item!");
return; return;
} }
List<String> lore; List<String> currentLore;
if (append) if (append)
lore = meta.getLore(); currentLore = meta.getLore();
else else
lore = new ArrayList<String>(); currentLore = new ArrayList<String>();
if (lore == null) if (currentLore == null)
lore = new ArrayList<String>(); currentLore = new ArrayList<String>();
name = ChatColor.translateAlternateColorCodes('&', name); lore = ChatColor.translateAlternateColorCodes('&', lore);
lore.add(name); currentLore.add(lore);
meta.setLore(lore); meta.setLore(currentLore);
item.setItemMeta(meta); item.setItemMeta(meta);
item.getItemMeta().setLore(lore); Utils.sendMessage(sender, null, "Lore set to " + lore);
Utils.sendMessage(sender, null, "Lore set to " + name);
} }
// @noformat // @noformat
@@ -92,8 +91,8 @@ public class Naming implements Module
" }\n" + " }\n" +
"}\n" + "}\n" +
"command lore {\n" + "command lore {\n" +
" [empty] {\n" + " [optional:-a] [string:lore...] {\n" +
" run lore -a name;\n" + " run lore -a lore;\n" +
" type player;\n" + " type player;\n" +
" help Adds lore to item in hand.;\n" + " help Adds lore to item in hand.;\n" +
" perm utils.lore;\n" + " perm utils.lore;\n" +