Skip to content

Commit f5a797b

Browse files
committed
版本更新至 3.59
调整:帮助命令的 JSON 版本改为 1.9+ 版本显示 调整:插件尚未启动完成则不会执行 onDisable() 方法 修复:ActionUtils 工具在 1.12 版本下失效的问题,感谢 MCBBS 用户 Innovators 的测试。
1 parent f2fd7a8 commit f5a797b

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

src/main/src/me/skymc/taboolib/Main.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ public class Main extends JavaPlugin implements Listener {
8888
private static LogClient client;
8989
@Getter
9090
private static Language2 exampleLangauge2;
91+
@Getter
92+
private static boolean started;
9193

9294
public static Random getRandom() {
9395
return NumberUtils.getRand();
@@ -220,12 +222,22 @@ public void run() {
220222
TLM.getInst();
221223
}
222224
}.runTask(this);
225+
226+
// 启动
227+
started = true;
223228
}
224229

225230
@Override
226231
public void onDisable() {
227232
disable = true;
228233

234+
// 如果插件尚未启动完成
235+
if (!started) {
236+
MsgUtils.send("&c插件尚未启动完成, 已跳过卸载代码");
237+
MsgUtils.send("&c插件作者: &4坏黑");
238+
return;
239+
}
240+
229241
// 保存数据
230242
Bukkit.getOnlinePlayers().forEach(x -> DataUtils.saveOnline(x.getName()));
231243
// 结束线程

src/main/src/me/skymc/taboolib/commands/sub/HelpCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public HelpCommand(CommandSender sender, String[] args) {
4646
helps.put("§e", null);
4747
helps.put("/taboolib importdata", "§4向数据库导入本地数据 §8(该操作将会清空数据库)");
4848

49-
if (sender instanceof ConsoleCommandSender || TabooLib.getVerint() < 10800) {
49+
if (sender instanceof ConsoleCommandSender || TabooLib.getVerint() < 10900) {
5050
sender.sendMessage("§f");
5151
sender.sendMessage("§b§l----- §3§lTaooLib Commands §b§l-----");
5252
sender.sendMessage("§f");

src/main/src/me/skymc/taboolib/display/ActionUtils.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import org.bukkit.Bukkit;
55
import org.bukkit.entity.Player;
66

7+
import me.skymc.taboolib.TabooLib;
78
import me.skymc.taboolib.methods.MethodsUtils;
9+
import net.minecraft.server.v1_12_R1.ChatMessageType;
810

911
public class ActionUtils {
1012

@@ -44,8 +46,16 @@ public static void send(Player p, String msg)
4446
try
4547
{
4648
Object ab = getNMSClass("ChatComponentText").getConstructor(new Class[] { String.class }).newInstance(new Object[] { msg });
47-
Constructor<?> ac = getNMSClass("PacketPlayOutChat").getConstructor(new Class[] { getNMSClass("IChatBaseComponent"), Byte.TYPE });
48-
Object abPacket = ac.newInstance(new Object[] { ab, Byte.valueOf((byte) 2) });
49+
Constructor<?> ac = null;
50+
Object abPacket = null;
51+
// ����汾���� 1.11.0
52+
if (TabooLib.getVerint() > 11100) {
53+
Class<?> chatMessageType = getNMSClass("ChatMessageType");
54+
ac = getNMSClass("PacketPlayOutChat").getConstructor(getNMSClass("IChatBaseComponent"), chatMessageType);
55+
abPacket = ac.newInstance(ab, chatMessageType.getMethod("a", Byte.TYPE).invoke(null, (byte) 2));
56+
} else {
57+
abPacket = ac.newInstance(ab, Byte.valueOf((byte) 2));
58+
}
4959
sendPacket(p, abPacket);
5060
}
5161
catch (Exception ex)

0 commit comments

Comments
 (0)