Anticheat help

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

funpvp

Member
Oct 7, 2023
40
1
8
22
code

package me.willgames_.batanticheat;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;

import java.util.ArrayList;
import java.util.List;


public abstract class Check {

protected String name;
protected CheckType type;
public float vl;

public static List<UserData> alertsEnabled = new ArrayList<>();

//Used for individual players
private final UserData data;

private static TextComponent lbracket = new TextComponent("["),
rbracket = new TextComponent("]"),
prefix = new TextComponent("Bat"),
space = new TextComponent(" "),
message = new TextComponent("failed"),
infoPrefix = new TextComponent("Information: ");

public void flag(String info, Object... objects) {
String formattedInfo = String.format(info, objects);

TextComponent playerName = new TextComponent(data.getPlayer().getName());
playerName.setColor(ChatColor.WHITE);

TextComponent checkName = new TextComponent(name);
checkName.setColor(ChatColor.WHITE);

TextComponent violationCount = new TextComponent(String.valueOf(MathUtils.round(vl, 1);
violationCount.setColor(ChatColor.RED);

TextComponent alertMsg = new TextComponent(lbracket, prefix, rbracket, space, playerName,
space, message, space, checkName, space, lbracket, violationCount, rbracket);

TextComponent information = new TextComponent(Color.translate(formattedInfo));

information.setColor(ChatColor.WHITE);

alertMsg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new BaseComponent[] {infoPrefix, space, information}));

alertsEnabled.forEach(user -> {
alertMsg.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tp " + name));

user.getPlayer().spigot().sendMessage(prefix space message space infoPrefix);
});
}

public abstract void receive(Object packet);

public abstract void send(Object packet);

static {
lbracket.setColor(ChatColor.DARK_GRAY);
rbracket.setColor(ChatColor.DARK_GRAY);
prefix.setColor(ChatColor.DARK_RED);
prefix.setBold(true);
message.setColor(ChatColor.GRAY);
infoPrefix.setColor(ChatColor.GOLD);
}
 

Attachments

  • errors.PNG
    errors.PNG
    41.9 KB · Views: 8