Revxrsal / Lamp

A powerful, extendable, flexible yet simple to use commands annotation framework.
MIT License
171 stars 33 forks source link

Sponge 8 Base Support. #67

Closed creatorfromhell closed 11 months ago

creatorfromhell commented 11 months ago

This has not been tested yet.

creatorfromhell commented 11 months ago

Few quarks when testing this. For some reason, the listener in the command system here doesn't get called so there may be some workarounds needed. I'm going to test adding the initializer before the GameEngine starts, which could lead to some interesting results, as any calls to Sponge.server will need moved out of the constructor. This comes mainly since, from what I've seen, in Sponge 8 the only way to register commands is through the event, which seems a little backwards and going against moving forward. Could be a different approach, if someone wants to build off the SpongeHandler.

creatorfromhell commented 11 months ago

Update here: I got it loading, and commands are able to be utilized in-game.

Things that currently don't work:

> Complete: gi [08:37:13] [Server thread/FATAL]: Error executing task on Server java.lang.IllegalStateException: Path cannot be empty! at net.tnemc.libs.lamp.commands.util.Preconditions.notEmpty(Preconditions.java:40) ~[Preconditions.class:?] at net.tnemc.libs.lamp.commands.core.CommandPath.get(CommandPath.java:76) ~[CommandPath.class:?] at net.tnemc.libs.lamp.commands.core.BaseAutoCompleter.complete(BaseAutoCompleter.java:133) ~[BaseAutoCompleter.class:?] at net.tnemc.libs.lamp.commands.sponge.core.SpongeCommandCallable.complete(SpongeCommandCallable.java:54) ~[SpongeCommandCallable.class:?] at org.spongepowered.common.command.registrar.SpongeRawCommandRegistrar.complete(SpongeRawCommandRegistrar.java:99) ~[SpongeRawCommandRegistrar.class:1.16.5-8.1.0-RC1352] at org.spongepowered.common.util.CommandUtil.createSuggestionsForRawCommand(CommandUtil.java:83) ~[CommandUtil.class:1.16.5-8.1.0-RC1352] at net.minecraft.server.network.ServerGamePacketListenerImpl.handler$zgm000$impl$getSuggestionsFromNonBrigCommand(ServerGamePacketListenerImpl.java:3309) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCustomCommandSuggestions(ServerGamePacketListenerImpl.java:481) ~[?:?] at net.minecraft.network.protocol.game.ServerboundCommandSuggestionPacket.handle(ServerboundCommandSuggestionPacket.java:35) ~[?:?] at net.minecraft.network.protocol.game.ServerboundCommandSuggestionPacket.handle(ServerboundCommandSuggestionPacket.java:9) ~[?:?] at org.spongepowered.common.event.tracking.phase.packet.PacketPhaseUtil.onProcessPacket(PacketPhaseUtil.java:262) ~[PacketPhaseUtil.class:1.16.5-8.1.0-RC1352] at net.minecraft.network.protocol.PacketUtils.md2e3e77$lambda$tracker$redirectProcessPacket$0$0(PacketUtils.java:552) ~[?:?] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[?:?] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:144) ~[?:?] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?] at net.minecraft.server.MinecraftServer.redirect$zca000$tracker$wrapAndPerformContextSwitch(MinecraftServer.java:4322) ~[?:?] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:761) ~[?:?] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:155) ~[?:?] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:118) ~[?:?] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:743) ~[?:?] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:737) ~[?:?] at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:127) ~[?:?] at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:722) ~[?:?] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:674) ~[?:?] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:257) ~[?:?] at java.lang.Thread.run(Thread.java:1623) [?:?]

creatorfromhell commented 11 months ago

Nvm, figured it out, the command name is not provided during the completion arguments. image Works now.

creatorfromhell commented 11 months ago

@Revxrsal This is ready for review, I've attached the screenshot above of my test with it using TNE for Sponge 8. I've also attached the built jar below. sponge-8-3.1.5.zip

Revxrsal commented 11 months ago

Excellent work! I'm glad you didn't need to change much.