mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
Added mcMMO checking to noswing as well to avoid conflicts with treefeller/instant break. Hopefully resolving #10
This commit is contained in:
1 parent
e3f92436ea
commit
4e27dacab3
2 files changed
+17
-13
No files matched your search
@@ -18,13 +18,11 @@
|
|||||||
|
|
||||||
package net.h31ix.anticheat.manage;
|
package net.h31ix.anticheat.manage;
|
||||||
|
|
||||||
import net.h31ix.anticheat.util.Utilities;
|
|
||||||
import com.gmail.nossr50.datatypes.AbilityType;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import net.h31ix.anticheat.util.Utilities;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -475,20 +473,12 @@ public class Backend
|
|||||||
|
|
||||||
public boolean checkSwing(Player player, Block block)
|
public boolean checkSwing(Player player, Block block)
|
||||||
{
|
{
|
||||||
return !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()) && !justAnimated(player);
|
return !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()) && !justAnimated(player) && !Utilities.isUsingMcMMOAbility(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkFastBreak(Player player, Block block)
|
public boolean checkFastBreak(Player player, Block block)
|
||||||
{
|
{
|
||||||
boolean b = true;
|
if(!Utilities.isUsingMcMMOAbility(player))
|
||||||
if(player.getServer().getPluginManager().getPlugin("mcMMO") != null)
|
|
||||||
{
|
|
||||||
if(mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER))
|
|
||||||
{
|
|
||||||
b = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(b)
|
|
||||||
{
|
{
|
||||||
int violations = FASTBREAK_MAXVIOLATIONS;
|
int violations = FASTBREAK_MAXVIOLATIONS;
|
||||||
if(player.getGameMode() == GameMode.CREATIVE)
|
if(player.getGameMode() == GameMode.CREATIVE)
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
package net.h31ix.anticheat.util;
|
package net.h31ix.anticheat.util;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.AbilityType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.h31ix.anticheat.Anticheat;
|
import net.h31ix.anticheat.Anticheat;
|
||||||
@@ -91,6 +93,18 @@ public final class Utilities
|
|||||||
Material lily = Material.WATER_LILY;
|
Material lily = Material.WATER_LILY;
|
||||||
return block.getType() == lily || block.getRelative(BlockFace.NORTH).getType() == lily || block.getRelative(BlockFace.SOUTH).getType() == lily || block.getRelative(BlockFace.EAST).getType() == lily || block.getRelative(BlockFace.WEST).getType() == lily;
|
return block.getType() == lily || block.getRelative(BlockFace.NORTH).getType() == lily || block.getRelative(BlockFace.SOUTH).getType() == lily || block.getRelative(BlockFace.EAST).getType() == lily || block.getRelative(BlockFace.WEST).getType() == lily;
|
||||||
}
|
}
|
||||||
|
public static boolean isUsingMcMMOAbility(Player player)
|
||||||
|
{
|
||||||
|
boolean b = false;
|
||||||
|
if(player.getServer().getPluginManager().getPlugin("mcMMO") != null)
|
||||||
|
{
|
||||||
|
if(mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER))
|
||||||
|
{
|
||||||
|
b = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b;
|
||||||
|
}
|
||||||
public static boolean isInt(String string)
|
public static boolean isInt(String string)
|
||||||
{
|
{
|
||||||
boolean x = false;
|
boolean x = false;
|
||||||
|
|||||||
Reference in new issue
Block a user