mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 14:38:45 +00:00
Tabs -> Spaces
This commit is contained in:
1 parent
170f4dd946
commit
ecb285f938
31 files changed
+5194
-5194
No files matched your search
@@ -26,97 +26,97 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class User {
|
||||
private final String name;
|
||||
private int level = 0;
|
||||
private int high;
|
||||
private int med;
|
||||
private Location goodLocation;
|
||||
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();
|
||||
silentMode = config.silentMode();
|
||||
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 (getPlayer() != null && getPlayer().isOnline()) {
|
||||
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 {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void decreaseLevel() {
|
||||
level = level != 0 ? level - 1 : 0;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
if (level > 0 && level <= high) {
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
|
||||
public void resetLevel() {
|
||||
level = 0;
|
||||
for (CheckType type : CheckType.values()) {
|
||||
type.clearUse(name);
|
||||
}
|
||||
}
|
||||
|
||||
public Location getGoodLocation(Location e) {
|
||||
if (goodLocation == null) { return e; }
|
||||
|
||||
return goodLocation;
|
||||
}
|
||||
|
||||
public boolean hasGoodLocation() {
|
||||
return goodLocation != null;
|
||||
}
|
||||
|
||||
public void setGoodLocation(Location e) {
|
||||
if (Utilities.cantStandAtExp(e)) { return; }
|
||||
|
||||
if (e.getBlock().isLiquid() && !Utilities.isFullyInWater(e)) { return; }
|
||||
|
||||
goodLocation = e;
|
||||
}
|
||||
|
||||
private final String name;
|
||||
private int level = 0;
|
||||
private int high;
|
||||
private int med;
|
||||
private Location goodLocation;
|
||||
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();
|
||||
silentMode = config.silentMode();
|
||||
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 (getPlayer() != null && getPlayer().isOnline()) {
|
||||
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 {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void decreaseLevel() {
|
||||
level = level != 0 ? level - 1 : 0;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
if (level > 0 && level <= high) {
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
|
||||
public void resetLevel() {
|
||||
level = 0;
|
||||
for (CheckType type : CheckType.values()) {
|
||||
type.clearUse(name);
|
||||
}
|
||||
}
|
||||
|
||||
public Location getGoodLocation(Location e) {
|
||||
if (goodLocation == null) { return e; }
|
||||
|
||||
return goodLocation;
|
||||
}
|
||||
|
||||
public boolean hasGoodLocation() {
|
||||
return goodLocation != null;
|
||||
}
|
||||
|
||||
public void setGoodLocation(Location e) {
|
||||
if (Utilities.cantStandAtExp(e)) { return; }
|
||||
|
||||
if (e.getBlock().isLiquid() && !Utilities.isFullyInWater(e)) { return; }
|
||||
|
||||
goodLocation = e;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user