All versions
v1.2.5
Release
Red Pockets v1.2.58 months ago 17
Uploaded by
Compatibility
Minecraft: Java Edition
1.21.x
Platforms
Folia
Paper
Purpur
Changes
RedPockets Changelog
v1.2.5-Release
Fixes
1. Double refund (ChatListener & RainRedPacketManager)
- Issue: The
runDelayedexpiry task and the 5-minutegetAndRemoveExpiredcould both process the same red packet, causing duplicate refunds. - Fix: Added
removeAndGet(UUID)toRedPacketManager; refund only when the packet is successfully removed atomically; if it returnsnull, the packet was already handled by the periodic task. - Files changed:
RedPacketManager.java(newremoveAndGet),ChatListener.java,RainRedPacketManager.java
2. RedPacket.claim() race condition
- Issue: When multiple threads claimed simultaneously, another thread could insert between
claims.size()andamounts.get(index), causing duplicate allocation or index errors. - Fix: Added
synchronizedto theclaim()method to ensure atomic claiming. - Files changed:
RedPacket.java
3. RedPacket.tryUseClickClaim() redundant logic
- Issue: Race condition between
clickClaimed.contains()andclickClaimed.add();ConcurrentHashMap.newKeySet().add()returnsfalsewhen the element already exists. - Fix: Simplified to
return clickClaimed.add(playerId), using the return value ofaddto determine first-time use. - Files changed:
RedPacket.java
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle. To learn more about the Modrinth Maven API, click here.
Note: When available, you should use the creator's maven repo instead as it will have transitive dependency information that the Modrinth Maven API does not. You may also end up with duplicate dependencies if you use a mix of Modrinth and non-Modrinth Maven repositories for your dependencies, because the group identifier will be different when served through the Modrinth Maven API.
Maven coordinates:
Version ID:
build.gradle:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
// forRepositories(fg.repository) // Uncomment when using ForgeGradle
filter {
includeGroup "maven.modrinth"
}
}
}
// Standard Gradle dependency
dependencies {
implementation "maven.modrinth:PBqLhkkZ:behJr0ot"
}
// Legacy Loom dependency
dependencies {
modImplementation "maven.modrinth:PBqLhkkZ:behJr0ot"
}

