mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 10:31:45 +00:00
Support viewing removed message content
This commit is contained in:
parent
63e3b7d7b9
commit
1211402c58
@ -524,9 +524,9 @@ public class Format {
|
|||||||
if (VersionHandler.is1_7()) {
|
if (VersionHandler.is1_7()) {
|
||||||
return "\"extra\":[{\"text\":\"Hover to see original message is not currently supported in 1.7\",\"color\":\"red\"}]";
|
return "\"extra\":[{\"text\":\"Hover to see original message is not currently supported in 1.7\",\"color\":\"red\"}]";
|
||||||
}
|
}
|
||||||
if (VersionHandler.isAbove_1_19()) {
|
// if (VersionHandler.isAbove_1_19()) {
|
||||||
return "\"extra\":[{\"text\":\"Hover to see original message is not currently supported in 1.19+\",\"color\":\"red\"}]";
|
// return "\"extra\":[{\"text\":\"Hover to see original message is not currently supported in 1.19+\",\"color\":\"red\"}]";
|
||||||
}
|
// }
|
||||||
List<Object> finalList = new ArrayList<>();
|
List<Object> finalList = new ArrayList<>();
|
||||||
StringBuilder stringbuilder = new StringBuilder();
|
StringBuilder stringbuilder = new StringBuilder();
|
||||||
stringbuilder.append("\"extra\":[");
|
stringbuilder.append("\"extra\":[");
|
||||||
@ -556,7 +556,7 @@ public class Format {
|
|||||||
jsonObject.put("underlined", underlined);
|
jsonObject.put("underlined", underlined);
|
||||||
jsonObject.put("obfuscated", obfuscated);
|
jsonObject.put("obfuscated", obfuscated);
|
||||||
stringbuilder.append(jsonObject.toJSONString() + ",");
|
stringbuilder.append(jsonObject.toJSONString() + ",");
|
||||||
} else {
|
} else if (VersionHandler.is1_18() || VersionHandler.is1_19()) {
|
||||||
String text = (String) component.getClass().getMethod("getString").invoke(component);
|
String text = (String) component.getClass().getMethod("getString").invoke(component);
|
||||||
Object chatModifier = component.getClass().getMethod("c").invoke(component);
|
Object chatModifier = component.getClass().getMethod("c").invoke(component);
|
||||||
Object color = chatModifier.getClass().getMethod("a").invoke(chatModifier);
|
Object color = chatModifier.getClass().getMethod("a").invoke(chatModifier);
|
||||||
@ -579,8 +579,32 @@ public class Format {
|
|||||||
jsonObject.put("obfuscated", obfuscated);
|
jsonObject.put("obfuscated", obfuscated);
|
||||||
stringbuilder.append(jsonObject.toJSONString() + ",");
|
stringbuilder.append(jsonObject.toJSONString() + ",");
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
String text = (String) component.getClass().getMethod("getString").invoke(component);
|
||||||
|
Object chatModifier = component.getClass().getMethod("a").invoke(component);
|
||||||
|
Object color = chatModifier.getClass().getMethod("a").invoke(chatModifier);
|
||||||
|
String colorString = "white";
|
||||||
|
if (color != null ) {
|
||||||
|
colorString = color.getClass().getMethod("b").invoke(color).toString();
|
||||||
|
}
|
||||||
|
boolean bold = (boolean) chatModifier.getClass().getMethod("b").invoke(chatModifier);
|
||||||
|
boolean italic = (boolean) chatModifier.getClass().getMethod("c").invoke(chatModifier);
|
||||||
|
boolean strikethrough = (boolean) chatModifier.getClass().getMethod("d").invoke(chatModifier);
|
||||||
|
boolean underlined = (boolean) chatModifier.getClass().getMethod("e").invoke(chatModifier);
|
||||||
|
boolean obfuscated = (boolean) chatModifier.getClass().getMethod("f").invoke(chatModifier);
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("text", text);
|
||||||
|
jsonObject.put("color", colorString);
|
||||||
|
jsonObject.put("bold", bold);
|
||||||
|
jsonObject.put("strikethrough", strikethrough);
|
||||||
|
jsonObject.put("italic", italic);
|
||||||
|
jsonObject.put("underlined", underlined);
|
||||||
|
jsonObject.put("obfuscated", obfuscated);
|
||||||
|
stringbuilder.append(jsonObject.toJSONString() + ",");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
return "\"extra\":[{\"text\":\"Something went wrong. Could not access color.\",\"color\":\"red\"}]";
|
return "\"extra\":[{\"text\":\"Something went wrong. Could not access color.\",\"color\":\"red\"}]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -639,7 +663,7 @@ public class Format {
|
|||||||
finalList.add(component);
|
finalList.add(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (VersionHandler.is1_18() || VersionHandler.is1_19()){
|
} else if (VersionHandler.is1_18() || VersionHandler.is1_19()) {
|
||||||
ArrayList<?> list = (ArrayList<?>) c.getMethod("b").invoke(o, new Object[0]);
|
ArrayList<?> list = (ArrayList<?>) c.getMethod("b").invoke(o, new Object[0]);
|
||||||
for (Object component : list) {
|
for (Object component : list) {
|
||||||
ArrayList<?> innerList = (ArrayList<?>) c.getMethod("b").invoke(component, new Object[0]);
|
ArrayList<?> innerList = (ArrayList<?>) c.getMethod("b").invoke(component, new Object[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user