Skip to content

Commit

Permalink
2023/12/25更新 API版本6.0.1
Browse files Browse the repository at this point in the history
[UltiTools-API]
1.支持了spigot 1.20.1-1.20.4
2.添加了指令图形化安装卸载模块
3.同步了部分模块的名称
  • Loading branch information
wisdommen committed Dec 25, 2023
1 parent 5230bf1 commit 099ac6a
Show file tree
Hide file tree
Showing 18 changed files with 801 additions and 59 deletions.
2 changes: 1 addition & 1 deletion BasicFunctions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<artifactId>ultitools-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<name>Basic Functions</name>
<name>BasicFunctions</name>
<identifyString>UltiTools-Basic-Functions</identifyString>
<shortDescription>All basic functions of the UltiTools</shortDescription>
<accessKeyFile>access_key.txt</accessKeyFile>
Expand Down
2 changes: 1 addition & 1 deletion MysqlConnector/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: UltiTools-MysqlConnector
name: MysqlConnector
version: '${project.version}'
main: com.ultikits.plugins.mysqlconnector.MysqlConnector
api-version: 600
Expand Down
2 changes: 1 addition & 1 deletion Sidebar/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: UltiTools-SidebarPlugin
name: Sidebar
version: '${project.version}'
main: com.ultikits.plugins.sidebar.SidebarPlugin
api-version: 600
Expand Down
2 changes: 1 addition & 1 deletion UltiTools-API/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>UltiTools-API</artifactId>
<groupId>com.ultikits</groupId>
<version>6.0.0.202312150106</version>
<version>6.0.1</version>
<modelVersion>4.0.0</modelVersion>
<name>UltiTools-API</name>
<description>This project is the base of the Ultitools plugin development.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;
import com.ultikits.ultitools.abstracts.UltiToolsPlugin;
import com.ultikits.ultitools.context.ContextConfig;
import com.ultikits.ultitools.commands.PluginInstallCommands;
import com.ultikits.ultitools.commands.UltiToolsCommands;
Expand Down Expand Up @@ -37,7 +38,7 @@
* UltiTools plugin main class.
*
* @author wisdommen, qianmo
* @version 6.0.0
* @version 6.0.1
*/
public final class UltiTools extends JavaPlugin implements Localized {
private static UltiTools ultiTools;
Expand Down Expand Up @@ -78,7 +79,7 @@ public static UltiTools getInstance() {
* @return the version of the UltiTools
*/
public static int getPluginVersion() {
return 600;
return 601;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ private Object[] parseParams(String[] strings, Method method, CommandSender comm
CmdParam cmdParam = parameter.getAnnotation(CmdParam.class);
String value = params.get(cmdParam.value());
try {

if (parameter.getType() == float.class || parameter.getType() == Float.class) {
ParamList.add(Float.parseFloat(value));
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

import com.ultikits.ultitools.UltiTools;
import com.ultikits.ultitools.abstracts.AbstractCommendExecutor;
import com.ultikits.ultitools.abstracts.UltiToolsPlugin;
import com.ultikits.ultitools.annotations.command.*;
import com.ultikits.ultitools.entities.PluginEntity;
import com.ultikits.ultitools.utils.MessageUtils;
import com.ultikits.ultitools.utils.PluginInstallUtils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;

import java.io.IOException;
Expand All @@ -25,33 +32,84 @@ public void listPlugins(@CmdSender CommandSender sender, @CmdParam("page") Strin
} catch (NumberFormatException ignored) {
}
}
List<UltiToolsPlugin> installedPlugins = UltiTools.getInstance().getPluginManager().getPluginList();
List<PluginEntity> plugins = PluginInstallUtils.getPluginList(pageInt, 10);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(UltiTools.getInstance().i18n("========|可用插件列表|========\n"));
int i = 1;
for (PluginEntity plugin : plugins) {
stringBuilder.append(i);
stringBuilder.append(UltiTools.getInstance().i18n(". 名字:"));
stringBuilder.append(plugin.getName());
stringBuilder.append("\n");
stringBuilder.append(UltiTools.getInstance().i18n(" 安装命令:/upm install "));
stringBuilder.append(plugin.getIdentifyString());
stringBuilder.append("\n");
stringBuilder.append(UltiTools.getInstance().i18n(" 简介:"));
stringBuilder.append(plugin.getShortDescription());
stringBuilder.append("\n");
if (i < plugins.size()) {
stringBuilder.append("---------------------\n");
if (sender instanceof Player) {
TextComponent text = Component.text(UltiTools.getInstance().i18n("========|可用插件列表|========\n"))
.color(TextColor.color(0x00ffff));
int i = 1;
for (PluginEntity plugin : plugins) {
text = text.append(Component.text(i + UltiTools.getInstance().i18n(". 名字:") + plugin.getName() + "\n").color(TextColor.color(0x00ffff)));
text = text.append(Component.text(UltiTools.getInstance().i18n(" 安装状态:")).color(TextColor.color(127, 127, 127)));
boolean installed = false;
for (UltiToolsPlugin installedPlugin : installedPlugins) {
if (installedPlugin.getPluginName().equals(plugin.getName())) {
installed = true;
break;
}
}
if (installed) {
text = text.append(Component.text(UltiTools.getInstance().i18n(" 已安装") + "\n").color(TextColor.color(0x00ff00)));
text = text.append(
Component
.text(UltiTools.getInstance().i18n(" | 卸载 | ") + "\n")
.color(TextColor.color(255, 0, 0))
.hoverEvent(Component.text(UltiTools.getInstance().i18n("点击卸载模块")))
.clickEvent(ClickEvent.runCommand("/upm uninstall " + plugin.getName()))
);
} else {
text = text.append(Component.text(UltiTools.getInstance().i18n(" 未安装") + "\n").color(TextColor.color(0xff0000)));
text = text.append(
Component
.text(UltiTools.getInstance().i18n(" | 安装 | ") + "\n")
.color(TextColor.color(0, 255, 0))
.hoverEvent(Component.text(UltiTools.getInstance().i18n("点击安装模块")))
.clickEvent(ClickEvent.runCommand("/upm install " + plugin.getIdentifyString()))
);
}
text = text.append(Component.text(UltiTools.getInstance().i18n(" 简介:") + plugin.getShortDescription() + "\n").color(TextColor.color(127, 127, 127)));
if (i < plugins.size()) {
text = text.append(Component.text("---------------------\n").color(TextColor.color(0x00ffff)));
}
i++;
}
i++;
}
stringBuilder.append(String.format(UltiTools.getInstance().i18n("======== 第%d页 ========"), pageInt));
new BukkitRunnable() {
@Override
public void run() {
sender.sendMessage(stringBuilder.toString());
text = text.append(Component.text(String.format(UltiTools.getInstance().i18n("======== 第%d页 ========"), pageInt))
.color(TextColor.color(0x00ffff)));
TextComponent finalText = text;
new BukkitRunnable() {
@Override
public void run() {
MessageUtils.sendMessage((Player) sender, finalText);
}
}.runTask(UltiTools.getInstance());
} else {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(UltiTools.getInstance().i18n("========|可用插件列表|========\n"));
int i = 1;
for (PluginEntity plugin : plugins) {
stringBuilder.append(i);
stringBuilder.append(UltiTools.getInstance().i18n(". 名字:"));
stringBuilder.append(plugin.getName());
stringBuilder.append("\n");
stringBuilder.append(UltiTools.getInstance().i18n(" 安装命令:/upm install "));
stringBuilder.append(plugin.getIdentifyString());
stringBuilder.append("\n");
stringBuilder.append(UltiTools.getInstance().i18n(" 简介:"));
stringBuilder.append(plugin.getShortDescription());
stringBuilder.append("\n");
if (i < plugins.size()) {
stringBuilder.append("---------------------\n");
}
i++;
}
}.runTask(UltiTools.getInstance());
stringBuilder.append(String.format(UltiTools.getInstance().i18n("======== 第%d页 ========"), pageInt));
new BukkitRunnable() {
@Override
public void run() {
sender.sendMessage(stringBuilder.toString());
}
}.runTask(UltiTools.getInstance());
}
}

@CmdMapping(format = "list")
Expand Down Expand Up @@ -96,7 +154,7 @@ public void listVersions(@CmdSender CommandSender sender, @CmdParam("plugin") St
if (i1 == pluginVersions.size()) {
stringBuilder.append(UltiTools.getInstance().i18n(" 安装命令:/upm install "));
stringBuilder.append(plugin);
stringBuilder.append(" [版本]");
stringBuilder.append(" [version]");
stringBuilder.append("\n");
stringBuilder.append("---------------------\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @version 1.0.0
*/
@CmdExecutor(description = "UltiToolsCommands" ,alias = {"ul", "ultitools", "ulti"}, requireOp = true)
@CmdTarget(CmdTarget.CmdTargetType.CONSOLE)
@CmdTarget(CmdTarget.CmdTargetType.BOTH)
public class UltiToolsCommands extends AbstractCommendExecutor {
@CmdMapping(format = "reload")
public void reloadPlugins() {
Expand Down
9 changes: 8 additions & 1 deletion UltiTools-API/src/main/resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,12 @@
"卸载成功!请手动删除本地文件,否则重启之后还会启用!": "Uninstalled! Please delete local files manually, otherwise it will be enabled after restart!",
"文件位置:%s": "File Location: %s",
"卸载失败!请检查是否拼写正确!": "Uninstall Failed! Please check if the spelling is correct!",
"删除失败!文件访问错误!请手动删除!": "Delete Failed! File access error! Please delete it manually!"
"删除失败!文件访问错误!请手动删除!": "Delete Failed! File access error! Please delete it manually!",
" 安装状态:": " Install Status:",
"已安装": "Installed",
"未安装": "Not Installed",
" | 安装 | ": " | Install | ",
" | 卸载 | ": " | Uninstall | ",
"点击卸载模块": "Click to uninstall module",
"点击安装模块": "Click to install module"
}
9 changes: 8 additions & 1 deletion UltiTools-API/src/main/resources/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,12 @@
"请先等待其他玩家发送的命令执行完毕!": "请先等待其他玩家发送的命令执行完毕!",
"操作频繁,请稍后再试": "操作频繁,请稍后再试",
"参数 '%s' 格式错误:'%s' 不是一个有效的 %s 类型": "参数 '%s' 格式错误:'%s' 不是一个有效的 %s 类型",
"=== UltiTools 命令列表 ===\n/ul reload 重载插件模块\n/ul list 查看已加载的模块列表\n================": "=== UltiTools 命令列表 ===\n/ul reload 重载插件模块\n/ul list 查看已加载的模块列表\n================"
"=== UltiTools 命令列表 ===\n/ul reload 重载插件模块\n/ul list 查看已加载的模块列表\n================": "=== UltiTools 命令列表 ===\n/ul reload 重载插件模块\n/ul list 查看已加载的模块列表\n================",
" 安装状态:": " 安装状态:",
"已安装": "已安装",
"未安装": "未安装",
" | 安装 | ": " | 安装 | ",
" | 卸载 | ": " | 卸载 | ",
"点击卸载模块": "点击卸载模块",
"点击安装模块": "点击安装模块"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
import com.ultikits.ultitools.entities.Colors;
import com.ultikits.ultitools.entities.Sounds;
import com.ultikits.ultitools.interfaces.VersionWrapper;
import io.netty.channel.Channel;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.network.protocol.game.ClientboundSystemChatPacket;
import net.minecraft.network.protocol.game.PacketPlayOutPlayerListHeaderFooter;
import net.minecraft.server.network.PlayerConnection;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.Sound;
Expand Down Expand Up @@ -207,20 +204,4 @@ public BlockFace getBlockFace(Block placedBlock) {
BlockData blockData = placedBlock.getBlockData();
return ((Directional) blockData).getFacing();
}

public PlayerConnection getPlayerConnection(Player player) {
return null;
}

public NetworkManager getNetworkManager(Player player) {
return null;
}

public Channel getChannel(Player player) {
return null;
}

public Object getHandle(Player player) {
return ((CraftPlayer) player).getHandle();
}
}
23 changes: 23 additions & 0 deletions Versions/1_20_R2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.ultikits.versions</groupId>
<artifactId>Versions</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>1_20_R2</artifactId>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

</dependencies>
</project>
Loading

0 comments on commit 099ac6a

Please sign in to comment.