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

This commit is contained in:
RK_01 2024-02-29 11:11:00 +01:00 committed by GitHub
parent aa262bb0a5
commit 4cf271af81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 13 deletions

View File

@ -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);
@ -88,4 +88,4 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_9_3, Serv
}
return item;
}
}
}

View File

@ -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);
@ -135,4 +135,4 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_9_3, Serv
}
return item;
}
}
}

View File

@ -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
@ -773,4 +773,4 @@ public class InventoryPackets extends ItemRewriter<ClientboundPackets1_12_1, Ser
|| id == 442 // shield
|| id == 443; // elytra
}
}
}

View File

@ -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");
}
});
@ -489,4 +489,4 @@ public class PlayerPackets {
}
});
}
}
}