Skip to content
Fulminazzo edited this page Dec 20, 2024 · 10 revisions

Welcome to the official YAGL Wiki page

What is YAGL?

Yet Another GUI Library (YAGL) is a Minecraft Java library created with multi-platform support and retro-compatibility in mind.

It gives both the developer and the server admin endless possibilities, with a pletora of features to choose from, while maintaining simplicity and accessibility for everybody.

What does it contain?

YAGL is currently divided into three modules:

  • The first one acts as a wrapper, a container for many Minecraft related objects.

    Often times developers need to update their works to later versions of Minecraft. However, frequently newer updates break old code and the developer is required to rewrite lines, chunks or even whole files from scratch. This will then cause delays for server admins which will not be able to use the project until it is upgraded.

    What wrappers does is fix the problem to the base: instead of using Minecraft versions related objects, the developers will use YAGL internal objects. This way, the only wait will be for YAGL to update for the latest version. The developer will only need to modify its reference to the newly released YAGL without editing or checking code on his project, thus greatly accelerating the update process of its works.

    wrappers also adds the possibility to create projects working automatically from Minecraft 1.8 and above, therefore adding retro-compatibility for any creation.

  • The second module, dependent on the first, offers the possibility to create custom items offering many features such as name, lore, enchantments, custom data and more.

    The real power of item relies on the simplicity provided for both developers and admins, which will be incredibly facilitated in the creation and modification of items by an easy yet complete system.

  • The third and last module introduces YAGL main focus: Graphical User Interfaces (GUI). They are essentially custom inventories created to display data, offer actions, store information and more.

    Since gui uses (and depends on) item and wrappers, all the previously seen features remains and are extended to the module. This means that creating a GUI is a simple process for both developers and admins, but, most importantly, they can be easily managed throughout the life-cycle of a project. YAGL allows the two to focus only on the aspects of interest, taking care of the mechanical part of actually displaying the GUI to the end user.

    But the real power of gui comes from the types that it offers: along with default GUIs, inventories similar to the ones find in Minecraft vanilla, many different GUIs are present that feature multiple pages, automatic display of data, search bars and even more are coming in next updates.

In this Wiki there are pages for all the three modules divided by developers (coders that will use the Java part of YAGL) and server admins (non-coders who are given the possibility to edit YAGL objects from data files as YAML, JSON and more).

How to import YAGL (for developers)

YAGL can be imported in one of three ways: Gradle, Maven and using the JAR (not recommended).

Guides for each are found in the main page, but it is important to note that the developer should not import the whole YAGL project just to access one module; meaning that if only the wrappers module is needed, it is advised to check the relative documentation found in wrappers. There are pages for both item and gui as well.

NOTE: if the project is a Bukkit plugin, it should be noted that importing the library will not be enough. Because of how Spigot works, two plugins cannot load the same classes (if they can, issues may arise later).

To avoid conflicts, the suggested solution is to relocate YAGL classes, so that plugins using YAGL will not conflict. This means that, if the base package name is it.developer.superplugin, all YAGL classes (with base package it.fulminazzo.yagl) will be moved to the base package.

This process can happen automatically if using Maven or Gradle, here are guides for that:

  • Gradle: the shadow plugin is required in order for this to work.

    plugins {
        /* ... */
        id 'com.github.johnrengelman.shadow' version '{LATEST}'
    }

    Once imported, all that's left is to relocate. Just add a new shadowJar task with the following lines:

    shadowJar {
        // YAGL
        relocate("it.fulminazzo.yagl", "it.developer.superplugin.yagl")
        /*
           YAMLParser, a library used by YAGL for file management.
           Check https://github.com/Fulminazzo/YAMLParser for more.
         */
        relocate("it.fulminazzo.yamlparser", "it.developer.superplugin.yamlparser")
        dependencies {
            exclude(dependency('org.yaml:snakeyaml'))
        }
        // FulmiCollection, another library.
        relocate("it.fulminazzo.fulmicollection", "it.developer.superplugin.fulmicollection")
    
        archiveFileName = "${project.name}-${project.version}.jar"
    }

    That's it! You can check if it worked by opening the generated JAR file with an archive manager like WinRar.

  • Maven: the shadow plugin is required in order for this to work.

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>{LATEST}</version>
      </plugin>
    </plugins>

    Once imported, all that's left is to relocate. This can be done by creating a new execution with a specific configuration:

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>{LATEST}</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                  <goal>shade</goal>
              </goals>
              <configuration>
                <artifactSet>
                  <excludes>
                    <exclude>org.yaml.snakeyaml</exclude>
                  </excludes>
                </artifactSet>
                <relocations>
                  <!-- YAGL -->
                  <relocation>
                      <pattern>it.fulminazzo.yagl</pattern>
                      <shadedPattern>it.developer.superplugin.yagl</shadedPattern>
                  </relocation>
                  <!-- YAMLParser, a library used by YAGL for file management. -->
                  <!-- Check https://github.com/Fulminazzo/YAMLParser for more. -->
                  <relocation>
                      <pattern>it.fulminazzo.yamlparser</pattern>
                      <shadedPattern>it.developer.superplugin.yamlparser</shadedPattern>
                  </relocation>
                  <relocation>
                  <!-- FulmiCollection, another library. -->
                      <pattern>it.fulminazzo.fulmicollection</pattern>
                      <shadedPattern>it.developer.superplugin.fulmicollection</shadedPattern>
                  </relocation>
                </relocations>
              </configuration>
            </execution>
          </executions>
      </plugin>
    </plugins>

    That's it! You can check if it worked by opening the generated JAR file with an archive manager like WinRar.