mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-22 18:09:06 +00:00
Small updates
This commit is contained in:
parent
24ce9103a4
commit
be690cb43d
@ -140,7 +140,7 @@ public class CommandListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void InventoryClick(final InventoryClickEvent event) {
|
public void InventoryClick(final InventoryClickEvent event) {
|
||||||
final Inventory inventory = event.getInventory();
|
final Inventory inventory = event.getInventory();
|
||||||
final InventoryHolder inventoryHolder = inventory.getHolder(false);
|
final InventoryHolder inventoryHolder = inventory.getHolder();
|
||||||
if (!(inventoryHolder instanceof ModerationGuiInventory)) {
|
if (!(inventoryHolder instanceof ModerationGuiInventory)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class PacketListenerSystemChat extends PacketAdapter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WrappedChatComponent chat = event.getPacket().getChatComponents().read(0);
|
final WrappedChatComponent chat = event.getPacket().getChatComponents().readSafely(0);
|
||||||
if (chat == null) {
|
if (chat == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package mineverse.Aust1n46.chat.utilities;
|
|||||||
|
|
||||||
import static mineverse.Aust1n46.chat.MineverseChat.getInstance;
|
import static mineverse.Aust1n46.chat.MineverseChat.getInstance;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -626,30 +627,27 @@ public class Format {
|
|||||||
return coloredText;
|
return coloredText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toPlainText(Object o, Class<?> c) {
|
public static String toPlainText(final Object o, final Class<?> c) {
|
||||||
List<Object> finalList = new ArrayList<>();
|
final List<Object> finalList = new ArrayList<>();
|
||||||
StringBuilder stringbuilder = new StringBuilder();
|
final StringBuilder stringbuilder = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
splitComponents(finalList, o, c);
|
splitComponents(finalList, o, c);
|
||||||
for (Object component : finalList) {
|
for (Object component : finalList) {
|
||||||
|
final String methodName;
|
||||||
if (VersionHandler.is1_7()) {
|
if (VersionHandler.is1_7()) {
|
||||||
final String text = (String) component.getClass().getMethod("e").invoke(component);
|
methodName = "e";
|
||||||
if (text.contains(ChatColor.stripColor(Format.FormatStringAll(MineverseChat.getInstance().getConfig().getString("guiicon"))))) {
|
|
||||||
continue; // skip adding moderation gui icon for message remover to properly compute hash
|
|
||||||
}
|
|
||||||
} else if(VersionHandler.is1_8() || VersionHandler.is1_9() || VersionHandler.is1_10() || VersionHandler.is1_11() || VersionHandler.is1_12() || VersionHandler.is1_13() || VersionHandler.is1_14() || VersionHandler.is1_15() || VersionHandler.is1_16() || VersionHandler.is1_17()){
|
} else if(VersionHandler.is1_8() || VersionHandler.is1_9() || VersionHandler.is1_10() || VersionHandler.is1_11() || VersionHandler.is1_12() || VersionHandler.is1_13() || VersionHandler.is1_14() || VersionHandler.is1_15() || VersionHandler.is1_16() || VersionHandler.is1_17()){
|
||||||
final String text = (String) component.getClass().getMethod("getText").invoke(component);
|
methodName = "getText";
|
||||||
if (text.contains(ChatColor.stripColor(Format.FormatStringAll(MineverseChat.getInstance().getConfig().getString("guiicon"))))) {
|
|
||||||
continue; // skip adding moderation gui icon for message remover to properly compute hash
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final String text = (String) component.getClass().getMethod("getString").invoke(component);
|
methodName = "getString";
|
||||||
if (text.contains(ChatColor.stripColor(Format.FormatStringAll(MineverseChat.getInstance().getConfig().getString("guiicon"))))) {
|
|
||||||
continue; // skip adding moderation gui icon for message remover to properly compute hash
|
|
||||||
}
|
|
||||||
stringbuilder.append(text);
|
|
||||||
}
|
}
|
||||||
|
final String guiIcon = ChatColor.stripColor(Format.FormatStringAll(MineverseChat.getInstance().getConfig().getString("guiicon")));
|
||||||
|
final String text = (String) component.getClass().getMethod(methodName).invoke(component);
|
||||||
|
if (text.contains(guiIcon)) {
|
||||||
|
continue; // skip adding moderation gui icon for message remover to properly compute hash
|
||||||
|
}
|
||||||
|
stringbuilder.append(text);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user