mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Fastplace check improved by @SuperSpyTX - Welcome to AntiCheat!
This commit is contained in:
1 parent
a50a57353a
commit
099f2c3b0f
3 files changed
+62
-76
No files matched your search
@@ -618,57 +618,4 @@ an absolute waiver of all civil liability in connection with the
|
|||||||
Program, unless a warranty or assumption of liability accompanies a
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
copy of the Program in return for a fee.
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
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/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
@@ -184,18 +184,17 @@ public class PlayerListener extends EventListener
|
|||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && backend.checkFlight(player, from.getY(), to.getY()))
|
if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && backend.checkFlight(player, from.getY(), to.getY()))
|
||||||
{
|
{
|
||||||
|
from.setX(from.getX()-1);
|
||||||
|
from.setY(from.getY()-1);
|
||||||
|
from.setZ(from.getZ()-1);
|
||||||
event.setTo(from);
|
event.setTo(from);
|
||||||
//Lets really give this flyer a real pushdown.
|
//Lets really give this flyer a real pushdown.
|
||||||
Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-2, player.getLocation().getZ());
|
Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-2, player.getLocation().getZ());
|
||||||
Block whatever = newLocation.getBlock();
|
Block newBlock = newLocation.getBlock();
|
||||||
if(whatever.getTypeId() != 0)
|
if(newBlock.getTypeId() != 0)
|
||||||
{
|
{
|
||||||
event.setTo(newLocation);
|
event.setTo(newLocation);
|
||||||
}
|
}
|
||||||
/* else
|
|
||||||
{
|
|
||||||
downlow--;
|
|
||||||
}*/
|
|
||||||
log("tried to fly.",player,CheckType.FLY);
|
log("tried to fly.",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))
|
||||||
|
|||||||
@@ -46,7 +46,10 @@ public class Backend
|
|||||||
public static final int FASTBREAK_MAXVIOLATIONS = 2;
|
public static final int FASTBREAK_MAXVIOLATIONS = 2;
|
||||||
public static final int FASTBREAK_MAXVIOLATIONTIME = 10000;
|
public static final int FASTBREAK_MAXVIOLATIONTIME = 10000;
|
||||||
public static final int FASTPLACE_LIMIT = 2;
|
public static final int FASTPLACE_LIMIT = 2;
|
||||||
public static final int FASTPLACE_TIMEMAX = 40;
|
public static final int FASTPLACE_ZEROLIMIT = 3;
|
||||||
|
public static final int FASTPLACE_TIMEMAX = 100;
|
||||||
|
public static final int FASTPLACE_MAXVIOLATIONS = 2;
|
||||||
|
public static final int FASTPLACE_MAXVIOLATIONTIME = 10000;
|
||||||
|
|
||||||
private static final int CHAT_WARN_LEVEL = 7;
|
private static final int CHAT_WARN_LEVEL = 7;
|
||||||
private static final int CHAT_KICK_LEVEL = 10;
|
private static final int CHAT_KICK_LEVEL = 10;
|
||||||
@@ -98,6 +101,8 @@ public class Backend
|
|||||||
private Map<String,Integer> fastBreakViolation = new HashMap<String,Integer>();
|
private Map<String,Integer> fastBreakViolation = new HashMap<String,Integer>();
|
||||||
private Map<String,Integer> blocksBroken = new HashMap<String,Integer>();
|
private Map<String,Integer> blocksBroken = new HashMap<String,Integer>();
|
||||||
private Map<String,Long> lastBlockBroken = new HashMap<String,Long>();
|
private Map<String,Long> lastBlockBroken = new HashMap<String,Long>();
|
||||||
|
private Map<String,Integer> fastPlaceViolation = new HashMap<String,Integer>();
|
||||||
|
private Map<String,Integer> lastZeroHitPlace = new HashMap<String,Integer>();
|
||||||
private Map<String,Long> lastBlockPlaced = new HashMap<String,Long>();
|
private Map<String,Long> lastBlockPlaced = new HashMap<String,Long>();
|
||||||
private Map<String,Long> lastBlockPlaceTime = new HashMap<String,Long>();
|
private Map<String,Long> lastBlockPlaceTime = new HashMap<String,Long>();
|
||||||
|
|
||||||
@@ -250,6 +255,7 @@ public class Backend
|
|||||||
}
|
}
|
||||||
if(violation >= FLIGHT_LIMIT)
|
if(violation >= FLIGHT_LIMIT)
|
||||||
{
|
{
|
||||||
|
System.out.println("yep");
|
||||||
flightViolation.put(name, 1);
|
flightViolation.put(name, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -258,6 +264,7 @@ public class Backend
|
|||||||
{
|
{
|
||||||
for(int i= 5;i>0;i--)
|
for(int i= 5;i>0;i--)
|
||||||
{
|
{
|
||||||
|
System.out.println(i);
|
||||||
Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-i, player.getLocation().getZ());
|
Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-i, player.getLocation().getZ());
|
||||||
Block lower = newLocation.getBlock();
|
Block lower = newLocation.getBlock();
|
||||||
if(lower.getTypeId() == 0)
|
if(lower.getTypeId() == 0)
|
||||||
@@ -293,6 +300,7 @@ public class Backend
|
|||||||
if(fastBreakViolation.get(name) > FASTBREAK_MAXVIOLATIONS && math < FASTBREAK_MAXVIOLATIONTIME)
|
if(fastBreakViolation.get(name) > FASTBREAK_MAXVIOLATIONS && math < FASTBREAK_MAXVIOLATIONTIME)
|
||||||
{
|
{
|
||||||
lastBlockBroken.put(name, System.currentTimeMillis());
|
lastBlockBroken.put(name, System.currentTimeMillis());
|
||||||
|
player.sendMessage(ChatColor.RED + "[AntiCheat] Fastbreaking detected. Please wait 10 seconds before breaking blocks.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(fastBreakViolation.get(name) > 0 && math > FASTBREAK_MAXVIOLATIONTIME)
|
else if(fastBreakViolation.get(name) > 0 && math > FASTBREAK_MAXVIOLATIONTIME)
|
||||||
@@ -333,29 +341,60 @@ public class Backend
|
|||||||
{
|
{
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
if(!lastBlockPlaceTime.containsKey(name))
|
if(!lastBlockPlaceTime.containsKey(name) || !fastPlaceViolation.containsKey(name))
|
||||||
{
|
{
|
||||||
//Make sure we have the last record for this player
|
|
||||||
lastBlockPlaceTime.put(name, Long.parseLong("0"));
|
lastBlockPlaceTime.put(name, Long.parseLong("0"));
|
||||||
|
if(!fastPlaceViolation.containsKey(name))
|
||||||
|
{
|
||||||
|
fastPlaceViolation.put(name, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(fastPlaceViolation.containsKey(name) && fastPlaceViolation.get(name) > FASTPLACE_MAXVIOLATIONS)
|
||||||
|
{
|
||||||
|
Long math = System.currentTimeMillis() - lastBlockPlaced.get(name);
|
||||||
|
if(lastBlockPlaced.get(name) > 0 && math < FASTPLACE_MAXVIOLATIONTIME)
|
||||||
|
{
|
||||||
|
lastBlockPlaced.put(name, time);
|
||||||
|
player.sendMessage(ChatColor.RED + "[AntiCheat] Fastplacing detected. Please wait 10 seconds before placing blocks.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (lastBlockPlaced.get(name) > 0 && math > FASTPLACE_MAXVIOLATIONTIME)
|
||||||
|
{
|
||||||
|
fastPlaceViolation.put(name, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(lastBlockPlaced.containsKey(name))
|
else if(lastBlockPlaced.containsKey(name))
|
||||||
{
|
{
|
||||||
//If we do, continue on to math
|
|
||||||
long last = lastBlockPlaced.get(name);
|
long last = lastBlockPlaced.get(name);
|
||||||
long lastTime = lastBlockPlaceTime.get(name);
|
long lastTime = lastBlockPlaceTime.get(name);
|
||||||
//Check if the time between the last block they placed and this block is high enough
|
long thisTime = time-last;
|
||||||
//If it is, also check if their last place was in violation of this limit as well
|
boolean nocheck = thisTime < 1 || lastTime < 1;
|
||||||
if(last != 0 && (time-last) < FASTPLACE_TIMEMAX && lastTime != 0 && lastTime < FASTPLACE_TIMEMAX)
|
if(!lastZeroHitPlace.containsKey(name))
|
||||||
|
{
|
||||||
|
lastZeroHitPlace.put(name, 0);
|
||||||
|
}
|
||||||
|
if(nocheck)
|
||||||
|
{
|
||||||
|
if(!lastZeroHitPlace.containsKey(name))
|
||||||
|
{
|
||||||
|
lastZeroHitPlace.put(name, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lastZeroHitPlace.put(name, lastZeroHitPlace.get(name)+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!nocheck && thisTime < FASTPLACE_TIMEMAX && lastTime < FASTPLACE_TIMEMAX
|
||||||
|
&& lastZeroHitPlace.get(name) > FASTPLACE_ZEROLIMIT)
|
||||||
{
|
{
|
||||||
//It was a fastplace
|
|
||||||
lastBlockPlaceTime.put(name, (time-last));
|
lastBlockPlaceTime.put(name, (time-last));
|
||||||
lastBlockPlaced.put(name, time);
|
lastBlockPlaced.put(name, time);
|
||||||
|
fastPlaceViolation.put(name, fastPlaceViolation.get(name)+1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
lastBlockPlaceTime.put(name, (time-last));
|
lastBlockPlaceTime.put(name, (time-last));
|
||||||
}
|
}
|
||||||
//It was not fastplacing (at least not yet), store the data and wait for the next check.
|
lastBlockPlaced.put(name, time);
|
||||||
lastBlockPlaced.put(name, time);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,7 +562,7 @@ public class Backend
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void logEvent(@SuppressWarnings("rawtypes") final List list, final Player player, long time)
|
private void logEvent(@SuppressWarnings("rawtypes") final List list, final Player player, long time)
|
||||||
{
|
{
|
||||||
list.add(player.getName());
|
list.add(player.getName());
|
||||||
micromanage.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(micromanage.getPlugin(), new Runnable()
|
micromanage.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(micromanage.getPlugin(), new Runnable()
|
||||||
@@ -535,8 +574,9 @@ public class Backend
|
|||||||
}
|
}
|
||||||
}, time);
|
}, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void logEvent(@SuppressWarnings("rawtypes") final Map map, final Player player, final Object obj, long time)
|
private void logEvent(@SuppressWarnings("rawtypes") final Map map, final Player player, final Object obj, long time)
|
||||||
{
|
{
|
||||||
map.put(player,obj);
|
map.put(player,obj);
|
||||||
micromanage.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(micromanage.getPlugin(), new Runnable()
|
micromanage.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(micromanage.getPlugin(), new Runnable()
|
||||||
|
|||||||
Reference in new issue
Block a user