-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move syncmatica custom payloads out of configuration phase
- Loading branch information
1 parent
46ccc9b
commit 9d6f107
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ain/java/net/earthcomputer/viavanillaplus/mixin/syncmatica/Protocol1_20_2To1_20Mixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package net.earthcomputer.viavanillaplus.mixin.syncmatica; | ||
|
||
import com.viaversion.viaversion.api.protocol.AbstractProtocol; | ||
import com.viaversion.viaversion.api.protocol.packet.Direction; | ||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; | ||
import com.viaversion.viaversion.api.protocol.packet.State; | ||
import com.viaversion.viaversion.api.type.Type; | ||
import com.viaversion.viaversion.exception.CancelException; | ||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ClientboundPackets1_19_4; | ||
import com.viaversion.viaversion.protocols.protocol1_19_4to1_19_3.ServerboundPackets1_19_4; | ||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.Protocol1_20_2To1_20; | ||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ClientboundPackets1_20_2; | ||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.packet.ServerboundPackets1_20_2; | ||
import com.viaversion.viaversion.protocols.protocol1_20_2to1_20.storage.ConfigurationState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(value = Protocol1_20_2To1_20.class, remap = false) | ||
public class Protocol1_20_2To1_20Mixin extends AbstractProtocol<ClientboundPackets1_19_4, ClientboundPackets1_20_2, ServerboundPackets1_19_4, ServerboundPackets1_20_2> { | ||
@SuppressWarnings("deprecation") | ||
public Protocol1_20_2To1_20Mixin() { | ||
} | ||
|
||
@Inject(method = "transform", at = @At(value = "FIELD", target = "Lcom/viaversion/viaversion/protocols/protocol1_20_2to1_20/packet/ClientboundConfigurationPackets1_20_2;CUSTOM_PAYLOAD:Lcom/viaversion/viaversion/protocols/protocol1_20_2to1_20/packet/ClientboundConfigurationPackets1_20_2;")) | ||
private void onClientboundPluginMessage(Direction direction, State state, PacketWrapper wrapper, CallbackInfo ci) throws Exception { | ||
String channel = wrapper.passthrough(Type.STRING); | ||
if (channel.startsWith("syncmatica:")) { | ||
wrapper.user().get(ConfigurationState.class).addPacketToQueue(wrapper, true); | ||
throw CancelException.generate(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters