From 6b377ca5cda6a57563d250c2ed5458eb4196bce1 Mon Sep 17 00:00:00 2001 From: H31IX Date: Mon, 4 Jun 2012 18:44:09 -0400 Subject: [PATCH 1/2] Fixed issue with shears and leaves --- .../java/net/h31ix/anticheat/Anticheat.java | 35 +++++++++++-------- .../net/h31ix/anticheat/manage/Backend.java | 2 +- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/h31ix/anticheat/Anticheat.java b/src/main/java/net/h31ix/anticheat/Anticheat.java index c39bd9a..02b00e3 100644 --- a/src/main/java/net/h31ix/anticheat/Anticheat.java +++ b/src/main/java/net/h31ix/anticheat/Anticheat.java @@ -78,7 +78,7 @@ public class Anticheat extends JavaPlugin updateFolder = config.updateFolder(); if (verbose) { - logger.log(Level.INFO, "[AC] Setup the config."); + logger.log(Level.INFO, "Setup the config."); } checkForUpdate(); eventList.add(new PlayerListener()); @@ -112,7 +112,7 @@ public class Anticheat extends JavaPlugin }, XRAY_TIME, XRAY_TIME); if (verbose) { - logger.log(Level.INFO, "[AC] Scheduled the XRay checker."); + logger.log(Level.INFO, "Scheduled the XRay checker."); } } } @@ -121,20 +121,19 @@ public class Anticheat extends JavaPlugin getServer().getPluginManager().registerEvents(listener, this); if (verbose) { - logger.log(Level.INFO, "[AC] Registered events for ".concat(listener.toString())); + logger.log(Level.INFO, "Registered events for ".concat(listener.toString())); } } getCommand("anticheat").setExecutor(new CommandHandler()); if (verbose) { - logger.log(Level.INFO, "[AC] Registered commands."); - logger.log(Level.INFO, "[AC] Finished loading."); + logger.log(Level.INFO, "Registered commands."); } if (update && config.autoUpdate()) { if (verbose) { - logger.log(Level.INFO, "[AC] Downloading the new update..."); + logger.log(Level.INFO, "Downloading the new update..."); } File file = new File("plugins/" + updateFolder); if (!file.exists()) @@ -192,7 +191,7 @@ public class Anticheat extends JavaPlugin metrics.start(); if (verbose) { - logger.log(Level.INFO, "[AC] Metrics started."); + logger.log(Level.INFO, "Metrics started."); } } catch (IOException ex) @@ -202,7 +201,15 @@ public class Anticheat extends JavaPlugin { String name = player.getName(); manager.getPlayerManager().setLevel(player,config.getLevel(name)); + if (verbose) + { + logger.log(Level.INFO, "Data for "+player.getName()+" re-applied from flatfile"); + } } + if (verbose) + { + logger.log(Level.INFO, "Finished loading."); + } } private void saveFile(String file, String url) @@ -254,7 +261,7 @@ public class Anticheat extends JavaPlugin saveDefaultConfig(); if (verbose) { - logger.log(Level.INFO, "[AC] Config file created."); + logger.log(Level.INFO, "Config file created."); } } if (!new File(getDataFolder() + "/lang.yml").exists()) @@ -262,7 +269,7 @@ public class Anticheat extends JavaPlugin saveResource("lang.yml",false); if (verbose) { - logger.log(Level.INFO, "[AC] Lang file created."); + logger.log(Level.INFO, "Lang file created."); } } } @@ -271,7 +278,7 @@ public class Anticheat extends JavaPlugin { if (verbose) { - logger.log(Level.INFO, "[AC] Checking for updates..."); + logger.log(Level.INFO, "Checking for updates..."); } URL url; URLConnection urlConn; @@ -309,7 +316,7 @@ public class Anticheat extends JavaPlugin update = true; if (verbose) { - logger.log(Level.INFO,"[AC] Your dev build has been promoted to release. Downloading the update."); + logger.log(Level.INFO,"Your dev build has been promoted to release. Downloading the update."); } } else @@ -317,7 +324,7 @@ public class Anticheat extends JavaPlugin update = false; if (verbose) { - logger.log(Level.INFO,"[AC] Dev build detected, so skipping update checking until this version is released."); + logger.log(Level.INFO,"Dev build detected, so skipping update checking until this version is released."); } } } @@ -326,7 +333,7 @@ public class Anticheat extends JavaPlugin update = true; if (verbose) { - logger.log(Level.INFO, "[AC] An update was found."); + logger.log(Level.INFO, "An update was found."); } } } @@ -334,7 +341,7 @@ public class Anticheat extends JavaPlugin { if (verbose) { - logger.log(Level.INFO, "[AC] No update found."); + logger.log(Level.INFO, "No update found."); } update = false; } diff --git a/src/main/java/net/h31ix/anticheat/manage/Backend.java b/src/main/java/net/h31ix/anticheat/manage/Backend.java index 49677c3..08479d5 100644 --- a/src/main/java/net/h31ix/anticheat/manage/Backend.java +++ b/src/main/java/net/h31ix/anticheat/manage/Backend.java @@ -477,7 +477,7 @@ public class Backend public boolean checkSwing(Player player, Block block) { - return !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()) && !justAnimated(player) && !Utilities.isUsingMcMMOAbility(player); + return !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()) && !justAnimated(player) && !Utilities.isUsingMcMMOAbility(player) && !(player.getInventory().getItemInHand().getType() == Material.SHEARS && block.getType() == Material.LEAVES); } public boolean checkFastBreak(Player player, Block block) From 517a12f339665e8667ad4751942fe692e38024b2 Mon Sep 17 00:00:00 2001 From: H31IX Date: Wed, 6 Jun 2012 00:04:22 -0400 Subject: [PATCH 2/2] Hopefully this adds the build number to dev builds, if not I'll look like a fool. --- src/main/java/net/h31ix/anticheat/Anticheat.java | 8 ++++---- src/main/resources/plugin.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/h31ix/anticheat/Anticheat.java b/src/main/java/net/h31ix/anticheat/Anticheat.java index 02b00e3..1b95df0 100644 --- a/src/main/java/net/h31ix/anticheat/Anticheat.java +++ b/src/main/java/net/h31ix/anticheat/Anticheat.java @@ -30,9 +30,9 @@ import java.util.logging.Logger; import net.h31ix.anticheat.event.*; import net.h31ix.anticheat.manage.AnticheatManager; import net.h31ix.anticheat.manage.CheckType; -import net.h31ix.anticheat.util.Utilities; import net.h31ix.anticheat.metrics.Metrics; import net.h31ix.anticheat.metrics.Metrics.Graph; +import net.h31ix.anticheat.util.Utilities; import net.h31ix.anticheat.xray.XRayListener; import net.h31ix.anticheat.xray.XRayTracker; import org.bukkit.ChatColor; @@ -249,7 +249,7 @@ public class Anticheat extends JavaPlugin } if (verbose) { - logger.log(Level.INFO,"[AC] AntiCheat update has been downloaded and will be installed on next launch."); + logger.log(Level.INFO,"AntiCheat update has been downloaded and will be installed on next launch."); } } } @@ -306,9 +306,9 @@ public class Anticheat extends JavaPlugin catch (Exception ex) { } - if (!this.getDescription().getVersion().equalsIgnoreCase(v)) + String version = this.getDescription().getVersion().split("-b")[0]; + if (!version.equalsIgnoreCase(v)) { - String version = this.getDescription().getVersion(); if (version.endsWith("-PRE") || version.endsWith("-DEV")) { if (version.replaceAll("-PRE", "").replaceAll("-DEV", "").equalsIgnoreCase(v)) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index df87b1c..9572995 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -6,7 +6,7 @@ name: AntiCheat softdepend: [AntiCheat] startup: postworld url: http://H31IX.NET/ -version: '1.3-DEV' +version: ${project.version}-b${BUILD_NUMBER} commands: anticheat: description: Control and view info about AntiCheat