mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-12-21 16:17:37 +01:00
close #6
This commit is contained in:
parent
7d225cfa4e
commit
6aaa206bb9
@ -3,7 +3,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
|
||||
plugins {
|
||||
id("java")
|
||||
id("net.minecrell.licenser") version "0.4.1"
|
||||
id("fabric-loom") version "0.2.3-SNAPSHOT"
|
||||
id("fabric-loom") version "0.2.4-SNAPSHOT"
|
||||
id("com.palantir.git-version") version "0.12.0-rc2"
|
||||
}
|
||||
|
||||
|
@ -44,44 +44,6 @@ public class ClientSideReference extends Protocol {
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
// Plugin Message
|
||||
registerOutgoing(State.PLAY, 0x18, 0x18, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
String channel = wrapper.passthrough(Type.STRING);
|
||||
|
||||
try {
|
||||
new Identifier(channel);
|
||||
} catch (InvalidIdentifierException ex) {
|
||||
Via.getPlatform().getLogger().warning("Ignoring invalid custom payload identifier: " + ex.getMessage());
|
||||
wrapper.set(Type.STRING, 0, "viafabric:invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel.equals("minecraft:register") || channel.equals("minecraft:unregister")) {
|
||||
String[] channels = new String(wrapper.read(Type.REMAINING_BYTES), StandardCharsets.UTF_8).split("\0");
|
||||
|
||||
List<String> filteredChannels = new LinkedList<>();
|
||||
|
||||
for (String c : channels) {
|
||||
try {
|
||||
new Identifier(c);
|
||||
} catch (InvalidIdentifierException ex) {
|
||||
Via.getPlatform().getLogger().warning("Ignoring invalid custom payload identifier in " + channel + ": " + ex.getMessage());
|
||||
continue;
|
||||
}
|
||||
filteredChannels.add(c);
|
||||
}
|
||||
|
||||
wrapper.write(Type.REMAINING_BYTES, Joiner.on('\0').join(filteredChannels).getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user