Skip to content

Commit 548d393

Browse files
committed
Add ECO-Reward notification & fix
1 parent ebb79a5 commit 548d393

30 files changed

+752
-280
lines changed

.github/workflows/package-publish.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ name: Publish to GitHub Packages
1313
run-name: 'Package Publish #${{github.run_number}}'
1414

1515
on:
16-
release:
17-
types: [published]
1816
workflow_dispatch:
1917

2018
jobs:
@@ -36,7 +34,7 @@ jobs:
3634
distribution: 'oracle'
3735

3836
- name: Publish to GitHub Packages Apache Maven
39-
run: ./gradlew publish -i
37+
run: ./gradlew publishToGithubPackage
4038
env:
4139
MAVEN_PUBLISH_URL: https://maven.pkg.github.com/${{github.repository}}
4240
MAVEN_PUBLISH_USERNAME: ${{github.actor}}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# User-specific stuff
22
.idea/
3+
.vscode/
34

45
*.iml
56
*.ipr

Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pipeline {
66
jdk "jdk17"
77
}
88
steps {
9-
sh './gradlew publish'
9+
sh './gradlew publishToNyaaCatCILocal'
1010
}
1111
}
1212
}

README.md

+127-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
12
# PlayTimeTracker
23
Playtime tracking plugin for ~~Bukkit/Spigot~~ PaperMC
34

5+
46
## Configuration
57

68
### missions.yml
@@ -58,6 +60,122 @@ missions:
5860
5. **If you modified `gradle.properties` under this repo, When committing changes, make sure to remove what you add in step 3. so that `GITHUB_TOKEN` is not exposed.**
5961

6062

63+
## Change Log
64+
65+
### 0.9-SNAPSHOT
66+
67+
- [Tech] port to 1.21.1 and CI migration;
68+
- [Tech] publish to github packages
69+
- **[BREAKING] Abandon support for other Bukkit/Spigot, Only support PaperMC **
70+
71+
we don't have enough effort for different distributions
72+
73+
### 0.10-alpha.1
74+
75+
- [Feature] **Rewards storage & any-time acquire**: Now rewards will be record when a mission is completed, and you can use `/ptt acquire` to acquire it at anytime, no need to worry about missing it!
76+
77+
- [Feature/WIP] Reward Module instead of use command all the time. Currently only support ECO Rewards. Command Rewards and Item Rewards are WIP.
78+
79+
- [Feature] Add `/ptt listrewards <missionName|all>` to show rewards awaiting for acquiring.
80+
81+
- [Configuration] `missions.yml` :
82+
83+
```yaml
84+
missions:
85+
eco:
86+
__class__: cat.nyaa.playtimetracker.config.data.MissionData
87+
group: []
88+
expression: lastSeen>1&&dailyTime>1&&weeklyTime>1&&monthlyTime>1&&totalTime>1&&1==2
89+
reset-daily: true
90+
reset-weekly: false
91+
reset-monthly: false
92+
reward-list: # can be multiple rewards; the key is not important, but reward will be executed in key order
93+
reward1:
94+
__class__: cat.nyaa.playtimetracker.config.data.EcoRewardData
95+
type: TRANSFER # TRANSFER, ADD
96+
ref-vault: $system # "$system" or player uuid
97+
ratio: 0.01
98+
min: 1.0
99+
max: 1024.0
100+
vault: $system # "$system" or player uuid # same as /eco transfer 0.01:1:1024:$system $system %player_name%
101+
notify: true
102+
daily:
103+
__class__: cat.nyaa.playtimetracker.config.data.MissionData
104+
group: []
105+
expression: dailyTime>3600000
106+
reset-daily: true
107+
reset-weekly: false
108+
reset-monthly: false
109+
reward-list:
110+
reward2:
111+
__class__: cat.nyaa.playtimetracker.config.data.EcoRewardData
112+
type: ADD
113+
amount: 100 # same as /eco add 100 %player%
114+
notify: true
115+
```
116+
117+
- [Configuration] lang
118+
119+
- `command.listrewards.*`
120+
- `manual.listrewards.*`
121+
122+
```yaml
123+
command:
124+
listrewards:
125+
show_all: 有 %s 个任务奖励待领取
126+
show: 有 %s 个 %s 任务奖励待领取
127+
empty_all: 没有可以领取的任务奖励
128+
empty: 没有可以领取的 %s 任务奖励
129+
manual:
130+
listrewards:
131+
description: 查看所有奖励
132+
usage: /ptt listrewards <奖励名称|all>
133+
```
134+
135+
- [Tech] Add some Unit Tests.
136+
137+
- [Tech] Recover to use NyaaCat CI
138+
139+
### 0.10-alpha.2
140+
141+
- [Feature] Add notification for ECO Rewards. Now when acquire ECO Rewards, it displays how much you get.
142+
143+
- [Feature] `/ptt listrewards all` now display detailed information of how many rewards for each mission.
144+
145+
- [Configuration] lang
146+
147+
- `command.listrewards.err`
148+
149+
- `command.listrewards.show_item`
150+
151+
- `message.reward.notify` for login notification
152+
153+
- `message.reward.eco` for ECO Rewards acquiring detailed information
154+
155+
```yaml
156+
command:
157+
listrewards:
158+
err: 查询失败
159+
show_item: "- 任务 %s: %s" # first %s is mission name; second %s is rewards count
160+
message:
161+
reward:
162+
notify:
163+
command: /ptt acquire
164+
msg: 您有 %s 个任务奖励可以领取
165+
eco:
166+
success: 经济奖励%s%s已经添加到您的账户 # first %s is amount; second %s is eco-unit
167+
```
168+
169+
- [Fix] Database wrapper log
170+
171+
- [Fix] remove `NotifyAcquireTask` since it should not work.
172+
173+
- [Fix] pipeline for github-package and NyaaCat CI
174+
175+
- [Tech/WIP] PaperMC Adventure for messages instead of legacy Bukkit API
176+
177+
178+
61179
## TODO
62180

63181
#### 0.10-alpha
@@ -69,13 +187,17 @@ missions:
69187

70188
- [ ] add reward module: command
71189
- [ ] add reward module: item
72-
- [ ] logging system
190+
- [x] logging system
191+
- [ ] i18n: https://docs.papermc.io/paper/dev/component-api/i18n#examples
192+
- [ ] mission completion notification (sound or Advancement)
73193

74194
#### 1.0
75-
195+
- [ ] Use time-wheel instead of 1gt polling
196+
- [ ] Optimize Expressions
197+
- [ ] calculate next mission completion time
198+
- [ ] time-wheel for mission completion
199+
- [ ] command for querying next mission completion time
76200
- [ ] Make all db operations async
77201
- [ ] Remove `cat.nyan.playtimetracker.db.connection`
78202
- [ ] Make `CachedXXXTable` and async methods
79-
- [ ] Use time-wheel instead of 1gt polling
80-
- [ ] Optimize Expressions
81-
203+
- [ ] disable plugin: self-disable

build.gradle.kts

+17-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ val paperApiName = "1.21.1-R0.1-SNAPSHOT"
1010

1111
// Version used for distribution. Different from maven repo
1212
group = "cat.nyaa"
13-
version = "0.10-alpha.1"
13+
version = "0.10-alpha.2"
1414

1515
java {
1616
// Configure the java toolchain. This allows gradle to auto-provision JDK 21 on systems that only have JDK 8 installed for example.
@@ -69,7 +69,7 @@ publishing {
6969
}
7070
repositories {
7171
maven {
72-
name = "maven-publish"
72+
name = "GithubPackage"
7373
url = uri(System.getenv("MAVEN_PUBLISH_URL") ?: layout.buildDirectory.dir("repo"))
7474
val mavenUsername = System.getenv("MAVEN_PUBLISH_USERNAME")
7575
val mavenPassword = System.getenv("MAVEN_PUBLISH_PASSWORD")
@@ -80,9 +80,24 @@ publishing {
8080
}
8181
}
8282
}
83+
maven {
84+
name = "NyaaCatCILocal"
85+
//local maven repository
86+
url = uri("file://${System.getenv("MAVEN_DIR")}")
87+
}
8388
}
8489
}
8590

91+
// Custom tasks for publishing to specific repositories
92+
tasks.register("publishToGithubPackage") {
93+
dependsOn("publishMavenJavaPublicationToGithubPackageRepository")
94+
// auto generated task: publish<PublicationName>PublicationTo<RepositoryName>Repository
95+
}
96+
97+
tasks.register("publishToNyaaCatCILocal") {
98+
dependsOn("publishMavenJavaPublicationToNyaaCatCILocalRepository")
99+
}
100+
86101

87102
tasks {
88103

src/main/java/cat/nyaa/playtimetracker/PlayTimeTracker.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public final class PlayTimeTracker extends JavaPlugin implements IEconomyCorePro
3636
@Nullable
3737
private TimeRecordManager timeRecordManager;
3838
@Nullable
39+
private PlayerRewardManager rewardManager;
40+
@Nullable
3941
private PlayerMissionManager missionManager;
4042
@Nullable
4143
private Plugin essentialsPlugin;
@@ -94,8 +96,10 @@ public void onEnable() {
9496
this.afkManager = new PlayerAFKManager(this);
9597
//record
9698
this.timeRecordManager = new TimeRecordManager(this, databaseManager.getTimeTrackerConnection());
99+
//reward
100+
this.rewardManager = new PlayerRewardManager(this, databaseManager.getRewardsConnection());
97101
//Mission
98-
this.missionManager = new PlayerMissionManager(this, pttConfiguration, timeRecordManager, databaseManager.getCompletedMissionConnection(), databaseManager.getRewardsConnection());
102+
this.missionManager = new PlayerMissionManager(this, pttConfiguration, timeRecordManager, rewardManager, databaseManager.getCompletedMissionConnection());
99103
}
100104

101105
@Nullable
@@ -123,6 +127,11 @@ public TimeRecordManager getTimeRecordManager() {
123127
return timeRecordManager;
124128
}
125129

130+
@Nullable
131+
public PlayerRewardManager getRewardManager() {
132+
return rewardManager;
133+
}
134+
126135
@Nullable
127136
public PlayerMissionManager getMissionManager() {
128137
return missionManager;

0 commit comments

Comments
 (0)