aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/rosegoldaddons/features/SexAura.java
blob: 543915f0d449d6c39ab24c774c671e5b2d43e1e7 (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
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 rosegoldaddons.Main;

public class SexAura {
    @SubscribeEvent(priority = EventPriority.HIGHEST)
    public void chat(ClientChatReceivedEvent event) {
        if(event.type == 0) {
            String message = event.message.getUnformattedText();
            String formatted = event.message.getFormattedText();
            if (message.startsWith("From") && message.contains("!SXAURA!")) {
                event.setCanceled(true);
                String sender = formatted.substring(formatted.indexOf("From")+5, formatted.indexOf(":"));
                Main.mc.thePlayer.addChatMessage(new ChatComponentText(sender+"§d§l has sexed you!"));
                playAlert();
            }
            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();
            }
        }
    }

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