Skip to content

Commit

Permalink
1.19 support
Browse files Browse the repository at this point in the history
  • Loading branch information
hevav committed Jun 8, 2022
1 parent e2f2cc2 commit cd97d93
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,4 @@ Your donations are really appreciated. Donations wallets/links/cards:

- MasterCard Debit Card (Tinkoff Bank): ``5536 9140 0599 1975``
- Qiwi Wallet: ``PFORG`` or [this link](https://my.qiwi.com/form/Petr-YSpyiLt9c6)
- YooMoney Wallet: ``4100 1721 8467 044`` or [this link](https://yoomoney.ru/quickpay/shop-widget?writer=seller&targets=Donation&targets-hint=&default-sum=&button-text=11&payment-type-choice=on&mobile-payment-type-choice=on&hint=&successURL=&quickpay=shop&account=410017218467044)
- PayPal: ``ogurec332@mail.ru``
- YooMoney Wallet: ``4100 1721 8467 044`` or [this link](https://yoomoney.ru/quickpay/shop-widget?writer=seller&targets=Donation&targets-hint=&default-sum=&button-text=11&payment-type-choice=on&mobile-payment-type-choice=on&hint=&successURL=&quickpay=shop&account=410017218467044)
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

setGroup("net.elytrium")
setVersion("1.0.4")
setVersion("1.0.5")

compileJava {
getOptions().setEncoding("UTF-8")
Expand All @@ -34,14 +34,14 @@ repositories {
}

dependencies {
compileOnly("net.elytrium:limboapi-api:1.0.4-SNAPSHOT")
compileOnly("net.elytrium:limboapi-api:1.0.5")

compileOnly("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT")
compileOnly("com.velocitypowered:velocity-proxy:3.1.2-SNAPSHOT") // From Elytrium Repo.

// Needs for some velocity methods.
compileOnly("io.netty:netty-codec:4.1.76.Final")
compileOnly("io.netty:netty-codec:4.1.77.Final")

implementation("org.bstats:bstats-velocity:3.0.0")

Expand Down
8 changes: 5 additions & 3 deletions src/main/java/net/elytrium/limbofilter/LimboFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ public void onProxyInitialization(ProxyInitializeEvent event) {
metrics.addCustomChart(new SimplePie("load_world", () -> String.valueOf(Settings.IMP.MAIN.LOAD_WORLD)));
metrics.addCustomChart(new SimplePie("check_brand", () -> String.valueOf(Settings.IMP.MAIN.CHECK_CLIENT_BRAND)));
metrics.addCustomChart(new SimplePie("check_settings", () -> String.valueOf(Settings.IMP.MAIN.CHECK_CLIENT_SETTINGS)));
System.out.println(Settings.IMP.MAIN.CAPTCHA_GENERATOR.BACKPLATE_PATHS.isEmpty());
metrics.addCustomChart(new SimplePie("has_backplate", () -> String.valueOf(!Settings.IMP.MAIN.CAPTCHA_GENERATOR.BACKPLATE_PATHS.isEmpty())));
metrics.addCustomChart(new SimplePie("has_backplate",
() -> String.valueOf(!Settings.IMP.MAIN.CAPTCHA_GENERATOR.BACKPLATE_PATHS.isEmpty()
&& !Settings.IMP.MAIN.CAPTCHA_GENERATOR.BACKPLATE_PATHS.get(0).isEmpty())));
metrics.addCustomChart(new SingleLineChart("pings", () -> Math.toIntExact(this.statistics.getPings()))); // Total pings
metrics.addCustomChart(new SingleLineChart("connections", () -> Math.toIntExact(this.statistics.getConnections())));

Expand Down Expand Up @@ -208,7 +209,8 @@ public void reload() {

this.filterServer = this.factory.createLimbo(this.filterWorld)
.setName("LimboFilter")
.setReadTimeout(Settings.IMP.MAIN.MAX_PING);
.setReadTimeout(Settings.IMP.MAIN.MAX_PING)
.setWorldTime(Settings.IMP.MAIN.WORLD_TICKS);

CommandManager manager = this.server.getCommandManager();
manager.unregister("limbofilter");
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/net/elytrium/limbofilter/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ public static class MAIN {
public String CHECK_STATE_NON_TOGGLED = "CAPTCHA_ON_POSITION_FAILED";

public boolean LOAD_WORLD = false;
@Comment("World file type: \"schematic\" (1.12.2 and lower), \"structure\" block .nbt (saved in the latest version).")
@Comment("World file type: \"schematic\" (1.12.2 and lower, not recommended), \"structure\" block .nbt (saved in 1.17 - 1.18.2).")
public String WORLD_FILE_TYPE = "structure";
public String WORLD_FILE_PATH = "world.nbt";

@Comment("World time in ticks (24000 ticks == 1 in-game day)")
public long WORLD_TICKS = 1000L;

@Comment("Unit of time in seconds for the Auto Toggles the Statistics.")
public int UNIT_OF_TIME_CPS = 300;

Expand Down
16 changes: 10 additions & 6 deletions src/main/java/net/elytrium/limbofilter/cache/CachedPackets.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolUtils;
import com.velocitypowered.proxy.protocol.packet.Chat;
import com.velocitypowered.proxy.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.chat.LegacyChat;
import com.velocitypowered.proxy.protocol.packet.chat.SystemChat;
import com.velocitypowered.proxy.protocol.packet.title.GenericTitlePacket;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -107,16 +108,19 @@ private MinecraftPacket createSetSlotPacket(LimboFactory factory, VirtualItem it

public PreparedPacket createChatPacket(LimboFactory factory, String text) {
return factory.createPreparedPacket()
.prepare(new Chat(
.prepare(new LegacyChat(
ProtocolUtils.getJsonChatSerializer(ProtocolVersion.MINIMUM_VERSION).serialize(
LimboFilter.getSerializer().deserialize(text)
), Chat.CHAT_TYPE, null
), LegacyChat.CHAT_TYPE, null
), ProtocolVersion.MINIMUM_VERSION, ProtocolVersion.MINECRAFT_1_15_2)
.prepare(new Chat(
.prepare(new LegacyChat(
ProtocolUtils.getJsonChatSerializer(ProtocolVersion.MINECRAFT_1_16).serialize(
LimboFilter.getSerializer().deserialize(text)
), Chat.CHAT_TYPE, null
), ProtocolVersion.MINECRAFT_1_16);
), LegacyChat.CHAT_TYPE, null
), ProtocolVersion.MINECRAFT_1_16, ProtocolVersion.MINECRAFT_1_18_2)
.prepare(new SystemChat(
LimboFilter.getSerializer().deserialize(text), 0
), ProtocolVersion.MINECRAFT_1_19);
}

private PreparedPacket createDisconnectPacket(LimboFactory factory, String message) {
Expand Down

0 comments on commit cd97d93

Please sign in to comment.