Skip to content

feat: autodisband inactive clans#22

Draft
Copilot wants to merge 3 commits intoversion/1.21.11from
copilot/autodisband-inactive-clans
Draft

feat: autodisband inactive clans#22
Copilot wants to merge 3 commits intoversion/1.21.11from
copilot/autodisband-inactive-clans

Conversation

Copy link

Copilot AI commented Feb 24, 2026

Clans accumulate over time as players create them and never use them, blocking tags and names. This adds periodic automatic deletion of clans where no member has been online within a configurable threshold.

Database

  • New nullable last_activity column (epoch millis) on clan_clans — existing rows get NULL and are excluded from auto-disband until a member logs in

Activity tracking

  • Velocity: JoinInviteListener updates clan lastActivity on network join
  • Paper: new PlayerActivityListener does the same for standalone deployments

Auto-disband task

  • Background coroutine in ClanInstance runs on a configurable interval, queries for clans with lastActivity < now - threshold, deletes them via the existing delete() flow (cache invalidation + listener notifications)

Configuration

auto-disband:
  enabled: false        # opt-in
  inactivity-days: 90
  check-interval-hours: 24

Notes

  • ClanImpl.lastActivity has a default value (null) so existing Redis-cached entries deserialize without issues
  • Clans with lastActivity = NULL (pre-existing) are never auto-disbanded — the timer starts once any member logs in post-deploy
  • SchemaUtils.create may not add the new column to existing tables; manual migration or switching to createMissingTablesAndColumns may be needed for existing deployments

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • downloads.gradle.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Xmx64m -Xms64m -Dorg.gradle.appname=gradlew -jar /home/REDACTED/work/surf-clan/surf-clan/gradle/wrapper/gradle-wrapper.jar :surf-clan-runtime:dependencies --configuration runtimeClasspath (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Xmx64m -Xms64m -Dorg.gradle.appname=gradlew -jar /home/REDACTED/work/surf-clan/surf-clan/gradle/wrapper/gradle-wrapper.jar :surf-clan-runtime:dependencies ep/bin/linux-x64/rg (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Autodisband inactive clans</issue_title>
<issue_description>Aktuelle erstellt jeder Spieler seinen eigenen Clan. Teilweise existieren hunderte von Clans, die teilweise nur ein Mitglied (den Owner) haben. Dazu kommt, dass Spieler oft den Clan nicht wirklich nutzen. Dies führt dazu, dass Clantags und Namen durch diese unbenutzten Clans blockiert werden.

Clans sollten automatisch nach einer Zeit X nach der letzten Aktivität gelöscht werden.
Waren die Spieler des Clans länger als X nicht mehr online wird der Clan automatisch gelöscht.</issue_description>

Comments on the Issue (you are @copilot in this section)

@JoField08 Keine Ahnung wie man das am besten umsetzt. Am leichtesten wäre es, wenn man die activity für jeden Clan aufzeichnet und loopt dann einmal am Tag oder so durch alle Clans durch und löscht diejenigen, bei denen die Zeit überschritten wurde weg.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 24, 2026 13:52
- Add lastActivity column to ClansTable for tracking clan activity
- Add lastActivity field to ClanImpl (backward-compatible serialization)
- Add updateLastActivity and findInactiveClanIds to ClanRepository
- Add updateLastActivity and disbandInactiveClans to CoreClanService/ClanServiceImpl
- Add AutoDisbandConfig to ClanConfig (disabled by default, 90 days threshold, 24h check interval)
- Add periodic auto-disband background task in ClanInstance lifecycle
- Track player activity on join in both Velocity (JoinInviteListener) and Paper (PlayerActivityListener)

Co-authored-by: twisti-dev <76837088+twisti-dev@users.noreply.github.com>
…k immediately on startup

Co-authored-by: twisti-dev <76837088+twisti-dev@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement automatic deletion of inactive clans feat: autodisband inactive clans Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Autodisband inactive clans

2 participants