Add Enchantment Glow without the actual Enchantment

Discussion in 'Plugin Development' started by BagduFagdu, May 1, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    BagduFagdu

    So I'm trying to add the glowing effect to items without them having the "<Enchantment here> X" lore. Tried using this, but it didn't work. Any tips/suggestion?

    Code:
    public static ItemStack addGlow(ItemStack item){
      net.minecraft.server.v1_8_2_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
      NBTTagCompound tag = null;
      if (!nmsStack.hasTag()) {
          tag = new NBTTagCompound();
          nmsStack.setTag(tag);
      }
      if (tag == null) tag = nmsStack.getTag();
      NBTTagList ench = new NBTTagList();
      tag.set("ench", ench);
      nmsStack.setTag(tag);
      return CraftItemStack.asCraftMirror(nmsStack);
    }
     
  2. @BagduFagdu Using a custom enchantment called glow, it's possible. You need to make sure that you call unLoad() in your onDisable() method and you can use addGlow(ITEMSTACK, ""); to add a glow with no name.

    The alternative is to use ProtocolLib
     
    BagduFagdu likes this.
  3. Offline

    BagduFagdu

    Thanks. I'll make sure to give you credits.

    @DJSkepter After using the unLoad method, it has constantly been crashing my entire console.

    Code:
    @Override
        public void onDisable() {
            prefix = null;
            EnchantGlow.unLoad();
    }
    Code:
    Failed to write core dump. Core dumps have been disabled.............
    
    org.bagdufagdu.utils.Main.onDisable()V+4
    j  org.bukkit.plugin.java.JavaPlugin.setEnabled(Z)V+28
    j  org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(Lorg/bukkit/plugin/Plugin;)V+87
    j  org.bukkit.plugin.SimplePluginManager.disablePlugin(Lorg/bukkit/plugin/Plugin;)V+16
    j  com.rylinaux.plugman.util.PluginUtil.unload(Lorg/bukkit/plugin/Plugin;)Ljava/lang/String;+245
    j  com.rylinaux.plugman.util.PluginUtil.reload(Lorg/bukkit/plugin/Plugin;)V+5
    j  com.rylinaux.plugman.command.ReloadCommand.execute(Lorg/bukkit/command/CommandSender;Lorg/bukkit/command/Command;Ljava/lang/String;[Ljava/lang/String;)V+215
    j  com.rylinaux.plugman.PlugManCommandHandler.onCommand(Lorg/bukkit/command/CommandSender;Lorg/bukkit/command/Command;Ljava/lang/String;[Ljava/lang/String;)Z+572
    j  org.bukkit.command.PluginCommand.execute(Lorg/bukkit/command/CommandSender;Ljava/lang/String;[Ljava/lang/String;)Z+35
    j  org.bukkit.command.SimpleCommandMap.dispatch(Lorg/bukkit/command/CommandSender;Ljava/lang/String;)Z+61
    j  org.bukkit.craftbukkit.v1_8_R2.CraftServer.dispatchCommand(Lorg/bukkit/command/CommandSender;Ljava/lang/String;)Z+20
    j  org.bukkit.craftbukkit.v1_8_R2.CraftServer.dispatchServerCommand(Lorg/bukkit/command/CommandSender;Lnet/minecraft/server/v1_8_R2/ServerCommand;)Z+44
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
Thread Status:
Not open for further replies.

Share This Page