mirror of
https://github.com/Cubicake/RaycastedAntiESP.git
synced 2026-11-17 06:26:04 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4f4e64670 | ||
|
|
aaee14e4f2 | ||
|
|
791ab79f54 | ||
|
|
af3b5f166d | ||
|
|
bb4d7eebca | ||
|
|
886e2e28a4 | ||
|
|
9d0f1163e7 | ||
|
|
eda3fd12f2 | ||
|
|
fb3e1d24f3 | ||
|
|
f4878c5afa | ||
|
|
40b99d5c43 | ||
|
|
e448e18472 | ||
|
|
d806ae3c0b | ||
|
|
34fe60a7ae | ||
|
|
0ff67e11a7 | ||
|
|
98eaf72cae | ||
|
|
e5c7f6ef90 | ||
|
|
da73bb26ec | ||
|
|
bd57a9b72c | ||
|
|
116f5e8e03 | ||
|
|
bcfdd731e2 | ||
|
|
e83ec5e6a2 | ||
|
|
2b48e7e8d2 | ||
|
|
7f1a284eae | ||
|
|
87aba0e2b5 | ||
|
|
d46d63668b | ||
|
|
83a278b00a | ||
|
|
c1e0db5613 | ||
|
|
34db141f08 | ||
|
|
a68bcfdbf5 | ||
|
|
77825067de | ||
|
|
085fa59e42 | ||
|
|
2db88a4498 | ||
|
|
e9935f0350 | ||
|
|
8d39fa5427 | ||
|
|
b958d0dc46 | ||
|
|
e9adb65690 | ||
|
|
6a289c81a9 | ||
|
|
34b04ff059 | ||
|
|
1a73c2509a | ||
|
|
e3731f76f0 | ||
|
|
bd1f6ad482 | ||
|
|
951e4f4ad9 | ||
|
|
114746aeaf | ||
|
|
9dc9652917 | ||
|
|
b97f675159 | ||
|
|
f5e16fc75d | ||
|
|
c228cef24a | ||
|
|
098aab5e31 | ||
|
|
31b500bc7b | ||
|
|
d5e3281cf2 | ||
|
|
98dbefd576 | ||
|
|
4dce9b3278 | ||
|
|
d5bf02b4ea | ||
|
|
ed98e2abeb | ||
|
|
9a07bd0119 | ||
|
|
74aca26910 | ||
|
|
25f5652a12 | ||
|
|
7679f08d06 | ||
|
|
7ad99917d1 | ||
|
|
ce56eb316e | ||
|
|
74426d80af | ||
|
|
fdb1f567ac | ||
|
|
e823f7a2f7 | ||
|
|
7c1f7fd2a6 | ||
|
|
c26e6a1623 | ||
|
|
8155903342 | ||
|
|
f2ade6b0b8 | ||
|
|
f486d1fc2e | ||
|
|
50eeab8cfe | ||
|
|
4009fe6d02 | ||
|
|
b7e6fa9c5f | ||
|
|
dcc986c232 | ||
|
|
95cea9f875 |
No files matched your search
@@ -0,0 +1,15 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: cubicake
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
polar: # Replace with a single Polar username
|
||||
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
|
||||
thanks_dev: # Replace with a single thanks.dev username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
+3
-1
@@ -1,11 +1,13 @@
|
||||
# User-specific stuff
|
||||
.idea/
|
||||
|
||||
README.md
|
||||
*.md
|
||||
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
README.md
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
Latest version: v1.5.1
|
||||
|
||||
The latest version can currently only be found on Modrinth https://modrinth.com/plugin/raycasted-entity-occlusions/
|
||||
|
||||
This is an async plugin for PaperMC and its forks that hides/culls entities (and tile entities) from players if they do not have line-of-sight.
|
||||
|
||||
The supported versions are 1.21.x PaperMC and Pufferfish. Other server versions and software may work too.
|
||||
|
||||
Use cases:
|
||||
|
||||
- Prevent cheating (anti-esp hacks)
|
||||
- Block usage of pie-ray to locate underground bases
|
||||
- Prevent mods such as mini-maps or cheat clients from displaying the locations of hidden entities
|
||||
- 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. REO will cull those entities for the client, reducing the number of entities to process.
|
||||
- Hide nametags behind walls
|
||||
- Yes, this plugin is a bit overkill for doing that, yes you can do it anyways.
|
||||
|
||||
Known issues:
|
||||
- Due to the nature of the plugin, there will be a short delay once an entity should be visible before it appears, causing it to appear like it "popped" into view. This issue is partially resolved by turning engine-mode to 2
|
||||
- If cull-player is set to true any culled players will be removed from tablist. Potential solutions are being investigated, suggestions are welcome.
|
||||
+18
-2
@@ -1,9 +1,10 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id("xyz.jpenilla.run-paper") version "2.3.1"
|
||||
}
|
||||
|
||||
group = 'games.cubi'
|
||||
version = '1.6.0-dev-1'
|
||||
version = '1.6.5'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -21,10 +22,19 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT")
|
||||
compileOnly("com.github.retrooper:packetevents-spigot:2.8.0")
|
||||
}
|
||||
|
||||
tasks {
|
||||
runServer {
|
||||
// Configure the Minecraft 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.
|
||||
minecraftVersion("1.21.11")
|
||||
}
|
||||
}
|
||||
|
||||
def targetJavaVersion = 21
|
||||
java {
|
||||
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
||||
@@ -50,4 +60,10 @@ processResources {
|
||||
filesMatching('plugin.yml') {
|
||||
expand props
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes "paperweight-mappings-namespace": "mojang"
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,6 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
|
||||
|
||||
public class CommandsManager {
|
||||
private final RaycastedEntityOcclusion plugin;
|
||||
private final ConfigManager cfg;
|
||||
@@ -22,9 +20,9 @@ public class CommandsManager {
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
public LiteralCommandNode<CommandSourceStack> registerCommand() {
|
||||
public LiteralCommandNode<CommandSourceStack> registerCommand(String commandName) {
|
||||
//run help command if no context provided
|
||||
LiteralCommandNode<CommandSourceStack> buildCommand = Commands.literal("raycastedentityocclusions")
|
||||
LiteralCommandNode<CommandSourceStack> buildCommand = Commands.literal(commandName)
|
||||
.requires(sender -> sender.getSender().hasPermission("raycastedentityocclusions.command"))
|
||||
.executes(context -> {
|
||||
helpCommand(context);
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
import static games.cubi.raycastedEntityOcclusion.UpdateChecker.checkForUpdates;
|
||||
@@ -51,19 +50,20 @@ public class EventListener implements Listener {
|
||||
manager.onChunkUnload(e.getChunk());
|
||||
}
|
||||
|
||||
public static final int BREAK = 1; public static final int PLACE = 2;
|
||||
@EventHandler
|
||||
public void onPlace(BlockPlaceEvent e) {
|
||||
manager.onBlockChange(e.getBlock().getLocation(), e.getBlock().getType());
|
||||
manager.onBlockChange(e.getBlock().getLocation(), e.getBlock().getType(), PLACE);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBreak(BlockBreakEvent e) {
|
||||
manager.onBlockChange(e.getBlock().getLocation(), Material.AIR);
|
||||
manager.onBlockChange(e.getBlock().getLocation(), Material.AIR, BREAK);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBurn(BlockBurnEvent e) {
|
||||
manager.onBlockChange(e.getBlock().getLocation(), Material.AIR);
|
||||
manager.onBlockChange(e.getBlock().getLocation(), Material.AIR, BREAK);
|
||||
}
|
||||
// These events do not cover all cases, but I can't be bothered to figure out a better solution rn. Frequent snapshot refreshes is the solution. If anyone has a solution please let me know.
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package games.cubi.raycastedEntityOcclusion;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
public class Logger {
|
||||
private final static String PREFIX = "<hover:show_text:'Raycasted Entity Occlusions'><click:suggest_command:'/reo'><grey>[<gold>REO<grey>]</click></hover><reset> ";
|
||||
private final static String PREFIX_WARNING = "<hover:show_text:'Raycasted Entity Occlusions'><click:suggest_command:'/reo'><grey>[<gold>REO<grey>]</click></hover> <yellow><hover:show_text:'<yellow>Something went wrong'>[Warning]</hover> ";
|
||||
private final static String PREFIX_ERROR = "<hover:show_text:'Raycasted Entity Occlusions'><click:suggest_command:'/reo'><grey>[<gold>REO<grey>]</click></hover> <red><hover:show_text:'<red>Something went wrong'>[Error]</hover> ";
|
||||
private static JavaPlugin plugin = null;
|
||||
|
||||
private enum Level {
|
||||
INFO,
|
||||
WARN,
|
||||
ERROR
|
||||
}
|
||||
|
||||
public static void info(String message) {
|
||||
forwardLog(/*PREFIX+*/message, Level.INFO);
|
||||
}
|
||||
|
||||
public static void warning(String message) {
|
||||
forwardLog(/* PREFIX_WARNING + */ message, Level.WARN);
|
||||
}
|
||||
|
||||
public static void error(String message) {
|
||||
forwardLog(/* PREFIX_ERROR+ */ message, Level.ERROR);
|
||||
}
|
||||
|
||||
public static void debug(String message, @Range(from = 1, to = 10) int level) {
|
||||
int debugLevel = 2; // TODO: grab real debug level from config
|
||||
if (debugLevel <= level) {
|
||||
forwardLog(message, Level.INFO);
|
||||
}
|
||||
}
|
||||
|
||||
private static void forwardLog(String message, Level severity) {
|
||||
if (plugin == null) {
|
||||
plugin = JavaPlugin.getProvidingPlugin(Logger.class);
|
||||
}
|
||||
Component messageComponent = MiniMessage.miniMessage().deserialize(message);
|
||||
switch (severity) {
|
||||
case INFO:
|
||||
plugin.getComponentLogger().info(messageComponent);
|
||||
break;
|
||||
case WARN:
|
||||
plugin.getComponentLogger().warn(messageComponent);
|
||||
break;
|
||||
case ERROR:
|
||||
plugin.getComponentLogger().error(messageComponent);
|
||||
break;
|
||||
default:
|
||||
plugin.getComponentLogger().error("{} | Additionally, severity {} is not supported by the logger.", messageComponent, severity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,15 @@ public class PacketsListener implements PacketListener {
|
||||
@Override
|
||||
public void onPacketSend(PacketSendEvent event) {
|
||||
if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_REMOVE) {
|
||||
if (packetProcessor == null) {
|
||||
// Initialize the PacketProcessor if it hasn't been initialized yet since the initialization of the PacketsListener is on load, not on enable.
|
||||
packetProcessor = plugin.getPacketProcessor();
|
||||
}
|
||||
initializePacketProcessor();
|
||||
packetProcessor.processPlayerInfoRemovePacket(event);
|
||||
}
|
||||
}
|
||||
|
||||
private void initializePacketProcessor() {
|
||||
if (packetProcessor == null) {
|
||||
packetProcessor = plugin.getPacketProcessor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +1,39 @@
|
||||
package games.cubi.raycastedEntityOcclusion.Raycast;
|
||||
|
||||
|
||||
import games.cubi.raycastedEntityOcclusion.Logger;
|
||||
import games.cubi.raycastedEntityOcclusion.Snapshot.ChunkSnapshotManager;
|
||||
import games.cubi.raycastedEntityOcclusion.ConfigManager;
|
||||
import games.cubi.raycastedEntityOcclusion.RaycastedEntityOcclusion;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.TileState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class Engine {
|
||||
|
||||
public static ConcurrentHashMap<Location, Set<Player>> canSeeTileEntity = new ConcurrentHashMap<>();
|
||||
public static Set<Chunk> syncRecheck = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private final static BlockData STONE = Material.STONE.createBlockData();
|
||||
private final static BlockData DEEPSLATE = Material.DEEPSLATE.createBlockData();
|
||||
|
||||
private static class RayJob {
|
||||
final Player player;
|
||||
@@ -43,9 +60,32 @@ public class Engine {
|
||||
visible = v;
|
||||
}
|
||||
}
|
||||
private static class TileResult {
|
||||
final Player player;
|
||||
final Location loc;
|
||||
final boolean visible;
|
||||
|
||||
TileResult(Player p, Location location, boolean v) {
|
||||
player = p;
|
||||
loc = location;
|
||||
visible = v;
|
||||
}
|
||||
}
|
||||
|
||||
public static void runEngine(ConfigManager cfg, ChunkSnapshotManager snapMgr, MovementTracker tracker, RaycastedEntityOcclusion plugin) {
|
||||
// ----- PHASE 1: SYNC GATHER -----
|
||||
|
||||
if (!syncRecheck.isEmpty()) {
|
||||
Logger.warning(syncRecheck.size() + " chunks failed to snapshot asynchronously, rechecking them now. This message may also have been triggered if a player teleported into unloaded chunks, in which case it's safe to ignore.");
|
||||
for (Chunk c : syncRecheck) {
|
||||
if (c.isLoaded()) {
|
||||
plugin.getChunkSnapshotManager().snapshotChunkSync(c);
|
||||
syncRecheck.remove(c);
|
||||
Logger.info("Successfully rechecked chunk " + c.getX() + ", " + c.getZ() + " in world " + c.getWorld().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<RayJob> jobs = new ArrayList<>();
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (p.hasPermission("raycastedentityocclusions.bypass")) continue;
|
||||
@@ -70,9 +110,7 @@ public class Engine {
|
||||
p.showEntity(plugin, e);
|
||||
} else if (dist > cfg.raycastRadius) {
|
||||
p.hideEntity(plugin, e);
|
||||
} else if (p.canSee(e) && plugin.tick % cfg.recheckInterval != 0) {
|
||||
// player can see entity, no need to raycast
|
||||
} else {
|
||||
} else if (!p.canSee(e) || plugin.tick % cfg.recheckInterval == 0) {
|
||||
// schedule for async raycast (with or without predEye)
|
||||
jobs.add(new RayJob(p, e, eye, predEye, target));
|
||||
}
|
||||
@@ -120,14 +158,18 @@ public class Engine {
|
||||
|
||||
}
|
||||
|
||||
private final static ConcurrentLinkedQueue<TileResult> results = new ConcurrentLinkedQueue<>();
|
||||
|
||||
public static void runTileEngine(ConfigManager cfg, ChunkSnapshotManager snapMgr, MovementTracker tracker, RaycastedEntityOcclusion plugin) {
|
||||
if (cfg.checkTileEntities) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
if (p.hasPermission("raycastedentityocclusions.bypass")) continue;
|
||||
String world = p.getWorld().getName();
|
||||
World world = p.getWorld();
|
||||
//get player's chunk location
|
||||
int chunkX = p.getLocation().getBlockX() >> 4;
|
||||
int chunkZ = p.getLocation().getBlockZ() >> 4;
|
||||
Location playerLoc = p.getLocation();
|
||||
|
||||
//async run with vars passed in
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
int chunksRadius = (cfg.searchRadius + 15) / 16;
|
||||
@@ -146,28 +188,28 @@ public class Engine {
|
||||
|
||||
if (snapMgr.getMaterialAt(loc).equals(Material.BEACON)) continue;
|
||||
|
||||
double distSquared = loc.distanceSquared(p.getLocation());
|
||||
if (!loc.getWorld().equals(playerLoc.getWorld())) continue;
|
||||
double distSquared = loc.distanceSquared(playerLoc);
|
||||
if (distSquared > cfg.searchRadius * cfg.searchRadius) {
|
||||
hideTileEntity(p, loc);
|
||||
results.add(new TileResult(p, loc,false));
|
||||
continue;
|
||||
}
|
||||
if (distSquared < cfg.alwaysShowRadius * cfg.alwaysShowRadius) {
|
||||
showTileEntity(p, loc);
|
||||
results.add(new TileResult(p, loc,true));
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean result = RaycastUtil.raycast(p.getEyeLocation(), loc, cfg.maxOccludingCount, cfg.debugMode, snapMgr);
|
||||
if (cfg.engineMode == 2) {
|
||||
boolean visible = RaycastUtil.raycast(p.getEyeLocation(), loc, cfg.maxOccludingCount, cfg.debugMode, snapMgr);
|
||||
if (cfg.engineMode == 2 && !visible) {
|
||||
Location predEye = tracker.getPredictedLocation(p);
|
||||
if (predEye != null) {
|
||||
boolean result2 = RaycastUtil.raycast(predEye, loc, cfg.maxOccludingCount, cfg.debugMode, snapMgr);
|
||||
if (result2) {
|
||||
result = true;
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
syncToggleTileEntity(p, loc, result, plugin);
|
||||
if (result) {
|
||||
if (visible) {
|
||||
canSeeTileEntity.computeIfAbsent(loc, k -> ConcurrentHashMap.newKeySet()).add(p);
|
||||
} else {
|
||||
Set<Player> seenPlayers = canSeeTileEntity.get(loc);
|
||||
@@ -178,39 +220,50 @@ public class Engine {
|
||||
}
|
||||
}
|
||||
}
|
||||
results.add(new TileResult(p, loc, visible));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
for (TileResult r : results) {
|
||||
Player p = r.player;
|
||||
Location loc = r.loc;
|
||||
boolean visible = r.visible;
|
||||
|
||||
public static void hideTileEntity(Player p, Location location) {
|
||||
if (p.hasPermission("raycastedentityocclusions.bypass")) return;
|
||||
BlockData fake;
|
||||
if (location.getBlockY() < 0) {
|
||||
fake = Material.DEEPSLATE.createBlockData();
|
||||
}
|
||||
else {
|
||||
fake = Material.STONE.createBlockData();
|
||||
}
|
||||
p.sendBlockChange(location, fake);
|
||||
}
|
||||
public static void showTileEntity(Player p, Location location) {
|
||||
Block block = location.getBlock();
|
||||
BlockData data = block.getBlockData();
|
||||
p.sendBlockChange(location, data);
|
||||
|
||||
}
|
||||
public static void syncToggleTileEntity(Player p, Location loc, boolean bool, RaycastedEntityOcclusion plugin) {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (bool) {
|
||||
showTileEntity(p, loc);
|
||||
} else {
|
||||
hideTileEntity(p, loc);
|
||||
syncToggleTileEntity(p, loc, visible, plugin);
|
||||
results.remove(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void hideTileEntity(Player p, Location location, RaycastedEntityOcclusion plugin) {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (p.hasPermission("raycastedentityocclusions.bypass")) return;
|
||||
if (location.getBlockY() < 0) p.sendBlockChange(location, DEEPSLATE);
|
||||
else p.sendBlockChange(location, STONE);
|
||||
});
|
||||
}
|
||||
}
|
||||
public static void showTileEntity(Player p, Location location, RaycastedEntityOcclusion plugin) {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
Block block = location.getBlock();
|
||||
BlockState data = block.getState();
|
||||
if (data instanceof TileState tileData) {
|
||||
p.sendBlockChange(location, block.getBlockData());
|
||||
//p.sendBlockUpdate(location, tileData);
|
||||
}
|
||||
else {
|
||||
//Logger.warning("Tried to show tile entity at " + location + " to "+p.getName()+" but it was not a TileState! Block type: " + block.getType()+". Removing from the list of tile entities.");
|
||||
canSeeTileEntity.remove(location);
|
||||
plugin.getChunkSnapshotManager().removeTileEntity(location);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
}
|
||||
public static void syncToggleTileEntity(Player p, Location loc, boolean show, RaycastedEntityOcclusion plugin) {
|
||||
if (show) {
|
||||
showTileEntity(p, loc, plugin);
|
||||
} else {
|
||||
hideTileEntity(p, loc, plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,21 @@ import org.bukkit.Particle;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class RaycastUtil {
|
||||
public static boolean raycast(Location start, Location end, int maxOccluding, boolean debug, ChunkSnapshotManager snap) {
|
||||
Particle.DustOptions dustRed = null;
|
||||
Particle.DustOptions dustGreen = null;
|
||||
if (debug) {
|
||||
static Particle.DustOptions dustRed = null;
|
||||
static Particle.DustOptions dustGreen = null;
|
||||
|
||||
private static void initDebugParticles() {
|
||||
if (dustRed == null) {
|
||||
dustRed = new Particle.DustOptions(org.bukkit.Color.RED, 1f);
|
||||
}
|
||||
if (dustGreen == null) {
|
||||
dustGreen = new Particle.DustOptions(org.bukkit.Color.GREEN, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean raycast(Location start, Location end, int maxOccluding, boolean debug, ChunkSnapshotManager snap) {
|
||||
initDebugParticles();
|
||||
if (!start.getWorld().equals(end.getWorld())) return false;
|
||||
double total = start.distance(end);
|
||||
double traveled = 0;
|
||||
Location curr = start.clone();
|
||||
|
||||
@@ -24,6 +24,7 @@ public class RaycastedEntityOcclusion extends JavaPlugin implements CommandExecu
|
||||
private CommandsManager commands;
|
||||
private boolean packetEventsPresent = false;
|
||||
private PacketProcessor packetProcessor = null;
|
||||
private static RaycastedEntityOcclusion instance;
|
||||
|
||||
public int tick = 0;
|
||||
|
||||
@@ -42,24 +43,19 @@ public class RaycastedEntityOcclusion extends JavaPlugin implements CommandExecu
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
cfg = new ConfigManager(this);
|
||||
snapMgr = new ChunkSnapshotManager(this);
|
||||
tracker = new MovementTracker(this);
|
||||
tracker = new MovementTracker(this, cfg);
|
||||
commands = new CommandsManager(this, cfg);
|
||||
new UpdateChecker(this);
|
||||
getServer().getPluginManager().registerEvents(new EventListener(this, snapMgr, cfg), this);
|
||||
//Brigadier API
|
||||
LiteralCommandNode<CommandSourceStack> buildCommand = commands.registerCommand();
|
||||
|
||||
this.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, commands -> {
|
||||
commands.registrar().register(buildCommand);
|
||||
this.getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, commandRegistrar -> {
|
||||
commandRegistrar.registrar().register(commands.registerCommand("raycastedentityocclusions"));
|
||||
//alias "reo"
|
||||
commands.registrar().register(Commands.literal("reo")
|
||||
.requires(sender -> sender.getSender().hasPermission("raycastedentityocclusions.command"))
|
||||
.executes(context -> {
|
||||
new CommandsManager(this, cfg).helpCommand(context);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
})
|
||||
.redirect(buildCommand).build());
|
||||
commandRegistrar.registrar().register(commands.registerCommand("reo"));
|
||||
});
|
||||
|
||||
//bStats
|
||||
@@ -82,7 +78,7 @@ public class RaycastedEntityOcclusion extends JavaPlugin implements CommandExecu
|
||||
if (packetEventsPresent && Bukkit.getPluginManager().isPluginEnabled("packetevents")) {
|
||||
cfg.setPacketEventsPresent(true);
|
||||
packetProcessor = new PacketProcessor(RaycastedEntityOcclusion.this);
|
||||
getLogger().info("PacketEvents is enabled, enabling packet-based tablist modification.");
|
||||
Logger.info("PacketEvents is enabled, enabling packet-based tablist modification.");
|
||||
}
|
||||
}
|
||||
}.runTaskLater(this, 1L);
|
||||
@@ -104,4 +100,7 @@ public class RaycastedEntityOcclusion extends JavaPlugin implements CommandExecu
|
||||
public PacketProcessor getPacketProcessor() {
|
||||
return packetProcessor;
|
||||
}
|
||||
public static RaycastedEntityOcclusion getInstance() {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
+161
-45
@@ -1,31 +1,43 @@
|
||||
package games.cubi.raycastedEntityOcclusion.Snapshot;
|
||||
|
||||
import games.cubi.raycastedEntityOcclusion.ConfigManager;
|
||||
import games.cubi.raycastedEntityOcclusion.EventListener;
|
||||
import games.cubi.raycastedEntityOcclusion.Logger;
|
||||
import games.cubi.raycastedEntityOcclusion.Raycast.Engine;
|
||||
import games.cubi.raycastedEntityOcclusion.RaycastedEntityOcclusion;
|
||||
import org.bukkit.*;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.TileState;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ChunkSnapshotManager {
|
||||
public static class Data {
|
||||
private static class ChunkData {
|
||||
public final ChunkSnapshot snapshot;
|
||||
public final Map<Location, Material> delta = new ConcurrentHashMap<>();
|
||||
public final Set<Location> tileEntities = ConcurrentHashMap.newKeySet();
|
||||
public final ConcurrentHashMap<BlockLocation, Material> delta = new ConcurrentHashMap<>();
|
||||
public final Set<BlockLocation> tileEntities = ConcurrentHashMap.newKeySet();
|
||||
public long lastRefresh;
|
||||
public int minHeight;
|
||||
public int maxHeight;
|
||||
|
||||
public Data(ChunkSnapshot snapshot, long time) {
|
||||
public ChunkData(ChunkSnapshot snapshot, long time) {
|
||||
this.snapshot = snapshot;
|
||||
this.lastRefresh = time;
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<String, Data> dataMap = new ConcurrentHashMap<>();
|
||||
private static final ConcurrentHashMap<String, ChunkData> dataMap = new ConcurrentHashMap<>();
|
||||
private final ConfigManager cfg;
|
||||
|
||||
public ChunkSnapshotManager(RaycastedEntityOcclusion plugin) {
|
||||
@@ -33,7 +45,7 @@ public class ChunkSnapshotManager {
|
||||
//get loaded chunks and add them to dataMap
|
||||
for (World w : plugin.getServer().getWorlds()) {
|
||||
for (Chunk c : w.getLoadedChunks()) {
|
||||
dataMap.put(key(c), takeSnapshot(c, System.currentTimeMillis()));
|
||||
snapshotChunk(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,65 +55,83 @@ public class ChunkSnapshotManager {
|
||||
long now = System.currentTimeMillis();
|
||||
int chunksRefreshed = 0;
|
||||
int chunksToRefreshMaximum = getNumberOfCachedChunks() / 3;
|
||||
for (Map.Entry<String, Data> e : dataMap.entrySet()) {
|
||||
for (Map.Entry<String, ChunkData> e : dataMap.entrySet()) {
|
||||
if (now - e.getValue().lastRefresh >= cfg.snapshotRefreshInterval * 1000L && chunksRefreshed < chunksToRefreshMaximum) {
|
||||
chunksRefreshed++;
|
||||
String key = e.getKey();
|
||||
String[] parts = key.split(":");
|
||||
World w = plugin.getServer().getWorld(parts[0]);
|
||||
if (w == null) {
|
||||
plugin.getLogger().warning("ChunkSnapshotManager: World " + parts[0] + " not found. Please report this on our discord (discord.cubi.games)'");
|
||||
continue;
|
||||
}
|
||||
Chunk c = w.getChunkAt(
|
||||
Integer.parseInt(parts[1]),
|
||||
Integer.parseInt(parts[2])
|
||||
);
|
||||
e.setValue(takeSnapshot(c, now));
|
||||
snapshotChunk(key);
|
||||
}
|
||||
}
|
||||
if (cfg.debugMode) {
|
||||
plugin.getLogger().info("ChunkSnapshotManager: Refreshed " + chunksRefreshed + " chunks out of " + chunksToRefreshMaximum + " maximum.");
|
||||
Logger.info("ChunkSnapshotManager: Refreshed " + chunksRefreshed + " chunks out of " + chunksToRefreshMaximum + " maximum.");
|
||||
}
|
||||
}
|
||||
}.runTaskTimerAsynchronously(plugin, cfg.snapshotRefreshInterval * 2L, cfg.snapshotRefreshInterval * 2L /* This runs 10 times per refreshInterval, spreading out the refreshes */);
|
||||
}
|
||||
|
||||
public void onChunkLoad(Chunk c) {
|
||||
dataMap.put(key(c), takeSnapshot(c, System.currentTimeMillis()));
|
||||
snapshotChunk(c);
|
||||
}
|
||||
|
||||
public void onChunkUnload(Chunk c) {
|
||||
removeChunkSnapshot(c);
|
||||
}
|
||||
|
||||
public void snapshotChunkSync(Chunk c) {
|
||||
if ((dataMap.get(key(c)).lastRefresh + 100) < System.currentTimeMillis() - cfg.snapshotRefreshInterval * 1000L) {
|
||||
return;
|
||||
}
|
||||
dataMap.put(key(c), takeSnapshot(c, System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
public void snapshotChunk(Chunk c) {
|
||||
//if (cfg.debugMode) {
|
||||
//Logger.info("ChunkSnapshotManager: Taking snapshot of chunk " + c.getWorld().getName() + ":" + c.getX() + ":" + c.getZ());
|
||||
//}
|
||||
Bukkit.getScheduler().runTaskAsynchronously(RaycastedEntityOcclusion.getInstance(), () -> {
|
||||
dataMap.put(key(c), takeSnapshot(c, System.currentTimeMillis()));
|
||||
});
|
||||
}
|
||||
public void snapshotChunk(String key) {
|
||||
snapshotChunk(getKeyChunk(key));
|
||||
}
|
||||
public void removeChunkSnapshot(Chunk c) {
|
||||
if (cfg.debugMode) {
|
||||
Logger.info("ChunkSnapshotManager: Removing snapshot of chunk " + c.getWorld().getName() + ":" + c.getX() + ":" + c.getZ());
|
||||
}
|
||||
dataMap.remove(key(c));
|
||||
}
|
||||
|
||||
// Used by EventListener to update the delta map when a block is placed or broken
|
||||
public void onBlockChange(Location loc, Material m) {
|
||||
public void onBlockChange(Location loc, Material m, int change) {
|
||||
if (cfg.debugMode) {
|
||||
Bukkit.getLogger().info("ChunkSnapshotManager: Block change at " + loc + " to " + m);
|
||||
Logger.info("ChunkSnapshotManager: Block change at " + loc + " to " + m);
|
||||
}
|
||||
Data d = dataMap.get(key(loc.getChunk()));
|
||||
ChunkData d = dataMap.get(key(loc.getChunk()));
|
||||
if (d != null) {
|
||||
d.delta.put(loc, m);
|
||||
d.delta.put(BlockLocation.fromLocation(loc), m);
|
||||
if (cfg.checkTileEntities) {
|
||||
// Check if the block is a tile entity
|
||||
BlockState data = loc.getBlock().getState();
|
||||
loc = loc.clone().add(0.5, 0.5, 0.5);
|
||||
if (data instanceof TileState) {
|
||||
if (cfg.debugMode){
|
||||
Bukkit.getLogger().info("ChunkSnapshotManager: Tile entity at " + loc);
|
||||
if (cfg.debugMode) {
|
||||
Logger.info("ChunkSnapshotManager: Tile entity at " + loc);
|
||||
}
|
||||
if (change == EventListener.PLACE) {
|
||||
d.tileEntities.add(BlockLocation.fromLocation(loc));
|
||||
}
|
||||
if (change == EventListener.BREAK) {
|
||||
d.tileEntities.remove(BlockLocation.fromLocation(loc));
|
||||
}
|
||||
d.tileEntities.add(loc);
|
||||
} else {
|
||||
d.tileEntities.remove(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {Logger.error("Data map value empty, ignoring block update!");}
|
||||
}
|
||||
|
||||
private Data takeSnapshot(Chunk c, long now) {
|
||||
private ChunkData takeSnapshot(Chunk c, long now) {
|
||||
World w = c.getWorld();
|
||||
Data data = new Data(c.getChunkSnapshot(), now);
|
||||
ChunkData data = new ChunkData(c.getChunkSnapshot(), now);
|
||||
int chunkX = c.getX() * 16;
|
||||
int chunkZ = c.getZ() * 16;
|
||||
int minHeight = w.getMinHeight();
|
||||
@@ -115,7 +145,7 @@ public class ChunkSnapshotManager {
|
||||
BlockState bs = data.snapshot.getBlockData(x, y, z).createBlockState();
|
||||
|
||||
if (bs instanceof TileState) {
|
||||
data.tileEntities.add(new Location(w, x+ chunkX +0.5, y+0.5, z + chunkZ+0.5));
|
||||
data.tileEntities.add(BlockLocation.fromValues(w, x+ chunkX, y, z + chunkZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,24 +154,44 @@ public class ChunkSnapshotManager {
|
||||
return data;
|
||||
}
|
||||
|
||||
private String key(Chunk c) {
|
||||
public String key(Chunk c) {
|
||||
return c.getWorld().getName() + ":" + c.getX() + ":" + c.getZ();
|
||||
}
|
||||
public String key(World world, int x, int z) {
|
||||
return world.getName() + ":" + x + ":" + z;
|
||||
}
|
||||
public int getKeyX(String key) {
|
||||
String[] parts = key.split(":");
|
||||
return Integer.parseInt(parts[1]);
|
||||
}
|
||||
public int getKeyZ(String key) {
|
||||
String[] parts = key.split(":");
|
||||
return Integer.parseInt(parts[2]);
|
||||
}
|
||||
public World getKeyWorld(String key) {
|
||||
String[] parts = key.split(":");
|
||||
return Bukkit.getWorld(parts[0]);
|
||||
}
|
||||
public Chunk getKeyChunk(String key) {
|
||||
return getKeyWorld(key).getChunkAt(getKeyX(key), getKeyZ(key));
|
||||
}
|
||||
|
||||
public Material getMaterialAt(Location loc) {
|
||||
Data d = dataMap.get(key(loc.getChunk()));
|
||||
Chunk chunk = loc.getChunk();
|
||||
ChunkData d = dataMap.get(key(chunk));
|
||||
if (d == null) {
|
||||
Chunk c = loc.getChunk();
|
||||
//dataMap.put(key(c), takeSnapshot(c, System.currentTimeMillis())); infinite loop
|
||||
System.err.println("ChunkSnapshotManager: No snapshot for " + c+ " Please report this on our discord (discord.cubi.games)'");
|
||||
return loc.getBlock().getType();
|
||||
//Chunk c = loc.getChunk();
|
||||
//Logger.error("ChunkSnapshotManager: No snapshot for " + c+ " If this error persists, please report this on our discord (discord.cubi.games)");
|
||||
Engine.syncRecheck.add(chunk);
|
||||
return Material.AIR;
|
||||
}
|
||||
double yLevel = loc.getY();
|
||||
if (yLevel < d.minHeight || yLevel > d.maxHeight) {
|
||||
return null;
|
||||
}
|
||||
Material dm = d.delta.get(loc);
|
||||
Material dm = d.delta.get(BlockLocation.fromLocation(loc));
|
||||
if (dm != null) {
|
||||
if (cfg.debugMode) Logger.info("Using delta");
|
||||
return dm;
|
||||
}
|
||||
int x = loc.getBlockX() & 0xF;
|
||||
@@ -152,12 +202,25 @@ public class ChunkSnapshotManager {
|
||||
}
|
||||
|
||||
//get TileEntity Locations in chunk
|
||||
public Set<Location> getTileEntitiesInChunk(String worldName, int x, int z) {
|
||||
Data d = dataMap.get(worldName + ":" + x + ":" + z);
|
||||
public Set<Location> getTileEntitiesInChunk(World world, int x, int z) {
|
||||
ChunkData d = dataMap.get(key(world, x, z));
|
||||
if (d == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return d.tileEntities;
|
||||
return BlockLocation.toLocations(d.tileEntities);
|
||||
}
|
||||
|
||||
public void removeTileEntity(Location loc) {
|
||||
Chunk c = loc.getChunk();
|
||||
ChunkData d = dataMap.get(key(c));
|
||||
if (d != null) {
|
||||
d.tileEntities.remove(BlockLocation.fromLocation(loc));
|
||||
if (cfg.debugMode) {
|
||||
Logger.info("ChunkSnapshotManager: Removed tile entity at " + loc);
|
||||
}
|
||||
} else {
|
||||
Logger.error("ChunkSnapshotManager: No snapshot for " + c + " when removing tile entity at " + loc);
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumberOfCachedChunks() {
|
||||
@@ -165,4 +228,57 @@ public class ChunkSnapshotManager {
|
||||
//created to use in a debug command maybe
|
||||
}
|
||||
|
||||
private static class BlockLocation {
|
||||
private final Location location;
|
||||
private final int hashCode;
|
||||
|
||||
private BlockLocation(Location location) {
|
||||
this.location = location.toCenterLocation();
|
||||
this.location.setPitch(0);
|
||||
this.location.setYaw(0);
|
||||
hashCode = calculateHashCode();
|
||||
}
|
||||
|
||||
static BlockLocation fromLocation(Location loc) {
|
||||
return new BlockLocation(loc);
|
||||
}
|
||||
|
||||
static BlockLocation fromValues(World world, double x, double y, double z) {
|
||||
return new BlockLocation(new Location(world, x, y, z));
|
||||
}
|
||||
|
||||
static Location toLocation(BlockLocation blockLocation) {
|
||||
return blockLocation.location.clone();
|
||||
}
|
||||
|
||||
static Set<Location> toLocations(Set<BlockLocation> blockLocations) {
|
||||
Set<Location> locations = new HashSet<>();
|
||||
for (BlockLocation bl : blockLocations) {
|
||||
locations.add(toLocation(bl));
|
||||
}
|
||||
return locations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof BlockLocation)) return false;
|
||||
Location other = ((BlockLocation) o).location;
|
||||
|
||||
return (this.location.getX() == other.getX()) && (this.location.getY() == other.getY()) && (this.location.getZ() == other.getZ()) && (this.location.getWorld().equals(other.getWorld()));
|
||||
}
|
||||
|
||||
private int calculateHashCode() {
|
||||
int result = 17;
|
||||
result = 31 * result + location.getBlockX();
|
||||
result = 31 * result + location.getBlockY();
|
||||
result = 31 * result + location.getBlockZ();
|
||||
return 31 * result + location.getWorld().getUID().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import com.google.gson.JsonParser;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -31,13 +30,12 @@ public class UpdateChecker {
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
|
||||
final String url = "https://api.modrinth.com/v2/project/raycasted-entity-occlusions/version?featured=true";
|
||||
final String url = "https://api.modrinth.com/v2/project/bCjNZu0C/version?version_type=release";
|
||||
try (final InputStreamReader reader = new InputStreamReader(new URL(url).openConnection().getInputStream())) {
|
||||
final JsonArray array = new JsonArray();
|
||||
array.add(new BufferedReader(reader).readLine());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
|
||||
sb.append(array.get(i).getAsString());
|
||||
}
|
||||
String apiData = sb.toString();
|
||||
@@ -54,20 +52,57 @@ public class UpdateChecker {
|
||||
return future;
|
||||
}
|
||||
|
||||
private static final int INVALID_VERSION_FORMAT = -2; private static final int CURRENT_IS_OLDER = -1; private static final int VERSIONS_ARE_EQUAL = 0; private static final int CURRENT_IS_NEWER = 1;
|
||||
|
||||
private static int checkIfLaterThan(String currentVersion, String fetchedVersion) {
|
||||
String[] currentParts = currentVersion.replace("v", "").split("[.-]");
|
||||
String[] fetchedParts = fetchedVersion.replace("v", "").split("[.-]");
|
||||
|
||||
if (currentParts.length < 3 || fetchedParts.length < 3) {
|
||||
return INVALID_VERSION_FORMAT;
|
||||
}
|
||||
|
||||
int majorVersionDifference = Integer.parseInt(currentParts[0]) - Integer.parseInt(fetchedParts[0]);
|
||||
|
||||
if (majorVersionDifference == VERSIONS_ARE_EQUAL) {
|
||||
int minorVersionDifference = Integer.parseInt(currentParts[1]) - Integer.parseInt(fetchedParts[1]);
|
||||
|
||||
if (minorVersionDifference == VERSIONS_ARE_EQUAL) {
|
||||
int patchVersionDifference = Integer.parseInt(currentParts[2]) - Integer.parseInt(fetchedParts[2]);
|
||||
return patchVersionDifference;
|
||||
}
|
||||
return minorVersionDifference;
|
||||
}
|
||||
return majorVersionDifference;
|
||||
}
|
||||
|
||||
public static void checkForUpdates(RaycastedEntityOcclusion plugin, CommandSender audience) {
|
||||
fetchFeaturedVersion(plugin).thenAccept(version -> {
|
||||
// This runs synchronously when the version is fetched
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
if (plugin.getDescription().getVersion().equals(version)) {
|
||||
int versionCheck = checkIfLaterThan(plugin.getDescription().getVersion(), version);
|
||||
|
||||
if (versionCheck == VERSIONS_ARE_EQUAL) {
|
||||
audience.sendRichMessage("<green>You are using the latest version of Raycasted Entity Occlusions.");
|
||||
} else {
|
||||
audience.sendRichMessage("<red>You are not using the latest version of Raycasted Entity Occlusions. Please update to <green>v" + version);
|
||||
}
|
||||
|
||||
if (versionCheck == CURRENT_IS_OLDER) {
|
||||
audience.sendRichMessage("<red>You are not using the latest version of Raycasted Entity Occlusions. Please update to <green>v" + version+".");
|
||||
if (audience instanceof Player) audience.sendRichMessage("\n" + "<hover:show_text:'https://modrinth.com/project/bCjNZu0C/versions'><aqua><u><click:open_url:'https://modrinth.com/project/bCjNZu0C/versions'>Click here to download it.</click></u></aqua></hover>");
|
||||
}
|
||||
|
||||
if (versionCheck == CURRENT_IS_NEWER) {
|
||||
audience.sendRichMessage("<yellow>You are using a development build of Raycasted Entity Occlusions. The latest stable version is <green>v" + version + "<yellow>.");
|
||||
}
|
||||
|
||||
if (versionCheck == INVALID_VERSION_FORMAT) {
|
||||
audience.sendRichMessage("<red>Unable to check for updates, invalid version format.");
|
||||
}
|
||||
});
|
||||
}).exceptionally(ex -> {
|
||||
// Handle error (e.g., log the exception)
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
plugin.getLogger().warning("Failed to fetch version: " + ex.getMessage());
|
||||
Logger.warning("Failed to fetch version: " + ex.getMessage());
|
||||
});
|
||||
return null;
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: RaycastedEntityOcclusions
|
||||
version: ${version}
|
||||
main: games.cubi.raycastedEntityOcclusion.RaycastedEntityOcclusion
|
||||
api-version: '1.21'
|
||||
api-version: '1.20.6'
|
||||
prefix: REO
|
||||
authors: [ _Cubicake ]
|
||||
load: STARTUP
|
||||
@@ -16,5 +16,8 @@ permissions:
|
||||
raycastedentityocclusions.updatecheck:
|
||||
description: Permission to check for plugin updates
|
||||
default: op
|
||||
raycastedentityocclusions.receivelogmessages:
|
||||
description: Permission to receive log messages which are sent to the console
|
||||
default: false
|
||||
softdepend:
|
||||
- packetevents
|
||||
Reference in new issue
Block a user