mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Respect speed for speed + potion; shade Updater. Fixes #259
This commit is contained in:
1 parent
d1804572aa
commit
870cebec59
5 files changed
+47
-7
No files matched your search
@@ -154,7 +154,7 @@ public class AntiCheat extends JavaPlugin {
|
||||
public void run() {
|
||||
verboseLog("Checking for a new update...");
|
||||
Updater updater = new Updater(plugin, PROJECT_ID, file, Updater.UpdateType.DEFAULT, false);
|
||||
update = updater.getResult() != Updater.UpdateResult.NO_UPDATE;
|
||||
update = updater.getResult() == Updater.UpdateResult.SUCCESS;
|
||||
verboseLog("Update available: " + update);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -311,6 +311,10 @@ public class Magic extends ConfigurationFile {
|
||||
* Maximum speed a player can travel forwards or backwards while under the influence; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_POTION;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while sprinting while under the influence; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
public double XZ_SPEED_MAX_POTION_SPRINT;
|
||||
/**
|
||||
* Maximum speed a player can travel forwards or backwards while sneaking; Type=double, +Leniency=Increase.
|
||||
*/
|
||||
@@ -374,11 +378,11 @@ public class Magic extends ConfigurationFile {
|
||||
// 0.2 -> 0.3 diffs
|
||||
// Fix improperly stored double Y_MAXDIFF
|
||||
new ConfigValue<Double>("Y_MAXDIFF").setValue(new ConfigValue<Double>("Y_MAXDIFF").getDefaultValue());
|
||||
// Update version
|
||||
version = new ConfigValue<Double>("VERSION").setValue(0.3D);
|
||||
setNeedsReload(true);
|
||||
|
||||
}
|
||||
new ConfigValue<Double>("VERSION").setValue(new ConfigValue<Double>("VERSION").getDefaultValue());
|
||||
|
||||
ENTERED_EXITED_TIME = new ConfigValue<Integer>("ENTERED_EXITED_TIME").getValue();
|
||||
SNEAK_TIME = new ConfigValue<Integer>("SNEAK_TIME").getValue();
|
||||
TELEPORT_TIME = new ConfigValue<Integer>("TELEPORT_TIME").getValue();
|
||||
@@ -445,6 +449,7 @@ public class Magic extends ConfigurationFile {
|
||||
Y_TIME = new ConfigValue<Integer>("Y_TIME").getValue();
|
||||
XZ_SPEED_MAX = new ConfigValue<Double>("XZ_SPEED_MAX").getValue();
|
||||
XZ_SPEED_MAX_SPRINT = new ConfigValue<Double>("XZ_SPEED_MAX_SPRINT").getValue();
|
||||
XZ_SPEED_MAX_POTION_SPRINT = new ConfigValue<Double>("XZ_SPEED_MAX_POTION_SPRINT").getValue();
|
||||
XZ_SPEED_MAX_FLY = new ConfigValue<Double>("XZ_SPEED_MAX_FLY").getValue();
|
||||
XZ_SPEED_MAX_POTION = new ConfigValue<Double>("XZ_SPEED_MAX_POTION").getValue();
|
||||
XZ_SPEED_MAX_SNEAK = new ConfigValue<Double>("XZ_SPEED_MAX_SNEAK").getValue();
|
||||
|
||||
@@ -304,8 +304,13 @@ public class Backend {
|
||||
reason = "while flying ";
|
||||
max = magic.XZ_SPEED_MAX_FLY;
|
||||
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||
reason = "with speed potion ";
|
||||
max = magic.XZ_SPEED_MAX_POTION;
|
||||
if (player.isSprinting()) {
|
||||
reason = "with speed potion while sprinting ";
|
||||
max = magic.XZ_SPEED_MAX_POTION_SPRINT;
|
||||
} else {
|
||||
reason = "with speed potion ";
|
||||
max = magic.XZ_SPEED_MAX_POTION;
|
||||
}
|
||||
} else if (player.isSprinting()) {
|
||||
reason = "while sprinting ";
|
||||
max = magic.XZ_SPEED_MAX_SPRINT;
|
||||
@@ -440,7 +445,7 @@ public class Backend {
|
||||
if (distance.getYDifference() > magic.TELEPORT_MIN || distance.getYDifference() < 0) {
|
||||
return PASS;
|
||||
}
|
||||
if (!isMovingExempt(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !Utilities.isClimbableBlock(player.getLocation().add(0, -1, 0).getBlock()) && !player.isInsideVehicle() && !Utilities.isInWater(player)) {
|
||||
if (!isMovingExempt(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !Utilities.isClimbableBlock(player.getLocation().add(0, -1, 0).getBlock()) && !player.isInsideVehicle() && !Utilities.isInWater(player) && !hasJumpPotion(player)) {
|
||||
double y1 = player.getLocation().getY();
|
||||
String name = player.getName();
|
||||
// Fix Y axis spam.
|
||||
@@ -1041,6 +1046,14 @@ public class Backend {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasJumpPotion(Player player) {
|
||||
return player.hasPotionEffect(PotionEffectType.JUMP);
|
||||
}
|
||||
|
||||
public boolean hasSpeedPotion(Player player) {
|
||||
return player.hasPotionEffect(PotionEffectType.SPEED);
|
||||
}
|
||||
|
||||
public void processChatSpammer(Player player) {
|
||||
User user = manager.getUserManager().getUser(player.getName());
|
||||
int level = chatLevel.containsKey(user.getName()) ? chatLevel.get(user.getName()) : 0;
|
||||
|
||||
Reference in new issue
Block a user