mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Add developer mode, other small fixes
This commit is contained in:
1 parent
cb1959d2c0
commit
8d13e964ae
6 files changed
+38
-16
No files matched your search
@@ -51,6 +51,7 @@ public class Anticheat extends JavaPlugin {
|
|||||||
private static boolean update = false;
|
private static boolean update = false;
|
||||||
private static Configuration config;
|
private static Configuration config;
|
||||||
private static boolean verbose;
|
private static boolean verbose;
|
||||||
|
private static boolean developer;
|
||||||
private static Metrics metrics;
|
private static Metrics metrics;
|
||||||
private static final long XRAY_TIME = 1200;
|
private static final long XRAY_TIME = 1200;
|
||||||
|
|
||||||
@@ -273,4 +274,22 @@ public class Anticheat extends JavaPlugin {
|
|||||||
config = null;
|
config = null;
|
||||||
metrics = 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -340,6 +340,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) {
|
public void sendPlayerReport(CommandSender cs, List<CheckType> types, User user, int page) {
|
||||||
String name = user.getName();
|
String name = user.getName();
|
||||||
int pages = (int) Math.ceil(((float) types.size()) / 6);
|
int pages = (int) Math.ceil(((float) types.size()) / 6);
|
||||||
@@ -435,6 +440,8 @@ public class CommandHandler implements CommandExecutor {
|
|||||||
handleReload(cs);
|
handleReload(cs);
|
||||||
} else if (args[0].equalsIgnoreCase("update")) {
|
} else if (args[0].equalsIgnoreCase("update")) {
|
||||||
handleUpdate(cs);
|
handleUpdate(cs);
|
||||||
|
} else if (args[0].equalsIgnoreCase("developer")) {
|
||||||
|
handleDeveloper(cs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* else if (args[0].equalsIgnoreCase("calibrate")) { handleCalibrate(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
|
if (i == 0 && getConfiguration().getFileLogLevel() == LOG_LEVEL_HIGH) // Not an alert, normal log message
|
||||||
{
|
{
|
||||||
fileLog(message);
|
fileLog(message);
|
||||||
} else if (getConfiguration().getFileLogLevel() != 0)// alert
|
} else if (getConfiguration().getFileLogLevel() != 0) { // alert
|
||||||
{
|
|
||||||
fileLog(message);
|
fileLog(message);
|
||||||
}
|
}
|
||||||
logs.add(ChatColor.stripColor(message));
|
logs.add(ChatColor.stripColor(message));
|
||||||
|
|||||||
@@ -274,9 +274,10 @@ public class Backend {
|
|||||||
nofallViolation.put(name, nofallViolation.get(player.getName()) + 1);
|
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);
|
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 {
|
} else {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.h31ix.anticheat.Anticheat;
|
||||||
import net.h31ix.anticheat.util.Configuration;
|
import net.h31ix.anticheat.util.Configuration;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -102,12 +103,13 @@ public class CheckManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean willCheck(Player player, CheckType type) {
|
public boolean willCheck(Player player, CheckType type) {
|
||||||
return
|
boolean check = isActive(type)
|
||||||
isActive(type)
|
|
||||||
&& config.checkInWorld(player.getWorld())
|
&& config.checkInWorld(player.getWorld())
|
||||||
&& !isExempt(player, type)
|
&& !isExempt(player, type)
|
||||||
&& !type.checkPermission(player)
|
&& !type.checkPermission(player)
|
||||||
&& !isOpExempt(player);
|
&& !isOpExempt(player);
|
||||||
|
Anticheat.debugLog("Check " + type + (check ? " run " : " not run ") + "on " + player.getName());
|
||||||
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOnline(Player player) {
|
public boolean isOnline(Player player) {
|
||||||
|
|||||||
@@ -52,14 +52,7 @@ public class PastebinReport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PastebinReport(CommandSender cs, Player tp) {
|
public PastebinReport(CommandSender cs, Player tp) {
|
||||||
Player player = null;
|
createReport(tp);
|
||||||
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);
|
|
||||||
try {
|
try {
|
||||||
writeReport();
|
writeReport();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {}
|
||||||
@@ -71,9 +64,10 @@ public class PastebinReport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void appendPermissionsTester(Player player) {
|
private void appendPermissionsTester(Player player) {
|
||||||
if (player == null) { return; }
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// alrighty then noobs.
|
|
||||||
for (Permission node : Permission.values()) {
|
for (Permission node : Permission.values()) {
|
||||||
report.append(player.getName() + ": " + node.toString() + " " + node.get(player));
|
report.append(player.getName() + ": " + node.toString() + " " + node.get(player));
|
||||||
if(node.get(player) && !node.whichPermission(player).equals(node.toString())) {
|
if(node.get(player) && !node.whichPermission(player).equals(node.toString())) {
|
||||||
|
|||||||
Reference in new issue
Block a user