Skip to content

Fix virtual world borders #12372

Open
@96DarkCode96

Description

@96DarkCode96

Expected behavior

Virtual world borders set to specific player would act as normal world border, taking damage when outside of the world border and not glitching when global world border is smaller then player's one.

Observed/Actual behavior

When player has virtual worldborder, server doesn't check if player is inside or outside of the worldborder which causes, that player doesn't take damage when outside but still takes damage if outside the global world border.

Steps/models to reproduce

Using this code, I'm able to set player's world border to be visible only to him with specific center and size (virtual world border).

Checking that position is always in relation to global world border, which creates weird invisible border, if the global one is smaller than player's one that he can see.

I didn't found any other way how to set virtual worldborder to certain player with allowing to check its position and dealing damage afterwards. (If it is possible, than correct me <3)

CraftWorldBorder worldBorder = new CraftWorldBorder(new net.minecraft.world.level.border.WorldBorder());
worldBorder.setCenter(x + 0.5d, z + 0.5d);
worldBorder.setSize(borderSize);
worldBorder.setWarningTime(0);
worldBorder.setWarningDistance(0);
worldBorder.setDamageAmount(5);
worldBorder.setDamageBuffer(0);
bukkitPlayer.setWorldBorder(worldBorder);

Plugin and Datapack List

ℹ Server Plugins (1):
Paper Plugins:

  • PaperTestPlugin <--- Custom plugin, that virtual world border to player (code mentioned above)
    There are 3 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)]
    There are no more data packs available

Paper version

This server is running Paper version 1.21.4-222-main@9b1798d (2025-03-27T13:35:40Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-212-bb1beda (MC: 1.21.4)

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions