Skip to content
Merged

5.0.0 #103

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
5715590
Started work on complete re-write
sarhatabaot Oct 9, 2025
7224100
More work and changes
sarhatabaot Oct 10, 2025
5250761
Fix some compiling issues
sarhatabaot Oct 11, 2025
3a8fce5
Abstracted removal mode
sarhatabaot Oct 11, 2025
10d4fb2
Finish impl for removal modes
sarhatabaot Oct 11, 2025
c68a0f6
Minor changes
sarhatabaot Oct 11, 2025
c487dd1
Impl tasks & removal
sarhatabaot Oct 12, 2025
5cd322c
Moved modes into their own package
sarhatabaot Oct 12, 2025
1689b4b
Add command library
sarhatabaot Oct 12, 2025
e908d52
Create AdminCommand.java
sarhatabaot Oct 12, 2025
292038e
Added prep for commands & plugin.yml
sarhatabaot Oct 15, 2025
3bed782
Added caching to config & added command formats
sarhatabaot Oct 16, 2025
ac85bbd
Implemented all old commands with changes
sarhatabaot Oct 16, 2025
650d02e
Add simple run task
sarhatabaot Oct 16, 2025
fd5cfa2
Actually impl queue tasks
sarhatabaot Oct 16, 2025
3205347
Added better debug logging
sarhatabaot Oct 16, 2025
ab578b1
Fix some logic issues with entity group
sarhatabaot Oct 16, 2025
2be67fa
Fix some issues with entity groups
sarhatabaot Oct 16, 2025
6a4c2c2
Minor changes
sarhatabaot Oct 16, 2025
aa094d6
Added world check logic
sarhatabaot Oct 16, 2025
a73d828
Add some checks
sarhatabaot Oct 16, 2025
49ed53b
Added world check logic
sarhatabaot Oct 17, 2025
d36d3b9
Add recheck functionallity
sarhatabaot Oct 17, 2025
e1a544d
Added checks & additional potential changes
sarhatabaot Oct 18, 2025
72bfc38
Small readme & config updates
sarhatabaot Oct 18, 2025
59c7a3a
Impl nbt check
sarhatabaot Oct 19, 2025
e2b9584
Forgot to init
sarhatabaot Oct 19, 2025
7c067d3
Keep the it consistent
sarhatabaot Oct 19, 2025
eea2e02
Moved to checks to util class
sarhatabaot Oct 19, 2025
43b8ce8
Caching reflection
sarhatabaot Oct 19, 2025
9881543
Removed rebuild command
sarhatabaot Oct 19, 2025
568f808
Add api version
sarhatabaot Oct 19, 2025
d2c7994
When enforcing, return the placed item to the player
sarhatabaot Oct 29, 2025
3f2448c
Properly cache the chunk
sarhatabaot Oct 29, 2025
a50e75a
Update build.gradle.kts
sarhatabaot Oct 29, 2025
5f0b7cc
Fix a mistake in the config
sarhatabaot Nov 1, 2025
60b185a
Try out nms block scanning
sarhatabaot Nov 2, 2025
4caa8ef
Some more optimizations
sarhatabaot Nov 20, 2025
d03a113
Cleanup & preperation for 2nd nms iteration
sarhatabaot Nov 22, 2025
3726214
Remove old nms changes
sarhatabaot Nov 22, 2025
1e847aa
Actually check the correct group
sarhatabaot Nov 22, 2025
bc6b38e
Some cleanup
sarhatabaot Dec 13, 2025
4aa87e3
Additional small fixes
sarhatabaot Dec 13, 2025
c31bd28
Simplified entities methods
sarhatabaot Dec 13, 2025
edf6f49
Update NmsBlockScanner.java
sarhatabaot Dec 13, 2025
18d7705
Sort out some minor issues
sarhatabaot Dec 20, 2025
477411a
Finish removing deprecated methods
sarhatabaot Dec 20, 2025
20b6aa0
More refactoring & improvements
sarhatabaot Dec 20, 2025
9b47053
Add notifications
sarhatabaot Dec 21, 2025
3cd9095
Reworked the nms scanner
sarhatabaot Dec 21, 2025
17dec90
Impl various tests
sarhatabaot Dec 30, 2025
56eacc5
Tests tests tests
sarhatabaot Jan 3, 2026
fb60496
More and more test fixes
sarhatabaot Jan 3, 2026
e479af3
More & more & more tests
sarhatabaot Jan 3, 2026
a83855f
Fixed even more tests
sarhatabaot Jan 3, 2026
fe74567
Fix a spelling mistake oops...
sarhatabaot Jan 3, 2026
8a9f778
Update build.gradle.kts
sarhatabaot Jan 3, 2026
33e1d99
RC4
sarhatabaot Jan 3, 2026
b71178a
Update PluginIntegrationLegacyTest.java
sarhatabaot Jan 3, 2026
d90497f
Merge pull request #100 from sarhatabaot/nms-block-scanning
sarhatabaot Jan 3, 2026
12adf3d
Remove old folder
sarhatabaot Jan 3, 2026
f1d0779
Fix bad performance on chunk unload
sarhatabaot Jan 17, 2026
96690db
Small optimization for AtomicInteger's
sarhatabaot Jan 17, 2026
bf11714
Implement save spawn eggs
sarhatabaot Jan 23, 2026
91b2fb7
Cache worlds list
sarhatabaot Jan 28, 2026
2e0198f
Added perdiodic purging for disabled worlds
sarhatabaot Jan 28, 2026
93faba2
Update build.gradle.kts
sarhatabaot Jan 28, 2026
b07694c
Cleanup & Minor changes
sarhatabaot Feb 4, 2026
a814dd7
We are reading for 5.0.0
sarhatabaot Feb 4, 2026
b4f269f
Merge pull request #102 from sarhatabaot/RC5
sarhatabaot Feb 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/1-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ body:
attributes:
label: "Plugin Version"
description: "Which version of the plugin are you using?"
placeholder: "e.g. 4.3.12"
placeholder: "e.g. 5.0.0"
- type: textarea
id: expected-behavior
attributes:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ dependency-reduced-pom.xml

.gradle
build

DESIGN.md

run

old
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ This plugin is especially useful for large servers or resource-constrained envir
* Spawner Limits: Enforce per-chunk spawner limits.
* Customizable: Adjust limits via configuration files.
* Lightweight: Minimal performance impact on your server.
* Support for Multiple Versions: Works with Minecraft 1.13-1.18+.
* Support for Multiple Versions: Works with Minecraft 1.8.8-1.21.10.

## Release Notes (5.0.0)

### Known Limitations

- **Async chunk scanning**: chunk block scans currently run asynchronously for performance. Some server implementations may treat Bukkit world access off the main thread as unsafe. If you encounter instability, consider disabling async scans or switching to synchronous scanning until a thread-safe scan path is introduced.
181 changes: 161 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,199 @@ plugins {
java
alias(libs.plugins.shadow)
alias(libs.plugins.plugin.yml)
alias(libs.plugins.run.paper)
}
version = "4.4.4"
description = "Limit entities in chunks."

group = "com.github.sarhatabaot"
version = "5.0.0"
description = "Limit blocks & entities in chunks."

dependencies {
compileOnly(libs.spigot.api)
compileOnly(libs.nbt.api)

implementation(libs.bstats)
implementation(libs.acf)
implementation(libs.annotations)
implementation(libs.jcip)

implementation(libs.commands)

testImplementation(libs.mockbukkit)
testImplementation(libs.assertj.core)
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.ADOPTIUM)
}
}
bukkit {
name = "ChunkSpawnerLimiter"
main = "com.cyprias.chunkspawnerlimiter.ChunkSpawnerLimiter"
name = rootProject.name
main = "com.github.sarhatabaot.chunkspawnerlimiter.ChunkSpawnerLimiter"
version = project.version.toString()
apiVersion = "1.14"
website = "https://github.com/sarhatabaot/ChunkSpawnerLimiter"
authors = listOf("Cyprias", "sarhatabaot")
website = "https://github.com/Cyprias/ChunkSpawnerLimiter"
description = "Limit entities in chunks."
load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD
prefix = "CSL"
apiVersion = "1.13"
softDepend = listOf("NBTAPI") //todo, this way we keep it small
}

tasks {
runServer {
//use this to manually test various version load, probably should use docker with ci/cd for the automated version
//todo amazing 1.13-1.16 breaks with jvm 21, the rest works, lmao, mention this on the website
minecraftVersion("1.20.1")
jvmArgs("-Dcom.mojang.eula.agree=true")
}


// Define your versions
val minecraftVersions = listOf("1.8.8", "1.9.4", "1.12.2", "1.16.5", "1.20.1", "1.21.10")

// Create tasks for each version
minecraftVersions.forEach { version ->
// Convert version to valid task name (replace dots with underscores)
val taskName = "runServer${version.replace(".", "_")}"

register(taskName) {
group = "minecraft"
description = "Run Minecraft server version $version"
dependsOn(runServer)
doFirst {
// Set the minecraft version on the base task
(runServer.get() as Task).extensions.extraProperties.set("minecraftVersion", version)
(runServer.get() as Task).extensions.extraProperties.set("jvmArgs", "-Dcom.mojang.eula.agree=true")
// Or if runServer has a property/method for setting version:
// runServer.get().setMinecraftVersion(version)
}
}
}

build {
dependsOn(shadowJar)
}

shadowJar {
minimize()

exclude("META-INF/**")

archiveFileName.set("chunkspawnerlimiter-${project.version}.jar")
archiveClassifier.set("shadow")

relocate("org.bstats", "com.cyprias.chunkspawnerlimiter.libs.bstats")
relocate("co.aikar.commands", "com.cyprias.chunkspawnerlimiter.libs.acf")
relocate("co.aikar.locales", "com.cyprias.chunkspawnerlimiter.libs.locales")
exclude("META-INF/**")

relocate("me.despical.commandframework","com.github.sarhatabaot.chunkspawnerlimiter.libs")
relocate("org.bstats", "com.github.sarhatabaot.chunkspawnerlimiter.libs")
}

compileJava {
options.compilerArgs.add("-parameters")
options.isFork = true
options.encoding = "UTF-8"
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
vendor.set(JvmVendorSpec.ADOPTIUM)
testing {
suites {
// Unit tests - version agnostic
val test by getting(JvmTestSuite::class) {
useJUnitJupiter()

dependencies {
implementation(libs.spigot.api)
implementation(libs.adventure.api)
implementation(libs.junit.api)
runtimeOnly(libs.junit.engine)
implementation(libs.mockito.core)
implementation(libs.mockito.junit.jupiter)
implementation(libs.assertj.core)
implementation(libs.commands)
}

targets {
all {
testTask.configure {
useJUnitPlatform()
}
}
}
}

// Legacy integration tests (1.8-1.12)
val testLegacy by creating(JvmTestSuite::class) {
useJUnitJupiter()

sources {
java {
srcDir("src/testLegacy/java")
compileClasspath += project.sourceSets.main.get().output
runtimeClasspath += project.sourceSets.main.get().output
}
}

dependencies {
implementation(libs.spigot.api)
implementation(libs.adventure.api)
implementation(libs.bstats)
implementation(libs.junit.api)
runtimeOnly(libs.junit.engine)
implementation(libs.mockito.core)
implementation(libs.mockito.junit.jupiter)
implementation(libs.assertj.core)
implementation(libs.mockbukkit.legacy)
implementation(libs.commands)
}

targets {
all {
testTask.configure {
useJUnitPlatform()
group = "verification"
description = "Runs legacy integration tests for Minecraft 1.8-1.12"
}
}
}
}

// Modern integration tests (1.17+)
val testModern by creating(JvmTestSuite::class) {
useJUnitJupiter()

sources {
java {
srcDir("src/testModern/java")
compileClasspath += project.sourceSets.main.get().output
runtimeClasspath += project.sourceSets.main.get().output
}
}

dependencies {
implementation(libs.paper.api)
implementation(libs.adventure.api)
implementation(libs.junit.api)
runtimeOnly(libs.junit.engine)
implementation(libs.mockito.core)
implementation(libs.mockito.junit.jupiter)
implementation(libs.assertj.core)
implementation(libs.mockbukkit)
implementation(libs.commands)
}

targets {
all {
testTask.configure {
useJUnitPlatform()
group = "verification"
description = "Runs modern integration tests for Minecraft 1.17+"
}
}
}
}
}
}
}

tasks.named("check") {
dependsOn(
testing.suites.named("testLegacy"),
// testing.suites.named("testModern") for now TODO
)
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
20 changes: 0 additions & 20 deletions internal-messages/command.json

This file was deleted.

9 changes: 0 additions & 9 deletions internal-messages/debug.json

This file was deleted.

34 changes: 26 additions & 8 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,39 @@ rootProject.name = "ChunkSpawnerLimiter"

dependencyResolutionManagement {
repositories {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
mavenCentral()
maven("https://jitpack.io")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://repo.codemc.org/repository/maven-public")
maven("https://repo.aikar.co/content/groups/aikar/")
maven("https://repo.loohpjames.com/repository/")
maven("https://repo.codemc.io/repository/maven-public/")
maven("https://repo.papermc.io/repository/maven-public/")
}

versionCatalogs {
create("libs") {
library("spigot-api", "org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT")
library("spigot-api", "org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT")
library("paper-api", "io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT")
library("bstats", "org.bstats:bstats-bukkit:3.1.0")
library("acf", "co.aikar:acf-paper:0.5.1-SNAPSHOT")
library("annotations", "org.jetbrains:annotations:26.0.2")
library("annotations", "org.jetbrains:annotations:26.0.2-1")
library("commands", "com.github.despical:command-framework:1.5.3")
library("nbt-api", "de.tr7zw:item-nbt-api-plugin:2.15.3")
library("jcip", "com.google.code.findbugs:jsr305:3.0.2")

plugin("plugin-yml","net.minecrell.plugin-yml.bukkit").version("0.6.0")
plugin("shadow","com.gradleup.shadow").version("8.3.1")
library("junit-api", "org.junit.jupiter:junit-jupiter-api:5.14.0")
library("junit-engine", "org.junit.jupiter:junit-jupiter-engine:5.14.0")
library("mockito-core", "org.mockito:mockito-core:5.14.0")
library("mockito-junit-jupiter", "org.mockito:mockito-junit-jupiter:5.14.0")
library("assertj-core", "org.assertj:assertj-core:3.26.3")

library("adventure-api", "net.kyori:adventure-api:4.14.0")
library("mockbukkit", "org.mockbukkit.mockbukkit:mockbukkit-v1.21:4.98.4")
library("mockbukkit-legacy", "com.github.MockBukkit:MockBukkit:v1.8-SNAPSHOT")

plugin("run-paper", "xyz.jpenilla.run-paper").version("2.3.1")
plugin("shadow", "com.gradleup.shadow").version("9.2.2")
plugin("plugin-yml", "de.eldoria.plugin-yml.bukkit").version("0.8.0")
}
}
}

}
Loading
Loading