Skip to content

Commit

Permalink
Update to API-11
Browse files Browse the repository at this point in the history
  • Loading branch information
Aquerr committed Jun 18, 2024
1 parent f643679 commit 5a32976
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 58 deletions.
40 changes: 28 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ plugins {
id("org.spongepowered.gradle.plugin") version "2.2.0"
idea
`maven-publish`
id("com.github.johnrengelman.shadow") version "7.1.2"
id("net.kyori.blossom") version "1.3.1"
id("io.github.goooler.shadow") version "8.1.7"
id("net.kyori.blossom") version "2.1.0"
}

description = eaglefactionsDescription
Expand Down Expand Up @@ -61,30 +61,32 @@ sponge {
}

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

blossom {
if(System.getenv("JENKINS_HOME") != null) {
rootProject.version = version.toString() + "_" + System.getenv("BUILD_NUMBER") + "-SNAPSHOT"
println("Version => " + rootProject.version)
} else {
rootProject.version = version.toString() + "-SNAPSHOT"
sourceSets {
main {
blossom {
javaSources {
property("version", rootProject.version.toString())
}
}
}
replaceTokenIn("src/main/java/io/github/aquerr/eaglefactions/PluginInfo.java")
replaceToken("%VERSION%", rootProject.version.toString())
}

repositories {
mavenCentral()
maven("https://repo.spongepowered.org/maven")
maven("https://jitpack.io")
maven("https://repo.mikeprimm.com/")
maven("https://repo.bluecolored.de/releases")
}

dependencies {
api(project(":EagleFactionsAPI"))

implementation("com.google.guava:guava:33.2.1-jre")

// Databases
implementation("com.zaxxer:HikariCP:5.1.0")
implementation("org.mariadb.jdbc:mariadb-java-client:3.3.2")
Expand All @@ -94,7 +96,7 @@ dependencies {

// Integrations
compileOnly("us.dynmap:DynmapCoreAPI:3.6")
compileOnly("com.github.BlueMap-Minecraft:BlueMapAPI:2.6.2")
compileOnly("de.bluecolored.bluemap:BlueMapAPI:2.7.2")
implementation("org.bstats:bstats-sponge:3.0.2")

// Tests
Expand All @@ -116,6 +118,15 @@ dependencies {
}

tasks {
jar {
if(System.getenv("JENKINS_HOME") != null) {
rootProject.version = version.toString() + "_" + System.getenv("BUILD_NUMBER") + "-SNAPSHOT"
println("Version => " + rootProject.version)
} else {
rootProject.version = version.toString() + "-SNAPSHOT"
}
}

shadowJar {

dependsOn(test)
Expand All @@ -134,6 +145,11 @@ tasks {
relocate("org.apache.commons.logging", "${libRelocationPath}.apache.commons.logging")
relocate("com.google.errorprone", "${libRelocationPath}.google.errorprone")
relocate("com.google.protobuf", "${libRelocationPath}.google.protobuf")
relocate("com.google.guava", "${libRelocationPath}.google.guava")
relocate("com.google.common", "${libRelocationPath}.google.common")
relocate("com.google.thirdparty", "${libRelocationPath}.google.thirdparty")
relocate("javax.annotation", "${libRelocationPath}.javax.annotation")
relocate("org.checkerframework", "${libRelocationPath}.checkerframework")
relocate("waffle", "${libRelocationPath}.other")

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
eaglefactions.id=eaglefactions
eaglefactions.version=1.1.0
eaglefactions.version=1.2.0
eaglefactions.description=A factions plugin that will make managing your battle-server easier. :)

sponge-api.version=10.0.0
sponge-api.version=11.0.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 9 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,14 @@ if [ -n "$JAVA_HOME" ] ; then
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
Expand Down Expand Up @@ -203,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand All @@ -229,4 +237,4 @@ eval "set -- $(
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
14 changes: 8 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class PluginInfo
{
public static final String ID = "eaglefactions";
public static final String NAME = "Eagle Factions";
public static final String VERSION = "%VERSION%";
public static final String VERSION = "{{ version }}";
public static final String DESCRIPTION = "A factions plugin that will make managing your battle-server easier. :)";
public static final String PLUGIN_PREFIX_PLAIN = "[EF] ";
public static final TextComponent PLUGIN_PREFIX = Component.text(PLUGIN_PREFIX_PLAIN, NamedTextColor.AQUA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.github.aquerr.eaglefactions.api.entities.ProtectionFlag;
import io.github.aquerr.eaglefactions.api.entities.ProtectionFlagType;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

Expand Down Expand Up @@ -35,7 +34,7 @@ public void setValue(boolean value)
}

@Override
public int compareTo(@NotNull ProtectionFlag o)
public int compareTo(ProtectionFlag o)
{
return this.type.getName().compareTo(o.getType().getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private void createOrUpdatePVPLoggerObjective(ServerPlayer player, PVPLoggerObje
}
player.setScoreboard(scoreboard);
}
Score pvpTimerScore = objective.findOrCreateScore(Component.text("Time:"));
Score pvpTimerScore = objective.findOrCreateScore("Time:");
pvpTimerScore.setScore(pvpLoggerObjective.getSeconds());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.TextReplacementConfig;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.api.command.exception.CommandException;

import java.io.IOException;
Expand All @@ -22,7 +21,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.PropertyResourceBundle;
import java.util.regex.MatchResult;
import java.util.stream.Collectors;

import static java.lang.String.format;
Expand Down Expand Up @@ -163,16 +161,12 @@ public TextComponent resolveComponentWithMessage(String messageKey, Object... ar
{
textComponent = (TextComponent) textComponent.replaceText(TextReplacementConfig.builder()
.match("\\{\\d\\}")
.condition(new TextReplacementConfig.Condition()
.condition((result, matchCount, replaced) ->
{
@Override
public @NotNull PatternReplacementResult shouldReplace(@NotNull MatchResult result, int matchCount, int replaced)
{
if (replaced > 0)
return PatternReplacementResult.STOP;
else
return PatternReplacementResult.REPLACE;
}
if (replaced > 0)
return PatternReplacementResult.STOP;
else
return PatternReplacementResult.REPLACE;
})
.replacement(arg)
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
import io.github.aquerr.eaglefactions.api.logic.FactionLogic;
import io.github.aquerr.eaglefactions.api.messaging.chat.AllianceAudience;
import net.kyori.adventure.audience.Audience;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.adventure.Audiences;
import org.spongepowered.api.entity.living.player.server.ServerPlayer;

import java.util.*;
Expand Down Expand Up @@ -69,7 +67,7 @@ private void addAudience(Audience audience)
}

@Override
public @NotNull Iterable<? extends Audience> audiences()
public Iterable<? extends Audience> audiences()
{
return this.audiences;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
import io.github.aquerr.eaglefactions.api.entities.Faction;
import io.github.aquerr.eaglefactions.api.messaging.chat.FactionAudience;
import net.kyori.adventure.audience.Audience;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.entity.living.player.server.ServerPlayer;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;

public class FactionAudienceImpl implements FactionAudience
{
Expand Down Expand Up @@ -54,7 +49,7 @@ private void registerReceivers()
}

@Override
public @NotNull Iterable<? extends Audience> audiences()
public Iterable<? extends Audience> audiences()
{
return this.audiences;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import io.github.aquerr.eaglefactions.storage.task.IStorageTask;
import io.github.aquerr.eaglefactions.storage.task.StorageTaskFactory;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.nio.file.Path;
Expand All @@ -39,7 +38,6 @@
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;

import static com.google.common.base.Preconditions.checkNotNull;
import static java.lang.String.format;
Expand All @@ -50,16 +48,12 @@ public class StorageManagerImpl implements StorageManager
private final PlayerStorage playerStorage;
private final BackupStorage backupStorage;

private final ExecutorService executorService = Executors.newSingleThreadExecutor(new ThreadFactory()
private final ExecutorService executorService = Executors.newSingleThreadExecutor(runnable ->
{
@Override
public Thread newThread(@NotNull Runnable runnable)
{
Thread thread = new Thread(runnable);
thread.setDaemon(true);
return thread;
}
}); //Only one thread.
Thread thread = new Thread(runnable);
thread.setDaemon(true);
return thread;
});

private final StorageTaskFactory storageTaskFactory;

Expand Down

0 comments on commit 5a32976

Please sign in to comment.