A simple yet effective way to freeze a player.

Status
This thread has been locked.

oaft

Banned
Feedback score
0
Posts
16
Reactions
7
Resources
0
Here's my current method of freezing players, however if you have a more efficient way of doing this feel free to drop a comment, of course this isn't the best as it uses PlayerMoveEvent but after testing with potion effects, there was always client bypasses.

Code:
    @EventHandler
    private void onPlayerMove(PlayerMoveEvent event) {
        Player player = event.getPlayer();

        User user = this.core.getDataHandler().getUser(player.getUniqueId());
        if (!user.getUserOptions().isFrozen())
            return;

        if (event.getFrom().distanceSquared(event.getTo()) <= 0)
            return;

        if (event.getFrom().getY() != event.getTo().getY() && event.getFrom().getX() == event.getTo().getX() && event.getFrom().getZ() == event.getTo().getZ())
            return;

        player.teleport(event.getFrom());
    }
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Norska

Java Developer (https://norska.dev)
Supreme
Feedback score
68
Posts
899
Reactions
1,407
Resources
14
There's the option that many servers have, to just box the player in. Of course, when talking about "freezing" a player you also have to consider more (assuming you're making a plugin), such as command usage, session etc.
 

oaft

Banned
Feedback score
0
Posts
16
Reactions
7
Resources
0
There's the option that many servers have, to just box the player in. Of course, when talking about "freezing" a player you also have to consider more (assuming you're making a plugin), such as command usage, session etc.
In this context, we're speaking about MAINLY on HCF servers, usually where this command & method is used.
In most cores, they will have a freeze method similar to this. Usually players are frozen when about to be screenshared to search their computer for some type of cheat. I wouldn't rule out usage of PlayerMoveEvent though as this seems like a pretty solid method and allows you to still move on the Y axis.
On some anticheats, if you cannot move on the Y axis and are stuck mid air with PlayerMoveEvent cancelled, it can false flag.
 
Banned forever. Reason: Ban Evading (declynXD, https://builtbybit.com/members/declynxd.139302/)
Status
This thread has been locked.
Top