Compare commits

..

2 commits

Author SHA1 Message Date
6ffdfbaf9a release.sh: read the Forgejo token from ../../.forgejo-token when FORGEJO_TOKEN isn't set 2026-10-04 18:34:11 +01:00
851397c7d9 1.0.4c-zio7: don't reapply tags in OnAllPluginsLoaded at server start
CSS runs OnAllPluginsLoaded before the engine's globals exist, so Utilities.GetPlayers() threw
("Global Variables not initialized yet"). Nobody is connected then anyway; tags are only
reapplied there after a hot reload.
2026-10-02 18:47:40 +01:00
3 changed files with 13 additions and 6 deletions

View file

@ -44,7 +44,7 @@ public class CS2_Tags : BasePlugin
public override string ModuleName => "CS2-Tags";
public override string ModuleDescription => "Add player tags easily in cs2 game";
public override string ModuleAuthor => "daffyy";
public override string ModuleVersion => "1.0.4c-zio6";
public override string ModuleVersion => "1.0.4c-zio7";
private static string TagsPath => Path.Combine(Server.GameDirectory, "csgo", "addons", "counterstrikesharp",
"configs", "plugins", "CS2-Tags", "tags.json");
@ -89,7 +89,9 @@ public class CS2_Tags : BasePlugin
Logger.LogInformation(_verify == null
? "GroupVerify isn't loaded: players without a rank tag keep their own"
: "Using GroupVerify's clan tag for verified players without a rank tag");
if (_verify != null)
// Only after a hot reload: at server start nobody is connected, and the engine's globals
// (which GetPlayers needs) don't exist yet.
if (_verify != null && hotReload)
ApplyAllClanTags();
}

View file

@ -112,4 +112,4 @@ FORGEJO_TOKEN=... ./release.sh v<ModuleVersion>
`release.sh` rebuilds from the committed source and publishes `CS2-Tags-<tag>.tar.gz`, laid out
like `game/csgo/`, to https://git.zio.sh/cs2/CS2-Tags. The tag must equal `v<ModuleVersion>`
(`v1.0.4c-zio6` now).
(`v1.0.4c-zio7` now).

View file

@ -19,8 +19,13 @@ set -euo pipefail
FORGEJO_URL="https://git.zio.sh"
OWNER="cs2"
REPO="CS2-Tags"
# Placeholder - replace, or set FORGEJO_TOKEN in the environment instead. Needs write:repository.
# Only uploading needs it; downloading from the public repo doesn't. Don't commit a real token.
# Needs write:repository. Only uploading needs it; downloading from the public repo doesn't. From the
# environment, or else from .forgejo-token in the cs2/ folder above every plugin (outside their
# repos, mode 600). Don't commit a real token.
TOKEN_FILE="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/../../.forgejo-token"
if [[ -z "${FORGEJO_TOKEN:-}" && -r "$TOKEN_FILE" ]]; then
FORGEJO_TOKEN="$(tr -d '[:space:]' < "$TOKEN_FILE")"
fi
FORGEJO_TOKEN="${FORGEJO_TOKEN:-CHANGE_ME_FORGEJO_TOKEN}"
# Only these ship from the publish output. CounterStrikeSharp.API.dll is excluded by the csproj
@ -37,7 +42,7 @@ if [[ -z "$TAG" ]]; then
exit 1
fi
if [[ "$FORGEJO_TOKEN" == "CHANGE_ME_FORGEJO_TOKEN" ]]; then
echo "Set FORGEJO_TOKEN (edit release.sh or export it) first." >&2
echo "Set FORGEJO_TOKEN (export it, or put it in $TOKEN_FILE) first." >&2
exit 1
fi
for tool in podman jq curl git; do