Essentials PLUGIN

Discussion in 'Archived: Plugin Requests' started by CrispyLipz, Oct 20, 2013.

Thread Status:
Not open for further replies.
  1. Is it possible for someone to recode Essentials? Only one part of it, see my donators get /enchant and in the guidelines for my ranks you aren't supposed to give enchanted items away. I've seen this done before and I would like for when someone /enchant and item it adds lore onto the item with the person that enchanted its name. So lets say someone used /enchant fireaspect 2 on a diamond sword it would normal just enchant. But I would like for the /enchant to add lore to the item with like the players name as the lore. FAIL Example below \/

    |Diamond Sword|
    |Example Name |
  2. You could probably make it so the items with /enchant have to have a certain lore and non donators can't pick up an item with that lore. I saw this on a guy's server but to be honest it's never a good idea to give /enchant
  3. Yeah, but I just started learning Java a few days ago and all this is way to complicated for me...
  4. And that is actually a good IDEA! Like with the lore DONATOR in dark red and non donators cant pick it up?
  5. Ermm find a plugin I guess bukkitdev is a good place to start.
  6. Yes there are plugins that can disable that. Check on bukkitdev
  7. I can't find anything like that only Item-Restrict and it doesn't support a lore tag
  8. And I made /enchant less OP because it has a cooldown, also the only thing I need is for a tag or lore to be applied to the item when someone uses /enchant
  9. So I found the source code for enchanting :) I was wondering if I can get some help with it I've tried it a couple times it fail where can I add the tag for lore when they enchant?

    1. package com.earth2me.essentials.commands;
    3. import com.earth2me.essentials.Enchantments;
    4. import static com.earth2me.essentials.I18n._;
    5. import com.earth2me.essentials.MetaItemStack;
    6. import com.earth2me.essentials.User;
    7. import com.earth2me.essentials.utils.StringUtil;
    8. import java.util.Locale;
    9. import java.util.Map;
    10. import java.util.Set;
    11. import java.util.TreeSet;
    12. import org.bukkit.Material;
    13. import org.bukkit.Server;
    14. import org.bukkit.enchantments.Enchantment;
    15. import org.bukkit.inventory.ItemStack;
    18. public class Commandenchant extends EssentialsCommand
    19. {
    20. public Commandenchant()
    21. {
    22. super("enchant");
    23. }
    25. //TODO: Implement charge costs: final Trade charge = new Trade("enchant-" + enchantmentName, ess);
    26. @Override
    27. protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
    28. {
    29. final ItemStack stack = user.getItemInHand();
    30. if (stack == null || stack.getType() == Material.AIR)
    31. {
    32. throw new Exception(_("nothingInHand"));
    33. }
    34. if (args.length == 0)
    35. {
    36. final Set<String> enchantmentslist = new TreeSet<String>();
    37. for (Map.Entry<String, Enchantment> entry : Enchantments.entrySet())
    38. {
    39. final String enchantmentName = entry.getValue().getName().toLowerCase(Locale.ENGLISH);
    40. if (enchantmentslist.contains(enchantmentName) || (user.isAuthorized("essentials.enchantments." + enchantmentName) && entry.getValue().canEnchantItem(stack)))
    41. {
    42. enchantmentslist.add(entry.getKey());
    43. //enchantmentslist.add(enchantmentName);
    44. }
    45. }
    46. throw new NotEnoughArgumentsException(_("enchantments", StringUtil.joinList(enchantmentslist.toArray())));
    47. }
    49. int level = -1;
    50. if (args.length > 1)
    51. {
    52. try
    53. {
    54. level = Integer.parseInt(args[1]);
    55. }
    56. {
    57. level = -1;
    58. }
    59. }
    61. final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && user.isAuthorized("essentials.enchantments.allowunsafe");
    63. final MetaItemStack metaStack = new MetaItemStack(stack);
    64. final Enchantment enchantment = metaStack.getEnchantment(user, args[0]);
    65. metaStack.addEnchantment(user.getSource(), allowUnsafe, enchantment, level);
    66. user.getInventory().setItemInHand(metaStack.getItemStack());
    68. user.updateInventory();
    69. final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH);
    70. if (level == 0)
    71. {
    72. user.sendMessage(_("enchantmentRemoved", enchantmentName.replace('_', ' ')));
    73. }
    74. else
    75. {
    76. user.sendMessage(_("enchantmentApplied", enchantmentName.replace('_', ' ')));
    77. }
    78. }
    79. }
  10. Can anyone help? :eek:
  11. What you want is that you want to add item meta, to Items, instead of giving?
  12. I'm not sure what that means sorry, but what I need is when someone /enchant it tags the enchanted item with the name of the person that enchanted it. So like enchant it puts the enchantment on the item, but also with a tag. Like this [​IMG] so I can track items :) to see if donators are giving enchants away.
  13. Like all I need it a recoded Essentials or someone to tell me how to? I guess :/ I'm noob at Java only a few days so I will probably fail -...-
  14. So mainly, you want it so that whatever item they got in hand, you can do /enchant and it will put the lore or name to the item? Im just trying to get things more clear, Because i can recode essentials if you really need that
  15. Yes the item you are holding for example you are holding diamond sword you /enchant sharpness 10 It does the usuall thing and puts the enchantment on the item BUT with the name of the person that enchanted it Like the image
  16. The lore would be the players name
  17. Put a lore onto players name? more like if a player do /enchant player lore <player_namta_lore>

    and then it comes out like this

    <Need Help>
  18. ./enchant (enchantment)
    - applies enchantment
    - gets playername
    - puts player name as lore

    So I know who enchants what and if someone like a default rank has a god sword I can check that sword to see who enchanted it.
  19. Try this command /give (name) bow 1 lore:~playername~ that is the format I would like for the items I would like the /enchant command to stay the same but when they execute the command it puts the player name into the item
  20. Ok, So if they add a lore to a item, it goes to the name also?

    But! What if they want to make multiple enchantments? How can they just add a lore just to there characters? I can make a plugin that can add a lore that they wont under there name but not hooked onto with essentials, Just because that enchant, And also, If you want to do enchant, Why not just use /item (essentials command), You can use this command also to add lores to items that characters to there items, But not names so do you want /enchant /item or a custom command? and sorry, I dont speak good english
  21. I can just add that addon to the command /item because /enchant isnt what you want to use for this method!
  22. If they do enchantments over and over again it would reapply the name? All I need is a tagging system for the item. When they /enchant (enchantment) it enchants but also renames the item to the playername or adds the player name as item lore
  23. This is for donators because i have problems with them giving out gear and I want to see where its coming from.
    I dont want them to spawn items.
  24. How about i just make a small plugin that when a player do /lorenick it will give them a nick, but as a lore that cannot be longer that a (certain) amount of charactors?
  25. Ok first you want to add lores to players name with enchant command, now you dont want players to give items to other items, what do you want??
  26. Um... I don't know, if you make that are you able to hook it into the /enchant command? I dont want players to use item renaming commands
  27. I'm not sure I thought it was like adding a player event for the command /enchant then it gets player name and applies that player name to the item that is being enchanted
  28. How about this, i can make the plugin with /lorenick,

    and i can remove the essentials command with give other players items with /enchant???
  29. I'm stupid what does /lorenick do? :/
  30. What you want is that you want to add item meta, to Items, instead of giving?
    Yes this! It enchants and give the item that the player enchants item data with lore of the persons name
Thread Status:
Not open for further replies.

Share This Page