mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Fixed flight detection on edge of stairs, and possible error when kicking players
This commit is contained in:
1 parent
493a9c8d33
commit
6d611b905f
2 files changed
+36
-29
No files matched your search
@@ -597,7 +597,7 @@ public class Backend
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(player.isSneaking() && Utilities.isStair(block.getRelative(BlockFace.NORTH)) || Utilities.isStair(block.getRelative(BlockFace.SOUTH)) || Utilities.isStair(block.getRelative(BlockFace.EAST)) || Utilities.isStair(block.getRelative(BlockFace.WEST)))
|
||||
else if(player.isSneaking() && (Utilities.isStair(block.getRelative(BlockFace.NORTH)) || Utilities.isStair(block.getRelative(BlockFace.SOUTH)) || Utilities.isStair(block.getRelative(BlockFace.EAST)) || Utilities.isStair(block.getRelative(BlockFace.WEST)) || Utilities.isStair(block.getRelative(BlockFace.NORTH_EAST)) || Utilities.isStair(block.getRelative(BlockFace.SOUTH_EAST)) || Utilities.isStair(block.getRelative(BlockFace.SOUTH_WEST)) || Utilities.isStair(block.getRelative(BlockFace.NORTH_WEST))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -23,27 +23,27 @@ import net.h31ix.anticheat.util.Configuration;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class User
|
||||
public class User
|
||||
{
|
||||
private final String name;
|
||||
private int level = 0;
|
||||
private int high;
|
||||
private int med;
|
||||
private boolean silentMode;
|
||||
|
||||
|
||||
public User(String name)
|
||||
{
|
||||
this.name = name;
|
||||
getConfigInfo();
|
||||
}
|
||||
|
||||
|
||||
public User(String name, int level)
|
||||
{
|
||||
this.name = name;
|
||||
this.level = level;
|
||||
getConfigInfo();
|
||||
}
|
||||
|
||||
|
||||
private void getConfigInfo()
|
||||
{
|
||||
Configuration config = Anticheat.getManager().getConfiguration();
|
||||
@@ -51,51 +51,58 @@ public class User
|
||||
med = config.medThreshold();
|
||||
high = config.highThreshold();
|
||||
}
|
||||
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return Bukkit.getPlayer(name);
|
||||
}
|
||||
|
||||
|
||||
public int getLevel()
|
||||
{
|
||||
return level;
|
||||
}
|
||||
|
||||
|
||||
public boolean increaseLevel(CheckType type)
|
||||
{
|
||||
if(silentMode && type.getUses(name) % 4 != 0)
|
||||
if(getPlayer().isOnline())
|
||||
{
|
||||
// Prevent silent mode from increasing the level way too fast
|
||||
return false;
|
||||
if(silentMode && type.getUses(name) % 4 != 0)
|
||||
{
|
||||
// Prevent silent mode from increasing the level way too fast
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
level++;
|
||||
if(level == med)
|
||||
{
|
||||
Anticheat.getManager().getUserManager().alertMed(this, type);
|
||||
}
|
||||
else if(level == high)
|
||||
{
|
||||
Anticheat.getManager().getUserManager().alertHigh(this, type);
|
||||
// Prevent the player from going over the high limit
|
||||
level = high-10;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
level++;
|
||||
if(level == med)
|
||||
{
|
||||
Anticheat.getManager().getUserManager().alertMed(this, type);
|
||||
}
|
||||
else if(level == high)
|
||||
{
|
||||
Anticheat.getManager().getUserManager().alertHigh(this, type);
|
||||
// Prevent the player from going over the high limit
|
||||
level = high-10;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void decreaseLevel()
|
||||
{
|
||||
level = level != 0 ? level-1 : 0;
|
||||
}
|
||||
|
||||
|
||||
public void setLevel(int level)
|
||||
{
|
||||
if(level > 0 && level <= high)
|
||||
@@ -103,14 +110,14 @@ public class User
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void resetLevel()
|
||||
{
|
||||
level = 0;
|
||||
for (CheckType type : CheckType.values())
|
||||
{
|
||||
type.clearUse(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user