1
mirror of https://github.com/CarmJos/UserPrefix.git synced 2026-06-04 23:43:29 +08:00

添加ASCII文字与插件介绍

This commit is contained in:
carm
2021-11-21 19:53:12 +08:00
parent cf749bf5c0
commit f23fa03f7a
2 changed files with 105 additions and 63 deletions
+11 -1
View File
@@ -301,7 +301,7 @@ itemNoPermission:
感谢您成为开源项目的支持者! 感谢您成为开源项目的支持者!
<img height=25% width=25% src="https://raw.githubusercontent.com/CarmJos/CarmJos/main/img/donate-code.jpg" /> <img height=25% width=25% src="https://raw.githubusercontent.com/CarmJos/CarmJos/main/img/donate-code.jpg" alt=""/>
## 开源协议 ## 开源协议
@@ -321,3 +321,13 @@ itemNoPermission:
> 需要注意的是,分发的时候,需要明确提供源代码和二进制文件,另外,用于某些程序的某些协议有一些问题和限制,你可以看一下 @PierreJoye 写的 Practical Guide to GPL Compliance 一文。使用 GPL 协议,你必须在源代码代码中包含相应信息,以及协议本身。 > 需要注意的是,分发的时候,需要明确提供源代码和二进制文件,另外,用于某些程序的某些协议有一些问题和限制,你可以看一下 @PierreJoye 写的 Practical Guide to GPL Compliance 一文。使用 GPL 协议,你必须在源代码代码中包含相应信息,以及协议本身。
> >
> *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。* > *以上文字来自 [五种开源协议GPL,LGPL,BSD,MIT,Apache](https://www.oschina.net/question/54100_9455) 。*
```text
_ _ _____ __ _
| | | | | __ \ / _|(_)
| | | | ___ ___ _ __ | |__) |_ __ ___ | |_ _ __ __
| | | |/ __| / _ \| '__|| ___/| '__|/ _ \| _|| |\ \/ /
| |__| |\__ \| __/| | | | | | | __/| | | | > <
\____/ |___/ \___||_| |_| |_| \___||_| |_|/_/\_\
```
@@ -15,8 +15,13 @@ import cc.carm.plugin.userprefix.util.ColorParser;
import cc.carm.plugin.userprefix.util.MessageUtil; import cc.carm.plugin.userprefix.util.MessageUtil;
import net.luckperms.api.event.user.UserDataRecalculateEvent; import net.luckperms.api.event.user.UserDataRecalculateEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.TabCompleter;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Main extends JavaPlugin { public class Main extends JavaPlugin {
@@ -25,7 +30,7 @@ public class Main extends JavaPlugin {
@Override @Override
public void onEnable() { public void onEnable() {
instance = this; instance = this;
showPluginName();
log(getName() + " " + getDescription().getVersion() + " &7开始加载..."); log(getName() + " " + getDescription().getVersion() + " &7开始加载...");
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
@@ -34,8 +39,8 @@ public class Main extends JavaPlugin {
PrefixManager.init(); PrefixManager.init();
log("注册指令..."); log("注册指令...");
Bukkit.getPluginCommand("UserPrefix").setExecutor(new UserPrefixCommand()); registerCommand("UserPrefix", new UserPrefixCommand());
Bukkit.getPluginCommand("UserPrefixAdmin").setExecutor(new UserPrefixAdminCommand()); registerCommand("UserPrefixAdmin", new UserPrefixAdminCommand());
log("注册监听器..."); log("注册监听器...");
regListener(new UserListener()); regListener(new UserListener());
@@ -63,6 +68,7 @@ public class Main extends JavaPlugin {
@Override @Override
public void onDisable() { public void onDisable() {
showPluginName();
log(getName() + " " + getDescription().getVersion() + " 开始卸载..."); log(getName() + " " + getDescription().getVersion() + " 开始卸载...");
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
@@ -98,6 +104,32 @@ public class Main extends JavaPlugin {
return instance; return instance;
} }
public static void registerCommand(String commandName,
@NotNull CommandExecutor executor) {
registerCommand(commandName, executor, null);
}
public static void registerCommand(String commandName,
@NotNull CommandExecutor executor,
@Nullable TabCompleter tabCompleter) {
PluginCommand command = Bukkit.getPluginCommand(commandName);
if (command == null) return;
command.setExecutor(executor);
if (tabCompleter != null) command.setTabCompleter(tabCompleter);
}
private void showPluginName() {
log("&b _ _ &f _____ __ _ ");
log("&b| | | | &f| __ \\ / _|(_) ");
log("&b| | | | ___ ___ _ __ &f| |__) |_ __ ___ | |_ _ __ __");
log("&b| | | |/ __| / _ \\| '__|&f| ___/| '__|/ _ \\| _|| |\\ \\/ /");
log("&b| |__| |\\__ \\| __/| | &f| | | | | __/| | | | > < ");
log("&b \\____/ |___/ \\___||_| &f|_| |_| \\___||_| |_|/_/\\_\\");
log("&8 ");
log("&8> &f" + getDescription().getWebsite());
}
private void showAD() { private void showAD() {
log("&7感谢您使用 &3&lUserPrefix " + getDescription().getVersion() + "&7!"); log("&7感谢您使用 &3&lUserPrefix " + getDescription().getVersion() + "&7!");
log("&7本插件由 &b&lYourCraft &7提供长期支持与维护。"); log("&7本插件由 &b&lYourCraft &7提供长期支持与维护。");