Search in sources :

Example 16 with ItemClass

use of mc.dragons.core.gameobject.item.ItemClass in project DragonsOnline by UniverseCraft.

the class ItemCommand method setName.

private void setName(CommandSender sender, String[] args) {
    ItemClass itemClass = lookupItemClass(sender, args[0]);
    if (itemClass == null)
        return;
    Document base = Document.parse(itemClass.getData().toJson());
    String name = StringUtil.concatArgs(args, 2);
    String displayName = ChatColor.translateAlternateColorCodes('&', name);
    itemClass.setName(displayName);
    sender.sendMessage(ChatColor.GREEN + "Updated item display name successfully.");
    AUDIT_LOG.saveEntry(itemClass, user(sender), base, "Set display name to " + displayName);
}
Also used : ItemClass(mc.dragons.core.gameobject.item.ItemClass) Document(org.bson.Document)

Aggregations

ItemClass (mc.dragons.core.gameobject.item.ItemClass)16 Document (org.bson.Document)8 User (mc.dragons.core.gameobject.user.User)7 Material (org.bukkit.Material)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Item (mc.dragons.core.gameobject.item.Item)2 ItemClassLoader (mc.dragons.core.gameobject.item.ItemClassLoader)2 Quest (mc.dragons.core.gameobject.quest.Quest)2 GUI (mc.dragons.core.gui.GUI)2 GUIElement (mc.dragons.core.gui.GUIElement)2 ChatColor (org.bukkit.ChatColor)2 Player (org.bukkit.entity.Player)2 UUID (java.util.UUID)1 Collectors (java.util.stream.Collectors)1 Dragons (mc.dragons.core.Dragons)1 Addon (mc.dragons.core.addon.Addon)1 ItemAddon (mc.dragons.core.addon.ItemAddon)1 GameObject (mc.dragons.core.gameobject.GameObject)1