1.16.1 compatibility

This commit is contained in:
Kikisito 2020-06-25 16:21:34 +02:00
parent 86579732ca
commit 1ddbd60b69
5 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
name: ActionHealth
main: com.zeshanaslam.actionhealth.Main
version: 3.4.7
version: 3.4.8
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, WorldGuard, mcMMO, MythicMobs, LangUtils]
commands:
Actionhealth:

6
src/META-INF/MANIFEST.MF Normal file
View File

@ -0,0 +1,6 @@
Manifest-Version: 1.0
Main-Class:
Class-Path: MVdWPlaceholderAPI.jar spigot-api-1.16.1-R0.1-SNAPSHOT-shade
d.jar worldguard-bukkit-7.0.2.jar jsr305-3.0.2.jar LangUtils-1.9.jar My
thicMobs-4.9.1.jar PlaceholderAPI-2.10.6.jar

View File

@ -9,11 +9,11 @@ public class PreAction {
private final String packageVersion = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
public PreAction(Player player, String message) {
public PreAction(Player player, String message) throws ClassNotFoundException {
try {
Object chatComponentText = getNMSClass("ChatComponentText").getConstructor(new Class[]{String.class}).newInstance(message);
Object chatMessageType = getNMSClass("ChatMessageType").getField("GAME_INFO").get(null);
Object packetPlayOutChat = getNMSClass("PacketPlayOutChat").getConstructor(new Class[]{getNMSClass("IChatBaseComponent"), getNMSClass("ChatMessageType")}).newInstance(chatComponentText, chatMessageType);
Object packetPlayOutChat = getNMSClass("PacketPlayOutChat").getConstructor(new Class[]{getNMSClass("IChatBaseComponent"), getNMSClass("ChatMessageType"), Class.forName("java.util.UUID")}).newInstance(chatComponentText, chatMessageType, player.getUniqueId());
Object getHandle = player.getClass().getMethod("getHandle", new Class[0]).invoke(player);
Object playerConnection = getHandle.getClass().getField("playerConnection").get(getHandle);

View File

@ -1,5 +1,6 @@
package com.zeshanaslam.actionhealth.support;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.managers.RegionManager;
@ -61,7 +62,7 @@ public class WorldGuardAPI {
return;
}
} else {
regionContainer = worldGuardPlugin.getRegionContainer();
regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer();
try {
regionContainerGetMethod = regionContainer.getClass().getMethod("get", World.class);
} catch (Exception ex) {

View File

@ -10,6 +10,7 @@ import org.apache.commons.lang.WordUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -241,7 +242,7 @@ public class HealthUtil {
message = ChatColor.translateAlternateColorCodes('&', message);
try {
if (plugin.configStore.mcVersion.equals("v1_12_R1") || plugin.configStore.mcVersion.startsWith("v1_13") || plugin.configStore.mcVersion.startsWith("v1_14_") || plugin.configStore.mcVersion.startsWith("v1_15_")) {
if (plugin.configStore.mcVersion.equals("v1_12_R1") || plugin.configStore.mcVersion.startsWith("v1_13") || plugin.configStore.mcVersion.startsWith("v1_14_") || plugin.configStore.mcVersion.startsWith("v1_15_") || plugin.configStore.mcVersion.startsWith("v1_16_")) {
new PreAction(player, message);
} else if (!(plugin.configStore.mcVersion.equalsIgnoreCase("v1_8_R1") || (plugin.configStore.mcVersion.contains("v1_7_")))) {
Class<?> c1 = Class.forName("org.bukkit.craftbukkit." + plugin.configStore.mcVersion + ".entity.CraftPlayer");