Skip to content

Commit

Permalink
Merge latest changes from API-8
Browse files Browse the repository at this point in the history
  • Loading branch information
Aquerr committed Apr 16, 2024
1 parent 6f152d3 commit 15f6358
Show file tree
Hide file tree
Showing 20 changed files with 146 additions and 80 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Thanks to JetBrains for their IDE

## License

[MIT](https://github.com/Aquerr/EagleFactionsAPI/blob/master/LICENSE)
[MIT](https://github.com/Aquerr/EagleFactionsAPI/blob/api-10/LICENSE)

## Donation

Creation of this plugin is really a time consuming task. If you would like to support and motivate me to further work then you can star this repo or send me some cookies through [PayPal](https://paypal.me/aquerrnerdi).
Creation of this plugin is really a time-consuming task. If you would like to support and motivate me to further work then you can star this repo or send me some cookies through [PayPal](https://paypal.me/aquerrnerdi).
52 changes: 47 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import java.io.ByteArrayOutputStream

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

val eaglefactionsApiVersion = findProperty("eaglefactions-api.version") as String
val spongeApiVersion = findProperty("sponge-api.version") as String
val finalVersion = "$eaglefactionsApiVersion-API-$spongeApiVersion"

group = "io.github.aquerr"
version = "$eaglefactionsApiVersion-API-$spongeApiVersion"
version = finalVersion

repositories {
mavenCentral()
Expand All @@ -21,15 +23,18 @@ dependencies {

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(JavaVersion.VERSION_17.majorVersion))

withSourcesJar()
withJavadocJar()
}

tasks.withType(Jar::class).configureEach {
tasks.jar {
archiveBaseName.set("EagleFactionsAPI")
if(System.getenv("JENKINS_HOME") != null) {
archiveBaseName.set("EagleFactionsAPI")
project.version = project.version.toString() + "_" + System.getenv("BUILD_NUMBER") + "-SNAPSHOT"
project.version = finalVersion + "_" + System.getenv("BUILD_NUMBER") + "-SNAPSHOT"
println("Version => " + project.version.toString())
} else {
project.version = project.version.toString() + "-SNAPSHOT"
project.version = "$finalVersion-SNAPSHOT"
}
}

Expand Down Expand Up @@ -75,4 +80,41 @@ tasks.register("publishBuildOnDiscord") {
}
}
}
}

publishing {
publications {
create<MavenPublication>("maven") {

from(components["java"])

pom {
name.set("EagleFactionsAPI")
artifactId = "eaglefactionsapi"
description.set(project.description)
url.set("https://github.com/Aquerr/EagleFactionsAPI")

licenses {
license {
name.set("MIT")
url.set("https://github.com/Aquerr/EagleFactionsAPI/blob/api-8/LICENSE")
}
}

developers {
developer {
id.set("Aquerr")
name.set("Bartłomiej Stępień")
url.set("https://github.com/Aquerr")
}
}

scm {
connection.set("scm:git:git://github.com/Aquerr/EagleFactionsAPI.git")
developerConnection.set("scm:git:ssh://github.com/Aquerr/EagleFactionsAPI.git")
url.set("https://github.com/Aquerr/EagleFactionsAPI")
}
}
}
}
}
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk11
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "EagleFactionsAPI"
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public interface EagleFactions
* Gets Eagle Factions resource file.
*
* @param fileName to get from resources
* @return <tt>URI</tt> object of that file or <tt>null</tt> if file could not be found.
* @return {@link URI} object of that file or null if file could not be found.
*/
URI getResource(final String fileName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import org.spongepowered.math.vector.Vector3i;

import java.util.*;
import java.util.Collections;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;

public class Claim
{
Expand All @@ -14,7 +17,7 @@ public class Claim

public Claim(UUID worldUUID, Vector3i chunkPosition)
{
this(worldUUID, chunkPosition, Collections.EMPTY_SET, true);
this(worldUUID, chunkPosition, Collections.emptySet(), true);
}

public Claim(UUID worldUUID, Vector3i chunkPosition, final Set<UUID> owners, final boolean accessibleByFaction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,18 @@ public interface Faction extends Comparable<Faction>, Inviter, InviteAcceptor
*/
Set<String> getEnemies();

/**
* Gets leader rank.
*
* @return the leader rank.
*/
Rank getLeaderRank();

/**
* Gets the rank with given rank from the faction.
* @param rankName the rank name
* @return Optional containing the rank, else Optional.empty()
*/
Optional<Rank> getRank(String rankName);

/**
Expand All @@ -94,11 +104,15 @@ public interface Faction extends Comparable<Faction>, Inviter, InviteAcceptor

/**
* Gets faction ranks with their in-faction permission.
*
* @return the list of ranks
*/
List<Rank> getRanks();

/**
* Gets default rank in faction.
*
* @return the default rank
*/
Rank getDefaultRank();

Expand Down Expand Up @@ -143,15 +157,15 @@ public interface Faction extends Comparable<Faction>, Inviter, InviteAcceptor

/**
* Checks if this faction is public.
* @return <tt>true</tt> if faction is public, <tt>false</tt> if not.
* @return true if faction is public, false if not.
*/
boolean isPublic();

/**
* Gets value for given flag type.
*
* @param type the type
* @return <tt>true</tt> if flag is set to true, <tt>false</tt> if flag is set to false OR it does not exist.
* @return true if flag is set to true, false if flag is set to false OR it does not exist.
*/
boolean getProtectionFlagValue(ProtectionFlagType type);

Expand All @@ -167,13 +181,13 @@ public interface Faction extends Comparable<Faction>, Inviter, InviteAcceptor
/**
* Checks if the given player UUID exists in that faction.
* @param playerUUID the UUID of the player.
* @return <tt>true</tt> if player exists, <tt>false</tt> if not.
* @return true if player exists, false if not.
*/
boolean containsPlayer(final UUID playerUUID);

/**
* Checks if this faction is SafeZone.
* @return <tt>true<tt/> if it is SafeZone, <tt>false</tt>> if not.
* @return true if it is SafeZone, false if not.
*/
default boolean isSafeZone()
{
Expand All @@ -182,7 +196,7 @@ default boolean isSafeZone()

/**
* Checks if this faction is WarZone.
* @return <tt>true<tt/> if it is WarZone, <tt>false</tt>> if not.
* @return true if it is WarZone, false if not.
*/
default boolean isWarZone()
{
Expand All @@ -192,7 +206,7 @@ default boolean isWarZone()
/**
* Checks if the given faction is in alliance with this faction.
* @param faction the faction that will be checked.
* @return <tt>true</tt> if faction is an ally, <tt>false</tt> if not.
* @return true if faction is an ally, false if not.
*/
default boolean isAlly(final Faction faction)
{
Expand All @@ -202,7 +216,7 @@ default boolean isAlly(final Faction faction)
/**
* Checks if the given faction is in truce with this faction.
* @param faction the faction that will be checked.
* @return <tt>true</tt> if faction is in truce, <tt>false</tt> if not.
* @return true if faction is in truce, false if not.
*/
default boolean isTruce(final Faction faction)
{
Expand All @@ -212,7 +226,7 @@ default boolean isTruce(final Faction faction)
/**
* Checks if the given faction is an enemy to this faction.
* @param faction the faction that will be checked.
* @return <tt>true</tt> if faction is an enemy, <tt>false</tt> if not.
* @return true if faction is an enemy, false if not.
*/
default boolean isEnemy(final Faction faction)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.spongepowered.api.entity.living.player.User;

import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
Expand Down Expand Up @@ -32,7 +31,7 @@ public interface FactionPlayer extends Inviter, InviteAcceptor

/**
* Gets player's faction name.
* @return the name of the faction as {@link Optional<String>} or {@link Optional#empty()} if player is not in a faction.
* @return the name of the faction as {@link Optional} or {@link Optional#empty()} if player is not in a faction.
*/
default Optional<String> getFactionName()
{
Expand All @@ -47,7 +46,7 @@ default Optional<String> getFactionName()

/**
* Checks if the player is online.
* @return <tt>true</tt> if player is online or <tt>false</tt> if not.
* @return true if player is online or false if not.
*/
boolean isOnline();

Expand All @@ -71,7 +70,7 @@ default Optional<String> getFactionName()

/**
* Checks if the given player recently died in WarZone.
* @return <tt>true</tt> if yes, <tt>false</tt> if not.
* @return true if yes, false if not.
*/
boolean diedInWarZone();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface ProtectionFlags
* Gets value for given flag type.
*
* @param type the type
* @return <tt>true</tt> if flag is set to true, <tt>false</tt> if flag is set to false OR it does not exist.
* @return true if flag is set to true, false if flag is set to false OR it does not exist.
*/
boolean getValueForFlag(ProtectionFlagType type);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public interface FactionAreaEnterEvent extends Event, Cancellable
*
* @return Faction or Optional.empty if left claim belongs to wilderness.
*
* Clients can cancel this event by sending <tt>true</tt> to {@link Cancellable#setCancelled(boolean)} method.
* Clients can cancel this event by sending true to {@link Cancellable#setCancelled(boolean)} method.
*/
Optional<Faction> getEnteredFaction();

Expand All @@ -36,7 +36,7 @@ public interface FactionAreaEnterEvent extends Event, Cancellable
*
* @return Faction or Optional.empty if entered claim belongs to wilderness.
*
* Clients can cancel this event by sending <tt>true</tt> to {@link Cancellable#setCancelled(boolean)} method.
* Clients can cancel this event by sending true to {@link Cancellable#setCancelled(boolean)} method.
*/
Optional<Faction> getLeftFaction();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public interface FactionEvent extends Event, Cancellable

/**
* Gets faction that this event is related to.
* Clients can cancel this event by sending <tt>true</tt> to {@link Cancellable#setCancelled(boolean)} method.
* Clients can cancel this event by sending true to {@link Cancellable#setCancelled(boolean)} method.
* @return the faction
*/
Faction getFaction();
}
Loading

0 comments on commit 15f6358

Please sign in to comment.