Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Don't display achievement broadcasts to 1.12+ #757
Dieser Commit ist enthalten in:
Ursprung
11be597d11
Commit
fd01b9a6d2
@ -104,6 +104,10 @@ public class Protocol1_12To1_11_1 extends Protocol {
|
||||
if (!Via.getConfig().is1_12NBTArrayFix()) return;
|
||||
try {
|
||||
JsonElement obj = new JsonParser().parse(wrapper.get(Type.STRING, 0));
|
||||
if (!TranslateRewriter.toClient(obj, wrapper.user())) {
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
ChatItemRewriter.toClient(obj, wrapper.user());
|
||||
wrapper.set(Type.STRING, 0, obj.toString());
|
||||
} catch (Exception e) {
|
||||
@ -386,7 +390,7 @@ public class Protocol1_12To1_11_1 extends Protocol {
|
||||
newId += 3;
|
||||
return newId;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void register(ViaProviders providers) {
|
||||
providers.register(InventoryQuickMoveProvider.class, new InventoryQuickMoveProvider());
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren