1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-09-01 18:32:33 +02:00

Update Fabric/Forge to Minecraft 1.20

Co-authored-by: Aurelien <aurelien.domino@gmail.com>
This commit is contained in:
Luck
2023-05-30 12:57:15 +02:00
parent da08be0b20
commit d859085056
22 changed files with 70 additions and 102 deletions

View File

@@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
dependencies {

View File

@@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
repositories {

View File

@@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
dependencies {

View File

@@ -1,8 +1,8 @@
import net.fabricmc.loom.task.RemapJarTask
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'fabric-loom' version '1.2-SNAPSHOT'
}
archivesBaseName = 'luckperms'
@@ -14,9 +14,9 @@ repositories {
dependencies {
// https://modmuss50.me/fabric.html
minecraft 'com.mojang:minecraft:1.19.4'
mappings 'net.fabricmc:yarn:1.19.4+build.1:v2'
modImplementation 'net.fabricmc:fabric-loader:0.14.17'
minecraft 'com.mojang:minecraft:1.20'
mappings 'net.fabricmc:yarn:1.20+build.1:v2'
modImplementation 'net.fabricmc:fabric-loader:0.14.21'
Set<String> apiModules = [
'fabric-api-base',
@@ -26,7 +26,7 @@ dependencies {
]
apiModules.forEach {
modImplementation(fabricApi.module(it, '0.76.0+1.19.4'))
modImplementation(fabricApi.module(it, '0.83.0+1.20'))
}
include(modImplementation('me.lucko:fabric-permissions-api:0.2-SNAPSHOT'))
@@ -75,8 +75,8 @@ shadowJar {
task remappedShadowJar(type: RemapJarTask) {
dependsOn tasks.shadowJar
input.set(tasks.shadowJar.archiveFile)
addNestedDependencies.set(true)
input = tasks.shadowJar.archiveFile
addNestedDependencies = true
archiveFileName = "LuckPerms-Fabric-${project.ext.fullVersion}.jar"
}

View File

@@ -72,11 +72,13 @@ public class FabricSenderFactory extends SenderFactory<LPFabricPlugin, ServerCom
@Override
protected void sendMessage(ServerCommandSource sender, Component message) {
Locale locale = null;
final Locale locale;
if (sender.getEntity() instanceof ServerPlayerEntity) {
locale = ((MixinUser) sender.getEntity()).getCachedLocale();
} else {
locale = null;
}
sender.sendFeedback(toNativeText(TranslationManager.render(message, locale)), false);
sender.sendFeedback(() -> toNativeText(TranslationManager.render(message, locale)), false);
}
@Override

View File

@@ -79,7 +79,7 @@ public class FabricPlayerCalculator implements ContextCalculator<ServerPlayerEnt
}
// TODO: figure out dimension type context too
ServerWorld world = target.getWorld();
ServerWorld world = target.getServerWorld();
if (this.world) {
this.plugin.getConfiguration().get(ConfigKeys.WORLD_REWRITES).rewriteAndSubmit(getContextKey(world.getRegistryKey().getValue()), consumer);
}

View File

@@ -69,7 +69,7 @@ public abstract class ServerPlayerEntityMixin implements MixinUser {
private Locale luckperms$locale;
// Used by PlayerChangeWorldCallback hook below.
@Shadow public abstract ServerWorld getWorld();
@Shadow public abstract ServerWorld getServerWorld();
@Override
public User getLuckPermsUser() {
@@ -183,6 +183,6 @@ public abstract class ServerPlayerEntityMixin implements MixinUser {
@Inject(at = @At("TAIL"), method = "worldChanged")
private void luckperms_onChangeDimension(ServerWorld targetWorld, CallbackInfo ci) {
PlayerChangeWorldCallback.EVENT.invoker().onChangeWorld(this.getWorld(), targetWorld, (ServerPlayerEntity) (Object) this);
PlayerChangeWorldCallback.EVENT.invoker().onChangeWorld(this.getServerWorld(), targetWorld, (ServerPlayerEntity) (Object) this);
}
}

View File

@@ -1,20 +1,9 @@
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2' }
maven { url 'https://maven.minecraftforge.net/' }
}
dependencies {
classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
classpath 'net.kyori:blossom:1.3.0'
classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.+'
}
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'net.kyori.blossom' version '1.3.0'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'net.kyori.blossom'
apply plugin: 'net.minecraftforge.gradle'
sourceCompatibility = 1.8
targetCompatibility = 17
@@ -27,12 +16,6 @@ minecraft {
mappings channel: 'official', version: minecraftVersion
}
configurations {
}
repositories {
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}"
implementation project(':common')
@@ -40,10 +23,6 @@ dependencies {
compileOnly project(':forge:forge-api')
}
reobf {
shadowJar {}
}
shadowJar {
archiveFileName = "luckperms-forge.jarinjar"

View File

@@ -1,15 +1,7 @@
buildscript {
repositories {
maven { url 'https://maven.minecraftforge.net/' }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.+'
}
plugins {
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
apply plugin: 'net.minecraftforge.gradle'
sourceCompatibility = 1.8
targetCompatibility = 17
@@ -17,12 +9,6 @@ minecraft {
mappings channel: 'official', version: minecraftVersion
}
configurations {
}
repositories {
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}"
implementation project(':api')

View File

@@ -1,2 +1,2 @@
minecraftVersion=1.19.4
forgeVersion=45.0.1
minecraftVersion=1.20
forgeVersion=46.0.1

View File

@@ -1,19 +1,9 @@
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2' }
maven { url 'https://maven.minecraftforge.net/' }
}
dependencies {
classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.+'
}
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java-library'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java-library'
apply plugin: 'net.minecraftforge.gradle'
sourceCompatibility = 1.8
targetCompatibility = 17
@@ -21,9 +11,6 @@ minecraft {
mappings channel: 'official', version: minecraftVersion
}
repositories {
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}"
implementation project(':api')
@@ -56,10 +43,6 @@ processResources {
}
}
reobf {
shadowJar {}
}
shadowJar {
archiveFileName = "LuckPerms-Forge-${project.ext.fullVersion}.jar"

View File

@@ -77,7 +77,7 @@ public class ForgeSenderFactory extends SenderFactory<LPForgePlugin, CommandSour
locale = null;
}
sender.sendSuccess(toNativeText(TranslationManager.render(message, locale)), false);
sender.sendSuccess(() -> toNativeText(TranslationManager.render(message, locale)), false);
}
@Override

View File

@@ -68,7 +68,7 @@ public class ForgePlayerCalculator implements ContextCalculator<ServerPlayer> {
@Override
public void calculate(@NonNull ServerPlayer target, @NonNull ContextConsumer consumer) {
ServerLevel level = target.getLevel();
ServerLevel level = target.serverLevel();
if (this.dimensionType) {
consumer.accept(DefaultContextKeys.DIMENSION_TYPE_KEY, getContextKey(level.dimension().location()));
}

Binary file not shown.

View File

@@ -1,5 +1,6 @@
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.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

25
gradlew vendored
View File

@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,10 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
@@ -205,6 +210,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.

15
gradlew.bat vendored
View File

@@ -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
@@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,7 +41,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.
@@ -75,13 +76,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

View File

@@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
repositories {

View File

@@ -1,10 +1,13 @@
// Fabric Needs this
pluginManagement {
repositories {
jcenter()
maven {
name = 'Fabric'
url 'https://maven.fabricmc.net/'
}
maven {
name = 'Forge'
url = 'https://maven.minecraftforge.net/'
}
gradlePluginPortal()
}
}

View File

@@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
repositories {

View File

@@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
sourceCompatibility = 17

View File

@@ -1,6 +1,6 @@
plugins {
id 'net.kyori.blossom' version '1.3.0'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
repositories {