Custom Enchantment

Discussion in 'Plugin Requests' started by slamos, Jun 21, 2019.

Thread Status:
Not open for further replies.
  1. Hello,
    Is there anyway to create custom enchants on weapons/armors with custom items? Like Rubys and the enchant can destroy the previous enchant
     
  2. Offline

    Shqep

    Yes, it’s possible.
     
  3. Could you possibly give me a tutorial and maybe something to start from?
     
  4. Offline

    Shqep

    I don't really know,... eat this guy's video.
    And uh, at least, learn something, you can ask what you did not understand here, and hopefully people will help.

    Check this, it kind of covers some parts, you can skip through tho, it's quite long:

    very long video beware
     
  5. Offline

    KarimAKL

    Eat? :confused:
     
  6. Offline

    Kars

    You could create a custom enchantment in the form of lore for an item. For example "Blasting V" on a pickaxe.
    Then you catch block break events and check whehther the player is holding an item with said lore. If so, you break all blocks around the broken block. Custom enchantment for ya.

    The same can be done for swords. Say you wanna make a Zeus enchant or something. You set custom lore for a sword and on entity damage events, if the weapon was said sword, you cast a lightning bolt on the entity.
     
  7. Online

    timtower Administrator Administrator Moderator

    @slamos Are you asking as developer or as server owner?
     
  8. As a server owner.
    The thing is not books, I want a system with diffrent rubys. Green Ruby 5% ... Blue Ruby 7% etc.
    And the first ruby has 75% to success, the second 65% etc. and if it does not succeed it breaks one enchant from the sword/armor
     
  9. Offline

    Shqep

    cough Request it then ;-;


    Am i paranoid or i saw that this topic used to be in the development section...
     
  10. Offline

    wand555

    @Shqep

    Quick question regarding the video:
    Been trying to understand what NamespacedKey exactly is, since it doesn't work with an Integer ID in the constructor anymore. And according to the bukkit docs, NamespacedKey requires the plugin and a String key. So I think the constructor and getId would have to look like that:
    Code:java
    1. public CustomMagicGlowing(NamespacedKey id) {
    2. super(id);
    3. }
    4.  
    5. public NamespacedKey getId() {
    6. return(plugin, "name_of_key")
    7. }

    But first, how do I access the plugin when my class extends Enchantment, but not JavaPlugin directly (tried CustomMagic plugin = CustomMagic.getPlugin(CustomMagic.class); ) but it doesnt seem to work (it returns type CustomMagic). Now secondly I still have no clue what NamespacedKey actually is used for and more specifically, how to use it.
     
  11. Online

    timtower Administrator Administrator Moderator

    Used to be.
    @wand555 Please make a thread if you want an answer to that specific question.
     
  12. Offline

    Shqep

    @timtower
    Thanks for that ;-; I thought I was really being scammed by tapatalk

    EDIT:
    @wand555
    Here's the JavaDoc for org.bukkit.NamespacedKey.
    I think NamespacedKey is just a replacement for the "int id" in later versions.

    About the plugin instance, why don't you pass it using a constructor?

    PHP:
        public MyClass(final Object... randomParameters) {
            
    //Hi, my name is "Constructor". I love initializing fields for you to create polished objects!
            //My friend "static" is dominating me :< pls love me again
        
    }
    Correct me if I'm wrong, I'm going to be stupid and unsure for a while.

    If your class (CustomMagic) is extending JavaPlugin which implements Plugin, shouldn't that mean an instance of CustomMagic will be accepted by the other guys, JavaPlugin and Plugin?

    Ok, whatever...
     
    Last edited: Jun 24, 2019
    slamos likes this.
Thread Status:
Not open for further replies.

Share This Page