mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-05 01:59:40 +01:00
Don't display achievement broadcasts to 1.12+ #757
This commit is contained in:
parent
11be597d11
commit
fd01b9a6d2
@ -104,6 +104,10 @@ public class Protocol1_12To1_11_1 extends Protocol {
|
|||||||
if (!Via.getConfig().is1_12NBTArrayFix()) return;
|
if (!Via.getConfig().is1_12NBTArrayFix()) return;
|
||||||
try {
|
try {
|
||||||
JsonElement obj = new JsonParser().parse(wrapper.get(Type.STRING, 0));
|
JsonElement obj = new JsonParser().parse(wrapper.get(Type.STRING, 0));
|
||||||
|
if (!TranslateRewriter.toClient(obj, wrapper.user())) {
|
||||||
|
wrapper.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
ChatItemRewriter.toClient(obj, wrapper.user());
|
ChatItemRewriter.toClient(obj, wrapper.user());
|
||||||
wrapper.set(Type.STRING, 0, obj.toString());
|
wrapper.set(Type.STRING, 0, obj.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package us.myles.ViaVersion.protocols.protocol1_12to1_11_1;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
|
||||||
|
public class TranslateRewriter {
|
||||||
|
public static boolean toClient(JsonElement element, UserConnection user) {
|
||||||
|
if (element instanceof JsonObject) {
|
||||||
|
JsonObject obj = (JsonObject) element;
|
||||||
|
if(obj.has("translate")) {
|
||||||
|
if(obj.get("translate").getAsString().equals("chat.type.achievement")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user