mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Add developer mode, other small fixes
This commit is contained in:
1 parent
cb1959d2c0
commit
8d13e964ae
6 files changed
+39
-17
No files matched your search
@@ -51,6 +51,7 @@ public class Anticheat extends JavaPlugin {
|
||||
private static boolean update = false;
|
||||
private static Configuration config;
|
||||
private static boolean verbose;
|
||||
private static boolean developer;
|
||||
private static Metrics metrics;
|
||||
private static final long XRAY_TIME = 1200;
|
||||
|
||||
@@ -273,4 +274,22 @@ public class Anticheat extends JavaPlugin {
|
||||
config = null;
|
||||
metrics = null;
|
||||
}
|
||||
|
||||
public static boolean developerMode() {
|
||||
return developer;
|
||||
}
|
||||
|
||||
public static void setDeveloperMode(boolean b) {
|
||||
developer = b;
|
||||
}
|
||||
|
||||
public static void debugLog(final String string) {
|
||||
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
|
||||
public void run() {
|
||||
if(developer) {
|
||||
manager.log("[DEBUG] " + string);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -339,6 +339,11 @@ public class CommandHandler implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleDeveloper(CommandSender cs) {
|
||||
Anticheat.setDeveloperMode(!Anticheat.developerMode());
|
||||
cs.sendMessage(ChatColor.GREEN + "Developer mode " + (Anticheat.developerMode() ? "ON" : "OFF"));
|
||||
}
|
||||
|
||||
public void sendPlayerReport(CommandSender cs, List<CheckType> types, User user, int page) {
|
||||
String name = user.getName();
|
||||
@@ -435,6 +440,8 @@ public class CommandHandler implements CommandExecutor {
|
||||
handleReload(cs);
|
||||
} else if (args[0].equalsIgnoreCase("update")) {
|
||||
handleUpdate(cs);
|
||||
} else if (args[0].equalsIgnoreCase("developer")) {
|
||||
handleDeveloper(cs);
|
||||
}
|
||||
/**
|
||||
* else if (args[0].equalsIgnoreCase("calibrate")) { handleCalibrate(cs); }
|
||||
|
||||
@@ -89,8 +89,7 @@ public class AnticheatManager {
|
||||
if (i == 0 && getConfiguration().getFileLogLevel() == LOG_LEVEL_HIGH) // Not an alert, normal log message
|
||||
{
|
||||
fileLog(message);
|
||||
} else if (getConfiguration().getFileLogLevel() != 0)// alert
|
||||
{
|
||||
} else if (getConfiguration().getFileLogLevel() != 0) { // alert
|
||||
fileLog(message);
|
||||
}
|
||||
logs.add(ChatColor.stripColor(message));
|
||||
|
||||
@@ -274,9 +274,10 @@ public class Backend {
|
||||
nofallViolation.put(name, nofallViolation.get(player.getName()) + 1);
|
||||
}
|
||||
|
||||
if (nofallViolation.get(name) >= magic.NOFALL_LIMIT) {
|
||||
int i = nofallViolation.get(name);
|
||||
if (i >= magic.NOFALL_LIMIT) {
|
||||
nofallViolation.put(player.getName(), 1);
|
||||
return new CheckResult(Result.FAILED, player.getName()+" tried to avoid fall damage (fall distance = 0 "+nofallViolation.get(name)+" times in a row, max=+"+magic.NOFALL_LIMIT+")");
|
||||
return new CheckResult(Result.FAILED, player.getName()+" tried to avoid fall damage (fall distance = 0 "+i+" times in a row, max="+magic.NOFALL_LIMIT+")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.h31ix.anticheat.Anticheat;
|
||||
import net.h31ix.anticheat.util.Configuration;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -102,12 +103,13 @@ public class CheckManager {
|
||||
}
|
||||
|
||||
public boolean willCheck(Player player, CheckType type) {
|
||||
return
|
||||
isActive(type)
|
||||
boolean check = isActive(type)
|
||||
&& config.checkInWorld(player.getWorld())
|
||||
&& !isExempt(player, type)
|
||||
&& !type.checkPermission(player)
|
||||
&& !isOpExempt(player);
|
||||
Anticheat.debugLog("Check " + type + (check ? " run " : " not run ") + "on " + player.getName());
|
||||
return check;
|
||||
}
|
||||
|
||||
public boolean isOnline(Player player) {
|
||||
|
||||
@@ -52,14 +52,7 @@ public class PastebinReport {
|
||||
}
|
||||
|
||||
public PastebinReport(CommandSender cs, Player tp) {
|
||||
Player player = null;
|
||||
if (tp == null) {
|
||||
cs.sendMessage(ChatColor.RED + "We were unable to detect the target player when making this report. Skipping permstester");
|
||||
} else {
|
||||
player = tp;
|
||||
}
|
||||
|
||||
createReport(player);
|
||||
createReport(tp);
|
||||
try {
|
||||
writeReport();
|
||||
} catch (IOException e) {}
|
||||
@@ -71,9 +64,10 @@ public class PastebinReport {
|
||||
}
|
||||
|
||||
private void appendPermissionsTester(Player player) {
|
||||
if (player == null) { return; }
|
||||
|
||||
// alrighty then noobs.
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Permission node : Permission.values()) {
|
||||
report.append(player.getName() + ": " + node.toString() + " " + node.get(player));
|
||||
if(node.get(player) && !node.whichPermission(player).equals(node.toString())) {
|
||||
|
||||
Reference in new issue
Block a user