-
Notifications
You must be signed in to change notification settings - Fork 63
/
PkgAnn.java
51 lines (48 loc) · 1.71 KB
/
PkgAnn.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package org.itxtech.mcl.module.builtin;
import org.fusesource.jansi.Ansi;
import org.itxtech.mcl.module.MclModule;
/*
*
* Mirai Console Loader
*
* Copyright (C) 2020-2022 iTX Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author PeratX
* @website https://github.com/iTXTech/mirai-console-loader
*
*/
public class PkgAnn extends MclModule {
@Override
public String getName() {
return "pkgann";
}
@Override
public void boot() {
for (var pkg : loader.packageManager.getPackages()) {
try {
if (!pkg.channel.startsWith("maven")) {
var info = loader.repo.fetchPackage(pkg.id);
if (info.announcement != null) {
loader.logger.info(Ansi.ansi().fgBrightYellow().a(info.getName(pkg.id)).reset().a(" Announcement:"));
loader.logger.println(info.announcement);
}
}
} catch (Exception e) {
loader.logger.error("Failed to fetch announcement for \"" + pkg.id + "\"");
}
}
}
}