这是本文档旧的修订版!
条件列表
(版本:2017.01.12 原文链接)
背包里的物品: item
判断玩家背包里是否有某个物品. 如果多个物品,可以用逗号分隔 (中间没有空格!) 每个物品包括名称和数量,用冒号隔开. 如果没有标明数量,那么就代表一个.
例子 item emerald:5,diamond:10
(背包里有5个绿宝石和10个钻石)
手中的物品: hand
判断玩家手中的物品. 这个判断并不能判断物品的数量,可以通过item
去判断.
例子 hand bow
(手中拿着弓)
或: or
满足一项条件即可. !
代表非
.
例子: or night,rain,!has_armor
(现在是夜晚,或者正在下雨,或者没有护甲)
与: and
同时满足所有条件.
例子: and has_helmet,has_chestplate,has_leggings,has_boots
(同时有头盔、胸甲、护腿、靴子)
位置: location
判断玩家的位置是否在某个范围之内 x;y;z;world;distance
.
例子: location 100;200;300;survival_nether;5
(在survival_nether世界,距离100,200,300在5格之内)
血量: health
判断玩家的血量是否 >= 某个值(浮点型). 不要用0!
例子: health 5.6
(血量大于等于5.6)
经验: experience
判断玩家的等级.
例子: experience 30
权限: permission
判断玩家是否有某种权限.
例子: permission essentials.tpa
积分: point
判断玩家的某种积分是否达到一定值. 必须有两个参数,第一个是分类,第二个是值.
例子: point beton 20
标签: tag
判断玩家是否有标签.(这是一个特别有用的功能,一般由此判断玩家是否完成某个任务)
例子: tag quest_completed
装备: armor
判断玩家是否穿着特殊的装备, 这个装备在items.yml
里边编写.
例子: armor helmet_of_concrete
药水效果: effect
判断玩家是否有某种药水效果. 参数见: potion types.
例子: effect SPEED
时间: time
判断当前的“Minecraft时间”是否在一定范围. 用两个参数表示时间范围(24小时制). 第一个数必须小于第二个数. 如果你想写成23点到2点, 需要写time 2-23
, 然后在判断条件的时候写!
.
例子: time 2-23
天气: weather
判断当前的天气. 三种情况: sun, rain and storm. 需要注意 /toggledownfall
不能改变天气. 如果想要停止下雨,/weather clear
.
例子: weather sun
水平线: height
判断玩家位置的Y值是否_低于_某个值. 参数是一个数字或者位置 (例如 100;200;300;world). 如果用位置,执行判断程序的时候会从里边取出Y值然后对比.
例子: height 16
护甲值: rating
判断玩家的护甲值(10 意味着原版中满护甲状态的一半).
例子: rating 10
随机/概率: random
persistent, static
以一定概率返回true。可以用来roll dice或抽奖。
例子: random 12-100
(平均100次中有12次满足条件,12%概率返回true)
弯腰: sneak
判断玩家是否按住了Shift键.
例子: sneak
日记: journal
判断玩家的小本本(源于 journal.yml
文件).
例子: journal wood_started
方块检测: testforblock persistent, static
判断某个位置是否是某个方块可用列表.
例子: testforblock 100;200;300;world STONE
背包空位: empty
判断玩家背包是否有满足数量的空位.
例子: empty 5
团队: ''%%party%%''
To see details about parties read “Party” chapter in Reference section. This condition takes three optional arguments: every:
, any:
and count:
. “Every” is a list of conditions that must be met by every player in the party. Any is a list of conditions that must be met by at least one player in a party (it doesn’t have to be the same player, one can meet first condition, another one can meet the rest and it will work). Count is just a number, minimal amount of players in the party. You don’t have to specify all those arguments, you can use only one if you want.
例子: party 10 has_tag1,!has_tag2 every:some_item any:some_location,some_other_item count:5
指定区域内有怪物: monsters
persistent, static
指定的范围有(或超过)一定数量数量的怪物. 有两个参数 - 怪物、位置. 怪物列表用逗号隔开. 每个怪物 (怪物列表) 都可以指定数量, 例如 ZOMBIE:5,SKELETON:2
有5个(或以上)的僵尸和2个(或以上)的骷髅. 位置条件 100;200;300;world;10
, 最后一个参数代表了搜索半径. 可以使用附加参数 name:
, 限制怪物的名字. 这里的空格要替换成_
.
例子: monsters ZOMBIE:2 100;200;300;world;10 name:Deamon
任务目标: objective
判断玩家正在被分配的任务,如果某项任务正在进行中,则返回true。具体请参照:objectives.yml。
例子: objective wood
多条件检测: check
可以检测多个条件. 每个指令用 ^
分隔. 它与 and
不同, 因为这个写的是详细条件,而不是条件名称(conditions.yml).
例子: check ^tag beton ^item emerald:5 ^location 100;200;300;survival_nether;5 ^experience 20
===== 箱子里的物品: chestitem
persistent, static
和 item
条件相似, 但是判断的是箱子里的物品. 第一个参数是箱子的位置 100;200;300;world
(必须是整数!) 第二个参数和item
相同. 如果没有箱子,返回“否”.
例子: chestitem 100;200;300;world emerald:5,sword
记分板分数: score
With this condition you can check if the score in a specified objective on a scoreboard is greater or equal to specified amount. The first argument is the name of the objective, second one is amount (an integer).
例子: score kills 20
所在世界: world
This conditions checks if the player is in a specified world. The first argument is the name of a world.
Example: `world world`
玩家游戏模式: gamemode
This condition checks if the player is in a specified game mode. The first argument is the game mode, i.e. survival, creative, adventure.
Example: `gamemode survival`
成就: achievement
This condition checks if the player has specified achievement (default Minecraft achievements). The first argument is name of the [achievement](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Achievement.html).
Example: `achievement BUILD_FURNACE`
变量: variable
This condition checks if a variable value matches given [pattern](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html). The first argument is a variable (with `%` characters). Second one is the pattern (for example, if you want to check if it's “word”, the patter would simply be `word`, but if you want to check if it's a number (positive or negative) you would use `-?\d+` pattern - `-?` means a dash or no dash, `\d` means any digit and `+` allows that digit to be repeated one or more times).
Example: `variable %objective.var.price% -?\d+`