From 44fbd9fdd2d76f5c5f2d830aa201de1e1c7d3027 Mon Sep 17 00:00:00 2001 From: Chiss Date: Sat, 8 Nov 2014 10:11:12 +1100 Subject: [PATCH 1/7] updated punishment output. punishee is now informed of the reason in chat. --- .../src/mineplex/core/punish/Punish.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index 71be3aa51..a716782ca 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -154,7 +154,7 @@ public class Punish extends MiniPlugin } else if (banResult == PunishmentResponse.Punished) { - final String durationString = F.time(UtilTime.convertString(finalDuration < 0 ? -1 : (long)(finalDuration * 3600000), 1, TimeUnit.FIT)); + final String durationString = UtilTime.convertString(finalDuration < 0 ? -1 : (long)(finalDuration * 3600000), 1, TimeUnit.FIT); if (sentence == PunishmentSentence.Ban) { @@ -178,7 +178,18 @@ public class Punish extends MiniPlugin System.out.println(F.main(GetName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " muted " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + durationString + ".")); - UtilServer.broadcast(F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " muted " + playerName + " for " + durationString + ".")); + //Warning + if (finalDuration == 0) + UtilServer.broadcast(F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " issued a warning to " + playerName + ".")); + else + UtilServer.broadcast(F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " muted " + playerName + " for " + durationString + ".")); + + //Inform + Player target = UtilPlayer.searchExact(playerName); + if (target != null) + { + UtilPlayer.message(target, F.main("Punish", F.elem(C.cGray + C.Bold + "Reason: ") + reason)); + } _repository.LoadPunishClient(playerName, new Callback() { From 24725eb22e40cab926c2fcc78a2dafbdf6c4a795 Mon Sep 17 00:00:00 2001 From: Chiss Date: Sat, 8 Nov 2014 10:15:46 +1100 Subject: [PATCH 2/7] play a sound when you get punished --- Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index a716782ca..0fdbc8ddb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -18,6 +18,7 @@ import mineplex.core.punish.Tokens.PunishClientToken; import mineplex.core.punish.Tokens.PunishmentToken; import org.bukkit.Bukkit; +import org.bukkit.Sound; import org.bukkit.craftbukkit.libs.com.google.gson.Gson; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -189,6 +190,7 @@ public class Punish extends MiniPlugin if (target != null) { UtilPlayer.message(target, F.main("Punish", F.elem(C.cGray + C.Bold + "Reason: ") + reason)); + target.playSound(target.getLocation(), Sound.CAT_MEOW, 1f, 1f); } _repository.LoadPunishClient(playerName, new Callback() From 75c07588a59c0688a97246054168fac442f644b1 Mon Sep 17 00:00:00 2001 From: Chiss Date: Sat, 8 Nov 2014 10:22:23 +1100 Subject: [PATCH 3/7] UHC wont start for 2 minutes after creation --- .../src/nautilus/game/arcade/managers/GameManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 6266b386f..aaaf04d28 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -200,7 +200,7 @@ public class GameManager implements Listener public void StateCountdown(Game game, int timer, boolean force) { //Always give time to pick team. - if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), 15000)) + if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), game.GetType() == GameType.UHC ? 120000 : 15000)) { return; } From 96f54c2949ee1521b1205f94da3e3699b66e84ca Mon Sep 17 00:00:00 2001 From: CoderTim Date: Fri, 7 Nov 2014 18:27:20 -0500 Subject: [PATCH 4/7] Made DBPool class uninstantiatable --- .../Mineplex.Core/src/mineplex/core/database/DBPool.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java b/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java index 93274675e..3cd2c9aa0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java @@ -5,7 +5,7 @@ import java.sql.Connection; import org.apache.commons.dbcp2.BasicDataSource; -public class DBPool +public final class DBPool { public static final DataSource ACCOUNT = openDataSource("jdbc:mysql://db.mineplex.com/Account", "root", "tAbechAk3wR7tuTh"); public static final DataSource QUEUE = openDataSource("jdbc:mysql://db.mineplex.com/Queue", "root", "tAbechAk3wR7tuTh"); @@ -30,4 +30,9 @@ public class DBPool return source; } + + private DBPool() + { + + } } From ae35e82e229be1ec6555bb43e101c0b3bcb92bd6 Mon Sep 17 00:00:00 2001 From: CoderTim Date: Fri, 7 Nov 2014 18:28:06 -0500 Subject: [PATCH 5/7] Disabled AFK kick in Draw My Thing --- .../nautilus/game/arcade/ArcadeManager.java | 8 ++- .../src/nautilus/game/arcade/game/Game.java | 5 ++ .../game/arcade/game/games/draw/Draw.java | 2 + .../game/arcade/managers/IdleManager.java | 49 +++++++++++++------ 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 5c05db3c1..ca4edf115 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -143,6 +143,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation private ServerStatusManager _serverStatusManager; private InventoryManager _inventoryManager; private CosmeticManager _cosmeticManager; + private final IdleManager _idleManager; private AchievementManager _achievementManager; private StatsManager _statsManager; @@ -261,7 +262,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation new GameLootManager(this, petManager); _gameWorldManager = new GameWorldManager(this); new MiscManager(this); - new IdleManager(this); + _idleManager = new IdleManager(this); new HalloweenManager(this); _arcadeRepository = new ArcadeRepository(plugin); @@ -1065,4 +1066,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation { _youtube.remove(event.getPlayer()); } + + public IdleManager getIdleManager() + { + return _idleManager; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index deef76245..892c03dfa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -1246,4 +1246,9 @@ public abstract class Game implements Listener _statTrackers.clear(); } + + public ArcadeManager getArcadeManager() + { + return Manager; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index b96abfe88..c83e00783 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -110,6 +110,8 @@ public class Draw extends SoloGame new KeenEyeStatTracker(this), new PureLuckStatTracker(this) ); + + getArcadeManager().getIdleManager().setEnabled(false); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java index c6071d5a4..925a95b5b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/IdleManager.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.managers; import java.util.HashMap; +import java.util.Map; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -12,6 +13,7 @@ import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.Game.GameState; +import org.bukkit.Bukkit; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -20,30 +22,32 @@ import org.bukkit.event.player.PlayerQuitEvent; public class IdleManager implements Listener { - ArcadeManager Manager; + private final ArcadeManager _arcadeManager; + private final Map _yaw = new HashMap<>(); + private final Map _idle = new HashMap<>(); + private final Map _beep = new HashMap<>(); + private boolean _enabled = true; - private HashMap _yaw = new HashMap(); - private HashMap _idle = new HashMap(); - private HashMap _beep = new HashMap(); - - public IdleManager(ArcadeManager manager) { - Manager = manager; + _arcadeManager = manager; - Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + Bukkit.getPluginManager().registerEvents(this, getArcadeManager().GetPlugin()); } @EventHandler - public void KickIdlePlayers(UpdateEvent event) + public void kickIdlePlayers(UpdateEvent event) { + if (!isEnabled()) + return; + if (event.getType() != UpdateType.FAST) return; - if (!Manager.IsPlayerKickIdle()) + if (!getArcadeManager().IsPlayerKickIdle()) return; - if (Manager.GetGame() == null) + if (getArcadeManager().GetGame() == null) return; for (Player player : UtilServer.getPlayers()) @@ -58,10 +62,10 @@ public class IdleManager implements Listener { if (UtilTime.elapsed(_idle.get(player), 120000)) { - if (Manager.GetGame().GetState() != GameState.Recruit && !Manager.GetGame().IsAlive(player)) + if (getArcadeManager().GetGame().GetState() != GameState.Recruit && !getArcadeManager().GetGame().IsAlive(player)) continue; - if (Manager.GetClients().Get(player).GetRank().Has(Rank.MODERATOR)) + if (getArcadeManager().GetClients().Get(player).GetRank().Has(Rank.MODERATOR)) continue; //Start Beeps @@ -77,7 +81,7 @@ public class IdleManager implements Listener if (count == 0) { player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); - Manager.GetPortal().SendPlayerToServer(player, "Lobby"); + getArcadeManager().GetPortal().SendPlayerToServer(player, "Lobby"); } else { @@ -105,10 +109,25 @@ public class IdleManager implements Listener } @EventHandler - public void Quit(PlayerQuitEvent event) + public void onPlayerQuit(PlayerQuitEvent event) { _yaw.remove(event.getPlayer()); _idle.remove(event.getPlayer()); _beep.remove(event.getPlayer()); } + + public boolean isEnabled() + { + return _enabled; + } + + public void setEnabled(boolean enabled) + { + _enabled = enabled; + } + + public ArcadeManager getArcadeManager() + { + return _arcadeManager; + } } From 5b1a185a5f6eaba7cb594d86f2adb5532bde216e Mon Sep 17 00:00:00 2001 From: CoderTim Date: Fri, 7 Nov 2014 18:28:28 -0500 Subject: [PATCH 6/7] Fixed Bad Hider achievement --- .../game/arcade/stats/BadHiderStatTracker.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BadHiderStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BadHiderStatTracker.java index 6b50bc4a4..fef5ba346 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BadHiderStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BadHiderStatTracker.java @@ -12,6 +12,7 @@ import org.bukkit.event.entity.PlayerDeathEvent; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.hideseek.HideSeek; +import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm; public class BadHiderStatTracker extends StatTracker { @@ -28,7 +29,8 @@ public class BadHiderStatTracker extends StatTracker if (getGame().GetState() != Game.GameState.Live) return; - _disqualified.add(event.getPlayer().getUniqueId()); + if (event.getForm() instanceof CreatureForm) + _disqualified.add(event.getPlayer().getUniqueId()); } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @@ -40,15 +42,6 @@ public class BadHiderStatTracker extends StatTracker _disqualified.add(event.getEntity().getUniqueId()); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public void onPlayerSolidify(HideSeek.PlayerSolidifyEvent event) - { - if (getGame().GetState() != Game.GameState.Live) - return; - - _disqualified.add(event.getPlayer().getUniqueId()); - } - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onGameStateChange(GameStateChangeEvent event) { From e286bec77708e27ee59a6b1934b637f949fc195a Mon Sep 17 00:00:00 2001 From: Chiss Date: Sat, 8 Nov 2014 10:30:32 +1100 Subject: [PATCH 7/7] added a little msg for people in UHC, informing that it will start soon --- .../game/arcade/game/games/uhc/UHC.java | 74 +++++++++++-------- .../game/arcade/managers/GameManager.java | 8 +- 2 files changed, 50 insertions(+), 32 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 677f226a0..dd9c9479a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -102,6 +102,8 @@ public class UHC extends TeamGame private boolean xrayDebug = false; + private long lastInform = 0; + public UHC(ArcadeManager manager) { super(manager, GameType.UHC, @@ -120,7 +122,7 @@ public class UHC extends TeamGame }); this.StrictAntiHack = true; - + this.GameTimeout = 10800000; this.DamagePvP = false; @@ -154,9 +156,9 @@ public class UHC extends TeamGame this.CompassGiveItem = false; this.WorldBoundaryKill = false; - + this.TickPerTeleport = 3; - + this.GemBoosterEnabled = false; this.GemDoubleEnabled = false; this.GemHunterEnabled = false; @@ -583,31 +585,31 @@ public class UHC extends TeamGame event.getDrops().add(ItemStackFactory.Instance.CreateStack(Material.GOLD_INGOT, 1)); } } - + @EventHandler(priority = EventPriority.LOWEST) public void PlayerQuitDropItems(PlayerQuitEvent event) { Player player = event.getPlayer(); - + GameTeam team = GetTeam(player); if (team == null) return; - + if (!IsAlive(player)) return; - + if (!QuitOut) return; //Drop Items UtilInv.drop(player, true); - + //Skull Drop ItemStack stack = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)3, 1, team.GetColor() + player.getName() + "'s Head"); - + SkullMeta meta = (SkullMeta)stack.getItemMeta(); meta.setOwner(player.getName()); stack.setItemMeta(meta); - + event.getPlayer().getWorld().dropItemNaturally(player.getEyeLocation(), stack); } @@ -621,11 +623,11 @@ public class UHC extends TeamGame //Skull Drop ItemStack stack = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte)3, 1, team.GetColor() + player.getName() + "'s Head"); - + SkullMeta meta = (SkullMeta)stack.getItemMeta(); meta.setOwner(player.getName()); stack.setItemMeta(meta); - + event.getDrops().add(stack); //Lightning @@ -896,16 +898,16 @@ public class UHC extends TeamGame if (event.getItemInHand().getType() == Material.SKULL || event.getItemInHand().getType() == Material.SKULL_ITEM) event.setCancelled(true); } - + @EventHandler(priority = EventPriority.MONITOR) public void HeadPickup(PlayerPickupItemEvent event) { if (!IsLive()) return; - + if (event.isCancelled()) return; - + if (event.getItem().getItemStack().getType() == Material.SKULL_ITEM) { UtilPlayer.message(event.getPlayer(), " "); @@ -915,7 +917,7 @@ public class UHC extends TeamGame UtilPlayer.message(event.getPlayer(), " "); } } - + /* @EventHandler public void HeadEat(PlayerInteractEvent event) @@ -926,23 +928,23 @@ public class UHC extends TeamGame (new PotionEffect(PotionEffectType.ABSORPTION, 2400, 0)).apply(event.getPlayer()); (new PotionEffect(PotionEffectType.REGENERATION, 200, 1)).apply(event.getPlayer()); - + event.getPlayer().setItemInHand(null); event.setCancelled(true); } } - + @EventHandler(priority = EventPriority.MONITOR) public void DamageHealCancel(EntityDamageEvent event) { if (event.isCancelled()) return; - + if (event.getEntity() instanceof Player) { Player player = (Player)event.getEntity(); player.removePotionEffect(PotionEffectType.REGENERATION); - + UtilPlayer.message(player, "You took damage and lost " + F.elem(C.cGreen + "Regeneration") + ChatColor.RESET + "."); } }*/ @@ -1238,11 +1240,11 @@ public class UHC extends TeamGame { if (event.getType() != UpdateType.SEC) return; - + if (!_ended) if (_joinable) return; - + for (final Player player : UtilServer.getPlayers()) { UtilPlayer.message(player, " "); @@ -1431,39 +1433,39 @@ public class UHC extends TeamGame private ArrayList findOres(Block source, int range) { ArrayList ores = new ArrayList(); - + for (int x=-range ; x <= range ; x++) for (int z=-range ; z <= range ; z++) for (int y=-range ; y <= range ; y++) { Block block = source.getRelative(x, y, z); - + findOreFromBlock(ores, block); } - + if (xrayDebug) for (Block debug : ores) System.out.println("Found " + debug.getType() + " at " + UtilWorld.locToStrClean(debug.getLocation())); - + return ores; } - + public void findOreFromBlock(ArrayList ores, Block block) { if (ores.contains(block)) return; - + if (isOre(block)) { ores.add(block); - + for (Block neighbour : UtilBlock.getSurrounding(block, true)) { findOreFromBlock(ores, neighbour); } } } - + public boolean isOre(Block block) { return (block.getType() == Material.IRON_ORE || @@ -1531,7 +1533,7 @@ public class UHC extends TeamGame return veins; } - + private void removeNonAirVeins(ArrayList> oreVeins) { //Remove Non-Aired Veins @@ -1578,4 +1580,14 @@ public class UHC extends TeamGame } } } + + public void informStartSoon() + { + if (UtilTime.elapsed(lastInform, 20000)) + { + lastInform = System.currentTimeMillis(); + + Bukkit.broadcastMessage(C.cGray + "Countdown will start in " + UtilTime.MakeStr(150000 - (System.currentTimeMillis() - GetStateTime())) +"..."); + } + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index aaaf04d28..e15eebcf7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -29,6 +29,7 @@ import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.stats.StatTracker; import org.bukkit.ChatColor; @@ -200,8 +201,13 @@ public class GameManager implements Listener public void StateCountdown(Game game, int timer, boolean force) { //Always give time to pick team. - if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), game.GetType() == GameType.UHC ? 120000 : 15000)) + if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), game.GetType() == GameType.UHC ? 150000 : 15000)) { + if (game.GetType() == GameType.UHC) + { + ((UHC)game).informStartSoon(); + } + return; }