mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 22:16:03 +00:00
Fixes regarding 1.9+ support
This commit is contained in:
1 parent
06c1eab2e6
commit
7ae3f010a3
10 files changed
+43
-17
No files matched your search
@@ -4,6 +4,8 @@ import java.util.EnumSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class NMS_1_9_PLUS {
|
||||
@@ -17,5 +19,9 @@ public class NMS_1_9_PLUS {
|
||||
static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION;
|
||||
|
||||
static final Enchantment FROST_WALKER = Enchantment.FROST_WALKER;
|
||||
|
||||
public static ItemStack getItemInHand(Player player) {
|
||||
return player.getInventory().getItemInMainHand();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class VersionUtil {
|
||||
|
||||
@@ -79,5 +80,13 @@ public class VersionUtil {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getItemInHand(Player player) {
|
||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
||||
return NMS_1_9_PLUS.getItemInHand(player);
|
||||
} else {
|
||||
return player.getItemInHand();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user