Memeware 7.3 AntiBlind module 2 files, 173 lines

Memeware 7.3 AntiBlind: Full Source Analysis

AntiBlind is a one-line visual cleaner: on every UpdateEvent it checks isPotionActive(Potion.blindness) and, when the flag is set, removes the effect from the local active potion map with removePotionEffect.

me/memewaredevs/client/module/render/AntiBlind.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-08-13

Packets This Module Uses

Analysis

Overview

AntiBlind is a one-line visual cleaner: on every UpdateEvent it checks isPotionActive(Potion.blindness) and, when the flag is set, removes the effect from the local active potion map with removePotionEffect. The strip is purely client-side; the server keeps the blindness effect and its expiry timer, so no packet leaves the client and the module is invisible to traffic analysis. The only wire interaction is receive-side: S1C metadata carries the entity's potion-effect bitmask, and S1D re-applications are stripped again on the next update tick.

Registration and per-tick strip

The module is the Memeware event pattern at its smallest: a single public Consumer<UpdateEvent> field named eventConsumer0. Module.toggle() calls EventAPI.put(this) on enable, which subscribes the instance to the client's PubSub bus, and the bus invokes every Consumer field whose generic type matches the fired event. The consumer tests mc.thePlayer.isPotionActive(Potion.blindness) and calls mc.thePlayer.removePotionEffect(Potion.blindness.id) (id 15) when true. In the fork's EntityLivingBase, removePotionEffect pulls the PotionEffect out of activePotionsMap and calls onFinishedPotionEffect, which sets potionsNeedUpdate and, because worldObj.isRemote is true on the client, skips the attribute-modifier half entirely; the local DataWatcher potion bitmask is recomputed on the next onUpdate. The blindness overlay in EntityRenderer is driven by isPotionActive, so the black screen and fog vanish the same tick.

Wire presence is zero

Nothing is sent. The server-side player still has the effect: health packets, S1D apply, S1E expire and the S1C metadata bitmask all continue as vanilla. Because the removal only edits the client's activePotionsMap, the divergence is confined to the local render state. If the server re-applies blindness (a new S1D or a refresh), the next UpdateEvent strips it again within a tick, so the effect can never render. A server cannot learn that the effect was removed: no client packet reports potion state, and the S1C stream is server-originated.

Failure modes

The strip is keyed on the local map, so it depends on the effect having been applied client-side first: an S1D that arrives while the module is disabled leaves the overlay until re-enable. removePotionEffect returns the removed effect and the null branch is silent, which is harmless here. Because the consumer runs on UpdateEvent only, the module never touches other players, only the local camera state. There are no settings, no modes and no config surface; the module is unconditional behavior for the render category.

source AntiBlind.java

AntiBlind.java18 lines · JavaOriginal ↗
1
package me.memewaredevs.client.module.render;
2
3
import me.memewaredevs.client.event.events.UpdateEvent;
4
import me.memewaredevs.client.module.Module;
5
import net.minecraft.potion.Potion;
6
7
import java.util.function.Consumer;
8
9
public class AntiBlind extends Module {
10
    public AntiBlind() {
11
        super("AntiBlind", 0, Category.RENDER);
12
    }
13
    public Consumer<UpdateEvent> eventConsumer0 = (updateEvent) -> {
14
        if (mc.thePlayer.isPotionActive(Potion.blindness)) {
15
            mc.thePlayer.removePotionEffect(Potion.blindness.id);
16
        }
17
    };
18
}

What this file does

The whole mechanism in 17 lines: the single Consumer<UpdateEvent> field, the isPotionActive gate and the removePotionEffect call that constitute the module's entire behavior. The field is what Module.toggle() subscribes through EventAPI.put, so this file is also the registration contract.

source Module.java (event subscription contract)

Module.java155 lines · JavaOriginal ↗
1
/*
2
 * Decompiled with CFR 0.145.
3
 *
4
 * Could not load the following classes:
5
 *  com.google.common.collect.Lists
6
 */
7
package me.memewaredevs.client.module;
8
9
import me.memewaredevs.client.Memeware;
10
import me.memewaredevs.client.event.EventAPI;
11
import me.memewaredevs.client.module.hud.GameHud;
12
import me.memewaredevs.client.option.*;
13
import net.minecraft.block.Block;
14
import net.minecraft.client.Minecraft;
15
import org.apache.commons.lang3.StringUtils;
16
17
import java.util.ArrayList;
18
19
@SuppressWarnings("all")
20
public abstract class Module {
21
    protected static final Minecraft mc = Minecraft.getMinecraft();
22
    private boolean state = false;
23
    private final String name;
24
    private int key;
25
    private final Category category;
26
27
    public Module(final String name, final int key, final Category category) {
28
        this.name = name;
29
        this.key = key;
30
        this.category = category;
31
    }
32
33
    public final static Module getInstance(final Class<? extends Module> clazz) {
34
        return Memeware.INSTANCE.getModuleManager().get(clazz);
35
    }
36
37
    public final void addModes(final String... modes) {
38
        Memeware.INSTANCE.getSettingsManager().addSetting(new StringOption(this, "Mode", modes));
39
    }
40
41
    public final void addDouble(final String name, final double dval, final double min, final double max) {
42
        Memeware.INSTANCE.getSettingsManager().addSetting(new NumberOption(this, name, dval, min, max, false));
43
    }
44
45
    public final void addDouble(final String name, String mode, final double dval, final double min, final double max) {
46
        Memeware.INSTANCE.getSettingsManager().addSetting(new NumberOption(this, name, mode, dval, min, max, false));
47
    }
48
49
    public final void addInt(final String name, String mode, final double dval, final double min, final double max) {
50
        Memeware.INSTANCE.getSettingsManager().addSetting(new NumberOption(this, name, mode, dval, min, max, true));
51
    }
52
53
    public final void addBoolean(final String name, final boolean value) {
54
        Memeware.INSTANCE.getSettingsManager().addSetting(new BooleanOption(this, name, value));
55
    }
56
57
    public final void addInt(final String name, final double dval, final double min, final double max) {
58
        Memeware.INSTANCE.getSettingsManager().addSetting(new NumberOption(this, name, dval, min, max, true));
59
    }
60
61
    public final Double getDouble(final String string) {
62
        return (Double) Memeware.INSTANCE.getSettingsManager().getSettingByMod(this.getClass(), string).getValue();
63
    }
64
65
    public final Double getDouble(final String mode, final String string) {
66
        return (Double) Memeware.INSTANCE.getSettingsManager().getSettingByMod(this.getClass(), mode, string)
67
                .getValue();
68
    }
69
70
    public final boolean getBool(final String string) {
71
        return (Boolean) Memeware.INSTANCE.getSettingsManager().getSettingByMod(this.getClass(), string).getValue();
72
    }
73
74
    public final String getMode(boolean format) {
75
        try {
76
            Option<?> option = Memeware.INSTANCE.getSettingsManager().getSettingByMod(this.getClass(), "Mode");
77
            if (option != null) {
78
                String str = option.getValue().toString();
79
                if (format) {
80
                    str = "\2477 - " + str;
81
                }
82
                return str;
83
            }
84
        } catch (Exception e) {
85
86
        }
87
        return "";
88
    }
89
90
    public final boolean isMode(final String mode) {
91
        return getMode(false).equalsIgnoreCase(mode);
92
    }
93
94
    public final void toggle() {
95
        this.state = !this.state;
96
        if (this.state) {
97
            if (this.mc.thePlayer != null) {
98
                this.onEnable();
99
            }
100
            EventAPI.put(this);
101
        } else {
102
            EventAPI.remove(this);
103
            if (this.mc.thePlayer != null) {
104
                this.onDisable();
105
            }
106
        }
107
        GameHud.sortingUpdate = true;
108
    }
109
110
    public final boolean isToggled() {
111
        return this.state;
112
    }
113
114
    public void onEnable() {
115
116
    }
117
118
    public void onDisable() {
119
120
    }
121
122
    public Category getCategory() {
123
        return this.category;
124
    }
125
126
    public String getName() {
127
        return this.name;
128
    }
129
130
    public String getModuleDisplayname() {
131
        return this.name;
132
    }
133
134
    public void setKeyBind(final int keyCode) {
135
        this.key = keyCode;
136
    }
137
138
    public int getKey() {
139
        return this.key;
140
    }
141
142
    public void addBlockSelection(String name, ArrayList<Block> list) {
143
        Memeware.INSTANCE.getSettingsManager().addSetting(new BlockSelectionSetting(this, name, list));
144
    }
145
146
    public enum Category {
147
        COMBAT, MOVEMENT, PLAYER, MISC, RENDER, EXPLOIT;
148
149
        public String getName() {
150
            return StringUtils.capitalize(this.name().toLowerCase());
151
        }
152
153
    }
154
155
}

What this file does

The base class shows the wiring that makes the strip run: toggle() calls EventAPI.put(this) and EventAPI.remove(this) to subscribe and unsubscribe the module instance on the PubSub bus, and the bus dispatches the declared Consumer fields per event. It is the contract that turns a plain field into a per-tick handler.

anticheat Countering Checks

The anticheat code that detects or counters the techniques this module uses. Full source, with the detection mechanism explained below each box.

anticheat PacketSelfMetadataListener (self metadata consumer)

PacketSelfMetadataListener.java231 lines · Java
1
package ac.grim.grimac.events.packets;
2
3
import ac.grim.grimac.GrimAPI;
4
import ac.grim.grimac.player.GrimPlayer;
5
import ac.grim.grimac.utils.data.SprintingState;
6
import ac.grim.grimac.utils.nmsutil.WatchableIndexUtil;
7
import com.github.retrooper.packetevents.event.PacketListenerAbstract;
8
import com.github.retrooper.packetevents.event.PacketListenerPriority;
9
import com.github.retrooper.packetevents.event.PacketSendEvent;
10
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
11
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
12
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
13
import com.github.retrooper.packetevents.protocol.player.InteractionHand;
14
import com.github.retrooper.packetevents.util.Vector3d;
15
import com.github.retrooper.packetevents.util.Vector3i;
16
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;
17
18
import java.util.List;
19
import java.util.Optional;
20
21
public class PacketSelfMetadataListener extends PacketListenerAbstract {
22
23
    public PacketSelfMetadataListener() {
24
        super(PacketListenerPriority.HIGH);
25
    }
26
27
    @Override
28
    public boolean isPreVia() {
29
        return true;
30
    }
31
32
    @Override
33
    public void onPacketSend(PacketSendEvent event) {
34
        if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {
35
            GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());
36
            if (player == null) return;
37
38
            WrapperPlayServerEntityMetadata entityMetadata = new WrapperPlayServerEntityMetadata(event);
39
            if (entityMetadata.getEntityId() != player.entityID) return;
40
41
            List<EntityData<?>> metadata = entityMetadata.getEntityMetadata();
42
43
            // If we send multiple transactions, we are very likely to split them
44
            boolean hasSendTransaction = false;
45
46
            // 1.14+ poses:
47
            // - Client: I am sneaking
48
            // - Client: I am no longer sneaking
49
            // - Server: You are now sneaking
50
            // - Client: Okay, I am now sneaking.
51
            // - Server: You are no longer sneaking
52
            // - Client: Okay, I am no longer sneaking
53
            //
54
            // 1.13- poses:
55
            // - Client: I am sneaking
56
            // - Client: I am no longer sneaking
57
            // - Server: Okay, got it.
58
            //
59
            // Why mojang, why.  Why are you so incompetent at netcode.
60
            //
61
            // Also, mojang.  This system makes movement ping dependent!
62
            // A player using or exiting an elytra, or using or exiting sneaking will have differnet movement
63
            // to a player because of sending poses!  ViaVersion works fine without sending these poses
64
            // to the player on old servers... because the player just overrides this pose the very next tick
65
            //
66
            // It makes no sense to me why mojang is doing this, it has to be a bug.
67
            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {
68
                // Remove the pose metadata from the list
69
                metadata.removeIf(element -> element.getIndex() == 6);
70
                entityMetadata.setEntityMetadata(metadata);
71
                event.markForReEncode(true);
72
            }
73
74
            EntityData<?> watchable = WatchableIndexUtil.getIndex(metadata, 0);
75
76
            if (watchable != null && watchable.getValue() instanceof Byte) {
77
                byte field = (byte) watchable.getValue();
78
                boolean isGliding = (field & 0x80) == 0x80 && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9);
79
                boolean isSwimming = (field & 0x10) == 0x10;
80
                boolean isSprinting = (field & 0x8) == 0x8;
81
82
                if (!hasSendTransaction) player.sendTransaction();
83
                hasSendTransaction = true;
84
85
                player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
86
                    player.isSwimming = isSwimming;
87
                    player.lastSprinting = isSprinting;
88
                    if (!isSprinting) {
89
                        player.vehicleData.camelSprintingState = SprintingState.STOPPING;
90
                    }
91
                    // Protect this due to players being able to get the server to spam this packet a lot
92
                    if (player.isGliding != isGliding) {
93
                        player.pointThreeEstimator.updatePlayerGliding();
94
                    }
95
                    player.isGliding = isGliding;
96
                });
97
            }
98
99
            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_10)) {
100
                EntityData<?> gravity = WatchableIndexUtil.getIndex(metadata, 5);
101
102
                if (gravity != null) {
103
                    Object gravityObject = gravity.getValue();
104
105
                    if (gravityObject instanceof Boolean) {
106
                        if (!hasSendTransaction) player.sendTransaction();
107
                        hasSendTransaction = true;
108
109
                        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
110
                            // Vanilla uses hasNoGravity, which is a bad name IMO
111
                            // hasGravity > hasNoGravity
112
                            player.playerEntityHasGravity = !((Boolean) gravityObject);
113
                        });
114
                    }
115
                }
116
            }
117
118
            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_17)) {
119
                EntityData<?> frozen = WatchableIndexUtil.getIndex(metadata, 7);
120
121
                if (frozen != null) {
122
                    if (!hasSendTransaction) player.sendTransaction();
123
                    hasSendTransaction = true;
124
                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),
125
                            () -> player.powderSnowFrozenTicks = (int) frozen.getValue());
126
                }
127
            }
128
129
            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {
130
                int id;
131
132
                if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_14_4)) {
133
                    id = 12; // Added in 1.14 with an initial ID of 12
134
                } else if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_16_4)) {
135
                    id = 13; // 1.15 changed this to 13
136
                } else {
137
                    id = 14; // 1.17 changed this to 14
138
                }
139
140
                EntityData<?> bedObject = WatchableIndexUtil.getIndex(metadata, id);
141
                if (bedObject != null && bedObject.getValue() instanceof Optional<?> optional) {
142
                    if (!hasSendTransaction) player.sendTransaction();
143
                    hasSendTransaction = true;
144
145
                    if (optional.isPresent()) {
146
                        if (optional.get() instanceof Vector3i bedPos) {
147
                            player.addRealTimeTaskNow(() -> {
148
                                player.isInBed = true;
149
                                player.bedPosition = new Vector3d(bedPos.getX() + 0.5, bedPos.getY(), bedPos.getZ() + 0.5);
150
                            });
151
                        }
152
                    } else {
153
                        // Run when we know the player is not in bed 100%
154
                        player.addRealTimeTaskNow(() -> player.isInBed = false);
155
                    }
156
                }
157
            }
158
159
            if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) {
160
                int id;
161
162
                if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_17)) {
163
                    id = 8;
164
                } else if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {
165
                    id = 7;
166
                } else if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_10)) {
167
                    id = 6;
168
                } else {
169
                    id = 5;
170
                }
171
172
                EntityData<?> entityData = WatchableIndexUtil.getIndex(metadata, id);
173
174
                // only present if it changed
175
                if (entityData != null && entityData.getValue() instanceof Byte) {
176
                    if (!hasSendTransaction) player.sendTransaction();
177
                    hasSendTransaction = true;
178
179
                    byte data = (Byte) entityData.getValue();
180
181
                    if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_13)) {
182
                        boolean isRiptiding = (data & 4) == 4;
183
184
                        player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),
185
                                () -> player.isRiptidePose = isRiptiding);
186
                    }
187
188
                    // 1.9 eating:
189
                    // - Client: I am starting to eat
190
                    // - Client: I am no longer eating
191
                    // - Server: Got that, you are eating!
192
                    // - Client: Okay, starting to eat (no response packet because server caused this)
193
                    // - Server: I got that you aren't eating, you are not eating!
194
                    // - Client: Okay, I am no longer eating (no response packet because server caused this)
195
                    //
196
                    // 1.8 eating:
197
                    // - Client: I am starting to eat
198
                    // - Client: I am no longer eating
199
                    // - Server: Okay, I will not make you eat or stop eating because it makes sense that the server doesn't control a player's eating.
200
                    //
201
                    // This was added for stuff like shields, but IMO it really should be all client sided
202
                    boolean isActive = (data & 1) > 0;
203
                    boolean isOffhand = (data & 2) > 0;
204
205
                    // Player might have gotten this packet
206
                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),
207
                            () -> player.packetStateData.setSlowedByUsingItem(false));
208
209
                    int markedTransaction = player.lastTransactionSent.get();
210
211
                    // Player has gotten this packet
212
                    player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> {
213
                        // If the player hasn't overridden this packet by using or stopping using an item
214
                        // Vanilla update order: Receive this -> process new interacts
215
                        // Grim update order: Process new interacts -> receive this
216
                        if (player.packetStateData.slowedByUsingItemTransaction < markedTransaction) {
217
                            player.packetStateData.setSlowedByUsingItem(isActive);
218
219
                            if (isActive) {
220
                                player.packetStateData.itemInUseHand = isOffhand ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
221
                            }
222
                        }
223
                    });
224
225
                    // Yes, we do have to use a transaction for eating as otherwise it can desync much easier
226
                    event.getTasksAfterSend().add(player::sendTransaction);
227
                }
228
            }
229
        }
230
    }
231
}

How it counteracts this module

The only Grim consumer of self-targeted S1C metadata. It unwraps WrapperPlayServerEntityMetadata for the player's own entity id, strips the pose entry on 1.14+ clients and reads the watcher-0 flags byte to track sprinting, gliding and swimming for prediction. It never reads the potion-effect bitmask and it reacts only to server-originated packets, so the module's local removePotionEffect produces no observable input: the S1C stream Grim sees is identical to a vanilla client's. This entry is the honest boundary for the whole module family: the strip is a render-state edit that no metadata consumer can observe.

anticheat HawkPlayer (metadata event state)

HawkPlayer.java1121 lines · Java
1
/*
2
 * This file is part of Hawk Anticheat.
3
 * Copyright (C) 2018 Hawk Development Team
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
package me.islandscout.hawk;
20
21
import me.islandscout.hawk.check.Check;
22
import me.islandscout.hawk.util.*;
23
import me.islandscout.hawk.wrap.block.WrappedBlock;
24
import me.islandscout.hawk.wrap.entity.MetaData;
25
import me.islandscout.hawk.wrap.entity.WrappedEntity;
26
import me.islandscout.hawk.wrap.entity.human.WrappedEntityHuman;
27
import org.bukkit.*;
28
import org.bukkit.block.Block;
29
import org.bukkit.entity.Entity;
30
import org.bukkit.entity.Player;
31
import org.bukkit.event.player.PlayerTeleportEvent;
32
import org.bukkit.inventory.ItemStack;
33
import org.bukkit.util.Vector;
34
35
import java.util.*;
36
import java.util.concurrent.ConcurrentHashMap;
37
import java.util.concurrent.CopyOnWriteArrayList;
38
39
/**
40
 * Represents a client. Provides essential and additional tools
41
 * to analyze players during packet interception. Recommended
42
 * to use this rather than Bukkit's implementation.
43
 *
44
 * Fields here should be faithful to the client they represent
45
 * as much as possible, regardless of any modifications that the
46
 * anti-cheat makes to the incoming packets. Caution: that means
47
 * some of these fields can be spoofed!
48
 */
49
public class HawkPlayer {
50
51
    //Represents a queue of commands sent from server to client. Simulates latency as it is ticked.
52
    //Can be used to simulate commands that the client doesn't show any clear acknowledgement for,
53
    //such as inventory window opening/closing.
54
    private final List<Pair<Runnable, Long>> simulatedCmds;
55
56
    private final UUID uuid;
57
    private final Map<Check, Double> vl;
58
    private boolean digging;
59
    private boolean receiveNotifications;
60
    private boolean online;
61
    private final Player p;
62
    private long lastTeleportAcceptTick;
63
    private final Hawk hawk;
64
65
    //Be careful when playing with these fields.
66
    //World is not sync'd to position, yaw, nor pitch.
67
    //private World world; //updated by server
68
    private Vector position; //updated by server and client
69
    private Vector positionRaw; //updated by client
70
    private Location altSetbackLoc; //updated by server
71
    private float yaw; //updated by server and client
72
    private float pitch; //updated by server and client
73
74
    private Vector predictedPosition; //ticked by client
75
    private Vector previousPredictedPosition;
76
    private Vector predictedVelocity;
77
    private Vector previousPredictedVelocity;
78
79
    private Map<Location, List<AABB>> trackedBlockCollisions; //Private. Used to update ignoredBlockCollisions.
80
    private Set<Location> ignoredBlockCollisions; //is accessible via getter
81
82
    private Vector velocity;
83
    private Vector previousVelocity;
84
    private float deltaYaw;
85
    private float deltaPitch;
86
    private boolean onGround;
87
    private boolean prevTickOnGround;
88
    private boolean onGroundReally;
89
    private boolean sentPosUpdate;
90
    private boolean liquidExit;
91
    private float friction;
92
    private int ping;
93
    private short pingJitter;
94
    private long lastMoveTime;
95
    private long currentTick;
96
    private boolean sneaking;
97
    private boolean sprinting;
98
    private boolean blocking;
99
    private boolean pullingBow;
100
    private boolean consumingItem;
101
    private byte inventoryOpen; //0 for closed; 1 for own inventory; 2 for any other inventory. Updated by server & client
102
    private boolean inWater;
103
    private boolean inLava;
104
    private boolean swimming;
105
    private boolean inVehicle; //updated by server
106
    private boolean allowedToFly; //updated by server
107
    private boolean flying; //updated by server and client
108
    private boolean inCreative; //updated by server
109
    private long itemUseTick;
110
    private long lastAttackedPlayerTick;
111
    private long lastEntityInteractTick;
112
    private long lastInLiquidToggleTick;
113
    private long lastSlotSwitchTick;
114
    private long lastMoveTick;
115
    private long hitSlowdownTick;
116
    private long lastVelocityAcceptTick;
117
    private long lastLandTick;
118
    private ItemStack itemUsedForAttack;
119
    private double maxY;
120
    private double jumpedHeight;
121
    private long flyPendingTime;
122
    private int heldItemSlot;
123
    private int itemConsumeTicks;
124
    private final Map<Location, ClientBlock> clientBlocks;
125
    private final List<Pair<Vector, Long>> pendingVelocities;
126
    private final List<Pair<Location, Long>> pendingTeleports;
127
    private final Set<Direction> boxSidesTouchingBlocks;
128
    private Vector waterFlowForce;
129
    private List<Pair<MetaData, Long>> metaDataUpdates;
130
    private Set<Entity> entitiesInteractedInThisTick;
131
    private List<Double> lastPings;
132
    private int clientVersion;
133
134
    HawkPlayer(Player p, Hawk hawk) {
135
        this.uuid = p.getUniqueId();
136
        vl = new ConcurrentHashMap<>();
137
        receiveNotifications = true;
138
        this.p = p;
139
        Location defaultLocation = p.getLocation();
140
        this.position = defaultLocation.toVector();
141
        this.positionRaw = defaultLocation.toVector();
142
        altSetbackLoc = defaultLocation;
143
        this.yaw = defaultLocation.getYaw();
144
        this.pitch = defaultLocation.getPitch();
145
        this.velocity = new Vector();
146
        this.previousVelocity = new Vector();
147
        this.predictedPosition = defaultLocation.toVector();
148
        this.previousPredictedPosition = defaultLocation.toVector();
149
        this.predictedVelocity = new Vector();
150
        this.onGround = ((Entity) p).isOnGround();
151
        this.hawk = hawk;
152
        this.ping = ServerUtils.getPing(p);
153
        this.heldItemSlot = p.getInventory().getHeldItemSlot();
154
        clientBlocks = new ConcurrentHashMap<>();
155
        pendingVelocities = new CopyOnWriteArrayList<>();
156
        pendingTeleports = new CopyOnWriteArrayList<>();
157
        boxSidesTouchingBlocks = new HashSet<>();
158
        this.waterFlowForce = new Vector();
159
        trackedBlockCollisions = new HashMap<>();
160
        ignoredBlockCollisions = new HashSet<>();
161
        simulatedCmds = new CopyOnWriteArrayList<>();
162
        metaDataUpdates = new CopyOnWriteArrayList<>();
163
        entitiesInteractedInThisTick = new HashSet<>();
164
        lastPings = new CopyOnWriteArrayList<>();
165
        clientVersion = ServerUtils.getProtocolVersion(p) == 47 ? 8 : 7;
166
167
        //do this a little later since these values are a little slow
168
        Bukkit.getScheduler().scheduleSyncDelayedTask(hawk, new Runnable() {
169
            @Override
170
            public void run() {
171
                allowedToFly = p.getAllowFlight();
172
                flying = p.isFlying();
173
                inCreative = p.getGameMode() == GameMode.CREATIVE;
174
            }
175
        });
176
177
    }
178
179
    public void tick() {
180
        this.currentTick++;
181
        manageClientBlocks();
182
        executeTasks();
183
        cleanUpOldMetaDataUpdates();
184
        cleanUpOldPendingTeleports();
185
        entitiesInteractedInThisTick.clear();
186
        predictNextPosition();
187
        if(consumingItem)
188
            itemConsumeTicks++;
189
    }
190
191
    public int getVL(Check check) {
192
        return (int) (double) vl.getOrDefault(check, 0D);
193
    }
194
195
    public Map<Check, Double> getVLs() {
196
        return vl;
197
    }
198
199
    public void setVL(Check check, double vl) {
200
        this.vl.put(check, vl);
201
    }
202
203
    public void incrementVL(Check check) {
204
        this.vl.put(check, vl.getOrDefault(check, 0D) + 1D);
205
    }
206
207
    public void addVL(Check check, double amnt) {
208
        this.vl.put(check, vl.getOrDefault(check, 0D) + amnt);
209
    }
210
211
    public void multiplyVL(Check check, double factor) {
212
        vl.put(check, vl.getOrDefault(check, 0D) * factor);
213
    }
214
215
    public UUID getUuid() {
216
        return uuid;
217
    }
218
219
    public boolean isDigging() {
220
        return digging && p.getGameMode() != GameMode.CREATIVE;
221
    }
222
223
    //this should really not be public
224
    public void setDigging(boolean digging) {
225
        this.digging = digging;
226
    }
227
228
    public boolean getReceiveNotificationsPreference() {
229
        return receiveNotifications;
230
    }
231
232
    public void setReceiveNotificationsPreference(boolean status) {
233
        receiveNotifications = status;
234
    }
235
236
    public boolean isOnline() {
237
        return online;
238
    }
239
240
    public void setOnline(boolean online) {
241
        this.online = online;
242
    }
243
244
    public boolean isTeleporting() {
245
        return !getPendingTeleports().isEmpty();
246
    }
247
248
    public long getLastTeleportAcceptTick() {
249
        return lastTeleportAcceptTick;
250
    }
251
252
    public void setLastTeleportAcceptTick(long lastTeleportAcceptTick) {
253
        this.lastTeleportAcceptTick = lastTeleportAcceptTick;
254
    }
255
256
    public boolean isOnGround() {
257
        return onGround;
258
    }
259
260
    //this should really not be public
261
    public void setOnGround(boolean onGround) {
262
        this.prevTickOnGround = this.onGround;
263
        this.onGround = onGround;
264
    }
265
266
    //why do I need to make this???
267
    public boolean wasOnGround() {
268
        return prevTickOnGround;
269
    }
270
271
    public boolean isOnGroundReally() {
272
        return onGroundReally;
273
    }
274
275
    public void setOnGroundReally(boolean onGroundReally) {
276
        this.onGroundReally = onGroundReally;
277
    }
278
279
    public int getPing() {
280
        return ping;
281
    }
282
283
    public void setPing(int ping) {
284
        this.ping = ping;
285
        this.lastPings.add((double)ping);
286
        if(lastPings.size() > 10) {
287
            lastPings.remove(0);
288
        }
289
        pingJitter = (short)MathPlus.range(lastPings);
290
    }
291
292
    public short getPingJitter() {
293
        return pingJitter;
294
    }
295
296
    public long getLastMoveTime() {
297
        return lastMoveTime;
298
    }
299
300
    public void setLastMoveTime(long lastMoveTime) {
301
        this.lastMoveTime = lastMoveTime;
302
    }
303
304
    public World getWorld() {
305
        return p.getWorld();
306
    }
307
308
    //currently doesn't support when in vehicle
309
    public Vector getPosition() {
310
        return position;
311
    }
312
313
    //the player's position since the last flying packet; completely untouched
314
    public Vector getPositionRaw() {
315
        return positionRaw;
316
    }
317
318
    //currently doesn't support when in vehicle
319
    public Vector getHeadPosition() {
320
        Vector add = new Vector(0, 0, 0);
321
        add.setY(isSneaking() ? 1.54 : 1.62);
322
        return position.clone().add(add);
323
    }
324
325
    public Vector getPositionCloned() {
326
        return position.clone();
327
    }
328
329
    //Returns the current predicted position of the HawkPlayer, assuming no user input.
330
    public Vector getPositionPredicted() {
331
        return predictedPosition;
332
    }
333
334
    public Vector getPreviousPositionPredicted() {
335
        return previousPredictedPosition;
336
    }
337
338
    public void updatePositionYawPitch(Vector position, float yaw, float pitch, boolean isPosUpdate) {
339
        this.previousVelocity = this.velocity;
340
        this.velocity = new Vector(
341
                position.getX() - this.position.getX(),
342
                position.getY() - this.position.getY(),
343
                position.getZ() - this.position.getZ());
344
        this.deltaYaw = yaw - this.yaw;
345
        this.deltaPitch = pitch - this.pitch;
346
347
        this.position = position;
348
        this.yaw = yaw;
349
        this.pitch = pitch;
350
        if(isPosUpdate) {
351
            predictedPosition = position.clone();
352
            if(hasSentPosUpdate())
353
                predictedVelocity = velocity.clone();
354
        }
355
    }
356
357
    public void setPositionRaw(Vector positionRaw) {
358
        this.positionRaw = positionRaw;
359
    }
360
361
    public float getYaw() {
362
        return yaw;
363
    }
364
365
    public void setYaw(float yaw) {
366
        this.yaw = yaw;
367
    }
368
369
    public float getPitch() {
370
        return pitch;
371
    }
372
373
    public void setPitch(float pitch) {
374
        this.pitch = pitch;
375
    }
376
377
    public void setVelocity(Vector velocity) {
378
        this.velocity = velocity;
379
    }
380
381
    public Vector getVelocity() {
382
        return velocity;
383
    }
384
385
    public Vector getVelocityPredicted() {
386
        return predictedVelocity;
387
    }
388
389
    public Vector getPreviousVelocity() {
390
        return previousVelocity;
391
    }
392
393
    public Vector getPreviousPredictedVelocity() {
394
        return previousPredictedVelocity;
395
    }
396
397
    public float getDeltaYaw() {
398
        return deltaYaw;
399
    }
400
401
    public float getDeltaPitch() {
402
        return deltaPitch;
403
    }
404
405
    public long getCurrentTick() {
406
        return currentTick;
407
    }
408
409
    public boolean isSneaking() {
410
        return sneaking;
411
    }
412
413
    public void setSneaking(boolean sneaking) {
414
        this.sneaking = sneaking;
415
    }
416
417
    public boolean isSprinting() {
418
        return sprinting;
419
    }
420
421
    public void setSprinting(boolean sprinting) {
422
        this.sprinting = sprinting;
423
    }
424
425
    public boolean isBlocking() {
426
        return blocking;
427
    }
428
429
    public void setBlocking(boolean blocking) {
430
        this.blocking = blocking;
431
        if(blocking)
432
            itemUseTick = currentTick;
433
    }
434
435
    public boolean isPullingBow() {
436
        return pullingBow;
437
    }
438
439
    public void setPullingBow(boolean pullingBow) {
440
        this.pullingBow = pullingBow;
441
        if(pullingBow)
442
            itemUseTick = currentTick;
443
    }
444
445
    public byte hasInventoryOpen() {
446
        return inventoryOpen;
447
    }
448
449
    public void setInventoryOpen(byte status) {
450
        this.inventoryOpen = status;
451
    }
452
453
    public double getFallDistance() {
454
        return maxY - position.getY();
455
    }
456
457
    public int getHeldItemSlot() {
458
        return heldItemSlot;
459
    }
460
461
    public void setHeldItemSlot(int heldItemSlot) {
462
        this.heldItemSlot = heldItemSlot;
463
    }
464
465
    public boolean isConsumingItem() {
466
        return consumingItem;
467
    }
468
469
    public void setConsumingItem(boolean consumingItem) {
470
        this.consumingItem = consumingItem;
471
        if(consumingItem)
472
            itemUseTick = currentTick;
473
        else
474
            itemConsumeTicks = 0;
475
    }
476
477
    public boolean isInWater() {
478
        return inWater;
479
    }
480
481
    public void setInWater(boolean inWater) {
482
        if(this.inWater != inWater) {
483
            lastInLiquidToggleTick = currentTick;
484
            this.inWater = inWater;
485
        }
486
    }
487
488
    public boolean isInLava() {
489
        return inLava;
490
    }
491
492
    public void setInLava(boolean inLava) {
493
        this.inLava = inLava;
494
    }
495
496
    @Deprecated
497
    public boolean isFlyingClientside() {
498
        return (p.getAllowFlight() && hasFlyPending()) || p.isFlying();
499
    }
500
501
    public long getLastItemUseTick() {
502
        return itemUseTick;
503
    }
504
505
    public long getLastAttackedPlayerTick() {
506
        return lastAttackedPlayerTick;
507
    }
508
509
    public void updateLastAttackedPlayerTick() {
510
        this.lastAttackedPlayerTick = currentTick;
511
    }
512
513
    public long getLastEntityInteractTick() {
514
        return lastEntityInteractTick;
515
    }
516
517
    public void updateLastEntityInteractTick() {
518
        this.lastEntityInteractTick = currentTick;
519
    }
520
521
    public long getLastInLiquidToggleTick() {
522
        return lastInLiquidToggleTick;
523
    }
524
525
    public long getLastSlotSwitchTick() {
526
        return lastSlotSwitchTick;
527
    }
528
529
    public void updateLastSlotSwitchTick() {
530
        this.lastSlotSwitchTick = currentTick;
531
    }
532
533
    public long getHitSlowdownTick() {
534
        return hitSlowdownTick;
535
    }
536
537
    public void updateHitSlowdownTick() {
538
        this.hitSlowdownTick = currentTick;
539
    }
540
541
    public long getLastVelocityAcceptTick() {
542
        return lastVelocityAcceptTick;
543
    }
544
545
    public void updateLastVelocityAcceptTick() {
546
        this.lastVelocityAcceptTick = currentTick;
547
    }
548
549
    public boolean hasHitSlowdown() {
550
        return hitSlowdownTick == currentTick;
551
    }
552
553
    public boolean isSwimming() {
554
        return swimming;
555
    }
556
557
    public void setSwimming(boolean swimming) {
558
        this.swimming = swimming;
559
    }
560
561
    public ItemStack getItemUsedForAttack() {
562
        return itemUsedForAttack;
563
    }
564
565
    public void updateItemUsedForAttack() {
566
        this.itemUsedForAttack = getHeldItem();
567
    }
568
569
    public ItemStack getHeldItem() {
570
        return p.getInventory().getItem(heldItemSlot);
571
    }
572
573
    //call this before updating whether on ground or not
574
    public void updateFallDistance(Location loc) {
575
        if (onGround)
576
            maxY = loc.getY();
577
        else
578
            maxY = Math.max(loc.getY(), maxY);
579
580
    }
581
582
    public double getTotalAscensionSinceGround() {
583
        return jumpedHeight;
584
    }
585
586
    //call this before updating whether on ground or not
587
    public void updateTotalAscensionSinceGround(double y1, double y2) {
588
        if (onGround) {
589
            jumpedHeight = 0;
590
            return;
591
        }
592
        double deltaY = y2 - y1;
593
        if(deltaY > 0)
594
            jumpedHeight += deltaY;
595
    }
596
597
    public boolean hasFlyPending() {
598
        return System.currentTimeMillis() - flyPendingTime <= 100;
599
    }
600
601
    public void setFlyPendingTime(long time) {
602
        flyPendingTime = time;
603
    }
604
605
    public Player getPlayer() {
606
        return p;
607
    }
608
609
    public Map<Location, ClientBlock> getClientBlocks() {
610
        return clientBlocks;
611
    }
612
613
    public void addClientBlock(Location loc, ClientBlock pBlock) {
614
        if (clientBlocks.size() >= ClientBlock.MAX_PER_PLAYER)
615
            return;
616
        clientBlocks.put(loc, pBlock);
617
    }
618
619
    private void manageClientBlocks() {
620
        for (Location loc : clientBlocks.keySet()) {
621
            ClientBlock clientBlock = clientBlocks.get(loc);
622
            if (currentTick - clientBlock.getInitTick() > ClientBlock.CLIENTTICKS_UNTIL_EXPIRE) {
623
                clientBlocks.remove(loc);
624
            }
625
        }
626
    }
627
628
    //TODO shrink this code
629
    //TODO TEST BEFORE RELEASING 2001
630
    private void predictNextPosition() {
631
        Vector move = predictedVelocity.clone();
632
        previousPredictedPosition = predictedPosition.clone();
633
        previousPredictedVelocity = predictedVelocity.clone();
634
635
        World world = getWorld();
636
637
        Block blockAtPos = ServerUtils.getBlockAsync(predictedPosition.toLocation(getWorld()));
638
        boolean onClimbable = blockAtPos != null && (blockAtPos.getType() == Material.LADDER || blockAtPos.getType() == Material.VINE);
639
640
        Set<Material> oldTouchedMats = WrappedEntity.getWrappedEntity(p).getCollisionBox(predictedPosition).getMaterials(getWorld());
641
642
        //compute new predicted motion values
643
        double pdX = move.getX() * getFriction();
644
        double pdY = move.getY() * 0.98;
645
        double pdZ = move.getZ() * getFriction();
646
647
        if(!isFlying())
648
            pdY += -0.0784;
649
650
        if(oldTouchedMats.contains(Material.WEB)) {
651
            pdX *= 0.25;
652
            pdY *= 0.05;
653
            pdZ *= 0.25;
654
        }
655
656
        if(Math.abs(pdX) < 0.005) {
657
            pdX = 0;
658
        }
659
        if(Math.abs(pdY) < 0.005 || (onClimbable && sneaking)) {
660
            pdY = 0;
661
        }
662
        if(Math.abs(pdZ) < 0.005) {
663
            pdZ = 0;
664
        }
665
666
        move.setX(pdX);
667
        move.setY(pdY);
668
        move.setZ(pdZ);
669
670
        AABB box = WrappedEntity.getWrappedEntity(p).getCollisionBox(predictedPosition);
671
        AABB preBox = box.clone();
672
        preBox.expand(-0.0001, -0.0001, -0.0001);
673
        List<AABB> collidedBlocksBefore = preBox.getBlockAABBs(world, getClientVersion(), Material.WEB);
674
675
        boolean collidedVertically = false;
676
677
        //clipping order: X, Z, Y
678
        //X
679
        box.expand(-0.00000001, -0.00000001, -0.00000001);
680
        boolean positive = pdX > 0;
681
        box.translate(new Vector(pdX, 0, 0));
682
        List<AABB> collidedBlocks = box.getBlockAABBs(world, getClientVersion(), Material.WEB);
683
        collidedBlocks.removeAll(collidedBlocksBefore);
684
685
        double highestPoint = positive ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY;
686
        for(AABB aabb : collidedBlocks) {
687
            double point = positive ? aabb.getMin().getX() : aabb.getMax().getX();
688
            if(positive && point < highestPoint)
689
                highestPoint = point;
690
            else if(!positive && point > highestPoint)
691
                highestPoint = point;
692
        }
693
        if(Double.isFinite(highestPoint)) {
694
            double invPenetrationDist = positive ? highestPoint - box.getMax().getX() - 0.00000001 : highestPoint - box.getMin().getX() + 0.00000001;
695
            box.translate(new Vector(invPenetrationDist, 0, 0));
696
            pdX += invPenetrationDist;
697
        }
698
699
        //Z
700
        positive = pdZ > 0;
701
        box.translate(new Vector(0, 0, pdZ));
702
        collidedBlocks = box.getBlockAABBs(world, getClientVersion(), Material.WEB);
703
        collidedBlocks.removeAll(collidedBlocksBefore);
704
705
        highestPoint = positive ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY;
706
        for(AABB aabb : collidedBlocks) {
707
            double point = positive ? aabb.getMin().getZ() : aabb.getMax().getZ();
708
            if(positive && point < highestPoint)
709
                highestPoint = point;
710
            else if(!positive && point > highestPoint)
711
                highestPoint = point;
712
        }
713
        if(Double.isFinite(highestPoint)) {
714
            double invPenetrationDist = positive ? highestPoint - box.getMax().getZ() - 0.00000001 : highestPoint - box.getMin().getZ() + 0.00000001;
715
            box.translate(new Vector(0, 0, invPenetrationDist));
716
            pdZ += invPenetrationDist;
717
        }
718
719
        //Y
720
        positive = pdY > 0;
721
        box.translate(new Vector(0, pdY, 0));
722
        collidedBlocks = box.getBlockAABBs(world, getClientVersion(), Material.WEB);
723
        collidedBlocks.removeAll(collidedBlocksBefore);
724
725
        highestPoint = positive ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY;
726
        for(AABB aabb : collidedBlocks) {
727
            double point = positive ? aabb.getMin().getY() : aabb.getMax().getY();
728
            if(positive && point < highestPoint)
729
                highestPoint = point;
730
            else if(!positive && point > highestPoint)
731
                highestPoint = point;
732
        }
733
        if(Double.isFinite(highestPoint)) {
734
            double invPenetrationDist = positive ? highestPoint - box.getMax().getY() - 0.00000001 : highestPoint - box.getMin().getY() + 0.00000001;
735
            box.translate(new Vector(0, invPenetrationDist, 0));
736
            pdY += invPenetrationDist;
737
            collidedVertically = true;
738
        }
739
740
        //crude way of handling sneaking
741
        boolean sneakHalt;
742
        if(sneaking) {
743
            Vector min = predictedPosition.clone().add(new Vector(-0.3, -0.001, -0.3));
744
            Vector max = predictedPosition.clone().add(new Vector(0.3, 0, 0.3));
745
            AABB feet = new AABB(min, max);
746
            boolean wasOnGround = feet.getBlockAABBs(world, clientVersion, Material.WEB).size() > 0;
747
748
            feet.translate(new Vector(pdX, pdY, pdZ));
749
            boolean isOnGround = feet.getBlockAABBs(world, clientVersion, Material.WEB).size() > 0;
750
751
            if(wasOnGround && !isOnGround) {
752
                //use max.getY() to save a clone()
753
                Vector check = new Vector(pdX, max.getY() - 1, pdZ);
754
                Block checkBlock = ServerUtils.getBlockAsync(check.toLocation(world));
755
                if(checkBlock == null) {
756
                    sneakHalt = true;
757
                }
758
                else {
759
                    sneakHalt = true;
760
                    for(AABB aabb : WrappedBlock.getWrappedBlock(checkBlock, clientVersion).getCollisionBoxes()) {
761
                        if(aabb.containsPoint(check)) {
762
                            sneakHalt = false;
763
                            break;
764
                        }
765
                    }
766
                }
767
            }
768
            else {
769
                sneakHalt = false;
770
            }
771
        }
772
        else {
773
            sneakHalt = false;
774
        }
775
        if(sneakHalt) {
776
            predictedVelocity = new Vector(0, 0, 0);
777
            return;
778
        }
779
780
        //move predicted position
781
        Vector clippedVel = new Vector(MathPlus.round(pdX, 10), MathPlus.round(pdY, 10), MathPlus.round(pdZ, 10));
782
        predictedPosition.add(clippedVel);
783
784
        //AABB a = AABB.playerCollisionBox.clone();
785
        //a.translate(predictedPosition);
786
        //a.highlight(hawk, getWorld(), 0.299);
787
788
        Set<Material> newTouchedMats = WrappedEntity.getWrappedEntity(p).getCollisionBox(predictedPosition).getMaterials(getWorld());
789
        if(newTouchedMats.contains(Material.WEB)) {
790
            predictedVelocity = new Vector();
791
        } else if(collidedVertically) {
792
            Block b = ServerUtils.getBlockAsync(predictedPosition.clone().add(new Vector(0, -0.2, 0)).toLocation(getWorld()));
793
            if(Hawk.getServerVersion() == 8 && !isSneaking() && b != null && b.getType() == Material.SLIME_BLOCK && move.getY() < 0) {
794
                predictedVelocity.setY(-move.getY());
795
            } else {
796
                predictedVelocity = clippedVel; //touched ground
797
            }
798
        }
799
        else {
800
            predictedVelocity = clippedVel; //air
801
        }
802
    }
803
804
    //Handles block AABB updates and teleportations to assist collision-based checks
805
    public void updateIgnoredBlockCollisions(Vector to, Vector from, boolean teleported) {
806
        final double expand = -0.0001; //TODO perhaps make this equal to NMS's margin to prevent bypasses via /sethome abuse?
807
        AABB bbox = WrappedEntity.getWrappedEntity(p).getCollisionBox(to);
808
        bbox.expand(expand, expand, expand);
809
810
        //handle teleportation INTO a block
811
        if(teleported) {
812
            AABB lastbbox = WrappedEntity.getWrappedEntity(p).getCollisionBox(from);
813
            lastbbox.expand(expand, expand, expand);
814
815
            //add new entries
816
            Set<Location> addIgnored = new HashSet<>();
817
            for(Block b : bbox.getBlocks(getWorld())) {
818
                for(AABB aabb : WrappedBlock.getWrappedBlock(b, getClientVersion()).getCollisionBoxes()) {
819
                    if(aabb.isColliding(bbox) && !aabb.isColliding(lastbbox)) { //Must enter an AABB. This patches a Phase bypass.
820
                        addIgnored.add(b.getLocation());
821
                        break;
822
                    }
823
                }
824
            }
825
826
            //remove old entries
827
            Set<Location> removeIgnored = new HashSet<>();
828
            for(Location loc : ignoredBlockCollisions) {
829
                Block b = ServerUtils.getBlockAsync(loc);
830
                if(b == null) {
831
                    removeIgnored.add(loc);
832
                    continue;
833
                }
834
835
                boolean colliding = false;
836
                for(AABB aabb : WrappedBlock.getWrappedBlock(b, getClientVersion()).getCollisionBoxes()) {
837
                    if(aabb.isColliding(bbox)) {
838
                        colliding = true;
839
                        break;
840
                    }
841
                }
842
843
                if(!colliding) {
844
                    removeIgnored.add(loc);
845
                }
846
            }
847
848
            ignoredBlockCollisions.removeAll(removeIgnored);
849
            ignoredBlockCollisions.addAll(addIgnored);
850
        }
851
852
        //handle AABB updates within player bounds
853
        //TODO Phase false when player moves out of block
854
        //TODO to fix concurrency issues with checks such as Phase, have these blocks/AABBs in this method copied and stored in a shared list in MoveEvent so that Phase can compare using the same block data
855
        else {
856
            Map<Location, List<AABB>> blocksInBBNew = new HashMap<>();
857
            for(Block b : bbox.getBlocks(getWorld())) {
858
                Location loc = b.getLocation();
859
                List<AABB> aabbs = Arrays.asList(WrappedBlock.getWrappedBlock(b, getClientVersion()).getCollisionBoxes());
860
                blocksInBBNew.put(loc, aabbs);
861
            }
862
863
            Map<Location, List<AABB>> blocksInBBOld = trackedBlockCollisions;
864
            Set<Location> ignored = new HashSet<>();
865
            for(Location entry : blocksInBBNew.keySet()) {
866
                if (blocksInBBOld.containsKey(entry) && !blocksInBBOld.get(entry).equals(blocksInBBNew.get(entry))) {
867
                    for(AABB aabb : blocksInBBNew.get(entry)) {
868
                        if(aabb.isColliding(bbox)) {
869
                            ignored.add(entry);
870
                            break;
871
                        }
872
                    }
873
                }
874
            }
875
876
            trackedBlockCollisions = blocksInBBNew;
877
            Set<Location> ignoredOld = ignoredBlockCollisions;
878
            for(Location loc : ignoredOld) {
879
                Block b = ServerUtils.getBlockAsync(loc);
880
                if(b == null)
881
                    continue;
882
                for(AABB aabb : WrappedBlock.getWrappedBlock(b, getClientVersion()).getCollisionBoxes()) {
883
                    if(aabb.isColliding(bbox)) {
884
                        ignored.add(loc);
885
                        break;
886
                    }
887
                }
888
            }
889
            ignoredBlockCollisions = ignored;
890
        }
891
    }
892
893
    //Get locations of blocks that had their AABB updated within the player's AABB
894
    public Set<Location> getIgnoredBlockCollisions() {
895
        return ignoredBlockCollisions;
896
    }
897
898
    public Set<Direction> getBoxSidesTouchingBlocks() {
899
        return boxSidesTouchingBlocks;
900
    }
901
902
    public Vector getWaterFlowForce() {
903
        return waterFlowForce;
904
    }
905
906
    public void setWaterFlowForce(Vector waterFlowForce) {
907
        this.waterFlowForce = waterFlowForce;
908
    }
909
910
    public long getLastMoveTick() {
911
        return lastMoveTick;
912
    }
913
914
    public long getClientTicksSinceLastMove() {
915
        return getCurrentTick() - lastMoveTick;
916
    }
917
918
    public void setHasMoved() {
919
        this.lastMoveTick = getCurrentTick();
920
    }
921
922
    public long getLastLandTick() {
923
        return lastLandTick;
924
    }
925
926
    public void updateLastLandTick() {
927
        this.lastLandTick = currentTick;
928
    }
929
930
    public List<Pair<Vector, Long>> getPendingVelocities() {
931
        return pendingVelocities;
932
    }
933
934
    public float getFriction() {
935
        return friction;
936
    }
937
938
    public void setFriction(float friction) {
939
        this.friction = friction;
940
    }
941
942
    //DO NOT USE THIS IN CHECKS. USE MoveEvent#isLiquidExit()
943
    public boolean isExitingLiquidTemp() {
944
        return liquidExit;
945
    }
946
947
    public void setLiquidExit(boolean liquidExit) {
948
        this.liquidExit = liquidExit;
949
    }
950
951
    //safely kill the connection
952
    public void kickPlayer(String reason) {
953
        online = false;
954
        Bukkit.getScheduler().scheduleSyncDelayedTask(hawk, () -> p.kickPlayer(reason), 0L);
955
    }
956
957
    //safely force player to release item (bow, consumable, or sword blocking)
958
    public void releaseItem() {
959
        Bukkit.getScheduler().scheduleSyncDelayedTask(hawk, () -> ((WrappedEntityHuman)WrappedEntity.getWrappedEntity(p)).releaseItem());
960
        sendSimulatedAction(() -> {
961
            setBlocking(false);
962
            setPullingBow(false);
963
            setConsumingItem(false);
964
        });
965
    }
966
967
    public void addPendingTeleport(Location loc) {
968
        pendingTeleports.add(new Pair<>(loc, currentTick));
969
        if(pendingTeleports.size() > 200) {
970
            pendingTeleports.remove(0);
971
        }
972
    }
973
974
    private void cleanUpOldPendingTeleports() {
975
        if(pendingTeleports.size() == 0)
976
            return;
977
        while(pendingTeleports.size() > 0 && currentTick - pendingTeleports.get(0).getValue() > (ping + 2000) / 50) {
978
            pendingTeleports.remove(0);
979
        }
980
    }
981
982
    public List<Pair<Location, Long>> getPendingTeleports() {
983
        return pendingTeleports;
984
    }
985
986
    //This method simulates the reaction of the client by a server packet.
987
    //This is accomplished by simulating latency.
988
    //This can be used to simulate sprint-update or inventory-open packets
989
    public void sendSimulatedAction(Runnable action) {
990
        simulatedCmds.add(new Pair<>(action, System.currentTimeMillis()));
991
    }
992
993
    private void executeTasks() {
994
        if(simulatedCmds.size() == 0)
995
            return;
996
        int ping = ServerUtils.getPing(p);
997
        long currTime = System.currentTimeMillis();
998
        while(simulatedCmds.size() > 0 && currTime - simulatedCmds.get(0).getValue() >= ping) {
999
            simulatedCmds.get(0).getKey().run();
1000
            simulatedCmds.remove(0);
1001
        }
1002
    }
1003
1004
    public void addMetaDataUpdate(MetaData metaData) {
1005
        metaDataUpdates.add(new Pair<>(metaData, System.currentTimeMillis()));
1006
        //in case something happens, let's not hog memory...
1007
        if(metaDataUpdates.size() > 200) {
1008
            metaDataUpdates.remove(0);
1009
        }
1010
    }
1011
1012
    public List<Pair<MetaData, Long>> getMetaDataUpdates() {
1013
        return metaDataUpdates;
1014
    }
1015
1016
    private void cleanUpOldMetaDataUpdates() {
1017
        if(metaDataUpdates.size() == 0)
1018
            return;
1019
        long currTime = System.currentTimeMillis();
1020
        while(metaDataUpdates.size() > 0 && currTime - metaDataUpdates.get(0).getValue() > ping + 2000) {
1021
            metaDataUpdates.remove(0);
1022
        }
1023
    }
1024
1025
    public Set<Entity> getEntitiesInteractedInThisTick() {
1026
        return entitiesInteractedInThisTick;
1027
    }
1028
1029
    public void addEntityToEntitiesInteractedInThisTick(Entity entity) {
1030
        entitiesInteractedInThisTick.add(entity);
1031
    }
1032
1033
    public AABB getCollisionBox() {
1034
        return WrappedEntity.getWrappedEntity(p).getCollisionBox(position);
1035
    }
1036
1037
    public AABB getHitBox() {
1038
        return WrappedEntity.getWrappedEntity(p).getHitbox(position);
1039
    }
1040
1041
    public int getClientVersion() {
1042
        return clientVersion;
1043
    }
1044
1045
    public void setClientVersion(int protocolVersion) {
1046
        clientVersion = protocolVersion == 47 ? 8 : 7;
1047
    }
1048
1049
    public boolean isInVehicle() {
1050
        return inVehicle;
1051
    }
1052
1053
    public void setInVehicle(boolean inVehicle) {
1054
        this.inVehicle = inVehicle;
1055
    }
1056
1057
    public int getItemConsumeTicks() {
1058
        return itemConsumeTicks;
1059
    }
1060
1061
    //Dedicated method for approximating whether a player is consuming or charging bow.
1062
    //Factors in meta-data updates sent from server. Damn it, Mojang. >:(
1063
    public boolean isConsumingOrPullingBowMetadataIncluded() {
1064
        boolean consumingOrBow = isConsumingItem() || isPullingBow();
1065
        long currTime = System.currentTimeMillis();
1066
        int ping = ServerUtils.getPing(p) + 100;
1067
        for(Pair<MetaData, Long> metaDataPair : getMetaDataUpdates()) {
1068
            //Ideally it would be +/-50ms leniency, but let's do +/-100ms just because of network jitter.
1069
            if(Math.abs(metaDataPair.getValue() + ping - currTime) < 100) {
1070
                MetaData metaData = metaDataPair.getKey();
1071
                if(metaData.getType() == MetaData.Type.USE_ITEM && !metaData.getValue()) {
1072
                    consumingOrBow = false;
1073
                    break;
1074
                }
1075
            }
1076
        }
1077
        return consumingOrBow;
1078
    }
1079
1080
    public boolean isAllowedToFly() {
1081
        return allowedToFly;
1082
    }
1083
1084
    public void setAllowedToFly(boolean allowedToFly) {
1085
        this.allowedToFly = allowedToFly;
1086
    }
1087
1088
    public boolean isFlying() {
1089
        return flying;
1090
    }
1091
1092
    public void setFlying(boolean flying) {
1093
        if(!isAllowedToFly() && flying)
1094
            return;
1095
        this.flying = flying;
1096
    }
1097
1098
    public boolean isInCreative() {
1099
        return inCreative;
1100
    }
1101
1102
    public void setInCreative(boolean inCreative) {
1103
        this.inCreative = inCreative;
1104
    }
1105
1106
    public boolean hasSentPosUpdate() {
1107
        return sentPosUpdate;
1108
    }
1109
1110
    public void setSentPosUpdate(boolean hasSentPosUpdate) {
1111
        this.sentPosUpdate = hasSentPosUpdate;
1112
    }
1113
1114
    public Location getAltSetbackLoc() {
1115
        return altSetbackLoc;
1116
    }
1117
1118
    public void setAltSetbackLoc(Location altSetbackLoc) {
1119
        this.altSetbackLoc = altSetbackLoc;
1120
    }
1121
}

How it counteracts this module

Hawk's per-player state object is where S1C metadata lands: PacketConverter8 turns PacketPlayOutEntityMetadata into a HawkAsyncPlayerMetadataEvent, PlayerEventListener.sendMetadataEvent fires it, and HawkPlayer stores the watchable objects, notably isConsumingOrPullingBowMetadataIncluded, which reads the use-item watcher flags for movement checks. No Hawk check consumes the potion-effect bitmask, and every flag Hawk tracks is server-written; a client-side removal of blindness changes none of them. The module therefore cannot disturb any Hawk state, which is the honest framing: the check surface around S1C exists, but none of it is reachable from a local-only render edit.

anticheat DamageIndicator (S1C health rewrite)

DamageIndicator.java107 lines · Java
1
package de.photon.anticheataddition.modules.additions;
2
3
import com.github.retrooper.packetevents.event.PacketListenerPriority;
4
import com.github.retrooper.packetevents.event.PacketSendEvent;
5
import com.github.retrooper.packetevents.protocol.attribute.Attributes;
6
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
7
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
8
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
9
import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
10
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
11
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;
12
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;
13
import de.photon.anticheataddition.ServerVersion;
14
import de.photon.anticheataddition.modules.Module;
15
import de.photon.anticheataddition.modules.ModuleLoader;
16
import de.photon.anticheataddition.util.protocol.LivingEntityIdLookup;
17
import de.photon.anticheataddition.util.protocol.PacketAdapterBuilder;
18
import org.bukkit.entity.Player;
19
20
import java.util.ArrayList;
21
import java.util.List;
22
23
public final class DamageIndicator extends Module {
24
    public static final DamageIndicator INSTANCE = new DamageIndicator();
25
26
    private static final float SPOOFED_HEALTH = 0.5F;
27
    private static final double SPOOFED_MAX_HEALTH = 1.0D;
28
29
    private final boolean spoofOthers = loadBoolean(".entities.others", true);
30
    private final boolean spoofPlayers = loadBoolean(".entities.players", true);
31
32
    private final boolean spoofHealth = loadBoolean(".spoof.health", true);
33
    private final boolean spoofMaxHealth = loadBoolean(".spoof.max_health", true);
34
35
    private DamageIndicator()
36
    {
37
        super("DamageIndicator");
38
    }
39
40
    @Override
41
    protected ModuleLoader createModuleLoader()
42
    {
43
        return ModuleLoader.of(this, PacketAdapterBuilder
44
                .of(this, PacketType.Play.Server.ENTITY_METADATA, PacketType.Play.Server.UPDATE_ATTRIBUTES)
45
                .priority(PacketListenerPriority.HIGH)
46
                // Use the onSending rather than onSendingRaw to allow for bypassing.
47
                .onSending((event, user) -> {
48
                    if (this.spoofHealth && event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) rewriteHealthMetadata(event);
49
                    else if (this.spoofMaxHealth && event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) rewriteMaxHealthAttribute(event);
50
                }).build());
51
    }
52
53
    private void rewriteHealthMetadata(PacketSendEvent event)
54
    {
55
        final WrapperPlayServerEntityMetadata wrapper = new WrapperPlayServerEntityMetadata(event);
56
        final Player viewer = event.getPlayer();
57
        final int entityId = wrapper.getEntityId();
58
59
        // The player should always be able to see their own data.
60
        if (viewer.getEntityId() == entityId) return;
61
62
        final EntityType entityType = LivingEntityIdLookup.INSTANCE.getEntityType(entityId);
63
        if (!shouldSpoof(entityType)) return;
64
65
        final int healthIndex = ServerVersion.ACTIVE.getMetadataPositionIndex().healthIndex();
66
67
        // Use raw EntityData here to ensure we can use setValue().
68
        for (EntityData data : wrapper.getEntityMetadata()) {
69
            if (data.getIndex() != healthIndex || data.getType() != EntityDataTypes.FLOAT) continue;
70
71
            final float health = (Float) data.getValue();
72
            if (health <= 0.0F) return;
73
74
            data.setValue(SPOOFED_HEALTH);
75
        }
76
    }
77
78
    private void rewriteMaxHealthAttribute(PacketSendEvent event)
79
    {
80
        final WrapperPlayServerUpdateAttributes wrapper = new WrapperPlayServerUpdateAttributes(event);
81
        final Player viewer = event.getPlayer();
82
        final int entityId = wrapper.getEntityId();
83
84
        if (viewer.getEntityId() == entityId) return;
85
86
        final EntityType entityType = LivingEntityIdLookup.INSTANCE.getEntityType(entityId);
87
        if (!shouldSpoof(entityType)) return;
88
89
        for (WrapperPlayServerUpdateAttributes.Property property : wrapper.getProperties()) {
90
            if (property.getAttribute() == Attributes.MAX_HEALTH) {
91
                property.setValue(SPOOFED_MAX_HEALTH);
92
                property.setModifiers(new ArrayList<>());
93
                return;
94
            }
95
        }
96
    }
97
98
    private boolean shouldSpoof(EntityType entityType)
99
    {
100
        if (entityType == null) return false;
101
102
        // Bossbar / boss-health edge cases
103
        if (entityType == EntityTypes.ENDER_DRAGON || entityType == EntityTypes.WITHER) return false;
104
105
        return entityType == EntityTypes.PLAYER ? spoofPlayers : spoofOthers;
106
    }
107
}

How it counteracts this module

Photon's S1C-touching module rewrites the health metadata entry on outgoing ENTITY_METADATA packets when the spoofHealth toggle is on, using the version's MetadataPositionIndex. It is the closest thing to a metadata-validating check in the corpus, and it still validates nothing about the client: it mutates the server-to-client stream and has no return channel. The blindness strip emits no packet and rewrites nothing, so the module is invisible to it by construction. The entry documents that even the most S1C-active anticheat surface cannot reach a local potion-map edit.

anticheat ExemptionSettings (Bukkit metadata hook)

ExemptionSettings.java194 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.hooks;
16
17
import java.util.ArrayList;
18
import java.util.Arrays;
19
import java.util.Collection;
20
import java.util.List;
21
22
import org.bukkit.entity.Entity;
23
import org.bukkit.entity.NPC;
24
25
import fr.neatmonster.nocheatplus.config.ConfPaths;
26
import fr.neatmonster.nocheatplus.config.ConfigFile;
27
28
/**
29
 * Encapsulate generic settings and checking functionality for exemption.
30
 * 
31
 * @author asofold
32
 *
33
 */
34
public class ExemptionSettings {
35
36
    /**
37
     * Check for meta data keys existence, allowing for multiple values to check
38
     * for.
39
     * 
40
     * @author asofold
41
     *
42
     */
43
    public static final class MetaDataListCheck {
44
45
        private static String[] getKeys(final Collection<String> keys) {
46
            if (keys == null) {
47
                return null;
48
            }
49
            else {
50
                final List<String> notNull = new ArrayList<String>(keys.size());
51
                for (final String key : keys) {
52
                    if (key != null) {
53
                        notNull.add(key);
54
                    }
55
                }
56
                if (notNull.isEmpty()) {
57
                    return null;
58
                }
59
                else {
60
                    return notNull.toArray(new String[notNull.size()]);
61
                }
62
            }
63
        }
64
65
        private final String[] metaDataKeys;
66
67
        public MetaDataListCheck(final ConfigFile config, final String pathActive, final String pathKeys) {
68
            this(config.getBoolean(pathActive) ? config.getStringList(pathKeys) : null);
69
        }
70
71
        public MetaDataListCheck(final Collection<String> keys) {
72
            this.metaDataKeys = getKeys(keys);
73
        }
74
75
        public boolean hasAnyMetaDataKey(final Entity entity) {
76
            if (metaDataKeys == null) {
77
                return false;
78
            }
79
            else {
80
                for (int i = 0; i < metaDataKeys.length; i++) {
81
                    if (entity.hasMetadata(metaDataKeys[i])) {
82
                        return true;
83
                    }
84
                }
85
                return false;
86
            }
87
        }
88
89
    }
90
91
    /** Default meta data check for exemption, not null. */
92
    public final MetaDataListCheck defaultMetaData;
93
94
    /** Always exempt NPCs from all checks. */
95
    public final boolean npcWildCardExempt;
96
97
    /**
98
     * Check for the Bukkit interface or not, in order to detect if a player is
99
     * an NPC.
100
     */
101
    public final boolean npcBukkitInterface;
102
103
    /**
104
     * Use meta data to check, if a player is an NPC, not null.
105
     */
106
    public final MetaDataListCheck npcMetaData;
107
108
    /**
109
     * Default constructor, containint the following settings:
110
     * <ul>
111
     * <li>Default wild card exemption by meta data key "nocheat.exempt".</li>
112
     * <li>Wild card exempt NPCs.</li>
113
     * <li>Check for the Bukkit NPC interface.</li>
114
     * <li>Regard entities with "NPC" meta data key as NPCs</li>
115
     * </ul>
116
     */
117
    public ExemptionSettings() {
118
        this(new MetaDataListCheck(Arrays.asList("nocheat.exempt")), 
119
                true, true, new MetaDataListCheck(Arrays.asList("NPC")));
120
    }
121
122
    /**
123
     * Read the settings from the given configuration file, using default paths,
124
     * assuming DefaultConfig as defaults.
125
     * 
126
     * @param config
127
     */
128
    public ExemptionSettings(final ConfigFile config) {
129
        this(
130
                new MetaDataListCheck(config, ConfPaths.COMPATIBILITY_EXEMPTIONS_WILDCARD_DEFAULT_METADATA_ACTIVE, 
131
                        ConfPaths.COMPATIBILITY_EXEMPTIONS_WILDCARD_DEFAULT_METADATA_KEYS), 
132
                config.getBoolean(ConfPaths.COMPATIBILITY_EXEMPTIONS_WILDCARD_NPC_ACTIVE), 
133
                config.getBoolean(ConfPaths.COMPATIBILITY_EXEMPTIONS_WILDCARD_NPC_BUKKITINTERFACE), 
134
                new MetaDataListCheck(config, ConfPaths.COMPATIBILITY_EXEMPTIONS_WILDCARD_NPC_METADATA_ACTIVE, 
135
                        ConfPaths.COMPATIBILITY_EXEMPTIONS_WILDCARD_NPC_METADATA_KEYS)
136
                );
137
    }
138
139
    /**
140
     * 
141
     * @param defaultMetaData
142
     *            Meta data keys to exempt for, currently servers as wild card,
143
     *            may be null.
144
     * @param npcWildCardExempt
145
     *            If to wild card exempt NPCs. If set to true,
146
     * @param npcBukkitInterface
147
     *            If to check for the NPC interface (Bukkit).
148
     * @param npcMetaData
149
     *            Meta data keys to exempt for, currently servers as wild card,
150
     *            may be null.
151
     */
152
    public ExemptionSettings(MetaDataListCheck defaultMetaData, boolean npcWildCardExempt, boolean npcBukkitInterface, MetaDataListCheck npcMetaData) {
153
        this.defaultMetaData = defaultMetaData == null ? new MetaDataListCheck(null) : defaultMetaData;
154
        this.npcWildCardExempt = npcWildCardExempt;
155
        this.npcBukkitInterface = npcBukkitInterface;
156
        this.npcMetaData = npcMetaData == null ? new MetaDataListCheck(null) : npcMetaData;
157
    }
158
159
    /**
160
     * Test if according to this instance of settings, the player is regarded as
161
     * an NPC. Meta data is only checked if this is the primary thread (!).
162
     * 
163
     * @param entity
164
     * @param isPrimaryThread
165
     * @return
166
     */
167
    public boolean isExemptedBySettings(final Entity entity) {
168
        return defaultMetaData.hasAnyMetaDataKey(entity) 
169
                || npcWildCardExempt && isRegardedAsNpc(entity);
170
    }
171
172
    @Deprecated
173
    public boolean isExemptedBySettings(final Entity entity, final boolean isPrimaryThread) {
174
        return isExemptedBySettings(entity);
175
    }
176
177
    /**
178
     * Test if according to this instance of settings, the player is regarded as
179
     * an NPC.Meta data is only checked if this is the primary thread (!).
180
     * 
181
     * @param entity
182
     * @param isPrimaryThread
183
     * @return
184
     */
185
    public boolean isRegardedAsNpc(final Entity entity) {
186
        return npcBukkitInterface && (entity instanceof NPC) || npcMetaData.hasAnyMetaDataKey(entity);
187
    }
188
189
    @Deprecated
190
    public boolean isRegardedAsNpc(final Entity entity, final boolean isPrimaryThread) {
191
        return isRegardedAsNpc(entity);
192
    }
193
194
}

How it counteracts this module

The only NCP file the S1C corpus lists, and it is not a check: it walks Bukkit entity metadata (hasMetadata) to decide exemption tags for other NCP features. NCP has no metadata-validity check at all, so there is no NCP-side surface the strip could trip. This entry is the honest gap for the anticheat's S1C story: the blindness removal is undetectable by design, and NCP's only S1C touch is a Bukkit convenience hook, not a detector.

← Back to Analysis Hub