mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-06 08:27:37 +01:00
Fabric 1.18
This commit is contained in:
parent
64bd8b5eaf
commit
fa17404133
@ -14,9 +14,9 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// https://modmuss50.me/fabric.html
|
// https://modmuss50.me/fabric.html
|
||||||
minecraft 'com.mojang:minecraft:1.17.1'
|
minecraft 'com.mojang:minecraft:1.18'
|
||||||
mappings 'net.fabricmc:yarn:1.17.1+build.39:v2'
|
mappings 'net.fabricmc:yarn:1.18+build.1:v2'
|
||||||
modImplementation 'net.fabricmc:fabric-loader:0.11.6'
|
modImplementation 'net.fabricmc:fabric-loader:0.12.6'
|
||||||
|
|
||||||
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.38.0+1.17'))
|
modImplementation(fabricApi.module(it, '0.43.1+1.18'))
|
||||||
}
|
}
|
||||||
|
|
||||||
include(modImplementation('me.lucko:fabric-permissions-api:0.1-SNAPSHOT'))
|
include(modImplementation('me.lucko:fabric-permissions-api:0.1-SNAPSHOT'))
|
||||||
|
@ -81,7 +81,7 @@ public class FabricPlayerCalculator implements ContextCalculator<ServerPlayerEnt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: figure out dimension type context too
|
// TODO: figure out dimension type context too
|
||||||
ServerWorld world = target.getServerWorld();
|
ServerWorld world = target.getWorld();
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of LuckPerms, licensed under the MIT License.
|
|
||||||
*
|
|
||||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
|
||||||
* Copyright (c) contributors
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package me.lucko.luckperms.fabric.mixin;
|
|
||||||
|
|
||||||
import net.minecraft.network.packet.c2s.play.ClientSettingsC2SPacket;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
|
|
||||||
@Mixin(ClientSettingsC2SPacket.class)
|
|
||||||
public interface ClientSettingsC2SPacketAccessor {
|
|
||||||
|
|
||||||
@Accessor("language")
|
|
||||||
String getLanguage();
|
|
||||||
|
|
||||||
}
|
|
@ -70,7 +70,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 getServerWorld();
|
@Shadow public abstract ServerWorld getWorld();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getLuckPermsUser() {
|
public User getLuckPermsUser() {
|
||||||
@ -148,12 +148,12 @@ public abstract class ServerPlayerEntityMixin implements MixinUser {
|
|||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "setClientSettings")
|
@Inject(at = @At("HEAD"), method = "setClientSettings")
|
||||||
private void luckperms_setClientSettings(ClientSettingsC2SPacket information, CallbackInfo ci) {
|
private void luckperms_setClientSettings(ClientSettingsC2SPacket information, CallbackInfo ci) {
|
||||||
String language = ((ClientSettingsC2SPacketAccessor) information).getLanguage();
|
String language = information.language();
|
||||||
this.luckperms$locale = TranslationManager.parseLocale(language);
|
this.luckperms$locale = TranslationManager.parseLocale(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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.getServerWorld(), targetWorld, (ServerPlayerEntity) (Object) this);
|
PlayerChangeWorldCallback.EVENT.invoker().onChangeWorld(this.getWorld(), targetWorld, (ServerPlayerEntity) (Object) this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
"package": "me.lucko.luckperms.fabric.mixin",
|
"package": "me.lucko.luckperms.fabric.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"ClientSettingsC2SPacketAccessor",
|
"CommandManagerMixin",
|
||||||
"ServerLoginNetworkHandlerAccessor",
|
"ServerLoginNetworkHandlerAccessor",
|
||||||
"ServerPlayerEntityMixin",
|
"ServerPlayerEntityMixin"
|
||||||
"CommandManagerMixin"
|
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user