Search in sources :

Example 1 with AbstractListenerPlayInImpl

use of com.denizenscript.denizen.nms.v1_18.impl.network.handlers.AbstractListenerPlayInImpl in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelperImpl method setFlyKickCooldown.

@Override
public void setFlyKickCooldown(Player player, int ticks) {
    ticks = 80 - ticks;
    ServerGamePacketListenerImpl conn = ((CraftPlayer) player).getHandle().connection;
    if (conn instanceof AbstractListenerPlayInImpl) {
        conn = ((AbstractListenerPlayInImpl) conn).oldListener;
    }
    try {
        FLY_TICKS.setInt(conn, ticks);
        VEHICLE_FLY_TICKS.setInt(conn, ticks);
    } catch (IllegalAccessException e) {
        Debug.echoError(e);
    }
}
Also used : AbstractListenerPlayInImpl(com.denizenscript.denizen.nms.v1_17.impl.network.handlers.AbstractListenerPlayInImpl) ServerGamePacketListenerImpl(net.minecraft.server.network.ServerGamePacketListenerImpl)

Example 2 with AbstractListenerPlayInImpl

use of com.denizenscript.denizen.nms.v1_18.impl.network.handlers.AbstractListenerPlayInImpl in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelperImpl method setFlyKickCooldown.

@Override
public void setFlyKickCooldown(Player player, int ticks) {
    ticks = 80 - ticks;
    ServerGamePacketListenerImpl conn = ((CraftPlayer) player).getHandle().connection;
    if (conn instanceof AbstractListenerPlayInImpl) {
        conn = ((AbstractListenerPlayInImpl) conn).oldListener;
    }
    try {
        FLY_TICKS.setInt(conn, ticks);
        VEHICLE_FLY_TICKS.setInt(conn, ticks);
    } catch (IllegalAccessException e) {
        Debug.echoError(e);
    }
}
Also used : AbstractListenerPlayInImpl(com.denizenscript.denizen.nms.v1_18.impl.network.handlers.AbstractListenerPlayInImpl) ServerGamePacketListenerImpl(net.minecraft.server.network.ServerGamePacketListenerImpl)

Aggregations

ServerGamePacketListenerImpl (net.minecraft.server.network.ServerGamePacketListenerImpl)2 AbstractListenerPlayInImpl (com.denizenscript.denizen.nms.v1_17.impl.network.handlers.AbstractListenerPlayInImpl)1 AbstractListenerPlayInImpl (com.denizenscript.denizen.nms.v1_18.impl.network.handlers.AbstractListenerPlayInImpl)1