From c6818c11f7ae6f19b7f2873fbd22821480270517 Mon Sep 17 00:00:00 2001 From: gravitylow Date: Sat, 19 Oct 2013 02:40:40 -0400 Subject: [PATCH] Add uptime to debug report, up reach magic values. --- .../net/gravitydevelopment/anticheat/AntiCheat.java | 6 ++++++ .../anticheat/util/PastebinReport.java | 11 ++++++----- src/main/resources/magic.yml | 6 +++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java b/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java index 11c42aa..18b0c13 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java +++ b/src/main/java/net/gravitydevelopment/anticheat/AntiCheat.java @@ -51,10 +51,12 @@ public class AntiCheat extends JavaPlugin { private static final int PROJECT_ID = 38723; private static PacketManager packetManager; private static boolean protocolLib = false; + private static Long loadTime; @Override public void onEnable() { plugin = this; + loadTime = System.currentTimeMillis(); manager = new AnticheatManager(this, getLogger()); eventList.add(new PlayerListener()); eventList.add(new BlockListener()); @@ -238,4 +240,8 @@ public class AntiCheat extends JavaPlugin { public void setVerbose(boolean b) { verbose = b; } + + public Long getLoadTime() { + return loadTime; + } } diff --git a/src/main/java/net/gravitydevelopment/anticheat/util/PastebinReport.java b/src/main/java/net/gravitydevelopment/anticheat/util/PastebinReport.java index d9cc343..933725c 100644 --- a/src/main/java/net/gravitydevelopment/anticheat/util/PastebinReport.java +++ b/src/main/java/net/gravitydevelopment/anticheat/util/PastebinReport.java @@ -35,11 +35,11 @@ import java.util.Date; import java.util.List; public class PastebinReport { + private static final String DATE = new SimpleDateFormat("yyyy-MM-dd kk:mm Z").format(new Date()); + private static final String API_KEY = "6eeace09c2742f8463b9db9b0c467605"; + private StringBuilder report = new StringBuilder(); private String url = ""; - private Date date = new Date(); - private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd kk:mm Z"); - public PastebinReport(CommandSender cs) { Player player = null; @@ -87,7 +87,7 @@ public class PastebinReport { append("------------ WARNING! ------------"); append("This report was run with NoCheatPlus enabled. Results may be inaccurate." + '\n'); } - append("------------ AntiCheat Report - " + format.format(date) + " ------------"); + append("------------ AntiCheat Report - " + DATE + " ------------"); appendSystemInfo(); append("------------Last 30 logs------------"); appendLogs(); @@ -125,6 +125,7 @@ public class PastebinReport { append("Online Mode: " + String.valueOf(Bukkit.getOnlineMode()).toUpperCase()); append("Players: " + Bukkit.getOnlinePlayers().length + "/" + Bukkit.getMaxPlayers()); append("Plugin Count: " + Bukkit.getPluginManager().getPlugins().length); + append("Plugin Uptime: " + ((System.currentTimeMillis() - AntiCheat.getPlugin().getLoadTime()) / 1000) / 60 + " minutes"); } private void appendMagicDiff() { @@ -180,7 +181,7 @@ public class PastebinReport { conn.setDoOutput(true); OutputStream out = conn.getOutputStream(); - out.write(("api_option=paste" + "&api_dev_key=" + URLEncoder.encode("c0616def494dcb5b7632304f8c52c0f1", "utf-8") + "&api_paste_code=" + URLEncoder.encode(report.toString(), "utf-8") + "&api_paste_private=" + URLEncoder.encode("1", "utf-8") + "&api_paste_name=" + URLEncoder.encode("", "utf-8") + "&api_paste_expire_date=" + URLEncoder.encode("1M", "utf-8") + "&api_paste_format=" + URLEncoder.encode("text", "utf-8") + "&api_user_key=" + URLEncoder.encode("", "utf-8")).getBytes()); + out.write(("api_option=paste" + "&api_dev_key=" + URLEncoder.encode(API_KEY, "utf-8") + "&api_paste_code=" + URLEncoder.encode(report.toString(), "utf-8") + "&api_paste_private=" + URLEncoder.encode("1", "utf-8") + "&api_paste_name=" + URLEncoder.encode("", "utf-8") + "&api_paste_expire_date=" + URLEncoder.encode("1M", "utf-8") + "&api_paste_format=" + URLEncoder.encode("text", "utf-8") + "&api_user_key=" + URLEncoder.encode("", "utf-8")).getBytes()); out.flush(); out.close(); diff --git a/src/main/resources/magic.yml b/src/main/resources/magic.yml index ff2e511..46a1637 100644 --- a/src/main/resources/magic.yml +++ b/src/main/resources/magic.yml @@ -26,8 +26,8 @@ DROP_TIME_MIN: 800 DROPPED_ITEM_TIME: 100 EAT_TIME_MIN: 1000 ENTERED_EXITED_TIME: 1000 -ENTITY_MAX_DISTANCE: 5.5 -ENTITY_MAX_DISTANCE_CREATIVE: 6.0 +ENTITY_MAX_DISTANCE: 5.9 +ENTITY_MAX_DISTANCE_CREATIVE: 6.5 EXIT_FLY_TIME: 2000 EXPLOSION_DAMAGE_TIME: 5000 FASTBREAK_LIMIT: 2 @@ -85,4 +85,4 @@ Y_MAXVIOLATIONS: 1 Y_MAXVIOTIME: 5000 Y_SPEED_MAX: 0.5 Y_TIME: 1000 -VERSION: 0.3 +VERSION: 0.4