- [FEAT] New APIs for Maintenance Mode and rewrite commands system

- [FEAT] Improved config system to fix old loading bugs and support JSON
- [FEAT] LuckPerms support for commands
This commit is contained in:
2024-08-10 15:17:10 +02:00
parent e14ac2a136
commit 614fb0bc49
352 changed files with 6045 additions and 1798 deletions

View File

@@ -4,8 +4,8 @@
setVersionType("release")
setChangelog("https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-fabric.md")
setProjectVersion("${minecraft_version}-${project.version}")
- setDisplayName("[FABRIC/QUILT 1.21.0] CraterLib - ${project.version}")
- setGameVersions("1.21")
- setDisplayName("[FABRIC/QUILT 1.21.x] CraterLib - ${project.version}")
- setGameVersions("1.21", "1.21.1")
+ setDisplayName("[FABRIC/QUILT 1.19.2] CraterLib - ${project.version}")
+ setGameVersions("1.19.2")
setLoaders("fabric", "quilt")

View File

@@ -30,8 +30,8 @@
cancellable = true
)
- private void injectChatEvent(PlayerChatMessage arg, Component arg2, FilteredText arg3, CallbackInfo ci) {
- Component finalArg = arg2 == null ? arg.decoratedContent() : arg2;
- CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
- Component finalcomp = arg2 == null ? arg.decoratedContent() : arg2;
- CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalcomp.getString(), ChatUtils.mojangToAdventure(finalcomp));
+ private void injectChatEvent(PlayerChatMessage arg, CallbackInfoReturnable<CompletableFuture> ci) {
+ CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), arg.serverContent().getString(), ChatUtils.mojangToAdventure(arg.serverContent()));
CraterEventBus.INSTANCE.postEvent(event);

View File

@@ -0,0 +1,55 @@
--- a/Fabric/src/main/java/com/hypherionmc/craterlib/mixin/ServerStatusPacketListenerMixin.java
+++ /dev/null
@@ -1,52 +1,0 @@
-package com.hypherionmc.craterlib.mixin;
-
-import com.hypherionmc.craterlib.api.events.server.ServerStatusEvent;
-import com.hypherionmc.craterlib.core.event.CraterEventBus;
-import com.hypherionmc.craterlib.utils.ChatUtils;
-import net.minecraft.network.Connection;
-import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket;
-import net.minecraft.network.protocol.status.ServerStatus;
-import net.minecraft.network.protocol.status.ServerboundStatusRequestPacket;
-import net.minecraft.server.network.ServerStatusPacketListenerImpl;
-import org.spongepowered.asm.mixin.Final;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(ServerStatusPacketListenerImpl.class)
-public class ServerStatusPacketListenerMixin {
-
- @Shadow
- @Final
- private ServerStatus status;
-
- @Shadow @Final private Connection connection;
-
- @Inject(method = "handleStatusRequest",
- at = @At(
- value = "INVOKE",
- target = "Lnet/minecraft/network/Connection;send(Lnet/minecraft/network/protocol/Packet;)V",
- shift = At.Shift.BEFORE),
- cancellable = true
- )
- private void injectHandleStatusRequest(ServerboundStatusRequestPacket arg, CallbackInfo ci) {
- ServerStatusEvent.StatusRequestEvent event = new ServerStatusEvent.StatusRequestEvent(ChatUtils.mojangToAdventure(status.description()));
- CraterEventBus.INSTANCE.postEvent(event);
-
- if (event.getNewStatus() != null) {
- ci.cancel();
- this.connection.send(new ClientboundStatusResponsePacket(
- new ServerStatus(ChatUtils.adventureToMojang(
- event.getNewStatus()),
- status.players(),
- status.version(),
- status.favicon(),
- status.enforcesSecureChat()
- )
- ));
- }
- }
-
-}

View File

@@ -0,0 +1,12 @@
--- a/Fabric/src/main/resources/craterlib.fabric.mixins.json
+++ b/Fabric/src/main/resources/craterlib.fabric.mixins.json
@@ -9,8 +9,7 @@
"TutorialMixin"
],
"server": [
- "ServerGamePacketListenerImplMixin",
- "ServerStatusPacketListenerMixin"
+ "ServerGamePacketListenerImplMixin"
],
"injectors": {
"defaultRequire": 1