@occultus/task-api 0.21.0-beta.0 → 0.21.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occultus/task-api",
3
- "version": "0.21.0-beta.0",
3
+ "version": "0.21.0-beta.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://codeberg.org/TeamOccultus/StarTenonAPI"
@@ -24,7 +24,7 @@
24
24
  "author": "CTN Studios",
25
25
  "type": "module",
26
26
  "dependencies": {
27
- "@occultus/format-api": "0.21.0-beta.0",
27
+ "@occultus/format-api": "0.21.0-beta.1",
28
28
  "@occultus/entity-api": "0.20.0",
29
29
  "@occultus/text-api": "0.20.0",
30
30
  "@occultus/item-api": "0.20.0"
package/src/api/Task.ts CHANGED
@@ -7,6 +7,7 @@ import { TaskCenter } from "./TaskCenter";
7
7
  import { MessageFormData } from "@minecraft/server-ui";
8
8
  import { TaskUtils } from "../utils/TaskUtils";
9
9
  import { LockedScreen } from "../ui/LockedScreen";
10
+ import { TaskServer } from "./TaskServer";
10
11
 
11
12
  export class Task {
12
13
  /**
@@ -128,4 +129,13 @@ export class Task {
128
129
  });
129
130
  player.playSound(this.options.completeSound ?? "random.levelup");
130
131
  }
132
+ /**
133
+ * 直接将任务上传到服务端监听器中
134
+ *
135
+ * **IMPORTANT: 除非任务使用的条件有特殊说明,否则此方法一般无用**
136
+ * @param server
137
+ */
138
+ pushToServer(server: TaskServer){
139
+ server.addTask(this);
140
+ }
131
141
  }
@@ -42,4 +42,9 @@ export class TaskServer {
42
42
  this.families.set(condition.family, condition.bindTo);
43
43
  }
44
44
  }
45
+ addTask(task: Task) {
46
+ task.options.conditions.forEach((condition) => {
47
+ this.addCondition(condition);
48
+ });
49
+ }
45
50
  }