Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NONPLAYT committed Nov 28, 2024
1 parent 234af27 commit 93b39c4
Show file tree
Hide file tree
Showing 17 changed files with 722 additions and 92 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish commons

on:
release:
branches: [ master ]
types: [ published ]

jobs:
publish:
runs-on: ubuntu-latest
environment: deployment
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Publish with Gradle
run: ./gradlew publish -PmavenUsername=${{ secrets.REPO_USERNAME }} -PmavenPassword=${{ secrets.REPO_SECRET }}
7 changes: 7 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
}
16 changes: 16 additions & 0 deletions buildSrc/src/main/kotlin/commons-java.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.withType

plugins {
`java-library`
}

tasks {
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
withType<JavaCompile> {
options.encoding = "UTF-8"
}
}
39 changes: 39 additions & 0 deletions buildSrc/src/main/kotlin/commons-publish.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import org.gradle.api.artifacts.repositories.PasswordCredentials
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.authentication.http.BasicAuthentication
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.credentials
import org.gradle.kotlin.dsl.get

plugins {
`java-library`
`maven-publish`
}

group = project.group
version = project.version

java {
withSourcesJar()
}

publishing {
repositories {
maven {
url = uri("https://repo.bx-team.space/releases/")

if (project.version.toString().endsWith("-SNAPSHOT")) {
url = uri("https://repo.bx-team.space/snapshots/")
}
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
}
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
9 changes: 9 additions & 0 deletions buildSrc/src/main/kotlin/commons-repositories.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
`java-library`
}

repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
49 changes: 4 additions & 45 deletions commons-adventure/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,52 +1,11 @@
plugins {
`java-library`
`maven-publish`
}

group = project.group
version = project.version

repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
`commons-java`
`commons-publish`
`commons-repositories`
}

dependencies {
api(project(":commons-shared"))
api("net.kyori:adventure-text-minimessage:4.17.0")
api("net.kyori:adventure-text-serializer-legacy:4.17.0")
}

tasks {
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
withType<JavaCompile> {
options.encoding = "UTF-8"
}
withType<Test> {
useJUnitPlatform()
}
}

publishing {
repositories {
maven {
url = uri("https://repo.bx-team.space/releases/")

if (project.version.toString().endsWith("-SNAPSHOT")) {
url = uri("https://repo.bx-team.space/snapshots/")
}
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
}
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
50 changes: 4 additions & 46 deletions commons-bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,55 +1,13 @@
plugins {
`java-library`
`maven-publish`
}

group = project.group
version = project.version

repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
`commons-java`
`commons-publish`
`commons-repositories`
}

dependencies {
api(project(":commons-shared"))
api("org.jetbrains:annotations:26.0.1")

compileOnly("org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT")
testImplementation("org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT")
}

tasks {
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
}
withType<JavaCompile> {
options.encoding = "UTF-8"
}
withType<Test> {
useJUnitPlatform()
}
}

publishing {
repositories {
maven {
url = uri("https://repo.bx-team.space/releases/")

if (project.version.toString().endsWith("-SNAPSHOT")) {
url = uri("https://repo.bx-team.space/snapshots/")
}
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
}
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package space.bxteam.commons.bukkit.scheduler;

import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitTask;
import space.bxteam.commons.scheduler.Task;

public class BukkitScheduledTask implements Task {
BukkitTask task;
boolean isRepeating;

public BukkitScheduledTask(final BukkitTask task) {
this.task = task;
this.isRepeating = false;
}

public BukkitScheduledTask(final BukkitTask task, boolean isRepeating) {
this.task = task;
this.isRepeating = isRepeating;
}

@Override
public void cancel() {
task.cancel();
}

@Override
public boolean isCancelled() {
return task.isCancelled();
}

@Override
public boolean isCurrentlyRunning() {
// Fuck Bukkit, you don't have any other way
return Bukkit.getServer().getScheduler().isCurrentlyRunning(this.task.getTaskId());
}

@Override
public boolean isRepeatingTask() {
return isRepeating;
}

@Override
public Plugin getPlugin() {
return task.getOwner();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package space.bxteam.commons.bukkit.scheduler;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.Plugin;
import space.bxteam.commons.scheduler.Scheduler;
import space.bxteam.commons.scheduler.Task;

public class BukkitScheduler implements Scheduler {
final Plugin plugin;

public BukkitScheduler(Plugin plugin) {
this.plugin = plugin;
}

@Override
public boolean isGlobalThread() {
return Bukkit.getServer().isPrimaryThread();
}

@Override
public boolean isEntityThread(Entity entity) {
return Bukkit.getServer().isPrimaryThread();
}

@Override
public boolean isRegionThread(Location location) {
return Bukkit.getServer().isPrimaryThread();
}

@Override
public Task runTask(Runnable runnable) {
return new BukkitScheduledTask(Bukkit.getScheduler().runTask(plugin, runnable));
}

@Override
public Task runTaskLater(Runnable runnable, long delay) {
return new BukkitScheduledTask(Bukkit.getScheduler().runTaskLater(plugin, runnable, delay));
}

@Override
public Task runTaskTimer(Runnable runnable, long delay, long period) {
return new BukkitScheduledTask(Bukkit.getScheduler().runTaskTimer(plugin, runnable, delay, period));
}

@Override
public Task runTaskAsynchronously(Runnable runnable) {
return new BukkitScheduledTask(Bukkit.getScheduler().runTaskAsynchronously(plugin, runnable));
}

@Override
public Task runTaskLaterAsynchronously(Runnable runnable, long delay) {
return new BukkitScheduledTask(Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, runnable, delay));
}

@Override
public Task runTaskTimerAsynchronously(Runnable runnable, long delay, long period) {
return new BukkitScheduledTask(Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, runnable, delay, period));
}

@Override
public void execute(Runnable runnable) {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, runnable);
}

@Override
public void cancelTasks() {
Bukkit.getScheduler().cancelTasks(plugin);
}

@Override
public void cancelTasks(Plugin plugin) {
Bukkit.getScheduler().cancelTasks(plugin);
}
}
12 changes: 12 additions & 0 deletions commons-paper/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
`commons-java`
`commons-publish`
`commons-repositories`
}

dependencies {
api(project(":commons-shared"))
api("org.jetbrains:annotations:26.0.1")

compileOnlyApi("dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT")
}
Loading

0 comments on commit 93b39c4

Please sign in to comment.