Skip to content

Repository files navigation

FarCoordGuard icon

FarCoordGuard

Bukkit plugin that keeps players and entities away from extreme or broken coordinates, so a bad position cannot crash the server on chunk load.

Build Release License: proprietary

English | Русский

English

Overview

On a modded server a single broken position can take the whole server down. A player saved at NaN, a teleport command with a typo that sends someone to X = 30 000 000, an ender pearl that flies past the world border: the server then tries to load or generate chunks far outside the prepared area, and heavy world generation or a mod bug turns that into a crash or a long freeze.

FarCoordGuard sets a hard square limit on X and Z. Any login, teleport or movement that would put a player beyond it is redirected to a safe spot, and entity teleports past the limit are cancelled.

What it does

Moment Action
Login, Paper PlayerSpawnLocationEvent is rewritten before the player enters the world
Login, any core after join, a player standing beyond the limit is teleported to the safe spot
Player teleport the destination is replaced with the safe spot
Entity teleport cancelled if the destination is beyond the limit
Walking or flying the player is put back to the previous position, or teleported if that one is unsafe too

A position is unsafe when X or Z is NaN, infinite, or its absolute value is above max-abs-xz. Every correction is written to the log with the old and the new position.

Requirements

  • Java 21
  • Bukkit, Spigot or Paper API 1.21. Paper and hybrid cores built on it get the earlier login hook.

Installation

  1. Download far-coord-guard-<version>.jar from Releases and put it into plugins/.
  2. Start the server and set max-abs-xz in plugins/FarCoordGuard/config.yml a little outside your world border.
  3. Restart.

Configuration

Key Default Meaning
max-abs-xz 4500.0 limit for the absolute value of X and Z
safe-spawn.world, x, y, z world, 0.5, 80.0, 0.5 where corrected players go; with X and Z near 0 the world spawn X and Z are used, and its Y as well if y is 0 or less
clamp-on-move true also stop walking or flying past the limit
deny-message Russian text message shown to the player on every correction

Releases

Every tag v* is built by GitHub Actions from this source and published in Releases. The build log of each release is public, so every jar can be traced to its commit.

Source history

The original source of 1.0.0 was lost. This repository holds a reconstruction from the release jar: decompiled, then rewritten by hand with readable names. The rebuilt jar was compared with the original method by method (called methods, fields, string constants). The logic is the same.

The comparison also showed that the original jar had been compiled against an incomplete API stub. Three call sites pointed at signatures Bukkit does not have: BukkitScheduler.runTask returning int, used by the post-join correction and by the teleport fallback, and an EventExecutor from the wrong package in the Paper login hook. On a real server those paths fail with NoSuchMethodError the moment they run. This build is compiled against the real Paper API, so they work. The only other change is the punctuation of the default message.

Known limitations

  • The limit is one square for every world. There is no per-world setting.
  • The early login hook looks for com.destroystokyo.paper.event.player.PlayerSpawnLocationEvent. Newer cores, Youer 1.21.1 among them, no longer ship it; there the check runs right after join.
  • The Y coordinate is not checked.
  • The move check runs on every PlayerMoveEvent. It is two comparisons, cheap, but it does run on every step.
  • Vehicles and passengers are not handled separately; they are covered only through the teleport events.

License

Proprietary, all rights reserved. Official release binaries may be run unmodified on servers you operate. Copying, modifying or redistributing the code or the binaries requires written permission. Full terms: LICENSE.

Русский

Обзор

На модовом сервере одна сломанная позиция может уронить весь сервер. Игрок, сохранённый в NaN, команда телепорта с опечаткой, которая отправляет кого-то на X = 30 000 000, эндер-жемчуг, улетевший за границу мира: сервер начинает грузить или генерировать чанки далеко за пределами подготовленной области, и тяжёлая генерация или баг мода превращают это в краш или долгое зависание.

FarCoordGuard задаёт жёсткий квадратный предел по X и Z. Любой вход, телепорт или движение, которые поставили бы игрока за предел, перенаправляются в безопасную точку, а телепорты сущностей за предел отменяются.

Что делает

Момент Действие
Вход, Paper PlayerSpawnLocationEvent переписывается до того, как игрок попадёт в мир
Вход, любое ядро после входа игрок за пределом телепортируется в безопасную точку
Телепорт игрока точка назначения заменяется безопасной
Телепорт сущности отменяется, если точка за пределом
Ходьба или полёт игрок возвращается на прошлую позицию, а если и она небезопасна, телепортируется

Позиция небезопасна, если X или Z равны NaN, бесконечны или больше max-abs-xz по модулю. Каждая поправка пишется в лог со старой и новой позицией.

Требования

  • Java 21
  • API Bukkit, Spigot или Paper 1.21. На Paper и гибридных ядрах на его основе работает более ранний перехват входа.

Установка

  1. Скачать far-coord-guard-<версия>.jar из Releases и положить в plugins/.
  2. Запустить сервер и выставить max-abs-xz в plugins/FarCoordGuard/config.yml чуть дальше границы мира.
  3. Перезапустить сервер.

Настройки

Ключ По умолчанию Назначение
max-abs-xz 4500.0 предел для модуля X и Z
safe-spawn.world, x, y, z world, 0.5, 80.0, 0.5 куда отправлять игроков; если X и Z около 0, берутся X и Z точки спавна мира, а если y 0 или меньше, то и её Y
clamp-on-move true останавливать и ходьбу или полёт за предел
deny-message текст на русском сообщение игроку при каждой поправке

Релизы

Каждый тег v* собирается из этих исходников в GitHub Actions и публикуется в Releases. Лог сборки каждого релиза открыт, так что любой jar можно сверить с его коммитом.

История исходников

Исходники версии 1.0.0 были утеряны. Здесь лежит восстановленный вариант: jar релиза декомпилирован и переписан вручную с понятными именами. Пересобранный jar сверен с оригиналом по каждому методу (вызываемые методы, поля, строковые константы). Логика та же.

Сверка заодно показала, что оригинальный jar собирали против неполной заглушки API. Три места вызывали сигнатуры, которых в Bukkit нет: BukkitScheduler.runTask с возвратом int (им пользуются поправка после входа и запасной телепорт) и EventExecutor не из того пакета в перехвате входа Paper. На настоящем сервере эти ветки падают с NoSuchMethodError, как только до них доходит дело. Эта сборка скомпилирована против настоящего API Paper, и они работают. Кроме этого изменена только пунктуация сообщения по умолчанию.

Известные ограничения

  • Предел один квадрат на все миры, настройки по мирам нет.
  • Ранний перехват входа ищет com.destroystokyo.paper.event.player.PlayerSpawnLocationEvent. В новых ядрах, включая Youer 1.21.1, этого класса уже нет, и там проверка идёт сразу после входа.
  • Координата Y не проверяется.
  • Проверка движения идёт на каждом PlayerMoveEvent. Это два сравнения, дёшево, но на каждый шаг.
  • Транспорт и пассажиры отдельно не обрабатываются, их покрывают только события телепорта.

Лицензия

Проприетарная, все права защищены. Официальные сборки из релизов можно запускать без изменений на своих серверах. Копировать, изменять и распространять код или сборки можно только с письменного разрешения. Полный текст: LICENSE.

About

Bukkit plugin that keeps players and entities away from extreme or broken coordinates, so a bad position cannot crash the server on chunk load.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages