From fd372b8418304d207ac3330a4af2a5c6c6275ede Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Mon, 28 Apr 2014 01:05:08 -0700 Subject: [PATCH] Changed skills to 2k gems each. Changed power/booster to 2k gems each. Added AntiHack perm storage of kicks. Commented out SafeChat stuff for now. --- .../src/mineplex/core/antihack/AntiHack.java | 31 +++++++++++++++---- .../core/antihack/AntiHackRepository.java | 18 ++++++----- .../src/mineplex/core/chat/Chat.java | 4 ++- .../game/classcombat/Skill/SkillFactory.java | 2 +- .../game/classcombat/item/ItemFactory.java | 8 ++--- 5 files changed, 43 insertions(+), 20 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index f3e52cf4e..b4efc12bf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -20,6 +20,7 @@ import mineplex.core.punish.Punish; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -29,6 +30,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.player.PlayerVelocityEvent; +import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.plugin.java.JavaPlugin; public class AntiHack extends MiniPlugin @@ -63,7 +65,7 @@ public class AntiHack extends MiniPlugin public ArrayList _detectors; - //private AntiHackRepository _repository; + private AntiHackRepository _repository; protected AntiHack(JavaPlugin plugin, Punish punish, Portal portal) { @@ -72,8 +74,8 @@ public class AntiHack extends MiniPlugin Punish = punish; Portal = portal; - //_repository = new AntiHackRepository(plugin.getConfig().getString("serverstatus.name")); - //_repository.initialize(); + _repository = new AntiHackRepository(plugin.getConfig().getString("serverstatus.name")); + _repository.initialize(); _detectors = new ArrayList(); @@ -295,10 +297,27 @@ public class AntiHack extends MiniPlugin ); UtilServer.broadcast(F.main("MAC", player.getName() + " was kicked for suspicious movement.")); - } - - //_repository.saveOffense(player, report, severity); + ServerListPingEvent event = new ServerListPingEvent(null, Bukkit.getServer().getMotd(), Bukkit.getServer().getOnlinePlayers().length, Bukkit.getServer().getMaxPlayers()); + GetPluginManager().callEvent(event); + + String motd = event.getMotd(); + String game = "N/A"; + String map = "N/A"; + + String[] args = motd.split("\\|"); + + if (args.length > 0) + motd = args[0]; + + if (args.length > 2) + game = args[2]; + + if (args.length > 3) + map = args[3]; + + _repository.saveOffense(player, motd, game, map, report); + } } private void ResetAll(Player player) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java index 3421721e6..f5372c258 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java @@ -16,8 +16,8 @@ public class AntiHackRepository private String _userName = "root"; private String _password = "tAbechAk3wR7tuTh"; - private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS AntiHack (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(256) NOT NULL, hackType VARCHAR(256) NOT NULL, playerName VARCHAR(256) NOT NULL, hackCount INT, updated LONG, PRIMARY KEY (id), UNIQUE KEY serverName_hackType_playerName (serverName, hackType, playerName));"; - private static String UPDATE_PLAYER_OFFENSES = "REPLACE INTO AntiHack (serverName, playerName, hackType, hackCount, updated) VALUES (?, ?, ?, ?, now());"; + private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS AntiHack_Log (id INT NOT NULL AUTO_INCREMENT, updated LONG, playerName VARCHAR(256), motd VARCHAR(56), gameType VARCHAR(56), map VARCHAR(256), serverName VARCHAR(256), report VARCHAR(256), PRIMARY KEY (id));"; + private static String UPDATE_PLAYER_OFFENSES = "INSERT INTO AntiHack_Log (updated, playerName, motd, gameType, map, serverName, report) VALUES (now(), ?, ?, ?, ?, ?, ?);"; public AntiHackRepository(String serverName) { @@ -57,7 +57,7 @@ public class AntiHackRepository } } - public void saveOffense(final Player player, final String report, final String severity) + public void saveOffense(final Player player, final String motd, final String game, final String map, final String report) { new Thread(new Runnable() { @@ -71,11 +71,13 @@ public class AntiHackRepository _connection = DriverManager.getConnection(_connectionString, _userName, _password); preparedStatement = _connection.prepareStatement(UPDATE_PLAYER_OFFENSES); - - preparedStatement.setString(1, _serverName); - preparedStatement.setString(2, player.getName()); - preparedStatement.setString(3, report); - preparedStatement.setString(4, severity); + + preparedStatement.setString(1, player.getName()); + preparedStatement.setString(2, motd); + preparedStatement.setString(3, game); + preparedStatement.setString(4, map); + preparedStatement.setString(5, _serverName); + preparedStatement.setString(6, report); preparedStatement.execute(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index 1d5c1b060..c5a8ff837 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -192,6 +192,7 @@ public class Chat extends MiniClientPlugin { _playerLastMessage.put(sender.getName(), event.getMessage()); + /* if (event.isAsynchronous()) { final Player player = event.getPlayer(); @@ -202,7 +203,7 @@ public class Chat extends MiniClientPlugin JSONObject message = buildJsonChatObject(filtertype, dname, plyrname, msg, 1); - boolean activehashing = false; + boolean activehashing = true; String response = getResponseFromTwoHat(message, filtertype); String display = parseResponse(response); @@ -232,6 +233,7 @@ public class Chat extends MiniClientPlugin player.setDisplayName(player.getPlayerListName()); } } + */ } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java index e0b60ed91..9677f68f1 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java @@ -129,7 +129,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory skillToken.Name = skill.GetName(); skillToken.Level = i + 1; skillToken.SalesPackage = new GameSalesPackageToken(); - skillToken.SalesPackage.Gems = 1000; + skillToken.SalesPackage.Gems = 2000; skillTokens.add(skillToken); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java index a090e1f73..dd2e73e9a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java @@ -104,11 +104,11 @@ public class ItemFactory extends MiniPlugin implements IItemFactory AddItem(new StandardSword(this, 0, 2)); AddItem(new StandardAxe(this, 0, 2)); - AddItem(new BoosterSword(this, 0, 4)); - AddItem(new BoosterAxe(this, 0, 4)); + AddItem(new BoosterSword(this, 2000, 4)); + AddItem(new BoosterAxe(this, 2000, 4)); - AddItem(new PowerSword(this, 0, 4)); - AddItem(new PowerAxe(this, 0, 4)); + AddItem(new PowerSword(this, 2000, 4)); + AddItem(new PowerAxe(this, 2000, 4)); AddItem(new StandardBow(this, 0, 1)); }