From 41e77b1adeefa0001d2ccfb8fecd1ede9224ee11 Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Wed, 17 Jun 2015 20:49:35 -0400 Subject: [PATCH 01/10] Fixed double-half-slabs (line 68) Signed-off-by: Aaron Brock --- .../game/games/minestrike/items/grenades/FireGrenadeBase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FireGrenadeBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FireGrenadeBase.java index a94e0ee44..a9cdeded4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FireGrenadeBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/FireGrenadeBase.java @@ -63,7 +63,9 @@ public abstract class FireGrenadeBase extends Grenade final int round = game.getRound(); for (final Block block : blocks.keySet()) { - if (block.getType() != Material.AIR && !block.getType().name().toLowerCase().contains("step")) + + //Edited by TheMineBench, to keep the two-half-slabs from burning + if (block.getType() != Material.AIR && !block.getType().name().toLowerCase().contains("step") || block.getType().name().toLowerCase().contains("double")) continue; if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN))) From b0ca5ca4aaf2d39c2017aec3bbd7a19d14b65f32 Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Wed, 17 Jun 2015 20:54:28 -0400 Subject: [PATCH 02/10] Freezes the time using doDayLightCycle instead of using a UpdateEvent. Signed-off-by: Aaron Brock --- .../mineplex/hub/modules/WorldManager.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java index c02a3c6a0..20e207cac 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java @@ -46,6 +46,7 @@ import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.weather.WeatherChangeEvent; public class WorldManager extends MiniPlugin { @@ -61,6 +62,17 @@ public class WorldManager extends MiniPlugin super("World Manager", manager.getPlugin()); Manager = manager; + + //Added by TheMineBench, to stop day cycles instead of setting the time on update event. + World world = UtilWorld.getWorld("world"); + + world.setGameRuleValue("doDaylightCycle", "false"); + + if (Manager.Type == HubType.Halloween) + world.setTime(16000); + else + world.setTime(6000); + world.setStorm(false); } @EventHandler @@ -216,7 +228,8 @@ public class WorldManager extends MiniPlugin ent.remove(); } } - +//Removed by TheMineBench, time is now stopped when the WorldManager is created +/* @EventHandler public void UpdateWeather(UpdateEvent event) { @@ -232,7 +245,17 @@ public class WorldManager extends MiniPlugin world.setStorm(false); } - +*/ + //Added by TheMineBench. Stops weather from changing. + @EventHandler + public void OnWeather(WeatherChangeEvent event) { + + if (!event.getWorld().getName().equals("world")) + return; + + event.setCancelled(true); + } + @EventHandler public void HalloweenUpdates(UpdateEvent event) { From 76e4dc605612aea3464b5e9a361ab2b174d33bc6 Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Thu, 18 Jun 2015 19:50:06 -0400 Subject: [PATCH 03/10] Stopped blocks from dropping and stopped people from breaking the other teams blocks with their fist. Signed-off-by: Aaron Brock --- .../game/games/turfforts/TurfForts.java | 67 +++++++++++++++---- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 87efca5ee..0d052332f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -16,13 +16,16 @@ import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.ProjectileHitEvent; @@ -268,7 +271,7 @@ public class TurfForts extends TeamGame EndCheck(); } } - + @EventHandler public void BowCancel(EntityShootBowEvent event) { @@ -280,12 +283,13 @@ public class TurfForts extends TeamGame ((Player) event.getEntity()).updateInventory(); } } - - @EventHandler + + @EventHandler(ignoreCancelled = true) public void BlockPlace(BlockPlaceEvent event) { - if (event.isCancelled()) - return; + //Remoeved and replaced by ignoreCancelled = true + //if (event.isCancelled()) + // return; GameTeam team = GetTeam(event.getPlayer()); if (team == null) @@ -324,6 +328,7 @@ public class TurfForts extends TeamGame event.setCancelled(true); return; } + } @EventHandler @@ -331,7 +336,7 @@ public class TurfForts extends TeamGame { if (event.getEntity().getShooter() == null) return; - + if (!(event.getEntity() instanceof Arrow)) return; @@ -347,6 +352,7 @@ public class TurfForts extends TeamGame Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() { + public void run() { try @@ -366,21 +372,22 @@ public class TurfForts extends TeamGame int z = fieldZ.getInt(entityArrow); Block block = arrow.getWorld().getBlockAt(x, y, z); - + if (block.getTypeId() == 35) { - if (block.getData() == 14 && team.GetColor() != ChatColor.RED) + if (block.getData() == 14 /* && team.GetColor() != ChatColor.RED */) { block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.REDSTONE_BLOCK.getId()); } - else if (block.getData() == 3 && team.GetColor() != ChatColor.AQUA) + else if (block.getData() == 3 /* && team.GetColor() != ChatColor.AQUA */) { block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.LAPIS_BLOCK.getId()); } - + Bukkit.getPluginManager().callEvent(new ShredBlockEvent(block, arrow)); - - block.breakNaturally(); + + + block.setType(Material.AIR); } arrow.remove(); @@ -655,7 +662,8 @@ public class TurfForts extends TeamGame } } } - + + /* @EventHandler public void ItemRemoval(UpdateEvent event) { @@ -674,7 +682,38 @@ public class TurfForts extends TeamGame ent.remove(); } } + */ + + //Added by TheMineBench. + @EventHandler + public void blockBreak(BlockBreakEvent event) { + + Block block = event.getBlock(); + + GameTeam team = GetTeam(event.getPlayer()); + GameTeam otherTeam = GetOtherTeam(team); + if (block.getType().equals(Material.WOOL) && (block.getData() == 14 && team.GetColor() != ChatColor.RED || block.getData() == 3 || team.GetColor() != ChatColor.AQUA)) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot break the " + F.elem(otherTeam.GetColor() + otherTeam.GetName()) + " team's blocks!")); + event.setCancelled(true); + return; + } + + + } + + public GameTeam GetOtherTeam(GameTeam team) { + return team.GetColor() == ChatColor.RED ? GetTeam(ChatColor.AQUA) : GetTeam(ChatColor.RED); + } + + @EventHandler + public void onItem(ItemSpawnEvent e) { + if (e.getEntityType().equals(EntityType.DROPPED_ITEM)) { + e.setCancelled(true); + } + } + @Override public void EndCheck() { @@ -704,7 +743,7 @@ public class TurfForts extends TeamGame if (player.isOnline()) AddGems(player, 10, "Participation", false, false); } - + //End SetState(GameState.End); } From 750dddeabc44baddbee0e08b13256e7bd01a4e86 Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Fri, 19 Jun 2015 21:10:10 -0400 Subject: [PATCH 04/10] Editing .classpath and a main testing method in UtilBlock Signed-off-by: Aaron Brock --- .../mineplex/core/common/util/UtilBlock.java | 26 ++++++++++++++++++- .../.classpath | 2 +- Plugins/Mineplex.EnjinTranslator/.classpath | 2 +- .../Mineplex.Minecraft.BungeeSigns/.classpath | 2 +- Plugins/Mineplex.PlayerCache/.classpath | 2 +- Plugins/Mineplex.StaffServer/.classpath | 2 +- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index fec6f0710..43cbfb1d2 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -18,7 +18,31 @@ import org.bukkit.inventory.ItemStack; public class UtilBlock { - + + public static void main(String[] args) { + + for (Material m : Material.values()) { + + boolean thisSolid = fullSolid(m.getId()); + boolean solid = m.isSolid(); + if (thisSolid != solid) { + StringBuilder sb = new StringBuilder(); + sb.append("Failed: "); + sb.append(m.name()); + int amount = 40 - sb.length(); + for (int i = 0; i < amount; i++) { + sb.append(" "); + } + sb.append(thisSolid); + System.out.println(sb); + } + + } + System.out.println("done!"); + + } + + /** * A list of blocks that are usable */ diff --git a/Plugins/Mineplex.DDoSProtectionSwitcher/.classpath b/Plugins/Mineplex.DDoSProtectionSwitcher/.classpath index a622fd726..3cc5b666a 100644 --- a/Plugins/Mineplex.DDoSProtectionSwitcher/.classpath +++ b/Plugins/Mineplex.DDoSProtectionSwitcher/.classpath @@ -1,11 +1,11 @@ - + diff --git a/Plugins/Mineplex.EnjinTranslator/.classpath b/Plugins/Mineplex.EnjinTranslator/.classpath index 76585c180..224f11ab1 100644 --- a/Plugins/Mineplex.EnjinTranslator/.classpath +++ b/Plugins/Mineplex.EnjinTranslator/.classpath @@ -1,10 +1,10 @@ - + diff --git a/Plugins/Mineplex.Minecraft.BungeeSigns/.classpath b/Plugins/Mineplex.Minecraft.BungeeSigns/.classpath index 211cf1dd3..3928b1d4c 100644 --- a/Plugins/Mineplex.Minecraft.BungeeSigns/.classpath +++ b/Plugins/Mineplex.Minecraft.BungeeSigns/.classpath @@ -1,7 +1,7 @@ - + diff --git a/Plugins/Mineplex.PlayerCache/.classpath b/Plugins/Mineplex.PlayerCache/.classpath index 7a237e253..e5ed569d5 100644 --- a/Plugins/Mineplex.PlayerCache/.classpath +++ b/Plugins/Mineplex.PlayerCache/.classpath @@ -1,7 +1,7 @@ - + diff --git a/Plugins/Mineplex.StaffServer/.classpath b/Plugins/Mineplex.StaffServer/.classpath index 69044860b..52e5e02bf 100644 --- a/Plugins/Mineplex.StaffServer/.classpath +++ b/Plugins/Mineplex.StaffServer/.classpath @@ -1,7 +1,6 @@ - @@ -12,5 +11,6 @@ + From 1f0accd2a18b399e0d5cac6f0c094c203d34c727 Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Sat, 20 Jun 2015 01:09:21 -0400 Subject: [PATCH 05/10] Fixed a little boolean derp that stopped people from breaking blocks. Signed-off-by: Aaron Brock --- .../nautilus/game/arcade/game/games/turfforts/TurfForts.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 0d052332f..a4c514cb3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -115,7 +115,6 @@ public class TurfForts extends TeamGame new Kit[] { - new KitMarksman(manager), new KitInfiltrator(manager), new KitShredder(manager), @@ -127,7 +126,6 @@ public class TurfForts extends TeamGame "", "Each kill advances your turf forwards.", "Take over all the turf to win!" - }); this.StrictAntiHack = true; @@ -693,14 +691,13 @@ public class TurfForts extends TeamGame GameTeam team = GetTeam(event.getPlayer()); GameTeam otherTeam = GetOtherTeam(team); - if (block.getType().equals(Material.WOOL) && (block.getData() == 14 && team.GetColor() != ChatColor.RED || block.getData() == 3 || team.GetColor() != ChatColor.AQUA)) + if (block.getType().equals(Material.WOOL) && (block.getData() == 14 && team.GetColor() != ChatColor.RED) || (block.getData() == 3 && team.GetColor() != ChatColor.AQUA)) { UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot break the " + F.elem(otherTeam.GetColor() + otherTeam.GetName()) + " team's blocks!")); event.setCancelled(true); return; } - } public GameTeam GetOtherTeam(GameTeam team) { From 9cedb3b742d18689018d184009f3263bdd62459e Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Sat, 20 Jun 2015 01:10:26 -0400 Subject: [PATCH 06/10] Rewrote how hackusations are detected. Signed-off-by: Aaron Brock --- .../src/mineplex/core/chat/Chat.java | 52 +++++++++---------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index 0cb37a7a5..d881e2a51 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -19,13 +19,9 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import mineplex.core.MiniPlugin; -import mineplex.core.chat.command.ChatSlowCommand; -import mineplex.core.preferences.PreferencesManager; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; import mineplex.core.account.CoreClientManager; import mineplex.core.chat.command.BroadcastCommand; +import mineplex.core.chat.command.ChatSlowCommand; import mineplex.core.chat.command.SilenceCommand; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -33,6 +29,10 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.preferences.PreferencesManager; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -50,7 +50,9 @@ public class Chat extends MiniPlugin { private CoreClientManager _clientManager; private PreferencesManager _preferences; - + + private String[] _hackusations = {"hack", "hax", "hacker", "hacking", "cheat", "cheater", "cheating", "forcefield", "flyhack", "flyhacking", "autoclick", "aimbot"}; + private String _filterUrl = "https://10.33.53.5:8003/content/item/moderate"; private String _appId = "34018d65-466d-4a91-8e92-29ca49f022c4"; private String _apiKey = "oUywMpwZcIzZO5AWnfDx"; @@ -273,7 +275,7 @@ public class Chat extends MiniPlugin */ String filteredMsg = ""; - + filteredMsg = ((JSONObject) JSONValue.parse(response)).get("content").toString(); if (filteredMsg.contains("parts")) { @@ -289,19 +291,20 @@ public class Chat extends MiniPlugin } } - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void HandleChat(AsyncPlayerChatEvent event) { - if (event.isCancelled()) - return; - + Player sender = event.getPlayer(); + //Bukkit.broadcastMessage("AsyncChat" + !_clientManager.Get(sender).GetRank().Has(Rank.HELPER)); + if (SilenceCheck(sender)) { event.setCancelled(true); return; } + else if (_clientManager.Get(sender).GetRank() == Rank.ALL && !Recharge.Instance.use(sender, "All Chat Message", 3000, false, false)) { @@ -315,11 +318,11 @@ public class Chat extends MiniPlugin UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast.")); event.setCancelled(true); } - else if (!_clientManager.Get(sender).GetRank().Has(Rank.HELPER) && + else if (//!_clientManager.Get(sender).GetRank().Has(Rank.HELPER) && msgContainsHack(event.getMessage())) { UtilPlayer.message(sender, F.main("Chat", - "Accusing players of cheating in-game is against the rules." + "Accusing players of cheating in-game is against the rules. " + "If you think someone is cheating, please gather evidence and report it at " + F.link("www.mineplex.com/supporthub/"))); event.setCancelled(true); @@ -341,28 +344,21 @@ public class Chat extends MiniPlugin event.setCancelled(true); } } - + if (!event.isCancelled()) _playerLastMessage.put(sender.getUniqueId(), new MessageData(event.getMessage())); } private boolean msgContainsHack(String msg) { - msg = msg.toLowerCase(); - return (msg.contains(" hack ") || - msg.contains(" hacker ") || - msg.contains(" hacking ") || - msg.contains(" cheat ") || - msg.contains(" cheater ") || - msg.contains(" cheating ") || - msg.contains(" forcefield ") || - msg.contains(" flyhack ") || - msg.contains(" flyhacker ") || - msg.contains(" flyhacking ") || - msg.contains(" autoclick ") || - msg.contains(" flyhacking ") || - msg.contains(" aimbot ")); + msg = " " + msg.toLowerCase().replaceAll("[^a-z ]", "") + " "; + for (String s : _hackusations) { + if (msg.contains(" " + s + " ")) { + return true; + } + } + return false; } public String hasher(JSONArray hasharray, String message) From da981980df85005fdb1845406ee4ddcca6040a9d Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Sat, 20 Jun 2015 01:35:11 -0400 Subject: [PATCH 07/10] Added world.setThundering(false); Signed-off-by: Aaron Brock --- Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java index 20e207cac..c0f169c4e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java @@ -73,6 +73,7 @@ public class WorldManager extends MiniPlugin else world.setTime(6000); world.setStorm(false); + world.setThundering(false); } @EventHandler From 8ea23f96fce2e083cc681265cabd70f38adf27e1 Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Sat, 20 Jun 2015 01:36:05 -0400 Subject: [PATCH 08/10] Froze time using doDayNightCycle instead of setting the time on UpdateEvent. Signed-off-by: Aaron Brock --- .../arcade/managers/GameLobbyManager.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index e70531e48..89bf6ada6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -32,6 +32,7 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerVelocityEvent; +import org.bukkit.event.weather.WeatherChangeEvent; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Scoreboard; @@ -121,7 +122,12 @@ public class GameLobbyManager implements Listener, IPacketHandler packetHandler.addPacketHandler(this); World world = UtilWorld.getWorld("world"); - + + world.setTime(6000); + world.setStorm(false); + world.setThundering(false); + world.setGameRuleValue("doDaylightCycle", "false"); + spawn = new Location(world, 0, 104, 0); _gameText = new Location(world, 0, 130, 50); @@ -752,9 +758,9 @@ public class GameLobbyManager implements Listener, IPacketHandler { if (event.getType() == UpdateType.FAST) { - spawn.getWorld().setTime(6000); - spawn.getWorld().setStorm(false); - spawn.getWorld().setThundering(false); + //spawn.getWorld().setTime(6000); + //spawn.getWorld().setStorm(false); + //spawn.getWorld().setThundering(false); } @@ -770,7 +776,16 @@ public class GameLobbyManager implements Listener, IPacketHandler ScoreboardDisplay(event); ScoreboardSet(event); } - + + @EventHandler + public void onWeather(WeatherChangeEvent event) { + + if (!event.getWorld().equals(spawn.getWorld())) + return; + + event.setCancelled(true); + } + @EventHandler private void RemoveInvalidEnts(GameStateChangeEvent event) { From 3532dea8921271f783f2d172e7b80a7b15853e83 Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Sat, 20 Jun 2015 10:01:50 -0400 Subject: [PATCH 09/10] Allowed Helper+ to bypass anti-hackusating Signed-off-by: Aaron Brock --- Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index d881e2a51..8ea9778dc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -318,7 +318,7 @@ public class Chat extends MiniPlugin UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast.")); event.setCancelled(true); } - else if (//!_clientManager.Get(sender).GetRank().Has(Rank.HELPER) && + else if (!_clientManager.Get(sender).GetRank().Has(Rank.HELPER) && msgContainsHack(event.getMessage())) { UtilPlayer.message(sender, F.main("Chat", From 5280433dbdbd8f4ea8e9162a7f4acd467cc1e47e Mon Sep 17 00:00:00 2001 From: Aaron Brock Date: Sat, 20 Jun 2015 10:03:53 -0400 Subject: [PATCH 10/10] Added the Pair class for simple 2 object storing, and added upperCaseCount and lowerCaseCount to UtilText. Signed-off-by: Aaron Brock --- .../src/mineplex/core/common/Pair.java | 65 +++++++++++++++++++ .../mineplex/core/common/util/UtilText.java | 50 ++++++++++---- 2 files changed, 103 insertions(+), 12 deletions(-) create mode 100644 Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java new file mode 100644 index 000000000..b39c3dce5 --- /dev/null +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Pair.java @@ -0,0 +1,65 @@ +package mineplex.core.common; + +import java.io.Serializable; + +public class Pair implements Serializable { + + private static final long serialVersionUID = -7631968541502978704L; + + private L left; + private R right; + + public static Pair create(L left, R right) + { + return new Pair(left, right); + } + + private Pair(L left, R right) { + this.setLeft(left); + this.setRight(right); + } + + public L getLeft() + { + return left; + } + + public void setLeft(L left) + { + this.left = left; + } + + public R getRight() + { + return right; + } + + public void setRight(R right) + { + this.right = right; + } + + @Override + public String toString() + { + return getLeft().toString() + ":" + getRight().toString(); + } + + @SuppressWarnings("rawtypes") + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (!(obj instanceof Pair)) + return false; + + Pair localPair = (Pair) obj; + + if (getLeft() != null ? !getLeft().equals(localPair.getLeft()) : localPair.getLeft() != null) + return false; + if (getRight() != null ? !getRight().equals(localPair.getRight()) : localPair.getRight() != null) + return false; + return true; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index 0cec248f5..0c7f5b8e4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -2,22 +2,48 @@ package mineplex.core.common.util; import java.util.Collection; -public class UtilText -{ - public static String listToString(Collection inputList, boolean comma) - { +public class UtilText { + public static String listToString(Collection inputList, boolean comma) { String out = ""; - - for (T cur : inputList) - { + + for (T cur : inputList) { out += cur.toString() + (comma ? ", " : " "); } - - if (out.length() > 0) - { - out = out.substring(0, out.length()-(comma ? 2 : 1)); + + if (out.length() > 0) { + out = out.substring(0, out.length() - (comma ? 2 : 1)); } - + return out; } + + public static int upperCaseCount(String input) { + int count = 0; + + for (int k = 0; k < input.length(); k++) { + + + char ch = input.charAt(k); + if (Character.isUpperCase(ch)) + count++; + + } + + return count; + } + public static int lowerCaseCount(String input) { + int count = 0; + + for (int k = 0; k < input.length(); k++) { + + + char ch = input.charAt(k); + if (Character.isLowerCase(ch)) + count++; + + } + + return count; + } + }