版本更新至 3.59
调整:帮助命令的 JSON 版本改为 1.9+ 版本显示 调整:插件尚未启动完成则不会执行 onDisable() 方法 修复:ActionUtils 工具在 1.12 版本下失效的问题,感谢 MCBBS 用户 Innovators 的测试。
This commit is contained in:
parent
09c063462f
commit
e7ebf50ff2
@ -88,6 +88,8 @@ public class Main extends JavaPlugin implements Listener {
|
||||
private static LogClient client;
|
||||
@Getter
|
||||
private static Language2 exampleLangauge2;
|
||||
@Getter
|
||||
private static boolean started;
|
||||
|
||||
public static Random getRandom() {
|
||||
return NumberUtils.getRand();
|
||||
@ -220,12 +222,22 @@ public class Main extends JavaPlugin implements Listener {
|
||||
TLM.getInst();
|
||||
}
|
||||
}.runTask(this);
|
||||
|
||||
// 启动
|
||||
started = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
disable = true;
|
||||
|
||||
// 如果插件尚未启动完成
|
||||
if (!started) {
|
||||
MsgUtils.send("&c插件尚未启动完成, 已跳过卸载代码");
|
||||
MsgUtils.send("&c插件作者: &4坏黑");
|
||||
return;
|
||||
}
|
||||
|
||||
// 保存数据
|
||||
Bukkit.getOnlinePlayers().forEach(x -> DataUtils.saveOnline(x.getName()));
|
||||
// 结束线程
|
||||
|
@ -46,7 +46,7 @@ public class HelpCommand extends SubCommand {
|
||||
helps.put("§e", null);
|
||||
helps.put("/taboolib importdata", "§4向数据库导入本地数据 §8(该操作将会清空数据库)");
|
||||
|
||||
if (sender instanceof ConsoleCommandSender || TabooLib.getVerint() < 10800) {
|
||||
if (sender instanceof ConsoleCommandSender || TabooLib.getVerint() < 10900) {
|
||||
sender.sendMessage("§f");
|
||||
sender.sendMessage("§b§l----- §3§lTaooLib Commands §b§l-----");
|
||||
sender.sendMessage("§f");
|
||||
|
@ -4,7 +4,9 @@ import java.lang.reflect.Constructor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import me.skymc.taboolib.TabooLib;
|
||||
import me.skymc.taboolib.methods.MethodsUtils;
|
||||
import net.minecraft.server.v1_12_R1.ChatMessageType;
|
||||
|
||||
public class ActionUtils {
|
||||
|
||||
@ -44,8 +46,16 @@ public class ActionUtils {
|
||||
try
|
||||
{
|
||||
Object ab = getNMSClass("ChatComponentText").getConstructor(new Class[] { String.class }).newInstance(new Object[] { msg });
|
||||
Constructor<?> ac = getNMSClass("PacketPlayOutChat").getConstructor(new Class[] { getNMSClass("IChatBaseComponent"), Byte.TYPE });
|
||||
Object abPacket = ac.newInstance(new Object[] { ab, Byte.valueOf((byte) 2) });
|
||||
Constructor<?> ac = null;
|
||||
Object abPacket = null;
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1.11.0
|
||||
if (TabooLib.getVerint() > 11100) {
|
||||
Class<?> chatMessageType = getNMSClass("ChatMessageType");
|
||||
ac = getNMSClass("PacketPlayOutChat").getConstructor(getNMSClass("IChatBaseComponent"), chatMessageType);
|
||||
abPacket = ac.newInstance(ab, chatMessageType.getMethod("a", Byte.TYPE).invoke(null, (byte) 2));
|
||||
} else {
|
||||
abPacket = ac.newInstance(ab, Byte.valueOf((byte) 2));
|
||||
}
|
||||
sendPacket(p, abPacket);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Loading…
Reference in New Issue
Block a user