Skip to content

Commit

Permalink
Javadocs cleanups + jar task configuration refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Aquerr committed Apr 16, 2024
1 parent 4e08ac7 commit 980f74f
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 78 deletions.
11 changes: 6 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ plugins {

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 @@ -28,13 +29,13 @@ java {
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
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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public interface FactionLogic
/**
* Gets {@link Faction} for the given player {@link UUID}.
* @param playerUUID the UUID of the player whose faction should be looked for.
* @return {@link Optional<Faction>} if the given player is in a faction or
* @return {@link Optional} if the given player is in a faction or
* {@link Optional#empty()} if the given player is not in a faction.
*/
Optional<Faction> getFactionByPlayerUUID(UUID playerUUID);
Expand All @@ -56,29 +56,29 @@ public interface FactionLogic
* Gets {@link Faction} for the given chunk location {@link Vector3i} in the given world UUID {@link UUID}.
* @param worldUUID the UUID of the world
* @param chunk the location of the chunk
* @return {@link Optional<Faction>} if the given chunk claimed by a faction or
* @return {@link Optional} if the given chunk claimed by a faction or
* {@link Optional#empty()} if the given chunk is not claimed by any faction.
*/
Optional<Faction> getFactionByChunk(UUID worldUUID, Vector3i chunk);

/**
* Gets {@link Faction} by the given faction name.
* @param factionName the name of the faction that should be looked for.
* @return {@link Faction} or <tt>null</tt> if factions could not be found.
* @return {@link Faction} or null if factions could not be found.
*/
@Nullable
Faction getFactionByName(String factionName);

/**
* Gets a {@link List<ServerPlayer>} that contains all online players in a given {@link Faction}
* Gets a {@link List} that contains all online players in a given {@link Faction}
* @param faction the faction that should be used to get online players from.
* @return {@link List<ServerPlayer>} list with online players in the given faction.
* @return {@link List} list with online players in the given faction.
*/
List<ServerPlayer> getOnlinePlayers(Faction faction);

/**
* Gets all faction names that exists on the server.
* @return {@link Set<String>} that contains all faction names on the server.
* @return {@link Set} that contains all faction names on the server.
*/
Set<String> getFactionsNames();

Expand All @@ -91,7 +91,7 @@ public interface FactionLogic
/**
* Disbands/Deletes a faction.
* @param factionName name of the faction that should be disbanded/deleted.
* @return <tt>true</tt> if operation succeeded or <tt>false</tt> if it did not.
* @return true if operation succeeded or false if it did not.
*/
boolean disbandFaction(String factionName);

Expand Down Expand Up @@ -197,15 +197,15 @@ public interface FactionLogic
* Checks if the chunk {@link Vector3i} in the given world {@link UUID} is claimed.
* @param worldUUID the UUID of the world
* @param chunk the position of the chunk
* @return <tt>true</tt> if chunk is claimed or <tt>false</tt> if it is not.
* @return true if chunk is claimed or false if it is not.
*/
boolean isClaimed(UUID worldUUID, Vector3i chunk);

/**
* Checks if a {@link Claim} is connected to other claims in the given {@link Faction}
* @param faction the faction object to perform check against
* @param claimToCheck the claim that should be checked
* @return <tt>true</tt> if chunk is connected to other claims or <tt>false</tt> if it is not.
* @return true if chunk is connected to other claims or false if it is not.
*/
boolean isClaimConnected(Faction faction, Claim claimToCheck);

Expand All @@ -214,7 +214,7 @@ public interface FactionLogic
* @param faction the faction that owns the claim.
* @param claim the claim
* @param owner the owner that should be added as owner of the given claim.
* @return <tt>true</tt> if operation succeeded, <tt>false</tt> if not.
* @return true if operation succeeded, false if not.
*/
boolean addClaimOwner(final Faction faction, final Claim claim, final UUID owner);

Expand All @@ -223,7 +223,7 @@ public interface FactionLogic
* @param faction the faction that owns the claim.
* @param claim the claim
* @param owner the owner that should be removed from the given claim.
* @return <tt>true</tt> if operation succeeded, <tt>false</tt> if not.
* @return true if operation succeeded, false if not.
*/
boolean removeClaimOwner(final Faction faction, final Claim claim, final UUID owner);

Expand All @@ -232,7 +232,6 @@ public interface FactionLogic
* @param faction the faction that own the claim.
* @param claim the claim.
* @param isAccessibleByFaction the
* @return <tt>true</tt> if operation succeeded, <tt>false</tt> if not.
*/
void setClaimAccessibleByFaction(final Faction faction, final Claim claim, final boolean isAccessibleByFaction);

Expand All @@ -245,14 +244,14 @@ public interface FactionLogic

/**
* Gets the list of all factions tags used on the server.
* @return {@link List<String>} that contains all factions tags.
* @return {@link List} that contains all factions tags.
*/
List<String> getFactionsTags();

/**
* Checks if the given faction has online players on the server.
* @param faction the faction that check should be run against.
* @return <tt>true</tt> if there are player on the server that are in that faction or <tt>false</tt> if this faction has no players who are currently online.
* @return true if there are player on the server that are in that faction or false if this faction has no players who are currently online.
*/
boolean hasOnlinePlayers(Faction faction);

Expand Down Expand Up @@ -321,7 +320,7 @@ public interface FactionLogic
/**
* Sets if faction is public (people can join it without invitation) or private (normal faction).
* @param faction that should be affected by this change.
* @param isPublic boolean value, <tt>true</tt> if faction should be public, <tt>false</tt> if not.
* @param isPublic boolean value, true if faction should be public, false if not.
*/
void setIsPublic(Faction faction, boolean isPublic);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface PVPLogger
{
/**
* Checks if {@link PVPLogger} is active or not.
* @return <tt>true</tt> if PVPLogger is active, <tt>false</tt> if not
* @return true if PVPLogger is active, false if not
*/
boolean isActive();

Expand All @@ -24,8 +24,8 @@ public interface PVPLogger
* Checks if a command should be blocked by PVPLogger if a player is blocked.
* @param player the player that should be checked against PVPLogger.
* @param command the command that should be checked by PVPLogger.
* @return <tt>true</tt> if command player is currently blocked and the given command should be blocked.
* <tt>false</tt> if the player is not currently blocked or a command should not be blocked.
* @return true if command player is currently blocked and the given command should be blocked.
* false if the player is not currently blocked or a command should not be blocked.
*/
boolean shouldBlockCommand(final ServerPlayer player, final String command);

Expand All @@ -40,7 +40,7 @@ public interface PVPLogger
/**
* Checks if player is being blocked by PVPLogger.
* @param player the player that should be checked.
* @return <tt>true</tt> if player is being blocked, <tt>false</tt> if not.
* @return true if player is being blocked, false if not.
*/
boolean isPlayerBlocked(final ServerPlayer player);

Expand Down
Loading

0 comments on commit 980f74f

Please sign in to comment.