Compare commits

...
4 Commits
Author SHA1 Message Date
Cubicake 9d0f1163e7 Remove use of brigadier redirects [Todo: Pull change to main] 2025-11-12 13:38:17 +10:30
Cubicake eda3fd12f2 Lower minimum version to v1.20.6 2025-11-12 13:37:46 +10:30
Cubicake fb3e1d24f3 Make Async 2025-11-12 13:37:31 +10:30
Cubicake f4878c5afa Make Async 2025-11-12 08:50:39 +10:30
5 changed files with 16 additions and 16 deletions

No files matched your search

+2 -2
View File
@@ -4,7 +4,7 @@ plugins {
}
group = 'games.cubi'
version = '1.6.3-backport'
version = '1.6.4'
repositories {
mavenCentral()
@@ -31,7 +31,7 @@ tasks {
// 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.10")
minecraftVersion("1.20.6")
}
}
@@ -20,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);
@@ -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,6 +43,7 @@ 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, cfg);
@@ -49,18 +51,11 @@ public class RaycastedEntityOcclusion extends JavaPlugin implements CommandExecu
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
@@ -105,4 +100,7 @@ public class RaycastedEntityOcclusion extends JavaPlugin implements CommandExecu
public PacketProcessor getPacketProcessor() {
return packetProcessor;
}
public static RaycastedEntityOcclusion getInstance() {
return instance;
}
}
@@ -81,7 +81,9 @@ public class ChunkSnapshotManager {
//if (cfg.debugMode) {
//Logger.info("ChunkSnapshotManager: Taking snapshot of chunk " + c.getWorld().getName() + ":" + c.getX() + ":" + c.getZ());
//}
dataMap.put(key(c), takeSnapshot(c, System.currentTimeMillis()));
Bukkit.getScheduler().runTaskAsynchronously(RaycastedEntityOcclusion.getInstance(), () -> {
dataMap.put(key(c), takeSnapshot(c, System.currentTimeMillis()));
});
}
public void snapshotChunk(String key) {
snapshotChunk(getKeyChunk(key));
+1 -1
View File
@@ -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