Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Adrigamer2950/AdriAPI
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.2.0
Choose a base ref
...
head repository: Adrigamer2950/AdriAPI
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.3.0
Choose a head ref

Commits on Feb 17, 2025

  1. beta: 2.3.0

    Adrigamer2950 committed Feb 17, 2025
    Copy the full SHA
    c6090ca View commit details
  2. Copy the full SHA
    8cce1c1 View commit details
  3. Copy the full SHA
    15f0bf2 View commit details

Commits on Feb 20, 2025

  1. Copy the full SHA
    bed78f1 View commit details

Commits on Feb 21, 2025

  1. Copy the full SHA
    196c62a View commit details
  2. Copy the full SHA
    27b34a1 View commit details
  3. Copy the full SHA
    73d0068 View commit details
  4. Copy the full SHA
    e82c71c View commit details

Commits on Feb 22, 2025

  1. Copy the full SHA
    1678316 View commit details
  2. Copy the full SHA
    ae545c0 View commit details
  3. feat: Make Inventory#setupInventory, Inventory#onInventoryClick and I…

    …nventory#onInventoryClose not abstract
    Adrigamer2950 committed Feb 22, 2025
    Copy the full SHA
    24a7f35 View commit details

Commits on Feb 23, 2025

  1. Copy the full SHA
    183d792 View commit details
  2. Copy the full SHA
    72eb252 View commit details
  3. test

    Adrigamer2950 committed Feb 23, 2025
    Copy the full SHA
    863990a View commit details
  4. test

    Adrigamer2950 committed Feb 23, 2025
    Copy the full SHA
    a8cdf2c View commit details
  5. test

    Adrigamer2950 committed Feb 23, 2025
    Copy the full SHA
    17c9d9d View commit details
  6. test

    Adrigamer2950 committed Feb 23, 2025
    Copy the full SHA
    2e1115c View commit details
  7. Revert "test"

    This reverts commit 2e1115c.
    Adrigamer2950 committed Feb 23, 2025
    Copy the full SHA
    eb6cea3 View commit details
  8. Revert "test"

    This reverts commit 17c9d9d.
    Adrigamer2950 committed Feb 23, 2025
    Copy the full SHA
    c52736b View commit details
  9. Revert "test"

    This reverts commit a8cdf2c.
    Adrigamer2950 committed Feb 23, 2025
    Copy the full SHA
    c52704b View commit details
  10. Revert "test"

    This reverts commit 863990a.
    Adrigamer2950 committed Feb 23, 2025
    Copy the full SHA
    466f0b4 View commit details

Commits on Feb 25, 2025

  1. chore(deps): update dependency gradle to v8.13 (#16)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 25, 2025
    Copy the full SHA
    e5bc4ff View commit details

Commits on Mar 4, 2025

  1. Copy the full SHA
    7e50c9a View commit details
  2. Copy the full SHA
    8c641e3 View commit details
  3. docs: Update README.md

    Adrigamer2950 committed Mar 4, 2025
    Copy the full SHA
    85b3835 View commit details

Commits on Mar 6, 2025

  1. Copy the full SHA
    639f3c9 View commit details
  2. Copy the full SHA
    39e1091 View commit details
  3. Copy the full SHA
    1f56054 View commit details

Commits on Mar 7, 2025

  1. Copy the full SHA
    6f339b3 View commit details
  2. Copy the full SHA
    6d069e1 View commit details
  3. Copy the full SHA
    8fb65e3 View commit details
  4. Copy the full SHA
    631b1b0 View commit details
  5. Copy the full SHA
    6521c6d View commit details
  6. Copy the full SHA
    1a01139 View commit details
  7. Copy the full SHA
    1651fbb View commit details
  8. Copy the full SHA
    a00ce68 View commit details
  9. Copy the full SHA
    124352b View commit details
  10. Copy the full SHA
    4da4e92 View commit details
  11. Copy the full SHA
    e04c48e View commit details
  12. Copy the full SHA
    c746eed View commit details
  13. Copy the full SHA
    76bdb34 View commit details
  14. Copy the full SHA
    8339619 View commit details
  15. Copy the full SHA
    757ca54 View commit details
  16. chore(deps): update dependency com.gradleup.shadow to v8.3.6 (#17)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 7, 2025
    Copy the full SHA
    bebaa8d View commit details
  17. Copy the full SHA
    2ce8af6 View commit details

Commits on Mar 8, 2025

  1. Copy the full SHA
    2a71e53 View commit details
  2. feat: Item Builder

    Adrigamer2950 committed Mar 8, 2025
    Copy the full SHA
    6d7304b View commit details
  3. Copy the full SHA
    38049ac View commit details
  4. Copy the full SHA
    236fd17 View commit details
  5. release: 2.3.0

    Adrigamer2950 committed Mar 8, 2025
    Copy the full SHA
    6aa1a5e View commit details
Showing with 1,339 additions and 493 deletions.
  1. +55 −14 .github/workflows/build.yml
  2. +14 −8 README.md
  3. +98 −0 api/build.gradle.kts
  4. +7 −8 { → api}/src/main/java/me/adrigamer2950/adriapi/api/APIPlugin.java
  5. +0 −1 { → api}/src/main/java/me/adrigamer2950/adriapi/api/colors/Colors.java
  6. 0 { → api}/src/main/java/me/adrigamer2950/adriapi/api/command/Command.java
  7. 0 { → api}/src/main/java/me/adrigamer2950/adriapi/api/command/SubCommand.java
  8. +1 −31 { → api}/src/main/java/me/adrigamer2950/adriapi/api/command/manager/CommandManager.java
  9. 0 { → api}/src/main/java/me/adrigamer2950/adriapi/api/event/command/CommandEvent.java
  10. 0 { → api}/src/main/java/me/adrigamer2950/adriapi/api/event/command/CommandLoadedEvent.java
  11. 0 { → api}/src/main/java/me/adrigamer2950/adriapi/api/event/item/ItemCraftedEvent.java
  12. 0 ...src/main/java/me/adrigamer2950/adriapi/api/exceptions/command/CommandNotInPluginYMLException.java
  13. +3 −5 { → api}/src/main/java/me/adrigamer2950/adriapi/api/inventory/Inventory.java
  14. 0 { → api}/src/main/java/me/adrigamer2950/adriapi/api/inventory/InventorySize.java
  15. +168 −0 api/src/main/java/me/adrigamer2950/adriapi/api/item/ItemBuilder.java
  16. 0 { → api}/src/main/java/me/adrigamer2950/adriapi/api/library/manager/LibraryManager.java
  17. +2 −0 { → api}/src/main/java/me/adrigamer2950/adriapi/api/library/manager/LibraryManagerImpl.java
  18. +0 −2 { → api}/src/main/java/me/adrigamer2950/adriapi/api/logger/APILogger.java
  19. +162 −0 api/src/main/java/me/adrigamer2950/adriapi/api/serializer/boostedyaml/ItemStackSerializer.java
  20. +56 −0 api/src/main/java/me/adrigamer2950/adriapi/api/serializer/boostedyaml/SoundSerializer.java
  21. +38 −0 api/src/main/java/me/adrigamer2950/adriapi/api/sound/Sound.java
  22. +1 −2 { → api}/src/main/java/me/adrigamer2950/adriapi/api/user/User.java
  23. +5 −9 { → api}/src/main/java/me/adrigamer2950/adriapi/api/user/UserImpl.java
  24. +7 −27 { → api}/src/main/java/me/adrigamer2950/adriapi/api/util/ServerType.java
  25. +2 −0 { → api}/src/main/java/me/adrigamer2950/adriapi/api/util/bStats.java
  26. +0 −242 build.gradle
  27. +191 −0 build.gradle.kts
  28. +17 −0 folia/build.gradle.kts
  29. +210 −0 folia/src/main/java/me/adrigamer2950/adriapi/api/scheduler/Scheduler.java
  30. +107 −0 folia/src/main/java/me/adrigamer2950/adriapi/api/scheduler/folia/FoliaScheduler.java
  31. +105 −0 folia/src/main/java/me/adrigamer2950/adriapi/api/scheduler/paper/PaperScheduler.java
  32. +34 −0 folia/src/main/java/me/adrigamer2950/adriapi/api/scheduler/task/ScheduledTask.java
  33. +5 −3 gradle.properties
  34. +8 −4 gradle/libs.versions.toml
  35. BIN gradle/wrapper/gradle-wrapper.jar
  36. +1 −1 gradle/wrapper/gradle-wrapper.properties
  37. +1 −2 gradlew
  38. +32 −0 plugin/build.gradle.kts
  39. +3 −8 ...ava/me/adrigamer2950/adriapi → plugin/src/main/java/me/adrigamer2950/adriapi/plugin}/AdriAPI.java
  40. +1 −7 ...adrigamer2950/adriapi → plugin/src/main/java/me/adrigamer2950/adriapi/plugin}/AdriAPICommand.java
  41. +1 −3 ...riapi → plugin/src/main/java/me/adrigamer2950/adriapi/plugin}/listeners/CustomEventsListener.java
  42. +1 −3 ...driapi → plugin/src/main/java/me/adrigamer2950/adriapi/plugin}/listeners/InventoriesListener.java
  43. +3 −1 settings.gradle → settings.gradle.kts
  44. +0 −11 src/main/java/me/adrigamer2950/adriapi/api/exceptions/DuplicatedManagerException.java
  45. +0 −75 src/main/java/me/adrigamer2950/adriapi/api/folia/Scheduler.java
  46. +0 −26 src/main/java/me/adrigamer2950/adriapi/listeners/ManagersListener.java
69 changes: 55 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
name: Build
name: Build & Publish

on: [
workflow_dispatch,
push
]
on:
workflow_dispatch:
inputs:
publish:
default: false
type: boolean
description: Whether to publish the release of not
required: true
push:

env:
COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"

jobs:
build:
name: Build & Publish
name: Build
runs-on: ubuntu-latest

permissions:
contents: read

env:
BUILD_NUMBER: "${{ github.run_number }}"
COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"

steps:
- uses: actions/checkout@v4
name: Checkout sources
@@ -31,7 +35,7 @@ jobs:
name: Setup Gradle

- name: Build Artifact
run: "chmod +x ./gradlew && ./gradlew build $([[ \"$COMMIT_MESSAGE\" == \"release:\"* ]] && echo || echo -PBUILD_NUMBER=$BUILD_NUMBER)"
run: "chmod +x ./gradlew && ./gradlew build"

- uses: actions/upload-artifact@v4
name: Save Artifact
@@ -44,10 +48,47 @@ jobs:
env:
NEXUS_USERNAME: "${{ secrets.NEXUS_USERNAME }}"
NEXUS_PASSWORD: "${{ secrets.NEXUS_PASSWORD }}"
run: "./gradlew publish -PNEXUS_USERNAME=$NEXUS_USERNAME -PNEXUS_PASSWORD=$NEXUS_PASSWORD $([[ \"$COMMIT_MESSAGE\" == \"release:\"* ]] && echo \"\" || echo \"-PBUILD_NUMBER=$BUILD_NUMBER\")"
run: "./gradlew :api:publish -PNEXUS_USERNAME=$NEXUS_USERNAME -PNEXUS_PASSWORD=$NEXUS_PASSWORD"
publish:
if: ${{ github.repository == 'Adrigamer2950/AdriAPI' &&
( startsWith(github.event.head_commit.message, 'release:')
|| (github.event_name == 'workflow_dispatch' && github.event.inputs.publish) ) }}
name: Publish Release
runs-on: ubuntu-latest
needs:
- build

permissions:
contents: read

steps:
- uses: actions/checkout@v4
name: Checkout sources

- uses: actions/setup-java@v4
name: Set up JDK 17
with:
java-version: '17'
distribution: 'temurin'

- uses: gradle/actions/setup-gradle@v4
name: Setup Gradle

- name: Create gh-assets directory
run: "mkdir gh-assets"

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: "AdriAPI-b${{ github.run_number }}"
path: "./gh-assets"

- name: Publish to HangarMC
env:
HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }}
run: "chmod +x ./gradlew && ./gradlew publishPluginPublicationToHangar"

- name: Publish to Modrinth
if: "${{ github.repository == 'Adrigamer2950/AdriAPI' && startsWith(github.event.head_commit.message, 'release:') }}"
env:
MODRINTH_TOKEN: "${{ secrets.MODRINTH_TOKEN }}"
run: "./gradlew modrinth modrinthSyncBody"
run: "./gradlew modrinth modrinthSyncBody"
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,18 +3,24 @@
<img src="https://avatars.githubusercontent.com/u/58531641?v=4" height="200" alt="Logo" />
</p>

An API created to make Minecraft Plugin development easier
An API aimed to simplify the development of Paper plugins

![Build](https://github.com/Adrigamer2950/AdriAPI/actions/workflows/build.yml/badge.svg)

# Resources
- [Docs](https://docs.devadri.es)
- [bStats](https://bstats.org/plugin/bukkit/AdriAPI/20135)
- [Maven Repository](https://repo.devadri.es)

# Info

This API is aimed to simplify the development of Bukkit plugins (please use Paper or any fork of Paper instead of CraftBukkit/Spigot),
This API is aimed to simplify the development of Paper plugins,
providing a lot of utilities that will make your life (and mine) easier.

### It's used in my plugins, but you can use it on your own plugins if you want, just make sure to give proper credit!
> [!CAUTION]
> You need Java 17+ to use this API/Plugin. If you are using a lower version consider upgrading
> [!WARNING]
> Only Minecraft 1.17 or superior is officially supported. Versions below 1.17 will not receive any support
### It's mostly used in my plugins, but you can use it on your own plugins if you want, just make sure to give proper credit!

# Resources
- [Docs](https://docs.devadri.es)
- [bStats](https://bstats.org/plugin/bukkit/AdriAPI/20135)
- [Maven Repository](https://repo.devadri.es)
98 changes: 98 additions & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
@file:Suppress("VulnerableLibrariesLocal")

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.internal.extensions.stdlib.toDefaultLowerCase

plugins {
id("java")
id("maven-publish")
alias(libs.plugins.shadow)
}

val versionIsBeta = (parent?.properties?.get("version") as String).toDefaultLowerCase().contains("beta")

if (project.hasProperty("NEXUS_USERNAME") && project.hasProperty("NEXUS_PASSWORD")) {
java {
withJavadocJar()
withSourcesJar()
}

publishing {
repositories {
maven {
val baseUrl = "https://repo.devadri.es/repository/"

url = uri(
baseUrl + if (versionIsBeta) "dev" else "releases"
)
credentials {
username = project.property("NEXUS_USERNAME") as String
password = project.property("NEXUS_PASSWORD") as String
}
}
}
publications {
create<MavenPublication>("shadow") {
groupId = rootProject.group as String
artifactId = rootProject.name
version = rootProject.version as String

from(components["shadow"])
pom {
name = rootProject.name
description.set(parent?.properties?.get("description") as String)
url = "https://github.com/Adrigamer2950/AdriAPI"

licenses {
license {
name = "GPL-3.0"
url = "https://www.gnu.org/licenses/gpl-3.0.html"
}
}

developers {
developer {
id = "Adrigamer2950"
name = "Adri"
}
}

scm {
url = "https://github.com/Adrigamer2950/AdriAPI"
}

issueManagement {
system = "GitHub"
url = "https://github.com/Adrigamer2950/AdriAPI/issues"
}
}
}
}
}
}

dependencies {
compileOnly(libs.paper.api)

implementation(libs.jansi)

implementation(libs.libby)

implementation(project(":folia"))

compileOnly(libs.boosted.yaml)
}

tasks.named<ShadowJar>("shadowJar") {
archiveClassifier.set("")

dependencies {
relocate("net.byteflux.libby", "me.adrigamer2950.adriapi.lib.libby")

relocate("org.fusesource.jansi", "me.adrigamer2950.adriapi.lib.jansi")
}
}

tasks.named("build") {
finalizedBy(tasks.named("shadowJar"))
}
Original file line number Diff line number Diff line change
@@ -4,12 +4,11 @@
import lombok.NonNull;
import me.adrigamer2950.adriapi.api.command.Command;
import me.adrigamer2950.adriapi.api.command.manager.CommandManager;
import me.adrigamer2950.adriapi.api.folia.Scheduler;
import me.adrigamer2950.adriapi.api.scheduler.Scheduler;
import me.adrigamer2950.adriapi.api.library.manager.LibraryManager;
import me.adrigamer2950.adriapi.api.logger.APILogger;
import me.adrigamer2950.adriapi.api.util.ServerType;
import me.adrigamer2950.adriapi.api.util.bStats;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.ApiStatus;
@@ -35,20 +34,21 @@ public abstract class APIPlugin extends JavaPlugin {
private Scheduler scheduler;
private bStats bstats;
private ServerType serverType;
private BukkitAudiences adventure;
protected LibraryManager libraryManager;
private LibraryManager libraryManager;

@Override
public final void onEnable() {
public final void onLoad() {
this.serverType = ServerType.getType();
this.adventure = BukkitAudiences.create(this);
this.libraryManager = LibraryManager.get(this);

onPreLoad();

this.getLogger().debug("&6Loading hooks...");
loadHooks();
}

@Override
public final void onEnable() {
this.getLogger().debug("&6Enabling plugin...");
onPostLoad();
}
@@ -58,7 +58,7 @@ private void loadHooks() {
this.commandManager = new CommandManager<>(this);

this.getLogger().debug("&6Loading Scheduler...");
this.scheduler = new Scheduler(this);
this.scheduler = Scheduler.get(this, this.getServerType().equals(ServerType.FOLIA));

if (this.getBStatsServiceId() != 0) {
this.getLogger().debug("&6Loading bStats hook...");
@@ -91,7 +91,6 @@ public final void onDisable() {
if (this.bstats != null) this.bstats.shutdown();
this.bstats = null;
this.serverType = null;
this.adventure = null;
this.libraryManager = null;
}

Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@
* You can also use a custom color code
* system that's easier to remember than Bukkit one.
*/
@SuppressWarnings("deprecation")
public class Colors {

/**
Original file line number Diff line number Diff line change
@@ -4,14 +4,11 @@
import me.adrigamer2950.adriapi.api.APIPlugin;
import me.adrigamer2950.adriapi.api.command.Command;
import me.adrigamer2950.adriapi.api.event.command.CommandLoadedEvent;
import me.adrigamer2950.adriapi.api.exceptions.DuplicatedManagerException;
import me.adrigamer2950.adriapi.api.exceptions.command.CommandNotInPluginYMLException;
import me.adrigamer2950.adriapi.api.logger.APILogger;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandMap;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.ApiStatus;

import java.util.ArrayList;
import java.util.List;
@@ -29,43 +26,17 @@ public final class CommandManager<T extends APIPlugin> {

public final APILogger LOGGER;
private final List<Command<? extends APIPlugin>> cmds = new ArrayList<>();
@ApiStatus.Internal
public static final List<CommandManager<? extends APIPlugin>> COMMAND_MANAGERS = new ArrayList<>();

/**
* @param plugin The plugin
* @return The plugin if it has a Command Manager, null otherwise
*/
public static CommandManager<? extends APIPlugin> getManager(Plugin plugin) {
for (CommandManager<? extends APIPlugin> cmdM : COMMAND_MANAGERS)
if (cmdM.getPlugin().equals(plugin))
return cmdM;

return null;
}

@Getter
private final T plugin;

/**
* @param pl The plugin
*/
@SuppressWarnings("deprecation")
public CommandManager(T pl) {
if (getManager(pl) != null) {
throw new DuplicatedManagerException(
String.format("Command Manager for plugin %s v%s has already been created and cannot be duplicated",
pl.getName(),
pl.getDescription().getVersion()
)
);
}

this.plugin = pl;

this.LOGGER = this.plugin.getLogger();

COMMAND_MANAGERS.add(this);
}

/**
@@ -84,7 +55,7 @@ public void registerCommand(Command<? extends APIPlugin> command) {
CommandMap commandMap = command.getPlugin().getServer().getCommandMap();

if (commandMap.getCommand(command.getName()) == null) {
commandMap.register(command.getPlugin().getPluginMeta().getName(), command);
commandMap.register(command.getPlugin().getDescription().getName(), command);
} else {
PluginCommand plCmd = command.getPlugin().getServer().getPluginCommand(command.getName());
if (plCmd == null || plCmd.getPlugin() != command.getPlugin()) {
@@ -101,7 +72,6 @@ public void registerCommand(Command<? extends APIPlugin> command) {
CommandLoadedEvent event = new CommandLoadedEvent(command, plugin);
Bukkit.getPluginManager().callEvent(event);

//noinspection deprecation
LOGGER.debug(
String.format("Command '%s' for plugin %s v%s has been successfully loaded", command.getName(), command.getPlugin().getName(), command.getPlugin().getDescription().getVersion())
);
Loading