- [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

@@ -0,0 +1,20 @@
--- a/Forge/src/main/java/com/hypherionmc/craterlib/common/ForgeServerEvents.java
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/common/ForgeServerEvents.java
@@ -3,7 +3,6 @@
import com.hypherionmc.craterlib.api.events.server.CraterRegisterCommandEvent;
import com.hypherionmc.craterlib.api.events.server.CraterServerLifecycleEvent;
import com.hypherionmc.craterlib.core.event.CraterEventBus;
-import com.hypherionmc.craterlib.nojang.commands.CommandsRegistry;
import com.hypherionmc.craterlib.nojang.server.BridgedMinecraftServer;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.event.server.ServerStartedEvent;
@@ -36,8 +35,7 @@
@SubscribeEvent
public void onCommandRegister(RegisterCommandsEvent event) {
- CraterEventBus.INSTANCE.postEvent(new CraterRegisterCommandEvent());
- CommandsRegistry.INSTANCE.registerCommands(event.getDispatcher());
+ CraterEventBus.INSTANCE.postEvent(new CraterRegisterCommandEvent(event.getDispatcher()));
}
}

View File

@@ -0,0 +1,22 @@
--- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ConfigScreenHandlerMixin.java
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ConfigScreenHandlerMixin.java
@@ -1,6 +1,7 @@
package com.hypherionmc.craterlib.mixin;
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
+import com.hypherionmc.craterlib.core.config.AbstractConfig;
import com.hypherionmc.craterlib.core.config.ConfigController;
import com.hypherionmc.craterlib.core.config.ModuleConfig;
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
@@ -28,9 +29,9 @@
*/
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
- ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
+ ConfigController.getWatchedConfigs().forEach((conf, watcher) -> {
if (!conf.getClass().isAnnotationPresent(NoConfigScreen.class)) {
- ModuleConfig config = (ModuleConfig) conf;
+ AbstractConfig config = watcher.getLeft();
if (config.getModId().equals(selectedMod.getModId())) {
cir.setReturnValue(
Optional.of((minecraft, screen) -> new CraterConfigScreen(config, screen))

View File

@@ -9,7 +9,7 @@
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
public class ServerGamePacketListenerImplMixin {
@@ -22,12 +24,13 @@
@@ -22,13 +24,14 @@
public ServerPlayer player;
@Inject(
@@ -19,10 +19,12 @@
cancellable = true
)
- private void injectChatEvent(Component component, PlayerChatMessage arg, FilteredText p_296589_, CallbackInfo ci) {
- Component finalArg = component == null ? arg.decoratedContent() : component;
- Component finalcomp = component == null ? arg.decoratedContent() : component;
- CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalcomp.getString(), ChatUtils.mojangToAdventure(finalcomp));
+ private void injectChatEvent(CompletableFuture<Component> completablefuture1, PlayerChatMessage arg, CompletableFuture<FilteredText> completablefuture, Void p_248218_, CallbackInfo ci) {
+ Component comp2 = completablefuture1.join();
+ Component finalArg = comp2 == null ? arg.decoratedContent() : comp2;
CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
+ CraterServerChatEvent event = new CraterServerChatEvent(BridgedPlayer.of(this.player), finalArg.getString(), ChatUtils.mojangToAdventure(finalArg));
CraterEventBus.INSTANCE.postEvent(event);
if (event.wasCancelled())
ci.cancel();

View File

@@ -0,0 +1,11 @@
--- a/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerStatusPacketListenerMixin.java
+++ b/Forge/src/main/java/com/hypherionmc/craterlib/mixin/ServerStatusPacketListenerMixin.java
@@ -44,7 +44,7 @@
status.version(),
status.favicon(),
status.enforcesSecureChat(),
- status.isModded()
+ status.forgeData()
)
));
}

View File

@@ -3,7 +3,7 @@
@@ -1,5 +1,5 @@
modLoader = "javafml"
-loaderVersion = "[50,)"
+loaderVersion = "[44,)"
+loaderVersion = "[45,)"
license = "MIT"
issueTrackerURL = "https://github.com/firstdarkdev/craterLib/issues"
@@ -12,7 +12,7 @@
modId = "forge"
mandatory = true
- versionRange = "[50,)"
+ versionRange = "[44,)"
+ versionRange = "[45,)"
ordering = "NONE"
side = "BOTH"
@@ -20,6 +20,6 @@
modId = "minecraft"
mandatory = true
- versionRange = "[1.20.6,1.21)"
+ versionRange = "[1.19.3,1.20)"
+ versionRange = "[1.19.4,1.20)"
ordering = "NONE"
side = "BOTH"