-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial LimboAPI and FastMOTD support
- Loading branch information
1 parent
facc6bc
commit 6d0b7f8
Showing
7 changed files
with
205 additions
and
18 deletions.
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
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
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
42 changes: 42 additions & 0 deletions
42
...rc/main/java/io/github/retrooper/packetevents/manager/InternalVelocityPacketListener.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,42 @@ | ||
/* | ||
* This file is part of packetevents - https://github.com/retrooper/packetevents | ||
* Copyright (C) 2024 retrooper and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package io.github.retrooper.packetevents.manager; | ||
|
||
import com.github.retrooper.packetevents.PacketEvents; | ||
import com.github.retrooper.packetevents.event.PacketSendEvent; | ||
import com.github.retrooper.packetevents.manager.InternalPacketListener; | ||
import com.github.retrooper.packetevents.protocol.packettype.PacketType; | ||
import com.github.retrooper.packetevents.wrapper.login.server.WrapperLoginServerSetCompression; | ||
import io.github.retrooper.packetevents.handlers.PacketEventsEncoder; | ||
import io.netty.channel.Channel; | ||
|
||
public class InternalVelocityPacketListener extends InternalPacketListener { | ||
|
||
@Override | ||
public void onPacketSend(PacketSendEvent event) { | ||
if (event.getPacketType() == PacketType.Login.Server.SET_COMPRESSION) { | ||
WrapperLoginServerSetCompression compression = new WrapperLoginServerSetCompression(event); | ||
Channel channel = (Channel) event.getUser().getChannel(); | ||
PacketEventsEncoder encoder = (PacketEventsEncoder) channel.pipeline().get(PacketEvents.ENCODER_NAME); | ||
encoder.enableCompressionClientside = compression.getThreshold() >= 0; | ||
} | ||
|
||
super.onPacketSend(event); | ||
} | ||
} |
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