3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 16:40:10 +01:00

Use equals in legacy custom payload channel comparisons (#3721)

Dieser Commit ist enthalten in:
RK_01 2024-02-29 11:11:00 +01:00 committet von GitHub
Ursprung aa262bb0a5
Commit 4cf271af81
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
4 geänderte Dateien mit 13 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -45,7 +45,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_9_3, Serv
map(Type.STRING); // 0 - Channel
handler(wrapper -> {
if (wrapper.get(Type.STRING, 0).equalsIgnoreCase("MC|TrList")) {
if (wrapper.get(Type.STRING, 0).equals("MC|TrList")) {
wrapper.passthrough(Type.INT); // Passthrough Window ID
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);

Datei anzeigen

@ -47,7 +47,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_9_3, Serv
map(Type.STRING); // 0 - Channel
handler(wrapper -> {
if (wrapper.get(Type.STRING, 0).equalsIgnoreCase("MC|TrList")) {
if (wrapper.get(Type.STRING, 0).equals("MC|TrList")) {
wrapper.passthrough(Type.INT); // Passthrough Window ID
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);

Datei anzeigen

@ -99,7 +99,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_12_1, Ser
handler(wrapper -> {
String channel = wrapper.get(Type.STRING, 0);
// Handle stopsound change
if (channel.equalsIgnoreCase("MC|StopSound")) {
if (channel.equals("MC|StopSound")) {
String originalSource = wrapper.read(Type.STRING);
String originalSound = wrapper.read(Type.STRING);
@ -129,7 +129,7 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_12_1, Ser
wrapper.set(Type.BYTE, 0, flags); // Update flags
return;
} else if (channel.equalsIgnoreCase("MC|TrList")) {
} else if (channel.equals("MC|TrList")) {
channel = "minecraft:trader_list";
wrapper.passthrough(Type.INT); // Passthrough Window ID

Datei anzeigen

@ -265,9 +265,9 @@ public class PlayerPackets {
map(Type.STRING); // 0 - Channel Name
handler(wrapper -> {
String name = wrapper.get(Type.STRING, 0);
if (name.equalsIgnoreCase("MC|BOpen")) {
if (name.equals("MC|BOpen")) {
wrapper.write(Type.VAR_INT, 0);
} else if (name.equalsIgnoreCase("MC|TrList")) {
} else if (name.equals("MC|TrList")) {
wrapper.passthrough(Type.INT); // ID
Short size = wrapper.passthrough(Type.UNSIGNED_BYTE);
@ -406,14 +406,14 @@ public class PlayerPackets {
map(Type.STRING); // 0 - Channel Name
handler(wrapper -> {
String name = wrapper.get(Type.STRING, 0);
if (name.equalsIgnoreCase("MC|BSign")) {
if (name.equals("MC|BSign")) {
Item item = wrapper.passthrough(Type.ITEM1_8);
if (item != null) {
item.setIdentifier(387); // Written Book
ItemRewriter.rewriteBookToServer(item);
}
}
if (name.equalsIgnoreCase("MC|AutoCmd")) {
if (name.equals("MC|AutoCmd")) {
wrapper.set(Type.STRING, 0, "MC|AdvCdm");
wrapper.write(Type.BYTE, (byte) 0);
wrapper.passthrough(Type.INT); // X
@ -423,7 +423,7 @@ public class PlayerPackets {
wrapper.passthrough(Type.BOOLEAN); // Flag
wrapper.clearInputBuffer();
}
if (name.equalsIgnoreCase("MC|AdvCmd")) {
if (name.equals("MC|AdvCmd")) {
wrapper.set(Type.STRING, 0, "MC|AdvCdm");
}
});