Compare commits

..
6 Commits
Author SHA1 Message Date
Cubicake 0e74a1ba15 Update pointers 2026-08-19 15:08:35 +09:30
Cubicake 9a822af8bc Remove FancyCompatibility.java (moving to bridge) 2026-08-19 15:08:28 +09:30
Cubicake c6afbf0733 Add EngineTickEvent 2026-08-19 15:07:44 +09:30
Cubicake 4eaa11b193 Mark barrier as non-occluding 2026-08-19 14:37:09 +09:30
Cubicake 258e47c39f Use event system for player validity check 2026-08-18 17:42:39 +09:30
Cubicake c825a4af96 Event system 2026-08-18 16:48:21 +09:30
15 changed files with 37 additions and 238 deletions

No files matched your search

@@ -8,7 +8,6 @@
package games.cubi.raycastedantiesp.core.engine;
import games.cubi.locatables.api.ImmutableSpatial;
import games.cubi.locatables.api.Locatable;
import games.cubi.logs.Logger;
import games.cubi.raycastedantiesp.core.config.ConfigManager;
@@ -25,6 +24,8 @@ import games.cubi.raycastedantiesp.core.raycast.RaycastUtil;
import games.cubi.raycastedantiesp.core.utils.PrimitiveIntArrayList;
import games.cubi.raycastedantiesp.core.view.BlockView;
import games.cubi.raycastedantiesp.core.view.EntityView;
import games.cubi.utils.events.CancellableEvent;
import games.cubi.utils.events.CancellableEventRegistry;
import java.util.ArrayList;
import java.util.Collection;
@@ -120,6 +121,9 @@ public abstract class AsyncEngine implements Engine {
}
}
public static class EngineTickEvent extends CancellableEvent {}
public final CancellableEventRegistry<EngineTickEvent> engineTickEventRegistry = new CancellableEventRegistry<>();
/**
* Claims worker capacity and either runs work immediately or schedules worker batches.
*
@@ -127,6 +131,11 @@ public abstract class AsyncEngine implements Engine {
* lifecycle; false if this attempt was skipped or cleaned up during setup.
*/
private boolean dispatchTick(int scheduledTick, int startTick, long scheduledNanos) {
if (!engineTickEventRegistry.dispatch(EngineTickEvent::new)) {
Logger.debug("Skipping tick due to event being cancelled");
finishTickState();
return false;
}
int threads = config.getEngineConfig().asyncConfig().asyncProcessingThreads();
if (threads < 1) threads = 1;
Submodule leafpile updated: dca89261e9...d49fa5bc39.
-4
View File
@@ -21,7 +21,6 @@ repositories {
maven { url = uri("https://repo.codemc.io/repository/maven-releases/") }
maven { url = uri("https://repo.codemc.io/repository/maven-snapshots/") }
maven { url = uri("https://eldonexus.de/repository/maven-public/") }
maven("https://repo.fancyinnovations.com/releases")
}
dependencies {
@@ -31,9 +30,6 @@ dependencies {
compileOnly("org.spongepowered:configurate-core:4.2.0")
compileOnly("org.spongepowered:configurate-yaml:4.2.0")
compileOnly("de.oliver:FancyHolograms:2.9.1")
compileOnly("de.oliver:FancyNpcs:2.9.2")
compileOnly("net.strokkur.commands:annotations-paper:2.1.2")
annotationProcessor("net.strokkur.commands:processor-paper:2.1.2")
@@ -17,9 +17,10 @@ import games.cubi.raycastedantiesp.core.players.PlayerRegistry;
import games.cubi.raycastedantiesp.paper.engine.PaperAsyncEngine;
import games.cubi.raycastedantiesp.core.players.PlayerData;
import games.cubi.raycastedantiesp.paper.utils.PaperListener;
import games.cubi.utils.events.CancellableEvent;
import games.cubi.utils.events.CancellableEventRegistry;
import io.papermc.paper.event.player.PlayerClientLoadedWorldEvent;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -44,6 +45,9 @@ public class EventListener extends PaperListener {
this.plugin = plugin;
this.engine = engine;
this.currentTickSupplier = currentTickSupplier;
playerValidityCheckEventRegistry.register(CancellableEventRegistry.Order.NORMAL, (event) -> {
if (event.player.hasMetadata("NPC")) event.cancel();
});
}
public static EventListener initialise(RaycastedAntiESP plugin, PaperAsyncEngine engine, IntSupplier currentTickSupplier) {
@@ -58,11 +62,23 @@ public class EventListener extends PaperListener {
EntityBypassRegistry.markEntityDespawned(event.getEntity().getEntityId());
}
public static final class PlayerValidityCheckEvent extends CancellableEvent {
public final Player player;
PlayerValidityCheckEvent(Player player) {
this.player = player;
}
}
/**
* If this event is cancelled, player join processing will be skipped for this entity
*/
public static final CancellableEventRegistry<PlayerValidityCheckEvent> playerValidityCheckEventRegistry = new CancellableEventRegistry<PlayerValidityCheckEvent>();
@EventHandler(priority = EventPriority.LOWEST) //Runs first
public void onPlayerJoin(PlayerClientLoadedWorldEvent e) {
Player player = e.getPlayer();
if (player.hasMetadata("NPC")) return;
if (!playerValidityCheckEventRegistry.dispatch(new PlayerValidityCheckEvent(player))) return;
PlayerData playerData = PlayerRegistry.getInstance().getPlayerData(player.getUniqueId());
if (playerData == null) {
@@ -1,78 +0,0 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright © 2026 Cubicake.
* This file is part of RaycastedAntiESP.
* RaycastedAntiESP is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License v3.0 only, which can be accessed at https://www.gnu.org/licenses/agpl-3.0.html.
* See README.md for warranty disclaimer and further information.
*/
package games.cubi.raycastedantiesp.paper;
import de.oliver.fancyholograms.api.events.*;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancynpcs.api.events.NpcCreateEvent;
import de.oliver.fancynpcs.api.events.NpcModifyEvent;
import de.oliver.fancynpcs.api.events.NpcSpawnEvent;
import games.cubi.logs.Logger;
import games.cubi.raycastedantiesp.core.entity.EntityBypassRegistry;
import games.cubi.raycastedantiesp.paper.utils.PaperListener;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
// Entity remove events aren't listened to because the event names are a bit confusing to me and I'm unclear when each event is called.
// This should not be an issue as NPCs and Holograms are typically static entities which are not spawned or unspawned.
public class FancyCompatibility {
FancyCompatibility() {
Logger.info("Attempting to initiate FancyNPCs and FancyHolograms compatibility layer. If you are not using those plugins, you will see an error. This is safe to ignore.", 5);
new NPCs();
new Holograms();
}
static class NPCs extends PaperListener {
@EventHandler(priority = EventPriority.LOWEST)
public void npcLoad(NpcSpawnEvent event) {
int id = event.getNpc().getEntityId();
Logger.info("NpcSpawnEvent called, adding entity: " + id, 1);
EntityBypassRegistry.addEntity(id);
}
@EventHandler(priority = EventPriority.LOWEST)
public void npcLoad(NpcCreateEvent event) {
int id = event.getNpc().getEntityId();
Logger.info("NpcCreateEvent called, adding entity: " + id, 1);
EntityBypassRegistry.addEntity(id);
}
@EventHandler(priority = EventPriority.LOWEST)
public void npcLoad(NpcModifyEvent event) {
int id = event.getNpc().getEntityId();
Logger.info("NpcModifyEvent called, adding entity: " + id, 1);
EntityBypassRegistry.addEntity(id);
}
}
static class Holograms extends PaperListener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onHologramCreate(HologramCreateEvent event) {
add(event.getHologram());
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onHologramShow(HologramShowEvent event) {
add(event.getHologram());
}
@EventHandler(priority = EventPriority.LOWEST)
public void onHologramsLoaded(HologramsLoadedEvent event) {
event.getManager().forEach(this::add);
}
private void add(Hologram hologram) {
int id = hologram.getEntityId();
Logger.info("Hologram event called, adding entity: " + id, 1);
EntityBypassRegistry.addEntity(id);
}
}
}
@@ -120,7 +120,6 @@ public final class RaycastedAntiESP extends JavaPlugin implements CommandExecuto
}
}, 1200, 1200);*/
/*Do not delete, this is a legal notice*/Attribution.sendAttributionMessage(Bukkit.getConsoleSender()); // Legal notice as required by AGPLv3, it prominently offers users of this plugin the source code and displays an appropriate copyright notice. If you are a fork developer, do NOT remove this unless you have a thorough understanding of the AGPL and have replaced it with a suitable equivalent notice which is "prominently visible", displays the copyright notice, and includes a link to the source code of your fork which is accessible to all users of the plugin.
new FancyCompatibility();
}
private String parseTrackers(Set<Player> trackers) {
@@ -69,7 +69,8 @@ public class PacketEventsPaperBlockInfoResolver implements BlockInfoResolver {
run = false;
continue;
}
if (blockData.getMaterial() == Material.AIR) {
Material material = blockData.getMaterial();
if (material == Material.AIR) {
airs++;
if (airs > 80000) { // There is a sequence of ~40 air blocks around ID 100, and another of several hundred at ~3000. We scan forwards 80k to future-proof any mojank. Since it runs once at startup, perf is irrelevant here
run = false;
@@ -79,12 +80,12 @@ public class PacketEventsPaperBlockInfoResolver implements BlockInfoResolver {
else {
airs = 0;
lastNonAirID = iterator;
if (materialToIDMode) {
Logger.info(blockData.getAsString() + iterator,1);
}
}
occlusion.put(iterator, blockData.getMaterial().isOccluding());
boolean occluding = material != Material.BARRIER && material.isOccluding();
if (materialToIDMode && material != Material.AIR) {
Logger.info(blockData.getAsString() + iterator + occluding,1);
}
occlusion.put(iterator, occluding);
try {
if (blockData.createBlockState() instanceof TileState) {
//Logger.debug("tile at" + iterator + " is tile entity" + material.name());
-62
View File
@@ -1,62 +0,0 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright © 2026 Cubicake.
* This file is part of RaycastedAntiESP.
* RaycastedAntiESP is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License v3.0 only, which can be accessed at https://www.gnu.org/licenses/agpl-3.0.html.
* See README.md for warranty disclaimer and further information.
*/
plugins {
id 'java'
id("xyz.jpenilla.run-velocity") version "3.0.2"
}
group = 'games.cubi'
version = '0.0.1-SNAPSHOT'
repositories {
mavenCentral()
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
}
dependencies {
compileOnly("com.velocitypowered:velocity-api:3.5.0-SNAPSHOT")
annotationProcessor("com.velocitypowered:velocity-api:3.5.0-SNAPSHOT")
}
tasks {
runVelocity {
// Configure the Velocity version for our task.
// This is the only required configuration besides applying the plugin.
// Your plugin's jar (or shadowJar if present) will be used automatically.
velocityVersion("3.5.0-SNAPSHOT")
}
}
def targetJavaVersion = 21
java {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release.set(targetJavaVersion)
}
def templateSource = file('src/main/templates')
def templateDest = layout.buildDirectory.dir('generated/sources/templates')
def generateTemplates = tasks.register('generateTemplates', Copy) { task ->
def props = [
'version': project.version
]
task.inputs.properties props
task.from templateSource
task.into templateDest
task.expand props
}
sourceSets.main.java.srcDir(generateTemplates)
-8
View File
@@ -1,8 +0,0 @@
#
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright © 2026 Cubicake.
# This file is part of RaycastedAntiESP.
# RaycastedAntiESP is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License v3.0 only, which can be accessed at https://www.gnu.org/licenses/agpl-3.0.html.
# See README.md for warranty disclaimer and further information.
#
@@ -1,9 +0,0 @@
#
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright © 2026 Cubicake.
# This file is part of RaycastedAntiESP.
# RaycastedAntiESP is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License v3.0 only, which can be accessed at https://www.gnu.org/licenses/agpl-3.0.html.
# See README.md for warranty disclaimer and further information.
#
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
-9
View File
@@ -1,9 +0,0 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright © 2026 Cubicake.
* This file is part of RaycastedAntiESP.
* RaycastedAntiESP is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License v3.0 only, which can be accessed at https://www.gnu.org/licenses/agpl-3.0.html.
* See README.md for warranty disclaimer and further information.
*/
rootProject.name = 'platform-velocity'
@@ -1,32 +0,0 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright © 2026 Cubicake.
* This file is part of RaycastedAntiESP.
* RaycastedAntiESP is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License v3.0 only, which can be accessed at https://www.gnu.org/licenses/agpl-3.0.html.
* See README.md for warranty disclaimer and further information.
*/
package games.cubi.raycastedantiesp.velocity;
import com.google.inject.Inject;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.plugin.Plugin;
import org.slf4j.Logger;
@Plugin(
id = "raycastedantiesp",
name = "RaycastedAntiESP",
version = BuildConstants.VERSION,
description = "Packet-based Anti-ESP plugin",
url = "https://cubi.games",
authors = {"_Cubicake"}
)
public class VeloRaycastedAntiESP {
@Inject private Logger logger;
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
}
}
@@ -1,15 +0,0 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright © 2026 Cubicake.
* This file is part of RaycastedAntiESP.
* RaycastedAntiESP is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License v3.0 only, which can be accessed at https://www.gnu.org/licenses/agpl-3.0.html.
* See README.md for warranty disclaimer and further information.
*/
package games.cubi.raycastedantiesp.velocity;
// The constants are replaced before compilation
public class BuildConstants {
public static final String VERSION = "${version}";
}
-9
View File
@@ -1,11 +1,3 @@
/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright © 2026 Cubicake.
* This file is part of RaycastedAntiESP.
* RaycastedAntiESP is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License v3.0 only, which can be accessed at https://www.gnu.org/licenses/agpl-3.0.html.
* See README.md for warranty disclaimer and further information.
*/
rootProject.name = 'RaycastedAntiESP'
dependencyResolutionManagement {
versionCatalogs {
@@ -21,4 +13,3 @@ include 'core'
include 'platform-paper'
include 'packetevents'
include 'leafpile'
include 'platform-velocity'