Interface IChunkAccessOverriderAPI


public interface IChunkAccessOverriderAPI
The API for implementation of chunk protection overriders by addons
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the display name for this chunk protection overrider.
    overrideChunkAccess(net.minecraft.resources.ResourceLocation dim, int x, int z, IPlayerConfigAPI claimConfig, net.minecraft.world.entity.Entity accessor, UUID accessorId, net.minecraft.server.MinecraftServer server, ChunkAccessOverride currentOverride)
    Lets you override full chunk access for a specified accessor.
  • Method Details

    • getName

      @Nonnull String getName()
      Gets the display name for this chunk protection overrider.
      Returns:
      the name String, not null
    • overrideChunkAccess

      @Nonnull ChunkAccessOverride overrideChunkAccess(@Nullable net.minecraft.resources.ResourceLocation dim, int x, int z, @Nonnull IPlayerConfigAPI claimConfig, @Nullable net.minecraft.world.entity.Entity accessor, @Nonnull UUID accessorId, @Nonnull net.minecraft.server.MinecraftServer server, @Nonnull ChunkAccessOverride currentOverride)
      Lets you override full chunk access for a specified accessor.

      Argument for accessor being null usually means that the accessor entity doesn't exist anymore or it's an offline player. Argument for accessorId is never null though.

      This is mainly meant for addons that want to implement a claim access expiration system or a claim raiding system but can be used for other things as well.

      This only affects whether a player has full access to a claim. Other claim exceptions are not affected by this at all!

      When you don't have a reason to override access, then it is recommended to simply return currentOverride.

      To override access to a chunk, return a new instance of ChunkAccessOverride with one of the types from ChunkAccessOverrideType.

      Overriding access here doesn't cause any special notifications to be displayed to the player. You must appropriately explain the override to the player yourself, e.g. with your own UI. Because this method may be called multiple times for a single action, it is not the best place to notify the player from, but with a cooldown timer or a server tick count check, you can still get it to work nicely.

      Parameters:
      dim - the dimension ID of the chunk, null when not provided
      x - the X chunk coordinate, Integer.MIN_VALUE when not provided
      z - the Z chunk coordinate, Integer.MIN_VALUE when not provided
      claimConfig - the actual player (sub-)config used for the claim, not null
      accessor - the entity or player accessing the chunk, can be null
      accessorId - the UUID of the entity or player accessing the chunk, not null
      server - the Minecraft server, not null
      currentOverride - the current candidate to override the access with, not null
      Returns:
      the chunk access override instance, not null