Jan 11, 2016
  • Created by Julian Sanchez
    Make use of Command Blocks as command senders for /summon /setblock etc

    Some of the newer Minecraft commands created especially for use with Command Blocks contain features that are not yet implemented in either Bukkit or Skript, such as the ability to set any dataTag of an item, block or entity on creation. CraftBukkit does not as yet have permissions set up for these commands, so can only be used by Ops. They also contain no "world" parameter, so they cannot be used from console. Skript doesn't yet support a Command Block sender, however, it is possible to make use of other command blocks in the world.

    This script provides support for creating, maintaining and providing command blocks as world-specific senders for use in other scripts, in worlds where there may not be an op around at all times to trigger it.

    /ccb ([player]) ((~)[x]) ((~)[y]) ((~)[z])

    Can be executed by ops only
    This creates a special command block just for Skript to make use of at the location you are standing. It will appear at your feet unless you specify coordinates or relative coordinates using the tilde (~). You can also specify a player to create the command block, which allows it to be used from the console. Note, the player using/targetted by this command MUST be an op, in order for it to make use of the /setblock command and create the command block.

    /tcb ([world]) - commandblock.test

    This tests if the command block for your current world is set up correctly. It will respond "@: I am ready", if this is so. You can optionally specify a world to test, allowing this command to be used from the console.


    Can be Ops only
    This is a macro to automate the process of creating a command block in its own bedrock box at the coordinates 666, 3, 666. It appears at the very bottom of the script and can be altered to suit your needs to quickly set up command blocks for a number of different worlds.

    Internal Commands
    These commands should never need be called as they are used internally.

    /cbr [world] [x] [y] [z] - Command blocks only This command can only be executed from a command block. When activated, it registers this command block as the sender for Skript for this world, and stores it location for later reactivation. If you want to set up a command block manually, you will need to add this command to it, and include the world name and precise integer coordinates.

    /acb [world] [x] [y] [z] - commandblock.activate

    This command activates a command block at the given coordinates. Although it can be used to activate any command block, this is not recommended as the method it does so is by setting the block under it to a lit redstone torch for 1 tick. This can be quite invasive and may damage any tile entities that sit directly underneath it, as well as activate any redstone underneath and adjacent to it. This should be taken into consideration if you are manually placing your command blocks.

    /rcb [world] - commandblock.activate

    This command attempts to activate the stored command block for a given world, forcing it to register itself again. This is used internally to recover after server restarts, script reloads, and world unload/reloads. It should need never be called manually.

    First you need to download "command" from the attachment below, and place it into your scripts folder. You can then use "/sk reload command blocks", to immediately load it up, no restart necessary.

    You will then need to travel to each world that may require a command block and use either /autocbm or /ccb commands detailed above to set up the command blocks for these worlds.

    This should now immediately work with any other script that makes use of this utility script, no restarts necessary.

    How to use
    When command blocks are registered, they are stored in the global list variable "{commandblock::*}". They are stored by the world-name, so if you want to summon a baby zombie in the "world" world for example, you could do so like this:

    make {commandblock::world} execute command "/summon Zombie 0 64 0 {IsBaby:1}"
    It is also a good idea to ensure that there is a command block registered for a world before attempting to make use of it. This can happen for a number of reasons, such as a world unloading/reloading, the script reloading or the server restarting, or there not being a command block set up yet for this world. This script will attempt to re-register any missing command blocks, however it is only possible to do so when at least one player is in a world, so it may not happen immediately.

    if {commandblock::world} is not set:
    log "Cannot summon a baby zombie as the command block for world is not registered" exit make {commandblock::world} execute command "/summon Zombie 0 64 0 {IsBaby:1}"

  • Loading...
  • Loading...