Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/deploy-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and Deploy Plot System API

on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- 'plot-system-api/**'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v7

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

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

- name: Build with Gradle
run: ./gradlew :plot-system-api:build

- name: Deploy Plot System API to Maven repository
run: ./gradlew :plot-system-api:publish
env:
ORG_GRADLE_PROJECT_alpsMavenUser: ${{ secrets.MAVEN_USERNAME }}
ORG_GRADLE_PROJECT_alpsMavenPassword: ${{ secrets.MAVEN_PASSWORD }}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ val guavaPackage = "com.google.guava"
val gsonPackage = "com.google.code.gson"

dependencies {
implementation(project(":plot-system-api"))
implementation(libs.com.alpsbte.canvas)
implementation(libs.com.alpsbte.alpslib.alpslib.io)
implementation(libs.com.alpsbte.alpslib.alpslib.hologram)
Expand Down
49 changes: 49 additions & 0 deletions plot-system-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
plugins {
`java-library`
`maven-publish`
}

repositories {
maven { url = uri("https://repo.papermc.io/repository/maven-public/") }
mavenCentral()
}

group = rootProject.group
version = rootProject.version
description = "Plot System API."

dependencies {
compileOnly(libs.io.papermc.paper.paper.api)
}

java {
toolchain {
languageVersion.set(rootProject.providers.gradleProperty("targetJava").map(JavaLanguageVersion::of).orElse(JavaLanguageVersion.of(25)))
}
withSourcesJar()
}

tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.release.set(rootProject.providers.gradleProperty("targetJava").map(String::toInt).orElse(25))
}

val alpsMavenUser: String? = project.findProperty("alpsMavenUser") as String?
val alpsMavenPassword: String? = project.findProperty("alpsMavenPassword") as String?

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
repositories {
maven {
credentials {
username = alpsMavenUser
password = alpsMavenPassword
}
url = uri("https://mvn.alps-bte.com/repository/alps-bte/")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.alpsbte.plotsystem.api.event;

import com.alpsbte.plotsystem.api.model.PlotAbandonReason;
import com.alpsbte.plotsystem.api.model.PlotSnapshot;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

public final class PlotAbandonedEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final PlotSnapshot plot;
private final PlotAbandonReason reason;

public PlotAbandonedEvent(@NotNull PlotSnapshot plot, @NotNull PlotAbandonReason reason) {
this.plot = Objects.requireNonNull(plot, "plot");
this.reason = Objects.requireNonNull(reason, "reason");
}

public @NotNull PlotSnapshot getPlot() {
return plot;
}

public @NotNull PlotAbandonReason getReason() {
return reason;
}

public static @NotNull HandlerList getHandlerList() {
return HANDLERS;
}

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.alpsbte.plotsystem.api.event;

import com.alpsbte.plotsystem.api.model.PlotSnapshot;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

public final class PlotCreatedEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final PlotSnapshot plot;

public PlotCreatedEvent(@NotNull PlotSnapshot plot) {
this.plot = plot;
}

public @NotNull PlotSnapshot getPlot() {
return plot;
}

public static @NotNull HandlerList getHandlerList() {
return HANDLERS;
}

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.alpsbte.plotsystem.api.event;

import com.alpsbte.plotsystem.api.model.ReviewSnapshot;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

public final class PlotFeedbackUpdatedEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final ReviewSnapshot review;

public PlotFeedbackUpdatedEvent(@NotNull ReviewSnapshot review) {
this.review = review;
}

public @NotNull ReviewSnapshot getReview() {
return review;
}

public static @NotNull HandlerList getHandlerList() {
return HANDLERS;
}

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.alpsbte.plotsystem.api.event;

import com.alpsbte.plotsystem.api.model.PlotSnapshot;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

import java.time.LocalDate;
import java.util.Objects;

public final class PlotInactivityWarningEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final PlotSnapshot plot;
private final LocalDate abandonmentDate;

public PlotInactivityWarningEvent(@NotNull PlotSnapshot plot, @NotNull LocalDate abandonmentDate) {
this.plot = Objects.requireNonNull(plot, "plot");
this.abandonmentDate = Objects.requireNonNull(abandonmentDate, "abandonmentDate");
}

public @NotNull PlotSnapshot getPlot() {
return plot;
}

public @NotNull LocalDate getAbandonmentDate() {
return abandonmentDate;
}

public static @NotNull HandlerList getHandlerList() {
return HANDLERS;
}

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.alpsbte.plotsystem.api.event;

import com.alpsbte.plotsystem.api.model.ReviewSnapshot;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

public final class PlotRejectedEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final ReviewSnapshot review;

public PlotRejectedEvent(@NotNull ReviewSnapshot review) {
this.review = review;
}

public @NotNull ReviewSnapshot getReview() {
return review;
}

public static @NotNull HandlerList getHandlerList() {
return HANDLERS;
}

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.alpsbte.plotsystem.api.event;

import com.alpsbte.plotsystem.api.model.ReviewSnapshot;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

public final class PlotReviewUndoneEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final ReviewSnapshot review;

public PlotReviewUndoneEvent(@NotNull ReviewSnapshot review) {
this.review = review;
}

public @NotNull ReviewSnapshot getReview() {
return review;
}

public static @NotNull HandlerList getHandlerList() {
return HANDLERS;
}

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.alpsbte.plotsystem.api.event;

import com.alpsbte.plotsystem.api.model.ReviewSnapshot;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

public final class PlotReviewedEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final ReviewSnapshot review;

public PlotReviewedEvent(@NotNull ReviewSnapshot review) {
this.review = review;
}

public @NotNull ReviewSnapshot getReview() {
return review;
}

public static @NotNull HandlerList getHandlerList() {
return HANDLERS;
}

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.alpsbte.plotsystem.api.event;

import com.alpsbte.plotsystem.api.model.PlotSnapshot;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

public final class PlotSubmissionUndoneEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final PlotSnapshot plot;

public PlotSubmissionUndoneEvent(@NotNull PlotSnapshot plot) {
this.plot = plot;
}

public @NotNull PlotSnapshot getPlot() {
return plot;
}

public static @NotNull HandlerList getHandlerList() {
return HANDLERS;
}

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.alpsbte.plotsystem.api.event;

import com.alpsbte.plotsystem.api.model.PlotSnapshot;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

public final class PlotSubmittedEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();
private final PlotSnapshot plot;

public PlotSubmittedEvent(@NotNull PlotSnapshot plot) {
this.plot = plot;
}

public @NotNull PlotSnapshot getPlot() {
return plot;
}

public static @NotNull HandlerList getHandlerList() {
return HANDLERS;
}

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Stable lifecycle events published by Plot System for external integrations.
*
* <p>Integrations should register a Bukkit listener and translate these events
* into their own transport or application API. Plot System does not depend on
* any integration implementation.</p>
*
* <pre>{@code
* public final class MyIntegrationListener implements Listener {
* @EventHandler
* public void onPlotSubmitted(PlotSubmittedEvent event) {
* // Translate event.getPlot() to the integration's model.
* }
* }
* }</pre>
*/
package com.alpsbte.plotsystem.api.event;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.alpsbte.plotsystem.api.model;

public enum PlotAbandonReason {
INACTIVITY,
MANUAL,
COMMAND,
SYSTEM
}
Loading
Loading