Compare commits

..
2 Commits
Author SHA1 Message Date
Cubicake e97bad3279 Merge pull request #87 from Cubicake/main
Update velocity branch
2026-08-21 12:33:18 +09:30
Cubicake 49812cc476 VERY early stages of velocity port 2026-07-09 13:26:50 +09:30
15 changed files with 238 additions and 37 deletions

No files matched your search

@@ -8,6 +8,7 @@
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;
@@ -24,8 +25,6 @@ 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;
@@ -121,9 +120,6 @@ 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.
*
@@ -131,11 +127,6 @@ 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: d49fa5bc39...dca89261e9.
+4
View File
@@ -21,6 +21,7 @@ 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 {
@@ -30,6 +31,9 @@ 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,10 +17,9 @@ 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;
@@ -45,9 +44,6 @@ 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) {
@@ -62,23 +58,11 @@ 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 (!playerValidityCheckEventRegistry.dispatch(new PlayerValidityCheckEvent(player))) return;
if (player.hasMetadata("NPC")) return;
PlayerData playerData = PlayerRegistry.getInstance().getPlayerData(player.getUniqueId());
if (playerData == null) {
@@ -0,0 +1,78 @@
/*
* 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,6 +120,7 @@ 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,8 +69,7 @@ public class PacketEventsPaperBlockInfoResolver implements BlockInfoResolver {
run = false;
continue;
}
Material material = blockData.getMaterial();
if (material == Material.AIR) {
if (blockData.getMaterial() == 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;
@@ -80,12 +79,12 @@ public class PacketEventsPaperBlockInfoResolver implements BlockInfoResolver {
else {
airs = 0;
lastNonAirID = iterator;
if (materialToIDMode) {
Logger.info(blockData.getAsString() + iterator,1);
}
}
boolean occluding = material != Material.BARRIER && material.isOccluding();
if (materialToIDMode && material != Material.AIR) {
Logger.info(blockData.getAsString() + iterator + occluding,1);
}
occlusion.put(iterator, occluding);
occlusion.put(iterator, blockData.getMaterial().isOccluding());
try {
if (blockData.createBlockState() instanceof TileState) {
//Logger.debug("tile at" + iterator + " is tile entity" + material.name());
+62
View File
@@ -0,0 +1,62 @@
/*
* 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
@@ -0,0 +1,8 @@
#
# 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.
#
@@ -0,0 +1,9 @@
#
# 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
@@ -0,0 +1,9 @@
/*
* 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'
@@ -0,0 +1,32 @@
/*
* 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) {
}
}
@@ -0,0 +1,15 @@
/*
* 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,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 'platform-velocity'