Resource XSeries - XMaterial, XSound, XPotion, XEnchantment, Titles, ActionBar, etc

Discussion in 'Spigot Plugin Development' started by CryptoMorin, Jun 16, 2019.


Do you need XParticle? (Read the first post for more info)

  1. Yes

  2. No

  1. Alright. I appreciate your feedback/suggestions, I'll have a go at everything and see if I can get working what I need.
  2. MeliodasX

    MeliodasX Previously Shin1gamiX

    I strongly believe you're misusing XMaterial and that you are a bit confused in regards to it. I would love to help you out but I believe this is not the right place to do so. Feel free to contact me on discord any time if you need help with that.

    As a last message, I'd like to re-direct any user reading this message back to this post, it is regarding an issue with XMaterials (Andesite enum), make sure to check it out and fix if you're using this.
  3. That's actually wrong, Idk why I even added the 1.13 tag, andesite was in minecraft since 1.8,
    same for granite and diorite. I'll fix it.
    And the version number will never be passed to format() method by XMaterial itself unless you do it manually.

    Only use this if you want to save material type to files. Other than that there's no use for it.
    (Using ItemStack#geType() is not compatible for 1.12 and below)
    It's specifically mentioned that XMaterial is not designed for blocks. It's for ItemStacks.
  4. Code (Java):
        private static MinecraftVersion valueOfVersion(@Nonnull String version) {
            version = getExactMajorVersion(version);
            if (version.equals("1.10") || version.equals("1.11") || version.equals("1.12")) return MinecraftVersion.VERSION_1_9;
            version = StringUtils.replace(version, ".", "_");
            if (!version.startsWith("VERSION_")) version = "VERSION_" + version;
            String check = version;
            return -> ? MinecraftVersion.valueOf(version) : MinecraftVersion.UNKNOWN;
    Are version 1.10||1.11||1.12 supposed to return VERSION_1_9? :)
  5. Yeah, it's supposed to do that as nothing huge changed in 1.10-1.12
    Same for MinecraftVersion.UNKNOWN which is for 1.7 and below.
    Getting this error, my code:
    Code (Java):
            ItemStack givegenerator = PlatinumGenerator.instance.itemCreator.create(Chat.colorRaw("&aGive Generator"), givegeneratorlore, XMaterial.END_PORTAL_FRAME.parseMaterial(), true, 1);
    Compiled against 1.8.8 and 1.14.4, both to no avail.
    #106 DarkKnights22, Oct 18, 2019
    Last edited: Oct 18, 2019
  7. MeliodasX

    MeliodasX Previously Shin1gamiX

    Show us your #create method.

    Along with your #parseMaterial(true) method from XMaterial as I think it's been modified.
  8. Code (Java):
    public ItemStack create(String title, List<String> lore, Material material, boolean glow, Integer amount) {
            ItemStack item = new ItemStack(material, amount);
            ItemMeta itemMeta = item.getItemMeta();
            if (glow) {
                itemMeta.addEnchant(Enchantment.DURABILITY, 1, true);
            return item;
    Copied the class directly from the Github page
  9. MeliodasX

    MeliodasX Previously Shin1gamiX

    Works perfectly fine for me with no errors:
    Code (Java):
    ItemStack stack = new ItemStack(MaterialUtil.END_PORTAL_FRAME.parseMaterial(true));
    What's in lines:
    1. at me.darkknights22.platinumgenerator.utils.XMaterial.valueOf( ~[?:?]
    2. at me.darkknights22.platinumgenerator.gui.AdminShopGUI.openAdminShop( ~[?:?]
    3. at me.darkknights22.platinumgenerator.gui.AdminGUI.onClick( ~[?:?]
    Please share all 3 of them.
  10. 1)
    Code (Java):
    public enum XMaterial {
    Code (Java):
    XMaterial itemMaterial = XMaterial.valueOf(PlatinumGenerator.instance.shopFile.getConfig().getString("shop.items." + i + ".material"));
    I get this with:
    Code (Java):
    ItemStack item = PlatinumGenerator.instance.itemCreator.create(itemTitle, itemLore, itemMaterial.parseMaterial(), itemGlow, 1);
    Code (Java):
  11. @Shin1gamiX - Also, I need the material, not item stack
  12. Try create it with my ItemCreator method, it might be with that.
  13. MeliodasX

    MeliodasX Previously Shin1gamiX

    Your itemMaterial variable initialization is being misused. What you're looking for is not XMaterial#valueOf but rather XMaterial#matchXMaterial
  14. Works thank you <3
  15. Nice resource!
    I really like it, keep going!

    Helps to make plugins stay compatible from 1.8 - 1.14 & even kangarko is using it:)
  16. We need XEffects for particle effects!
  17. MeliodasX

    MeliodasX Previously Shin1gamiX

    I suggest you checked this 1.7 - 1.14 particle project out, until something newer comes out.
    Something many users are waiting for is XBlock honestly.
  18. The new XSound, XEnchantment, and XPotion are finished.
    XBlock will take a lot more time because there are a lot of blocks. I coded a few most useful methods. When it's released I'll just leave it on GitHub if anyone wanted to add more methods to it with the same format.
    XMaterial is finished too but I keep finding better ways to optimize it even more. So yep, let's wait for 1.15

    Anyway about XParticle, XEffect or whatever... I'll see what I can do.
    Also, thanks for helping others ^^
    • Friendly Friendly x 1
  19. Thanks man, need XEffect :p