1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-09-02 10:52:37 +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 { plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2' id 'com.github.johnrengelman.shadow' version '8.1.1'
} }
dependencies { dependencies {

View File

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

View File

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

View File

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

View File

@@ -72,11 +72,13 @@ public class FabricSenderFactory extends SenderFactory<LPFabricPlugin, ServerCom
@Override @Override
protected void sendMessage(ServerCommandSource sender, Component message) { protected void sendMessage(ServerCommandSource sender, Component message) {
Locale locale = null; final Locale locale;
if (sender.getEntity() instanceof ServerPlayerEntity) { if (sender.getEntity() instanceof ServerPlayerEntity) {
locale = ((MixinUser) sender.getEntity()).getCachedLocale(); 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 @Override

View File

@@ -79,7 +79,7 @@ public class FabricPlayerCalculator implements ContextCalculator<ServerPlayerEnt
} }
// TODO: figure out dimension type context too // TODO: figure out dimension type context too
ServerWorld world = target.getWorld(); ServerWorld world = target.getServerWorld();
if (this.world) { if (this.world) {
this.plugin.getConfiguration().get(ConfigKeys.WORLD_REWRITES).rewriteAndSubmit(getContextKey(world.getRegistryKey().getValue()), consumer); 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; private Locale luckperms$locale;
// Used by PlayerChangeWorldCallback hook below. // Used by PlayerChangeWorldCallback hook below.
@Shadow public abstract ServerWorld getWorld(); @Shadow public abstract ServerWorld getServerWorld();
@Override @Override
public User getLuckPermsUser() { public User getLuckPermsUser() {
@@ -183,6 +183,6 @@ public abstract class ServerPlayerEntityMixin implements MixinUser {
@Inject(at = @At("TAIL"), method = "worldChanged") @Inject(at = @At("TAIL"), method = "worldChanged")
private void luckperms_onChangeDimension(ServerWorld targetWorld, CallbackInfo ci) { 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 { plugins {
repositories { id 'com.github.johnrengelman.shadow' version '8.1.1'
maven { url 'https://plugins.gradle.org/m2' } id 'net.kyori.blossom' version '1.3.0'
maven { url 'https://maven.minecraftforge.net/' } id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
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.+'
}
} }
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'net.kyori.blossom'
apply plugin: 'net.minecraftforge.gradle'
sourceCompatibility = 1.8 sourceCompatibility = 1.8
targetCompatibility = 17 targetCompatibility = 17
@@ -27,12 +16,6 @@ minecraft {
mappings channel: 'official', version: minecraftVersion mappings channel: 'official', version: minecraftVersion
} }
configurations {
}
repositories {
}
dependencies { dependencies {
minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}" minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}"
implementation project(':common') implementation project(':common')
@@ -40,10 +23,6 @@ dependencies {
compileOnly project(':forge:forge-api') compileOnly project(':forge:forge-api')
} }
reobf {
shadowJar {}
}
shadowJar { shadowJar {
archiveFileName = "luckperms-forge.jarinjar" archiveFileName = "luckperms-forge.jarinjar"

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

View File

@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

25
gradlew vendored
View File

@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (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. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,10 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) 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 ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | 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" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done done
fi 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; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
@@ -205,6 +210,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ 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. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # 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 limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 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 :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
plugins { plugins {
id 'net.kyori.blossom' version '1.3.0' 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 { repositories {