Bounds - ShaneBeee/SkBee GitHub Wiki
Bounds are a fast and easy way of creating cuboid areas in your server, which you can manage many aspects of.
Creating a Bound
Bounds can be created by a simple expression, where all you need to supply is two adjacent corners, similar to World Edit selections. Including full
in the effect causes the Y level of the locations to be ignored, in turn stretching the bound from the bottom of the world to the top:
Note: make sure the ID you choose for a bound is unique, so you can easily manipulate it later
create [a] [new] [(full)] bound with id %string% (within|between) %location% and %location%
An example of usage would be:
create a bound with id "myNewBound" within player's location and player's target block
Removing a Bound
Ever want to get rid of a bound you created? Luckily you can easily, just by supplying the ID of the bound of when you created it:
delete bound with id %string%
An example being:
delete bound with id "myNewBound"
Getting a Bound
There's a few ways of getting access to bound objects, highlighted below.
IDs
Sometimes you may need to get a bound object from an ID, or vise versa, an ID from a bound object, luckily you can do both pretty easily:
# Getting a bound object from an ID
bound (of|from|with) id %string%
# Getting an ID from a bound object
[the] [bound] id of %bounds%
All Bounds
Or sometimes you may even need to get all bounds, or all bounds from a specific world (or just their IDs instead of as an object):
# Bound objects only
[(all [[of] the]|the)] bound[s] [(in|of) %worlds%]
# Bound IDs only
[(all [[of] the]|the)] bound id[s] [(in|of) %worlds%]
Examples:
set {_all::*} to all bounds in player's world
set {_all::*} to all bound ids
All Bounds at Location
You may even need to check to see what bounds may be at a location, for example what bound(s) a player may be inside of, which can be done as easily as the other expressions:
# Bound objects only
[(all [[of] the]|the)] bound[s] at %location%
# Bound IDs only
[(all [[of] the]|the)] bound id[s] at %location%
Examples:
loop all bounds at player:
send all bound ids at target block
Entering and Leaving
[!WARNING] Due to breaking changes in Bukkit API, enter/exit events will not be called when a player mounts/dismounts an entity if running SkBee 3.5.0+ on MC 1.20.4 and below.
If you would like to know exactly when a player enters or exits a bound, luckily SkBee offers events just for that. Keep in mind that these events fire before the player is considered inside/outside of the bound in question:
# When they enter (optionally can include an ID to filter for)
[on] (bound enter|enter bound) [with id %string%]
# When they exit (optionally can include an ID to filter for)
[on] (bound exit|exit bound) [with id %string%]
Both events include event-string
, which represents the ID of the bound and event-bound
, which represents the bound itself as an object.
Owners, Members, and Values
SkBee offers some nice expressions for dealing with things like owners, members and specific attributes regarding bounds.
Owners and Members
Bounds within SkBee offer two lists where you can freely add, list and remove players from, they are called owners and members:
# One expression used for both owners and members
(owners|members) of [bound] %bound%
And of course you can treat them like a normal Skript list:
# Add the player owners list of the bound "testing"
add player to owners of bound with id "testing"
Note: Owners and members are stored as their UUIDs within the bound config file.
Note: The members and owners lists do not change anything about how the bound behaves, SkBee just offers the lists, you will need to implement any functionality yourself.
Values
In the event that you need to store some information regarding bounds and don't really want to create a list yourself, SkBee offers the ability to store stuff on a bound in a key-value format, allowing you to easily deal with bound-specific properties of your choosing:
# Represents the specific value for a bound
bound value %string% (of|from) %bound%
# Returns all the values or keys of a bound
all [[of] the] bound (values|keys) (of|from) %bound%
And then manipulating the values of bounds are pretty simple:
# Sets a key called spawnpoint of the bound to the location of the player
set bound value "spawnpoint" of bound with id "arena" to location of player
# Lists all the keys of the bound
send all bound keys of bound with id "arena"
Note: Simple types like strings, numbers, locations, booleans, itemtypes, and players will be serialized as their normal type when stored. Entities will be stored by their UUID and any other type will be stored as a string.
Note: The keys and values do not change anything about how the bound behaves, SkBee just offers the object, you will need to implement any functionality yourself.
Miscellaneous Syntax
Some other stuff that may not fit into the specific categories above.
Location is Within Bound
Self explanatory, condition to check if a location happens to be within a bound:
%locations% (is|are) [with]in [bound] %bound%
%locations% (isn't|is not|aren't|are not) [with]in [bound] %bound%
if player is within bound with id "pvp":
Bound Intersection
Checks to see if any bounds are intersecting (overlapping areas) or if a bound is intersecting an arbitrary cuboid:
%bound% (intersects with|overlaps) %bound%
%bound% (intersects with|overlaps) %location% and %location%
%bound% doesn't (intersect with|overlap) %location% and %location%
%bound% doesn't (intersect with|overlap) %bound%
if bound with id "area1" overlaps bound with id "area2":
Blocks Within Bound
Self explanatory, returns all the blocks within a bound:
[(all [[of] the]|the)] blocks within [bound] %bound%
send all of the blocks within bound with id "house"
Entities Within Bound
Returns all the entities within a bound, optionally can be a specific type:
[(all [[of] the]|the)] %*entitydatas% of [bound] %bounds%
kill all ghasts of bound with id "nether"