mirror of
https://github.com/Cubicake/RaycastedAntiESP.git
synced 2026-11-17 06:26:04 -05:00
Compare commits
19
Commits
citizens
...
eventbench
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c667c49f01 | ||
|
|
8d8a327cb0 | ||
|
|
a80b72c008 | ||
|
|
0725062d9c | ||
|
|
0e74a1ba15 | ||
|
|
9a822af8bc | ||
|
|
c6afbf0733 | ||
|
|
4eaa11b193 | ||
|
|
258e47c39f | ||
|
|
c825a4af96 | ||
|
|
244fde97c0 | ||
|
|
8b3a62f1f5 | ||
|
|
45d0e0581c | ||
|
|
aa7934f258 | ||
|
|
cfdb255b56 | ||
|
|
14e6aaaae6 | ||
|
|
d7cc7abd8c | ||
|
|
73e58e191e | ||
|
|
e5a591af1a |
No files matched your search
+1
-3
@@ -118,9 +118,7 @@ gradle-app.setting
|
||||
**/build/
|
||||
|
||||
# Common working directory
|
||||
run/
|
||||
runs/
|
||||
run-1-21-11/
|
||||
run*/
|
||||
|
||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||
!gradle-wrapper.jar
|
||||
@@ -13,7 +13,7 @@ The supported minecraft versions are 1.21.4+. Only Paper and derivative software
|
||||
- Prevent cheating (anti-esp hacks)
|
||||
- This is the plugin's primary purpose.
|
||||
- Block usage of pie-ray to locate underground bases or farms.
|
||||
- Prevent mods such as mini-maps or cheat clients from displaying the locations of hidden entities.
|
||||
- Prevent mods such as mini-maps or cheat clients from displaying the locations of entities which would not be visible to vanilla players.
|
||||
- Increase client-side performance for low-end devices
|
||||
- Massive megabases containing hundreds of armour stands, item frames, banners etc can cause performance issues on low-end devices unable to process so many entities. Raycasted AntiESP will cull those entities for the client, reducing the number of entities to process.
|
||||
- Reduce network load by limiting packets
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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("io.papermc.paperweight.userdev") version "2.0.0-beta.21" apply false
|
||||
id("xyz.jpenilla.run-paper") version "3.0.2" apply false
|
||||
id("com.gradleup.shadow") version "9.4.0" apply false
|
||||
}
|
||||
@@ -20,17 +20,21 @@ import org.spongepowered.configurate.ConfigurationNode;
|
||||
import org.spongepowered.configurate.yaml.NodeStyle;
|
||||
import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
|
||||
|
||||
import java.lang.invoke.VarHandle;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.invoke.VarHandle;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ConfigManager {
|
||||
@@ -306,28 +310,13 @@ public class ConfigManager {
|
||||
Files.createFile(configPath);
|
||||
}
|
||||
}
|
||||
prependConfigDocumentationHeaderIfMissing();
|
||||
ConfigMigrations.prependConfigDocumentationHeaderIfMissing(configPath);
|
||||
ConfigMigrations.migrateSoundEffectsEnabled(configPath);
|
||||
} catch (IOException e) {
|
||||
throw new ConfigLoadException("Failed to create config.yml", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void prependConfigDocumentationHeaderIfMissing() {
|
||||
try {
|
||||
String content = Files.readString(configPath);
|
||||
|
||||
if (content.startsWith("#")) {
|
||||
Logger.debug("Config starts with comment");
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.debug("no starting comment");
|
||||
Files.writeString(configPath, "# An explanation of this configuration file and what all the options do can be found at https://raycastedantiesp.cubi.games/config/" + System.lineSeparator() + content);
|
||||
} catch (Exception e) {
|
||||
Logger.warning(e,3, ConfigManager.class);
|
||||
}
|
||||
}
|
||||
|
||||
private ConfigurationNode loadConfigNode() {
|
||||
try {
|
||||
return loader.load();
|
||||
@@ -374,6 +363,108 @@ public class ConfigManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporary text-level config mutations. Remove this class when these migrations are no longer needed.
|
||||
*/
|
||||
private static final class ConfigMigrations {
|
||||
private static final Pattern YAML_KEY = Pattern.compile("^([ \\t]*)([^:#\\s][^:]*):.*$");
|
||||
private static final Pattern SOUND_EFFECTS_ENABLED_TRUE = Pattern.compile("^([ \\t]*enabled[ \\t]*:[ \\t]*)true([ \\t]*(?:#.*)?)$", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
private ConfigMigrations() {
|
||||
}
|
||||
|
||||
private static void prependConfigDocumentationHeaderIfMissing(Path configPath) {
|
||||
try {
|
||||
String content = Files.readString(configPath);
|
||||
|
||||
if (content.startsWith("#")) {
|
||||
Logger.debug("Config starts with comment");
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.debug("no starting comment");
|
||||
Files.writeString(configPath, "# An explanation of this configuration file and what all the options do can be found at https://raycastedantiesp.cubi.games/config/" + System.lineSeparator() + content);
|
||||
} catch (Exception e) {
|
||||
Logger.warning(e,3, ConfigManager.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Temporary(forRemovalIn = "0.8.0")
|
||||
private static void migrateSoundEffectsEnabled(Path configPath) {
|
||||
try {
|
||||
String content = Files.readString(configPath, StandardCharsets.UTF_8);
|
||||
String migrated = replaceSoundEffectsEnabled(content);
|
||||
if (!content.equals(migrated)) {
|
||||
Files.writeString(configPath, migrated, StandardCharsets.UTF_8);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new ConfigLoadException("Failed to migrate sound-effects.enabled in config.yml", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String replaceSoundEffectsEnabled(String content) {
|
||||
StringBuilder migrated = new StringBuilder(content.length());
|
||||
int lineStart = 0;
|
||||
int checksIndent = -1;
|
||||
int soundEffectsIndent = -1;
|
||||
boolean changed = false;
|
||||
|
||||
while (lineStart < content.length()) {
|
||||
int lineEnd = content.indexOf('\n', lineStart);
|
||||
boolean hasLineEnding = lineEnd >= 0;
|
||||
int contentEnd = hasLineEnding ? lineEnd : content.length();
|
||||
int lineContentEnd = contentEnd > lineStart && content.charAt(contentEnd - 1) == '\r'
|
||||
? contentEnd - 1 : contentEnd;
|
||||
String line = content.substring(lineStart, lineContentEnd);
|
||||
String lineEnding = content.substring(lineContentEnd, contentEnd) + (hasLineEnding ? "\n" : "");
|
||||
|
||||
Matcher key = YAML_KEY.matcher(line);
|
||||
if (key.matches()) {
|
||||
int indent = key.group(1).length();
|
||||
String name = key.group(2).trim();
|
||||
|
||||
if (checksIndent < 0) {
|
||||
if (name.equals("checks")) {
|
||||
checksIndent = indent;
|
||||
}
|
||||
} else if (indent <= checksIndent) {
|
||||
checksIndent = name.equals("checks") ? indent : -1;
|
||||
soundEffectsIndent = -1;
|
||||
} else if (soundEffectsIndent < 0) {
|
||||
if (name.equals("sound-effects")) {
|
||||
soundEffectsIndent = indent;
|
||||
}
|
||||
} else if (indent <= soundEffectsIndent) {
|
||||
soundEffectsIndent = name.equals("sound-effects") ? indent : -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (soundEffectsIndent >= 0 && key.matches()
|
||||
&& key.group(2).trim().equals("enabled")
|
||||
&& key.group(1).length() > soundEffectsIndent) {
|
||||
Matcher enabled = SOUND_EFFECTS_ENABLED_TRUE.matcher(line);
|
||||
if (enabled.matches()) {
|
||||
line = enabled.group(1) + "false" + enabled.group(2);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
migrated.append(line).append(lineEnding);
|
||||
if (!hasLineEnding) {
|
||||
break;
|
||||
}
|
||||
lineStart = contentEnd + 1;
|
||||
}
|
||||
|
||||
return changed ? migrated.toString() : content;
|
||||
}
|
||||
|
||||
@Documented
|
||||
private @interface Temporary {
|
||||
String forRemovalIn();
|
||||
}
|
||||
}
|
||||
|
||||
private ConfigurationNode node(ConfigurationNode root, String path) {
|
||||
String[] parts = path.split("\\.");
|
||||
return ConfigReader.node(root, parts);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -22,4 +22,6 @@ public interface ParticleSpawner {
|
||||
void spawnParticleAt(Locatable locatable, Colour colour);
|
||||
|
||||
void spawnParticleAt(UUID world, Spatial spatial, Colour colour);
|
||||
|
||||
void spawnParticleAt(UUID world, double x, double y, double z, Colour colour);
|
||||
}
|
||||
@@ -189,72 +189,59 @@ public class RaycastUtil {
|
||||
if (total > maxRaycastRadius) return false;
|
||||
float finalDist = (float) (total - stepSize);
|
||||
|
||||
RayChunkSection currentChunk = new RayChunkSection().updateFrom(current);
|
||||
ChunkOcclusionView currentOcclusionView = snap.getChunkOcclusionView(currentChunk.chunkX, currentChunk.chunkY, currentChunk.chunkZ);
|
||||
|
||||
int occluded = 0;
|
||||
final RayAdvancer rayAdvancer = new RayAdvancer(current, direction, snap);
|
||||
|
||||
float traveled = 0;
|
||||
final float fourSteps = stepSize * 4.0f;
|
||||
while (traveled + fourSteps <= finalDist) {
|
||||
current.advance(direction);
|
||||
int blockX = current.blockX();
|
||||
int blockY = current.blockY();
|
||||
int blockZ = current.blockZ();
|
||||
if (blockX >> 4 != currentChunk.chunkX || blockY >> 4 != currentChunk.chunkY || blockZ >> 4 != currentChunk.chunkZ) {
|
||||
currentChunk.updateFrom(current);
|
||||
currentOcclusionView = snap.getChunkOcclusionView(currentChunk.chunkX, currentChunk.chunkY, currentChunk.chunkZ);
|
||||
}
|
||||
if (currentOcclusionView != null && currentOcclusionView.isOccludingGlobal(blockX, blockY, blockZ)) occluded++;
|
||||
rayAdvancer.advance();
|
||||
|
||||
current.advance(direction);
|
||||
blockX = current.blockX();
|
||||
blockY = current.blockY();
|
||||
blockZ = current.blockZ();
|
||||
if (blockX >> 4 != currentChunk.chunkX || blockY >> 4 != currentChunk.chunkY || blockZ >> 4 != currentChunk.chunkZ) {
|
||||
currentChunk.updateFrom(current);
|
||||
currentOcclusionView = snap.getChunkOcclusionView(currentChunk.chunkX, currentChunk.chunkY, currentChunk.chunkZ);
|
||||
}
|
||||
if (currentOcclusionView != null && currentOcclusionView.isOccludingGlobal(blockX, blockY, blockZ)) occluded++;
|
||||
rayAdvancer.advance();
|
||||
|
||||
current.advance(direction);
|
||||
blockX = current.blockX();
|
||||
blockY = current.blockY();
|
||||
blockZ = current.blockZ();
|
||||
if (blockX >> 4 != currentChunk.chunkX || blockY >> 4 != currentChunk.chunkY || blockZ >> 4 != currentChunk.chunkZ) {
|
||||
currentChunk.updateFrom(current);
|
||||
currentOcclusionView = snap.getChunkOcclusionView(currentChunk.chunkX, currentChunk.chunkY, currentChunk.chunkZ);
|
||||
}
|
||||
if (currentOcclusionView != null && currentOcclusionView.isOccludingGlobal(blockX, blockY, blockZ)) occluded++;
|
||||
rayAdvancer.advance();
|
||||
|
||||
current.advance(direction);
|
||||
blockX = current.blockX();
|
||||
blockY = current.blockY();
|
||||
blockZ = current.blockZ();
|
||||
if (blockX >> 4 != currentChunk.chunkX || blockY >> 4 != currentChunk.chunkY || blockZ >> 4 != currentChunk.chunkZ) {
|
||||
currentChunk.updateFrom(current);
|
||||
currentOcclusionView = snap.getChunkOcclusionView(currentChunk.chunkX, currentChunk.chunkY, currentChunk.chunkZ);
|
||||
}
|
||||
if (currentOcclusionView != null && currentOcclusionView.isOccludingGlobal(blockX, blockY, blockZ)) occluded++;
|
||||
rayAdvancer.advance();
|
||||
|
||||
if (occluded >= maxOccluding) return false;
|
||||
if (rayAdvancer.occluded >= maxOccluding) return false;
|
||||
|
||||
traveled += fourSteps;
|
||||
}
|
||||
|
||||
for (; traveled < finalDist; traveled += stepSize) {
|
||||
rayAdvancer.advance();
|
||||
}
|
||||
|
||||
return rayAdvancer.occluded < maxOccluding;
|
||||
}
|
||||
|
||||
private static final class RayAdvancer {
|
||||
private final RayPosition current;
|
||||
private final RayDirection direction;
|
||||
private final RayChunkSection currentChunk;
|
||||
private final BlockView blockView;
|
||||
|
||||
private ChunkOcclusionView currentOcclusionView;
|
||||
private int occluded = 0;
|
||||
|
||||
private RayAdvancer(RayPosition rayPosition, RayDirection rayDirection, BlockView blockView) {
|
||||
current = rayPosition;
|
||||
direction = rayDirection;
|
||||
currentChunk = new RayChunkSection().updateFrom(current);
|
||||
currentOcclusionView = blockView.getChunkOcclusionView(currentChunk.chunkX, currentChunk.chunkY, currentChunk.chunkZ);
|
||||
this.blockView = blockView;
|
||||
}
|
||||
|
||||
private void advance() {
|
||||
current.advance(direction);
|
||||
int blockX = current.blockX();
|
||||
int blockY = current.blockY();
|
||||
int blockZ = current.blockZ();
|
||||
if (blockX >> 4 != currentChunk.chunkX || blockY >> 4 != currentChunk.chunkY || blockZ >> 4 != currentChunk.chunkZ) {
|
||||
currentChunk.updateFrom(current);
|
||||
currentOcclusionView = snap.getChunkOcclusionView(currentChunk.chunkX, currentChunk.chunkY, currentChunk.chunkZ);
|
||||
currentOcclusionView = blockView.getChunkOcclusionView(currentChunk.chunkX, currentChunk.chunkY, currentChunk.chunkZ);
|
||||
}
|
||||
if (currentOcclusionView != null && currentOcclusionView.isOccludingGlobal(blockX, blockY, blockZ)) occluded++;
|
||||
}
|
||||
|
||||
return occluded < maxOccluding;
|
||||
}
|
||||
|
||||
private static final class RayPosition {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
Run 1:
|
||||
[16:27:33 INFO]: [EventDispatchBenchmark] Event dispatch results (average ns/op, error is 99.9% confidence interval):
|
||||
[16:27:33 INFO]: [EventDispatchBenchmark] listeners | cubi ns/op | bukkit ns/op | bukkit/cubi
|
||||
[16:27:33 INFO]: [EventDispatchBenchmark] 0 | 2.529 ± 0.006 | 4.589 ± 0.037 | 1.81x
|
||||
[16:27:33 INFO]: [EventDispatchBenchmark] 1 | 3.489 ± 0.013 | 7.568 ± 0.102 | 2.17x
|
||||
[16:27:33 INFO]: [EventDispatchBenchmark] 4 | 5.855 ± 0.025 | 17.063 ± 0.616 | 2.91x
|
||||
[16:27:33 INFO]: [EventDispatchBenchmark] 16 | 10.737 ± 0.356 | 52.979 ± 0.236 | 4.93x
|
||||
[16:27:33 INFO]: [EventDispatchBenchmark] 32 | 18.078 ± 3.040 | 101.260 ± 1.882 | 5.60x
|
||||
[16:27:33 INFO]: [EventDispatchBenchmark] 64 | 29.596 ± 0.088 | 203.622 ± 0.996 | 6.88x
|
||||
|
||||
Run 2:
|
||||
[16:33:24 INFO]: [EventDispatchBenchmark] Event dispatch results (average ns/op, error is 99.9% confidence interval):
|
||||
[16:33:24 INFO]: [EventDispatchBenchmark] listeners | cubi ns/op | bukkit ns/op | bukkit/cubi
|
||||
[16:33:24 INFO]: [EventDispatchBenchmark] 0 | 2.550 ± 0.010 | 4.608 ± 0.016 | 1.81x
|
||||
[16:33:24 INFO]: [EventDispatchBenchmark] 1 | 4.381 ± 0.015 | 7.511 ± 0.011 | 1.71x
|
||||
[16:33:24 INFO]: [EventDispatchBenchmark] 4 | 6.053 ± 0.009 | 17.762 ± 3.984 | 2.93x
|
||||
[16:33:24 INFO]: [EventDispatchBenchmark] 16 | 14.320 ± 0.598 | 52.959 ± 0.099 | 3.70x
|
||||
[16:33:24 INFO]: [EventDispatchBenchmark] 32 | 23.392 ± 0.095 | 101.222 ± 0.228 | 4.33x
|
||||
[16:33:24 INFO]: [EventDispatchBenchmark] 64 | 41.709 ± 0.692 | 204.705 ± 2.331 | 4.91x
|
||||
|
||||
Using CopyOnWriteArray `for (BaseEventHandler<E> eventHandler : handlers.eventHandlers)`, without special-pathing monitor.
|
||||
Ignore bukkit results, they were made to not fire the event.
|
||||
[21:01:41 INFO]: [EventDispatchBenchmark] listeners | cubi ns/op | bukkit ns/op | bukkit/cubi
|
||||
[21:01:41 INFO]: [EventDispatchBenchmark] 0 | 4.287 ± 0.036 | 1.526 ± 0.176 | 0.36x
|
||||
[21:01:41 INFO]: [EventDispatchBenchmark] 1 | 7.566 ± 0.046 | 1.609 ± 0.123 | 0.21x
|
||||
[21:01:41 INFO]: [EventDispatchBenchmark] 4 | 8.813 ± 0.019 | 1.576 ± 0.061 | 0.18x
|
||||
[21:01:41 INFO]: [EventDispatchBenchmark] 16 | 17.443 ± 0.018 | 1.564 ± 0.002 | 0.09x
|
||||
[21:01:41 INFO]: [EventDispatchBenchmark] 32 | 34.947 ± 1.051 | 1.575 ± 0.042 | 0.05x
|
||||
[21:01:41 INFO]: [EventDispatchBenchmark] 64 | 74.946 ± 0.066 | 1.572 ± 0.039 | 0.02x
|
||||
|
||||
This benchmark is not a strictly apples-to-apples comparison because Bukkit’s event-dispatch path performs additional work,
|
||||
including thread validation, plugin-state checks, listener/executor indirection, and exception handling.
|
||||
The results therefore compare `games.cubi.utils.events`’s specialised handler registry with Bukkit’s broader public event infrastructure,
|
||||
rather than two dispatch mechanisms providing identical functionality.
|
||||
|
||||
However, since that extra work is unnecessary for our use-cases, `games.cubi.utils.events` is still better.
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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-paper")
|
||||
id("com.gradleup.shadow")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://repo.papermc.io/repository/maven-public/") }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT")
|
||||
|
||||
implementation(project(":leafpile"))
|
||||
implementation("org.openjdk.jmh:jmh-core:1.37")
|
||||
annotationProcessor("org.openjdk.jmh:jmh-generator-annprocess:1.37")
|
||||
}
|
||||
|
||||
group = "games.cubi.raycastedantiesp.benchmark"
|
||||
version = "1.0.0-SNAPSHOT"
|
||||
|
||||
java {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
archiveBaseName.set("EventDispatchBenchmark")
|
||||
archiveClassifier.set("")
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
archiveBaseName.set("Incorrectly-Compiled-Without-ShadowJar")
|
||||
}
|
||||
|
||||
tasks.runServer {
|
||||
minecraftVersion("1.21.11")
|
||||
jvmArgs(
|
||||
"-Xms1G",
|
||||
"-Xmx1G",
|
||||
"-Dcom.mojang.eula.agree=true",
|
||||
"-Dterminal.jline=false",
|
||||
"-Dterminal.ansi=false",
|
||||
"-DeventBenchmark.resultFile=${layout.buildDirectory.file("reports/event-benchmark/results.json").get().asFile.absolutePath}",
|
||||
)
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* 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.benchmark;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.openjdk.jmh.results.RunResult;
|
||||
import org.openjdk.jmh.results.format.ResultFormatType;
|
||||
import org.openjdk.jmh.runner.Runner;
|
||||
import org.openjdk.jmh.runner.options.Options;
|
||||
import org.openjdk.jmh.runner.options.OptionsBuilder;
|
||||
import org.openjdk.jmh.runner.options.TimeValue;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class EventBenchmarkPlugin extends JavaPlugin {
|
||||
private static EventBenchmarkPlugin instance;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
getLogger().info("Starting the event-dispatch benchmark asynchronously.");
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this, this::runBenchmark);
|
||||
}
|
||||
|
||||
static EventBenchmarkPlugin instance() {
|
||||
EventBenchmarkPlugin current = instance;
|
||||
if (current == null) {
|
||||
throw new IllegalStateException("Benchmark plugin is not enabled");
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
private void runBenchmark() {
|
||||
try {
|
||||
Path resultFile = Path.of(System.getProperty(
|
||||
"eventBenchmark.resultFile",
|
||||
getDataPath().resolve("results.json").toString()
|
||||
));
|
||||
Files.createDirectories(resultFile.toAbsolutePath().getParent());
|
||||
|
||||
Options options = new OptionsBuilder()
|
||||
.include(EventDispatchBenchmark.class.getName())
|
||||
.mode(org.openjdk.jmh.annotations.Mode.AverageTime)
|
||||
.timeUnit(TimeUnit.NANOSECONDS)
|
||||
.threads(1)
|
||||
.forks(0)
|
||||
.warmupIterations(5)
|
||||
.warmupTime(TimeValue.seconds(1))
|
||||
.measurementIterations(10)
|
||||
.measurementTime(TimeValue.seconds(1))
|
||||
.shouldFailOnError(true)
|
||||
.resultFormat(ResultFormatType.JSON)
|
||||
.result(resultFile.toString())
|
||||
.build();
|
||||
|
||||
Collection<RunResult> results = new Runner(options).run();
|
||||
logSummary(results, resultFile);
|
||||
} catch (Throwable throwable) {
|
||||
getLogger().log(Level.SEVERE, "Event-dispatch benchmark failed", throwable);
|
||||
} finally {
|
||||
Bukkit.getScheduler().runTask(this, Bukkit::shutdown);
|
||||
}
|
||||
}
|
||||
|
||||
private void logSummary(Collection<RunResult> results, Path resultFile) {
|
||||
record Score(double value, double error) {}
|
||||
|
||||
Map<Integer, Score> cubi = new HashMap<>();
|
||||
Map<Integer, Score> bukkit = new HashMap<>();
|
||||
results.stream()
|
||||
.sorted(Comparator.comparingInt(result -> Integer.parseInt(
|
||||
result.getParams().getParam("listenerCount")
|
||||
)))
|
||||
.forEach(result -> {
|
||||
int count = Integer.parseInt(result.getParams().getParam("listenerCount"));
|
||||
Score score = new Score(
|
||||
result.getPrimaryResult().getScore(),
|
||||
result.getPrimaryResult().getScoreError()
|
||||
);
|
||||
if (result.getParams().getBenchmark().endsWith(".cubi")) {
|
||||
cubi.put(count, score);
|
||||
} else if (result.getParams().getBenchmark().endsWith(".bukkit")) {
|
||||
bukkit.put(count, score);
|
||||
}
|
||||
});
|
||||
|
||||
getLogger().info("Event dispatch results (average ns/op, error is 99.9% confidence interval):");
|
||||
getLogger().info("listeners | cubi ns/op | bukkit ns/op | bukkit/cubi");
|
||||
cubi.keySet().stream().sorted().forEach(count -> {
|
||||
Score cubiScore = cubi.get(count);
|
||||
Score bukkitScore = bukkit.get(count);
|
||||
getLogger().info(String.format(
|
||||
Locale.ROOT,
|
||||
"%9d | %8.3f ± %-8.3f | %10.3f ± %-8.3f | %.2fx",
|
||||
count,
|
||||
cubiScore.value(),
|
||||
cubiScore.error(),
|
||||
bukkitScore.value(),
|
||||
bukkitScore.error(),
|
||||
bukkitScore.value() / cubiScore.value()
|
||||
));
|
||||
});
|
||||
getLogger().info("Machine-readable JMH results: " + resultFile.toAbsolutePath());
|
||||
}
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* 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.benchmark;
|
||||
|
||||
import games.cubi.utils.events.CancellableEventRegistry;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.openjdk.jmh.annotations.Benchmark;
|
||||
import org.openjdk.jmh.annotations.Param;
|
||||
import org.openjdk.jmh.annotations.Scope;
|
||||
import org.openjdk.jmh.annotations.Setup;
|
||||
import org.openjdk.jmh.annotations.State;
|
||||
import org.openjdk.jmh.annotations.TearDown;
|
||||
import org.openjdk.jmh.annotations.Level;
|
||||
|
||||
@State(Scope.Benchmark)
|
||||
public class EventDispatchBenchmark {
|
||||
private static final CancellableEventRegistry.Order[] CUBI_PRIORITIES = {
|
||||
CancellableEventRegistry.Order.EARLY,
|
||||
CancellableEventRegistry.Order.NORMAL,
|
||||
CancellableEventRegistry.Order.LATE,
|
||||
CancellableEventRegistry.Order.MONITOR,
|
||||
};
|
||||
private static final EventPriority[] BUKKIT_PRIORITIES = {
|
||||
EventPriority.LOWEST,
|
||||
EventPriority.NORMAL,
|
||||
EventPriority.HIGHEST,
|
||||
EventPriority.MONITOR,
|
||||
};
|
||||
|
||||
@Param({"0", "1", "4", "16", "32", "64"})
|
||||
public int listenerCount;
|
||||
|
||||
private CancellableEventRegistry<CubiBenchmarkEvent> cubiRegistry;
|
||||
private CubiBenchmarkEvent cubiEvent;
|
||||
private BukkitBenchmarkEvent bukkitEvent;
|
||||
|
||||
@Setup(Level.Trial)
|
||||
public void setup() {
|
||||
EventBenchmarkPlugin plugin = EventBenchmarkPlugin.instance();
|
||||
BukkitBenchmarkEvent.getHandlerList().unregister(plugin);
|
||||
|
||||
cubiRegistry = new CancellableEventRegistry<>();
|
||||
cubiEvent = new CubiBenchmarkEvent();
|
||||
bukkitEvent = new BukkitBenchmarkEvent();
|
||||
|
||||
for (int index = 0; index < listenerCount; index++) {
|
||||
CancellableEventRegistry.Order cubiPriority = listenerCount < 16
|
||||
? CancellableEventRegistry.Order.NORMAL
|
||||
: CUBI_PRIORITIES[index % CUBI_PRIORITIES.length];
|
||||
EventPriority bukkitPriority = listenerCount < 16
|
||||
? EventPriority.NORMAL
|
||||
: BUKKIT_PRIORITIES[index % BUKKIT_PRIORITIES.length];
|
||||
|
||||
cubiRegistry.register(cubiPriority, CubiBenchmarkEvent::recordHandling);
|
||||
Bukkit.getPluginManager().registerEvent(
|
||||
BukkitBenchmarkEvent.class,
|
||||
new Listener() {},
|
||||
bukkitPriority,
|
||||
(ignored, event) -> ((BukkitBenchmarkEvent) event).recordHandling(),
|
||||
plugin,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
BukkitBenchmarkEvent.getHandlerList().bake();
|
||||
verifySetup();
|
||||
}
|
||||
|
||||
private void verifySetup() {
|
||||
int registeredBukkitListeners = BukkitBenchmarkEvent.getHandlerList().getRegisteredListeners().length;
|
||||
if (registeredBukkitListeners != listenerCount) {
|
||||
throw new IllegalStateException("Expected " + listenerCount + " Bukkit listeners, found " + registeredBukkitListeners);
|
||||
}
|
||||
if (!cubiRegistry.dispatch(cubiEvent) || !bukkitEvent.callEvent()) {
|
||||
throw new IllegalStateException("An uncancelled verification dispatch returned cancelled");
|
||||
}
|
||||
if (cubiEvent.handledCount() != listenerCount || bukkitEvent.handledCount() != listenerCount) {
|
||||
throw new IllegalStateException(
|
||||
"Verification dispatch count mismatch: cubi=" + cubiEvent.handledCount()
|
||||
+ ", bukkit=" + bukkitEvent.handledCount()
|
||||
+ ", expected=" + listenerCount
|
||||
);
|
||||
}
|
||||
cubiEvent.resetHandledCount();
|
||||
bukkitEvent.resetHandledCount();
|
||||
}
|
||||
|
||||
@TearDown(Level.Trial)
|
||||
public void tearDown() {
|
||||
BukkitBenchmarkEvent.getHandlerList().unregister(EventBenchmarkPlugin.instance());
|
||||
BukkitBenchmarkEvent.getHandlerList().bake();
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public long cubi() {
|
||||
boolean dispatched = cubiRegistry.dispatch(cubiEvent);
|
||||
long handled = cubiEvent.handledCount();
|
||||
return dispatched ? handled : ~handled;
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public long bukkit() {/*
|
||||
boolean dispatched = bukkitEvent.callEvent();
|
||||
long handled = bukkitEvent.handledCount();
|
||||
return dispatched ? handled : ~handled;
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final class CubiBenchmarkEvent extends games.cubi.utils.events.CancellableEvent {
|
||||
private long handledCount;
|
||||
|
||||
void recordHandling() {
|
||||
handledCount++;
|
||||
}
|
||||
|
||||
long handledCount() {
|
||||
return handledCount;
|
||||
}
|
||||
|
||||
void resetHandledCount() {
|
||||
handledCount = 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public static final class BukkitBenchmarkEvent extends Event implements Cancellable {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
|
||||
private boolean cancelled;
|
||||
private long handledCount;
|
||||
|
||||
BukkitBenchmarkEvent() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
void recordHandling() {
|
||||
handledCount++;
|
||||
}
|
||||
|
||||
long handledCount() {
|
||||
return handledCount;
|
||||
}
|
||||
|
||||
void resetHandledCount() {
|
||||
handledCount = 0L;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
name: EventDispatchBenchmark
|
||||
version: 1.0.0-SNAPSHOT
|
||||
main: games.cubi.raycastedantiesp.benchmark.EventBenchmarkPlugin
|
||||
api-version: '1.21.11'
|
||||
authors: [ _Cubicake ]
|
||||
description: Temporary JMH comparison of Cubi and Paper event dispatch.
|
||||
+1
-1
Submodule leafpile updated: dca89261e9...eeaa8f812f.
+1
-1
Submodule locatables updated: 7de6bff030...97ff3c29dc.
+7
@@ -8,6 +8,7 @@
|
||||
|
||||
package games.cubi.raycastedantiesp.packetevents.viewcontrollers;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;
|
||||
import games.cubi.logs.Logger;
|
||||
@@ -33,6 +34,12 @@ final class PECacheablePacketReconciliationTask extends BaseEntitySpawnTask {
|
||||
NettyEntity<?> entity = playerData.entityFromID(entityID);
|
||||
if (entity == null) {
|
||||
Logger.error("Reconciliation fail: Attempted to cache packet for unknown entity, id=" + entityID + " packet=" + packet.getClass().getSimpleName() + ".", 3, this.getClass());
|
||||
if (packet instanceof WrapperPlayServerEntityMetadata metadataPacket) {
|
||||
var data = metadataPacket.getEntityMetadata();
|
||||
for (EntityData<?> eData : data) {
|
||||
Logger.debug("Index:"+eData.getIndex()+"Type:"+eData.getType()+"Value:"+eData.getValue());
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (packet instanceof WrapperPlayServerEntityMetadata metadataPacket) {
|
||||
|
||||
@@ -11,9 +11,9 @@ import org.gradle.jvm.toolchain.JavaToolchainService
|
||||
|
||||
plugins {
|
||||
id("java-library")
|
||||
id("io.papermc.paperweight.userdev") version "2.0.0-beta.21"
|
||||
id("xyz.jpenilla.run-paper") version "3.0.2"
|
||||
id("com.gradleup.shadow") version "9.4.0"
|
||||
id("io.papermc.paperweight.userdev")
|
||||
id("xyz.jpenilla.run-paper")
|
||||
id("com.gradleup.shadow")
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -21,19 +21,15 @@ 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 {
|
||||
paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT")
|
||||
paperweight.paperDevBundle("1.21.6-R0.1-SNAPSHOT")
|
||||
//paperweight.paperDevBundle("26.2.build.+")
|
||||
compileOnly("com.github.retrooper:packetevents-spigot:2.12.0")
|
||||
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")
|
||||
|
||||
@@ -109,10 +105,10 @@ tasks {
|
||||
// Your plugin's jar (or shadowJar if present) will be used automatically.
|
||||
javaLauncher = javaToolchainService.launcherFor {
|
||||
//languageVersion.set(paperRunJavaVersion.map(JavaLanguageVersion::of))
|
||||
languageVersion.set(JavaLanguageVersion.of(25))
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
minecraftVersion("26.1.2")
|
||||
//minecraftVersion("1.21.11")
|
||||
//minecraftVersion("26.1.2")
|
||||
minecraftVersion("1.21.11")
|
||||
jvmArgs("-Xms4G", "-Xmx4G", "-Dcom.mojang.eula.agree=true")
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
@@ -73,7 +89,7 @@ public class EventListener extends PaperListener {
|
||||
|
||||
if (ConfigManager.get().getUpdateConfig().notifyInGame()
|
||||
&& player.hasPermission("raycastedantiesp.updatecheck")
|
||||
&& (playerData.getJoinTick() - currentTickSupplier.getAsInt() < 10)) { //todo: centralise permission strings to prevent issues when perm names are changed
|
||||
&& (currentTickSupplier.getAsInt() - playerData.getJoinTick() < 10)) { //todo: centralise permission strings to prevent issues when perm names are changed
|
||||
checkForUpdates(plugin, player);
|
||||
}
|
||||
|
||||
|
||||
-78
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -32,6 +32,11 @@ public class PaperParticleSpawner implements ParticleSpawner {
|
||||
world.spawnParticle(Particle.DUST, spatial.x(), spatial.y(), spatial.z(), 0, toBukkitDust(colour));
|
||||
}
|
||||
|
||||
public void spawnParticleAt(UUID worldUUID, double x, double y, double z, Colour colour) {
|
||||
World world = Logger.requireNonNull(LocatableAdapterUtils.getWorld(worldUUID), "UUID resolved to nonexistent world", 2, PaperParticleSpawner.class);
|
||||
world.spawnParticle(Particle.DUST, x, y, z, 0, toBukkitDust(colour));
|
||||
}
|
||||
|
||||
private static final Particle.DustOptions RED_DUST = new Particle.DustOptions(Color.RED, 1);
|
||||
private static final Particle.DustOptions GREEN_DUST = new Particle.DustOptions(Color.GREEN, 1);
|
||||
private static final Particle.DustOptions BLUE_DUST = new Particle.DustOptions(Color.BLUE, 1);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+7
-6
@@ -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());
|
||||
|
||||
@@ -71,7 +71,7 @@ checks:
|
||||
hide-on-spawn-distance: 24
|
||||
visible-recheck-interval-ticks: -1 # -1 disables visible rechecks. When set to -1, once an entity is shown by any mechanism, it will be permanently visible.
|
||||
sound-effects:
|
||||
enabled: true
|
||||
enabled: false
|
||||
max-occluding-count: 3
|
||||
always-play-radius: 8
|
||||
raycast-radius: 48
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* 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 {
|
||||
@@ -13,3 +21,4 @@ include 'core'
|
||||
include 'platform-paper'
|
||||
include 'packetevents'
|
||||
include 'leafpile'
|
||||
include 'event-benchmark'
|
||||
Reference in new issue
Block a user