Skip to content

[Feature Request] 建议追加对 Denizen Script 的支持 / Add support for Denizen Script #686

Description

@BredyAK

Denizen Script 是与 Skript 类似的插件,提供加载用户脚本的功能。希望 CraftEngine 为其追加以下功能(参照 Denizen Script 文档风格书写):

目录

Events

  • Player breaks craftengine block
  • Player breaks craftengine furniture
  • Player right|left clicks craftengine block
  • Player right|left clicks craftengine furniture
  • Craftengine reloaded

Tags

  • <ItemTag.is_craftengine_item>
  • <LocationtagTag.is_craftengine_block>
  • <EntityTag.is_craftengine_furniture>
  • <ItemTag.craftengine_namespace>
  • <LocationtagTag.craftengine_namespace>
  • <EntityTag.craftengine_namespace>
  • <LocationTag.craftengine_block_states>
  • <craftengine_item[<craftengine_item>]>

Commands

  • PlaceCraftengineBlock
  • SpawnCraftengineFurniture
  • RemoveCraftengineFurniture

Events

Player breaks craftengine block

开发参考:https://meta.denizenscript.com/Docs/Events/player%20breaks%20block

Name player breaks craftengine block
Event Lines player breaks craftengine block block
player breaks craftengine block <craftengineblock>[?]
Triggers when a player breaks a block from the CraftEngine plugin.
Example
# Narrate the CraftEngine block's namespace when player break it.
on player breaks craftengine block block:
- narrate "You just break a <context.namespace> from <context.location.format[bx, by, bz]>!"
Example
# The event will only fire when player break a specific CraftEngine block.
on player breaks craftengine block custom:cloud_block:
- narrate "You just break a cloud block, it's soft!"
Example
# The event will only fire when player break a specific CraftEngine block with a specific tool.
on player breaks craftengine block custom:cloud_block with:diamond_pickaxe:
- narrate "You just break a cloud block with diamond pickaxe!"
Has Player Always. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Switches with:<item> to only process the event when the player is breaking the block with a specified item.
Contexts <context.location> returns the LocationTag the block was broken at.
<context.namespace> returns the CraftEngine namespace of the block that was broken.
<context.xp> returns how much XP will be dropped.
<context.should_drop_items> returns whether the event will drop items.
Determine "NOTHING" to make the block drop no items.
ListTag(ItemTag) to make the block drop a specified list of items.
ElementTag(Number) to set the amount of xp to drop.
Cancellable True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has Location True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
Synonyms (Search Aid) player breaks ce block, player mines ce block, player digs ce block
Group Player

Player breaks craftengine furniture

开发参考:https://meta.denizenscript.com/Docs/Events/player%20breaks%20block

Name player breaks craftengine furniture
Event Lines player breaks craftengine furniture furniture
player breaks craftengine furniture <craftenginefurniture>[?]
Triggers when a player breaks a furniture from the CraftEngine plugin.
Example
# Narrate the CraftEngine furniture's namespace when player break it.
on player breaks craftengine furniture furniture:
- narrate "You just break a <context.namespace> from <context.location.format[bx, by, bz]>!"
Example
# The event will only fire when player break a specific CraftEngine furniture.
on player breaks craftengine furniture custom:oak_closet:
- narrate "You just break an oak closet, be careful of your stuff!"
Example
# The event will only fire when player break a specific CraftEngine furniture with a specific tool.
on player breaks craftengine furniture custom:oak_closet with:diamond_axe:
- narrate "You just break an oak closet with diamond axe!"
Has Player Always. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Switches with:<item> to only process the event when the player is breaking the furniture with a specified item.
Contexts <context.location> returns the LocationTag the furniture was broken at.
<context.namespace> returns the CraftEngine namespace of the furniture that was broken.
<context.should_drop_items> returns whether the event will drop items.
Determine "NOTHING" to make the furniture drop no items.
ListTag(ItemTag) to make the furniture drop a specified list of items.
Cancellable True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has Location True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
Synonyms (Search Aid) player breaks ce furniture, player mines ce furniture, player digs ce furniture
Group Player

Player right|left clicks craftengine block

开发参考:https://meta.denizenscript.com/Docs/Events/player%20right%7Cleft%20clicks%20block

Name player right|left clicks craftengine block
Event Lines player (right|left) clicks craftengine block (<craftengineblock>[?])
Triggers when a player clicks on a block from the CraftEngine plugin.
Example
# Narrate the CraftEngine block's namespace when player right-click on it.
on player right clicks craftengine block:
- narrate "You just right-click on a <context.namespace> from <context.location.format[bx, by, bz]>!"
Example
# Narrate the CraftEngine block's namespace when player right-click on a specific block.
on player right clicks craftengine block custom:sugar_block:
- narrate "You just right-click on a sugar block from <context.location.format[bx, by, bz]>, so sweety!"
Has Player Always. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Switches with:<item> to only process the event when the player is breaking the furniture with a specified item.
Contexts <context.item> returns the ItemTag the player is clicking with.
<context.location> returns the LocationTag the player is clicking on.
<context.namespace> returns the CraftEngine namespace of the furniture that was broken.
<context.relative> returns a LocationTag of the air block in front of the clicked block.
<context.click_type> returns an ElementTag of the Spigot API click type https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/Action.html.
<context.hand> returns an ElementTag of the used hand.
Cancellable True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has Location True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
Synonyms (Search Aid) player clicks ce block
Group Player

Player right|left clicks craftengine furniture

开发参考:https://meta.denizenscript.com/Docs/Events/player%20right%20clicks%20entity

Name player right|left clicks craftengine furniture
Event Lines player (right|left) clicks craftengine furniture (<craftenginefurniture>[?])
Triggers when a player clicks on a furniture from the CraftEngine plugin.
Example
# Narrate the CraftEngine furniture's namespace when player right-click on it.
on player right clicks craftengine furniture:
- narrate "You just right-click on a <context.namespace> from <context.location.format[bx, by, bz]>!"
Example
# Narrate the CraftEngine furniture's namespace when player right-click on a specific furniture.
on player right clicks craftengine furniture custom:oak_lamp:
- narrate "You just right-click on an oak lamp from <context.location.format[bx, by, bz]>. Keep in the light!"
Has Player Always. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Switches with:<item> to only process the event when the player is breaking the furniture with a specified item.
Contexts <context.item> returns the ItemTag the player is clicking with.
<context.location> returns the LocationTag the player is clicking on.
<context.namespace> returns the CraftEngine namespace of the furniture that was broken.
<context.click_type> returns an ElementTag of the Spigot API click type https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/Action.html.
<context.hand> returns an ElementTag of the used hand.
Cancellable True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has Location True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
Synonyms (Search Aid) player clicks ce furniture
Group Player

Craftengine reloaded

开发参考:https://meta.denizenscript.com/Docs/Events/reload%20scripts

Name craftengine reloaded
Event Lines craftengine reloaded
Triggers when the CraftEngine plugin reloaded.
Example
# Narrate a message when CraftEngine reloaded successfully.
on craftengine reloaded had_error:false:
- narrate "CraftEngine has been reloaded successfully!"
Switches had_error:true/false to only process the event if there either was or was not an error message.
Contexts <context.had_error> returns an ElementTag(Boolean) whether there was an error.
Synonyms (Search Aid) ce reloaded
Group Core

Tags

<ItemTag.is_craftengine_item>

开发参考:https://meta.denizenscript.com/Docs/Tags/ItemTag.is_book

Name <ItemTag.is_craftengine_item>
Returns ElementTag(Boolean)
Description Returns whether the item is from CraftEngine.
Example
- if <player.item_in_hand.is_craftengine_item>:
    - narrate "You are holding CraftEngine's <player.item_in_hand.craftengine_namespace> item!"
Synonyms (Search Aid) itemtag.is_ce_item
Group Properties

<LocationtagTag.is_craftengine_block>

开发参考:https://meta.denizenscript.com/Docs/Tags/LocationTag.is_liquid

Name <LocationTag.is_craftengine_block>
Returns ElementTag(Boolean)
Description Returns whether the block is from CraftEngine.
Example
- if <player.cursor_on.is_craftengine_block>:
    - narrate "You are looking at CraftEngine's <player.cursor_on.craftengine_namespace> block!"
Synonyms (Search Aid) locationtag.is_ce_block
Group World

<EntityTag.is_craftengine_furniture>

开发参考:https://meta.denizenscript.com/Docs/Tags/EntityTag.is_sleeping

Name <EntityTag.is_craftengine_furniture>
Returns ElementTag(Boolean)
Description Returns whether the entity is a furniture from CraftEngine.
Example
- if <player.precise_target.is_craftengine_furniture.if_null[false]>:
    - narrate "You are looking at CraftEngine's <player.precise_target.craftengine_namespace> furniture!"
Synonyms (Search Aid) locationtag.is_ce_furniture
Group Properties

<ItemTag.craftengine_namespace>

Name <ItemTag.craftengine_namespace>
Returns ElementTag
Description Returns the namespace of the CraftEngine item.
Example
- if <player.item_in_hand.is_craftengine_item>:
    - narrate "You are holding CraftEngine's <player.item_in_hand.craftengine_namespace> item!"
Synonyms (Search Aid) itemtag.ce_namespace
Group Properties

<LocationtagTag.craftengine_namespace>

Name <LocationTag.craftengine_namespace>
Returns ElementTag
Description Returns the namespace of the CraftEngine block.
Example
- if <player.cursor_on.is_craftengine_block>:
    - narrate "You are looking at CraftEngine's <player.cursor_on.craftengine_namespace> block!"
Synonyms (Search Aid) locationtag.ce_namespace
Group World

<EntityTag.craftengine_namespace>

Name <EntityTag.craftengine_namespace>
Returns ElementTag
Description Returns the namespace of the CraftEngine furniture.
Example
- if <player.precise_target.is_craftengine_furniture.if_null[false]>:
    - narrate "You are looking at CraftEngine's <player.precise_target.craftengine_namespace> furniture!"
Synonyms (Search Aid) entitytag.ce_namespace
Group Properties

<LocationTag.craftengine_block_states>

开发参考:https://meta.denizenscript.com/Docs/Tags/LocationTag.sherds

Name <LocationTag.craftengine_block_states>
Returns MapTag
Description Returns a map of all block states of the CraftEngine block.
Example
- narrate "The block you are looking at faces <player.cursor_on.craftengine_block_states.get[facing]>."
Synonyms (Search Aid) locationtag.ce_block_states
Group World

<craftengine_item[<craftengine_item>]>

开发参考:https://meta.denizenscript.com/Docs/Tags/item

Name <craftengine_item[<craftengine_item>]>
Returns ItemTag
Description Returns a CraftEngine item object constructed from the input value.
Example
- give <craftengine_item[custom:sugar_block]>
Synonyms (Search Aid) ce_item
Group Core

Commands

PlaceCraftengineBlock

开发参考:https://meta.denizenscript.com/Docs/Commands/ModifyBlock

Name PlaceCraftengineBlock
Syntax placecraftengineblock [<location>|.../<ellipsoid>/<cuboid>] [<craftengine_block>|...] (no_physics) (<percent chance>|...) (source:<player>)
Short Description Place CraftEngine blocks.
Full description Place CraftEngine blocks in the world based on the criteria given.

Use 'no_physics' to place the blocks without physics taking over the modified blocks.
This is useful for block types such as portals or water. This does NOT control physics for an extended period of time.

Specify (<percent chance>|...) to give a chance of each type of blocks being placed (in any material at all).

Note that specifying a list of locations will take more time in parsing than in the actual block modification.

Optionally, specify a source player. When set, Bukkit events will fire that identify that player as the source of a change, and potentially cancel the change.
The source argument might cause weird interoperation with other plugins, use with caution.

The placecraftengineblock command is ~waitable. Refer to Language:~waitable.
Usage Example - narrate "Placing CraftEngine blocks, please wait..."
- ~placecraftengineblock <player.cursor_on> custom:sugar_block no_physics source:
- narrate "Placement complete!"
Group World

SpawnCraftengineFurniture

开发参考:https://meta.denizenscript.com/Docs/Commands/ModifyBlock

Name SpawnCraftengineFurniture
Syntax spawncraftenginefurniture [<location>|.../<ellipsoid>/<cuboid>] [<craftengine_furniture>|...] (<percent chance>|...) (direction:north/east/south/west) (source:<player>)
Short Description Spawn CraftEngine furnitures.
Full description Spawn CraftEngine furnitures in the world based on the criteria given.

Specify (<percent chance>|...) to give a chance of each furniture being spawned (in any material at all).

Note that specifying a list of locations will take more time in parsing than in the actual block modification.

Optionally, specify a source player. When set, Bukkit events will fire that identify that player as the source of a change, and potentially cancel the change.
The source argument might cause weird interoperation with other plugins, use with caution.

The spawncraftenginefurniture command is ~waitable. Refer to Language:~waitable.
Usage Example - narrate "Placing CraftEngine furnitures, please wait..."
- ~spawncraftenginefurniture <player.cursor_on> custom:oak_lamp direction:west source:
- narrate "Spawn complete!"
Group World

RemoveCraftengineFurniture

开发参考:https://meta.denizenscript.com/Docs/Commands/Remove

Name RemoveCraftengineFurniture
Syntax removecraftenginefurniture [<entity>|...] (source:<player>)
Short Description Remove CraftEngine furnitures.
Full description Remove CraftEngine furnitures in the world based on the criteria given.

Optionally, specify a source player. When set, Bukkit events will fire that identify that player as the source of a change, and potentially cancel the change.
The source argument might cause weird interoperation with other plugins, use with caution.

The spawncraftenginefurniture command is ~waitable. Refer to Language:~waitable.
Usage Example - narrate "Removing CraftEngine furnitures, please wait..."
- ~removecraftenginefurniture <player.precise_target> source:
- narrate "Remove complete!"
Group World

引用:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions