mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
Fix for bug #38, added ascension checking
This commit is contained in:
1 parent
517a12f339
commit
b8dd6b0f58
4 files changed
+37
-35
No files matched your search
@@ -56,6 +56,7 @@ public class Anticheat extends JavaPlugin
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
|
AnticheatManager.close();
|
||||||
Map<String, Integer> map = manager.getPlayerManager().getLevels();
|
Map<String, Integer> map = manager.getPlayerManager().getLevels();
|
||||||
Iterator<String> set = map.keySet().iterator();
|
Iterator<String> set = map.keySet().iterator();
|
||||||
while (set.hasNext())
|
while (set.hasNext())
|
||||||
|
|||||||
@@ -221,48 +221,21 @@ public class PlayerListener extends EventListener
|
|||||||
double x = distance.getXDifference();
|
double x = distance.getXDifference();
|
||||||
double y = distance.getYDifference();
|
double y = distance.getYDifference();
|
||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
backend.checkAscension(player,from.getY(),to.getY());
|
backend.logAscension(player,from.getY(),to.getY());
|
||||||
if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && backend.checkFlight(player, distance))
|
if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && backend.checkFlight(player, distance))
|
||||||
{
|
{
|
||||||
from.setX(from.getX()-1);
|
from.setX(from.getX()-1);
|
||||||
from.setY(from.getY()-1);
|
from.setY(from.getY()-1);
|
||||||
from.setZ(from.getZ()-1);
|
from.setZ(from.getZ()-1);
|
||||||
event.setTo(from);
|
event.setTo(from);
|
||||||
//Lets really give this flyer a real pushdown.
|
Block lower = player.getWorld().getHighestBlockAt(from);
|
||||||
Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-2, player.getLocation().getZ());
|
player.teleport(new Location(lower.getWorld(), lower.getLocation().getX(),lower.getLocation().getY()+2,lower.getLocation().getZ()));
|
||||||
Block newBlock = newLocation.getBlock();
|
|
||||||
if(newBlock.getTypeId() != 0)
|
|
||||||
{
|
|
||||||
event.setTo(newLocation);
|
|
||||||
}
|
|
||||||
log("tried to fly.",player,CheckType.FLY);
|
log("tried to fly.",player,CheckType.FLY);
|
||||||
}
|
}
|
||||||
if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && backend.checkYAxis(player, distance))
|
if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && (backend.checkYAxis(player, distance) || backend.checkAscension(player,from.getY(),to.getY())))
|
||||||
{
|
{
|
||||||
from.setX(from.getX()-1);
|
Block lower = player.getWorld().getHighestBlockAt(player.getLocation());
|
||||||
from.setY(from.getY()-1);
|
player.teleport(new Location(lower.getWorld(), lower.getLocation().getX(),lower.getLocation().getY()+2,lower.getLocation().getZ()));
|
||||||
from.setZ(from.getZ()-1);
|
|
||||||
if(from.getBlock().getTypeId() == 0)
|
|
||||||
{
|
|
||||||
event.setTo(from);
|
|
||||||
}
|
|
||||||
for(int i= 5;i>0;i--)
|
|
||||||
{
|
|
||||||
Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-i, player.getLocation().getZ());
|
|
||||||
Block lower = newLocation.getBlock();
|
|
||||||
if(lower.getTypeId() == 0)
|
|
||||||
{
|
|
||||||
player.teleport(newLocation);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Lets really give this flyer a real pushdown.
|
|
||||||
Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-2, player.getLocation().getZ());
|
|
||||||
Block newBlock = newLocation.getBlock();
|
|
||||||
if(newBlock.getTypeId() != 0)
|
|
||||||
{
|
|
||||||
event.setTo(newLocation);
|
|
||||||
}
|
|
||||||
log("tried to fly on y-axis", player, CheckType.FLY);
|
log("tried to fly on y-axis", player, CheckType.FLY);
|
||||||
}
|
}
|
||||||
if(checkManager.willCheck(player, CheckType.SPEED) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && checkManager.willCheck(player, CheckType.FLY))
|
if(checkManager.willCheck(player, CheckType.SPEED) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && checkManager.willCheck(player, CheckType.FLY))
|
||||||
|
|||||||
@@ -125,4 +125,8 @@ public class AnticheatManager
|
|||||||
{
|
{
|
||||||
return backend;
|
return backend;
|
||||||
}
|
}
|
||||||
|
public static void close()
|
||||||
|
{
|
||||||
|
handler.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -72,6 +72,7 @@ public class Backend
|
|||||||
private static final int Y_MAXVIOTIME = 5000;
|
private static final int Y_MAXVIOTIME = 5000;
|
||||||
private static final int NOFALL_LIMIT = 5;
|
private static final int NOFALL_LIMIT = 5;
|
||||||
|
|
||||||
|
private static final int ASCENSION_COUNT_MAX = 8;
|
||||||
private static final int WATER_ASCENSION_VIOLATION_MAX = 13;
|
private static final int WATER_ASCENSION_VIOLATION_MAX = 13;
|
||||||
private static final int WATER_SPEED_VIOLATION_MAX = 4;
|
private static final int WATER_SPEED_VIOLATION_MAX = 4;
|
||||||
|
|
||||||
@@ -119,6 +120,7 @@ public class Backend
|
|||||||
private List<String> instantBreakExempt = new ArrayList<String>();
|
private List<String> instantBreakExempt = new ArrayList<String>();
|
||||||
private List<String> isAscending = new ArrayList<String>();
|
private List<String> isAscending = new ArrayList<String>();
|
||||||
private List<String> trackingProjectiles = new ArrayList<String>();
|
private List<String> trackingProjectiles = new ArrayList<String>();
|
||||||
|
private Map<String,Integer> ascensionCount = new HashMap<String,Integer>();
|
||||||
private Map<String,String> oldMessage = new HashMap<String,String>();
|
private Map<String,String> oldMessage = new HashMap<String,String>();
|
||||||
private Map<String,String> lastMessage = new HashMap<String,String>();
|
private Map<String,String> lastMessage = new HashMap<String,String>();
|
||||||
private Map<String,Integer> flightViolation = new HashMap<String,Integer>();
|
private Map<String,Integer> flightViolation = new HashMap<String,Integer>();
|
||||||
@@ -463,11 +465,12 @@ public class Backend
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkAscension(Player player, double y1, double y2)
|
public void logAscension(Player player, double y1, double y2)
|
||||||
{
|
{
|
||||||
|
String name = player.getName();
|
||||||
if(y1 < y2)
|
if(y1 < y2)
|
||||||
{
|
{
|
||||||
isAscending.add(player.getName());
|
isAscending.add(name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -475,6 +478,27 @@ public class Backend
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkAscension(Player player, double y1, double y2)
|
||||||
|
{
|
||||||
|
if(!isMovingExempt(player))
|
||||||
|
{
|
||||||
|
String name = player.getName();
|
||||||
|
if(y1 < y2)
|
||||||
|
{
|
||||||
|
increment(player, ascensionCount, ASCENSION_COUNT_MAX);
|
||||||
|
if(ascensionCount.get(name) >= ASCENSION_COUNT_MAX)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ascensionCount.put(name,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
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) && !Utilities.isUsingMcMMOAbility(player) && !(player.getInventory().getItemInHand().getType() == Material.SHEARS && block.getType() == Material.LEAVES);
|
return !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()) && !justAnimated(player) && !Utilities.isUsingMcMMOAbility(player) && !(player.getInventory().getItemInHand().getType() == Material.SHEARS && block.getType() == Material.LEAVES);
|
||||||
|
|||||||
Reference in new issue
Block a user