名副其实
本帖最后由 名副其实 于 2022-11-19 23:56 编辑
【前言】

2022/11/12 19:27

如你所见,我又来大搞翻译之活了。
这次的 Wiki 是我自己发现的,因此可以尽情摆烂
开玩笑的。当晚上应该能解决这个大东西。不翻译完真是对不起我自己。

2022/11/12 20:49

你看,其实很快,这些翻译其实没什么。
也算是弥补我的一个罪过了,因为还有两坨 Wiki 等着我去解决呢,一个是 AureliumSkills ,一个是 RealisticWorldGenerator

原帖链接: https://github.com/titivermeesch/CommandTimer/wiki
插件原帖: https://www.spigotmc.org/resources/command-timer.24141/

【目录】
API 引用方法
配置文件
初次使用


名副其实
API 引用方法
CMT comes with an extensive API to integrate other plugins within CommandTimer

This documentation is still in progress and far from done. If you need help, ask help on the Discord server

本插件有一个高度灵活的 API,使其他插件和本插件对接。此文档仍然处于编辑中并且远未完成,若你需要帮助,请你在我们的 Discord 服务器上寻求帮。

创建一个拓展
Extensions always start with one simple class which needs to extend ConditionExtension. This will be the base for your extension and the place where all the conditions will be registered.

拓展常以一个 class 开始,通常用于拓展 ConditionExtension。 这将会是你拓展的基础,也将会是所有条件注册的地方。

You will see that a few fields need to be defined:
conditionGroupName: This is basically the name for your extension, try to find something unique that won't conflict with someone else
description: This is a simple description of the extension. Each entry in the array represents a line in the CommandTimer GUI
author: This is your name. Separate with comma's if there are multiple authors (e.g. PlayBossWar, Vertex)
version: This is the current version of your extension
rules: There are your conditions, more on this later
Interacting with the core API

下面这些内容是你需要定义的:
conditionGroupName: 用以标记你的拓展,以此确保不会和其他拓展冲突。
description: 此为拓展的默认描述。队列里的每一行都对应着在本插件中的GUI的一行。
author: 作者名称。使用逗号 (",") 来分隔多个作者的名字。
version: 拓展的版本号。
rules: 拓展的相应规则,我们稍后会讲到。

与核心 API 交互
Directly interacting with the core of CommandTimer is not very common but can be used to create interesting behavior. The recommended way remains using extensions.

与本插件的核心直接交互不是一种很普遍的方法,但你可以用这个操作做出一些很有趣的效果,推荐的实现方式便是创建拓展。

A full documentation about this is not available yet, but you should be able to get the CommandTimer instance with
CommandTimerPlugin cmtInstance = Bukkit.getServer().getServicesManager().load(CommandTimerPlugin.class)

完整文档尚未发布,但你可以使用这段代码来获取本插件的接口:

CommandTimerPlugin cmtInstance = Bukkit.getServer().getServicesManager().load(CommandTimerPlugin.class)

Don't forget to add CommandTimer as a dependency in your plugin.yml to prevent your plugin from loading before CommandTimer does

最后,请不要忘了在你的插件的 plugin.yml 中添加本插件为硬依赖,以防止你的插件先于本插件加载。

使用拓展与核心 API 交互
Interacting with the core API and using the extension is not possible in the same way you can with a plugin. You can however use getCommandTimerPlugin() (available in ConditionExtension) to get the current CommandTimer instance and start from there.

同时通过插件和拓展来对接本插件的核心 API 也不是不可能。无论如何你都可以使用 getCommandTimerPlugin()
(在 ConditionExtension 中可用) 以获取当前运行中的实例,并以此为基础开始编写你的自定义内容。

名副其实
配置文件

名称修改
Use the paper in your task detail to change the name.
The name should never include spaces
Never manually change the file names in the folders

在任务细节中点击 纸 按钮来修改名称。
名称不应包含任何空格。
请不要尝试手动修改文件夹中的文件名称。

间隔和时间设置
Each task should have an interval or a specific time. Interval and specific time are 2 very different things so you should understand what the differences are.

每一个定时任务都应当有一个执行间隔或执行时间点。并且间隔和时间点是两个完全不同的概念,所以你必须了解它们究竟哪里有不同。

间隔
An interval is a set value (x days, x hours, x minutes, x seconds) after which the commands will be executed. This interval never changes, so if you set the interval to 4 minutes, it will execute the commands you configured every 4 minutes. The image below shows you what the interval menu looks like:

间隔,即是设置一个命令持续执行的间隔时间长度 (x 天, x 小时, x 分钟 以及 x 秒)。间隔永远不变,所以若你将间隔设置为四分钟,那么指定的命令将会每四分钟执行一次,下面的图片展示了时间设置的 GUI 看起来是什么样的:

图片引自 Github,如果加载失败,请前往原帖查看图片。

插件同时也会考虑到服务器关闭的情况,因此你不用担心服务器关闭后插件的计时会出现紊乱。

指定时间
Specific time simply represents a point in time, a specific time of the day, or a specific time of the day on Tuesday, or during the weekend.
You can have as many specific times as you want, there is no limit to it.
You can also create ranges if you want for example a command to execute between 13:00:00 and 15:00:00 every 5 minutes.

指定时间,即是简单地指定一个时间点,例如一天中的某一个时刻,或是星期二的某个时间,或者是在周末期间。
指定时间的设置数量不受限制。
同时你也可以根据你的需求创建特定的命令执行时间段,例如在 13:00:00 和 15:00:00 的时间每隔五分钟执行一次特定的命令。

【脚注】
由于此篇 Wiki 尚未编辑完毕,故剩余章节只存在标题的部分暂时不译。

名副其实
初次使用

创建一个新的定时任务
Use the /cmt command to create a new task. A GUI will open that looks like this:

使用命令 /cmt 来创建一个新的定时任务,如下图所示的GUI将在执行命令后打开:

图片引自 Github,如果加载失败,请前往原帖查看图片。

Click on the paper. You will now see a list of all your created tasks. If you just installed CommandTimer this will be empty.

点击 纸按钮。现在将会显示一系列你所创建的任务,若你刚刚安装这个插件,那么这个列表将会是空的。

图片引自 Github,如果加载失败,请前往原帖查看图片。

Click on the anvil to create a fresh new task.

点击 铁砧 将会开始创建新任务的过程。

设置一个新任务
If you didn't create a task yet, create one first by following these steps.

Open your list of tasks again (/cmt -> paper) and left-click on the task you want to edit. You will see this menu:

若你尚未创建任务,你可以按照下面的步骤来创建一个新的定时任务。
按最初提到的步骤再次打开任务列表,左键点击你想要编辑的任务,然后你会看到如下图所示的菜单:

图片引自 Github,如果加载失败,请前往原帖查看图片。
Here is an overview of what all the items do:

这里是这些按钮的作用:

纸: 修改任务名称
时钟: 设置定时任务的时间间隔或执行时间点
命令方块: 设置将会执行的命令
金锭: 设置任务停止执行的条件
红石比较器: 为单独的玩家设置高级的执行定时任务的限制条件
灰色染料: 启用或禁用当前的定时任务

第一页 上一页 下一页 最后一页