mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Fix multiversion issues with levitation, fix more stacktraces
This commit is contained in:
1 parent
6497891e43
commit
9473781a26
5 files changed
+13
-47
No files matched your search
@@ -40,7 +40,6 @@ import com.rammelkast.anticheatreloaded.event.BlockListener;
|
||||
import com.rammelkast.anticheatreloaded.event.EntityListener;
|
||||
import com.rammelkast.anticheatreloaded.event.InventoryListener;
|
||||
import com.rammelkast.anticheatreloaded.event.PlayerListener;
|
||||
import com.rammelkast.anticheatreloaded.event.PotionEffectListener;
|
||||
import com.rammelkast.anticheatreloaded.event.VehicleListener;
|
||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||
import com.rammelkast.anticheatreloaded.metrics.Metrics;
|
||||
@@ -77,10 +76,6 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
eventList.add(new EntityListener());
|
||||
eventList.add(new VehicleListener());
|
||||
eventList.add(new InventoryListener());
|
||||
// Handles 1.9+ potion effects
|
||||
if (!VersionUtil.isBountifulUpdate()) {
|
||||
eventList.add(new PotionEffectListener());
|
||||
}
|
||||
// Order is important in some cases, don't screw with these unless
|
||||
// needed, especially config
|
||||
this.setupConfig();
|
||||
|
||||
@@ -73,6 +73,7 @@ import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
import com.rammelkast.anticheatreloaded.util.XMaterial;
|
||||
|
||||
public class PlayerListener extends EventListener {
|
||||
|
||||
@@ -287,7 +288,7 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
|
||||
if (!VersionUtil.isBountifulUpdate()) {
|
||||
if (itemInHand.getType() == Material.FIREWORK_ROCKET) {
|
||||
if (itemInHand.getType() == XMaterial.FIREWORK_ROCKET.parseMaterial()) {
|
||||
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
|
||||
if (player.isGliding()) {
|
||||
// TODO config max elytra height?
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class PotionEffectListener extends EventListener {
|
||||
|
||||
@EventHandler
|
||||
public void onEntityPotionEffect(EntityPotionEffectEvent event) {
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
if (event.getNewEffect() == null)
|
||||
return;
|
||||
if (!VersionUtil.isLevitationEffect(event.getNewEffect()))
|
||||
return;
|
||||
getBackend().logLevitating((Player) event.getEntity(), event.getNewEffect().getDuration());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,7 @@ package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
@@ -111,6 +112,15 @@ public class MovementManager {
|
||||
if (Utilities.couldBeOnBoat(player, 0.25, true) && !Utilities.isSubmersed(player))
|
||||
this.onGround = true;
|
||||
|
||||
// Handle 1.9+ potion effects
|
||||
if (MinecraftVersion.atOrAbove(MinecraftVersion.COMBAT_UPDATE)) {
|
||||
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||
if (!VersionUtil.isLevitationEffect(effect))
|
||||
return;
|
||||
AntiCheatReloaded.getManager().getBackend().logLevitating(player, 1);
|
||||
}
|
||||
}
|
||||
|
||||
this.touchedGroundThisTick = false;
|
||||
this.halfMovement = false;
|
||||
if (!this.onGround) {
|
||||
|
||||
@@ -113,7 +113,7 @@ public class VersionUtil {
|
||||
}
|
||||
|
||||
public static Block getTargetBlock(Player player, int distance) {
|
||||
if (isBountifulUpdate()) {
|
||||
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||
return player.getTargetBlock((Set<Material>) null, distance);
|
||||
}
|
||||
return player.getTargetBlockExact(distance);
|
||||
|
||||
Reference in new issue
Block a user