From 969c7c0fdef8b1179d145a8c2bd74b932939dc96 Mon Sep 17 00:00:00 2001 From: Chiss Date: Wed, 24 Sep 2014 15:46:55 +1000 Subject: [PATCH 1/6] Music gadget fixes Tournament point tally Removed snow from frosty HorseMount Added Tournament hub invite messages --- .../core/gadget/types/MusicGadget.java | 23 ++ .../mineplex/core/mount/types/MountFrost.java | 76 +++---- .../.externalToolBuilders/Hub Builder.launch | 2 +- .../src/mineplex/hub/HubManager.java | 6 +- .../hub/modules/TournamentInviter.java | 135 +++++++++++ .../src/nautilus/game/arcade/Arcade.java | 6 + .../nautilus/game/arcade/ArcadeManager.java | 62 ++---- .../src/nautilus/game/arcade/game/Game.java | 2 +- .../game/arcade/game/GameServerConfig.java | 2 + .../game/arcade/managers/GameLootManager.java | 13 ++ .../game/arcade/managers/GameManager.java | 16 +- .../managers/GameTournamentManager.java | 210 ++++++++++++++++++ 12 files changed, 451 insertions(+), 102 deletions(-) create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/modules/TournamentInviter.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTournamentManager.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java index d3dbf7b03..2b6c60249 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/MusicGadget.java @@ -56,6 +56,7 @@ public class MusicGadget extends Gadget return; } + //Near Portal for (Block block : UtilBlock.getInRadius(player.getLocation(), 3).keySet()) { if (block.getType() == Material.PORTAL) @@ -65,6 +66,28 @@ public class MusicGadget extends Gadget } } + //Invalid Location + Block block = player.getLocation().getBlock(); + for (int x=-1 ; x<=1 ; x++) + for (int z=-1 ; z<=1 ; z++) + if (!UtilBlock.airFoliage(block.getRelative(x, 0, z))) + { + UtilPlayer.message(player, F.main("Music", "You cannot place a Jukebox here.")); + return; + } + + //Near Parkour + ArrayList blocks = new ArrayList(); + blocks.add(block); + GadgetBlockEvent gadgetBlockEvent = new GadgetBlockEvent(this, blocks); + Bukkit.getServer().getPluginManager().callEvent(gadgetBlockEvent); + + if (gadgetEvent.isCancelled()) + { + UtilPlayer.message(player, F.main("Music", "You cannot place a Jukebox here.")); + return; + } + player.getWorld().playEffect(player.getLocation(), Effect.RECORD_PLAY, _id); _songs.add(new SongData(player.getLocation().getBlock(), _duration)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java index b02a30198..b34feedfb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountFrost.java @@ -1,11 +1,6 @@ package mineplex.core.mount.types; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - import org.bukkit.Material; -import org.bukkit.block.Block; import org.bukkit.entity.Horse; import org.bukkit.entity.Horse.Color; import org.bukkit.entity.Horse.Style; @@ -13,7 +8,6 @@ import org.bukkit.entity.Horse.Variant; import org.bukkit.event.EventHandler; import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.mount.HorseMount; @@ -46,39 +40,39 @@ public class MountFrost extends HorseMount UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0.1f, 4); } - @EventHandler - public void SnowAura(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Horse horse : GetActive().values()) - { - //Blocks - double duration = 2000; - HashMap blocks = UtilBlock.getInRadius(horse.getLocation(), 2.5d); - - for (Iterator> blockIterator = blocks.entrySet().iterator(); blockIterator.hasNext();) - { - Block block = blockIterator.next().getKey(); - HashMap snowBlocks = UtilBlock.getInRadius(block.getLocation(), 2d); - - boolean addSnow = true; - - for (Block surroundingBlock : snowBlocks.keySet()) - { - if (surroundingBlock.getType() == Material.PORTAL || surroundingBlock.getType() == Material.CACTUS) - { - blockIterator.remove(); - addSnow = false; - break; - } - } - - - if (addSnow) - Manager.getBlockRestore().Snow(block, (byte)1, (byte)1, (long)(duration * (1 + blocks.get(block))), 250, 0); - } - } - } +// @EventHandler +// public void SnowAura(UpdateEvent event) +// { +// if (event.getType() != UpdateType.TICK) +// return; +// +// for (Horse horse : GetActive().values()) +// { +// //Blocks +// double duration = 2000; +// HashMap blocks = UtilBlock.getInRadius(horse.getLocation(), 2.5d); +// +// for (Iterator> blockIterator = blocks.entrySet().iterator(); blockIterator.hasNext();) +// { +// Block block = blockIterator.next().getKey(); +// HashMap snowBlocks = UtilBlock.getInRadius(block.getLocation(), 2d); +// +// boolean addSnow = true; +// +// for (Block surroundingBlock : snowBlocks.keySet()) +// { +// if (surroundingBlock.getType() == Material.PORTAL || surroundingBlock.getType() == Material.CACTUS) +// { +// blockIterator.remove(); +// addSnow = false; +// break; +// } +// } +// +// +// if (addSnow) +// Manager.getBlockRestore().Snow(block, (byte)1, (byte)1, (long)(duration * (1 + blocks.get(block))), 250, 0); +// } +// } +// } } diff --git a/Plugins/Mineplex.Hub/.externalToolBuilders/Hub Builder.launch b/Plugins/Mineplex.Hub/.externalToolBuilders/Hub Builder.launch index 887eb7125..66529a78c 100644 --- a/Plugins/Mineplex.Hub/.externalToolBuilders/Hub Builder.launch +++ b/Plugins/Mineplex.Hub/.externalToolBuilders/Hub Builder.launch @@ -12,7 +12,7 @@ - + diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index d35aec971..d474e4331 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -82,6 +82,7 @@ import mineplex.hub.modules.MapManager; import mineplex.hub.modules.NewsManager; import mineplex.hub.modules.ParkourManager; import mineplex.hub.modules.TextManager; +import mineplex.hub.modules.TournamentInviter; import mineplex.hub.modules.VisibilityManager; import mineplex.hub.modules.WorldManager; import mineplex.hub.party.Party; @@ -154,8 +155,9 @@ public class HubManager extends MiniClientPlugin new MapManager(this); new WorldManager(this); new JumpManager(this); - //new UHCManager(this); - + //new UHCManager(this); + new TournamentInviter(this); + _news = new NewsManager(this); _mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TournamentInviter.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TournamentInviter.java new file mode 100644 index 000000000..f1dcc5178 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TournamentInviter.java @@ -0,0 +1,135 @@ +package mineplex.hub.modules; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; +import mineplex.hub.HubManager; + +public class TournamentInviter extends MiniPlugin +{ + private String[] invitees = new String[] + { + "Bluestone_FTW", + "adrien5d", + "zed0155", + "SubSonicDPS", + "charger134", + "rensy69", + "ghikft", + "ParaJon", + "Mmmmhbeans", + "Zilcor", + "kwcd", + "orangeguyy", + "kingcamas", + "TheHyperAsian", + "BossesCraftCake", + "Shadowsnippp3r", + "MySquishyTurtle", + "pyrodamage", + "Blazespot1", + "WiiTarted", + "Ghostgunner97", + "bbran21", + "StudlyWafflez", + "FrozenAodC", + "PikaBoyCraft", + "NoNowGetOut", + "CandleBlob", + "sad6boy", + "RacgiMan", + "stafford9", + "Wincraft12", + "13en2000", + }; + + private String[] backups = new String[] + { + "DeCouto_05", + "krusher430", + "duble11", + "IcyCaress", + "HeroG_ruha", + "TheCherry_Guy", + "Infernova86", + "epicswords02", + "lion2x", + "Brandon_Nish", + "LTplaysminecraft", + "BootFruit", + "Markus4445", + "jamescrafts8", + "iamlinked", + "axle1313", + "KainFTW", + "CreeperRain", + "thomasjinksybean", + "GamerFletch", + "Thepiggyassassin", + "Patu2010", + "Flying_pigglet", + "PowerMovingBacca", + "arduent", + "Aubble", + "MattaTackk22", + "boomdigity102", + "Creeper2341455", + "Amazing105", + }; + + public TournamentInviter(HubManager manager) + { + super("Map Manager", manager.GetPlugin()); + } + + @EventHandler + public void PlayerJoin(PlayerJoinEvent event) + { + for (String name : invitees) + { + if (!name.equalsIgnoreCase(event.getPlayer().getName())) + continue; + + inviteMessage(event.getPlayer()); + } + + for (String name : backups) + { + if (!name.equalsIgnoreCase(event.getPlayer().getName())) + continue; + + backupMessage(event.getPlayer()); + } + } + + private void inviteMessage(Player player) + { + UtilPlayer.message(player, C.cBlue + C.Strike + "----------------------------------------------------"); + UtilPlayer.message(player, C.cAqua + C.Bold + " Fall Invitational"); + UtilPlayer.message(player, ""); + UtilPlayer.message(player, C.cWhite + "Congratulations! You have earned an invite to the final event"); + UtilPlayer.message(player, C.cWhite + "for the 2014 Fall Invitational on September 27 at 3pm EST!"); + UtilPlayer.message(player, ""); + UtilPlayer.message(player, C.cWhite + "Please confirm that you can attend at this link;"); + UtilPlayer.message(player, C.cGreen + C.Line + "www.tinyurl.com/fallinvitational"); + UtilPlayer.message(player, ""); + UtilPlayer.message(player, C.cBlue + C.Strike + "----------------------------------------------------"); + } + + private void backupMessage(Player player) + { + UtilPlayer.message(player, C.cBlue + C.Strike + "----------------------------------------------------"); + UtilPlayer.message(player, C.cAqua + C.Bold + " Fall Invitational"); + UtilPlayer.message(player, ""); + UtilPlayer.message(player, C.cWhite + "You have earned a backup invite to the final event for the"); + UtilPlayer.message(player, C.cWhite + "2014 Fall Invitational on September 27 at 3pm EST!"); + UtilPlayer.message(player, ""); + UtilPlayer.message(player, C.cWhite + "Please confirm that you can attend at this link;"); + UtilPlayer.message(player, C.cGreen + C.Line + "www.tinyurl.com/fallinvitational"); + UtilPlayer.message(player, ""); + UtilPlayer.message(player, C.cBlue + C.Strike + "----------------------------------------------------"); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index de330327b..7ce3a65e5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -183,6 +183,10 @@ public class Arcade extends JavaPlugin { config.Tournament = Boolean.parseBoolean(tokens[1]); } + else if (tokens[0].equals("TOURNAMENT_POINTS")) + { + config.TournamentPoints = Boolean.parseBoolean(tokens[1]); + } else if (tokens[0].equals("TEAM_REJOIN")) { config.TeamRejoin = Boolean.parseBoolean(tokens[1]); @@ -289,6 +293,8 @@ public class Arcade extends JavaPlugin out.write("\nTOURNAMENT=" + config.Tournament + "\n"); + out.write("\nTOURNAMENT_POINTS=" + config.TournamentPoints + "\n"); + out.write("\nTEAM_REJOIN=" + config.TeamRejoin + "\n"); out.write("TEAM_AUTO_JOIN=" + config.TeamAutoJoin + "\n"); out.write("TEAM_FORCE_BALANCE=" + config.TeamForceBalance + "\n"); 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 3e8621b4c..7062156de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -96,6 +96,7 @@ import nautilus.game.arcade.managers.GameLootManager; import nautilus.game.arcade.managers.GameManager; import nautilus.game.arcade.managers.GamePlayerManager; import nautilus.game.arcade.managers.GameStatManager; +import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; @@ -130,6 +131,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation private GameManager _gameManager; private GameLobbyManager _gameLobbyManager; private GamePlayerManager _gamePlayerManager; + private GameTournamentManager _gameTournamentManager; private GameWorldManager _gameWorldManager; private ServerStatusManager _serverStatusManager; private InventoryManager _inventoryManager; @@ -155,8 +157,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation // Games private Game _game; - private HashMap _tournamentTeam = new HashMap(); - public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack, @@ -247,6 +247,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation new GameFlagManager(this); _gamePlayerManager = new GamePlayerManager(this); new GameAchievementManager(this); + _gameTournamentManager = new GameTournamentManager(this); new GameStatManager(this); new GameLootManager(this, petManager); _gameWorldManager = new GameWorldManager(this); @@ -401,6 +402,16 @@ public class ArcadeManager extends MiniPlugin implements IRelation { return _gameGemManager; } + + public GamePlayerManager GetGamePlayerManager() + { + return _gamePlayerManager; + } + + public GameTournamentManager GetGameTournamentManager() + { + return _gameTournamentManager; + } public GameWorldManager GetGameWorldManager() { @@ -486,7 +497,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation + "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName); //Always Joinable - if (_game.JoinInProgress) + if (_game != null && _game.JoinInProgress) { event.setMotd(ChatColor.GREEN + "Recruiting" + extrainformation); } @@ -530,8 +541,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName())); else event.setQuitMessage(null); - - _tournamentTeam.remove(event.getPlayer().getName()); } public Game GetGame() @@ -861,6 +870,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation { return _serverConfig.Tournament; } + + public boolean IsTournamentPoints() + { + return _serverConfig.TournamentPoints; + } public boolean IsTeamRejoin() { @@ -958,43 +972,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation } } } - - public void setTournamentTeam(Player player, GameTeam team) - { - if (!IsTeamRejoin()) - return; - - _tournamentTeam.put(player.getName(), team.GetName()); - } - - public void rejoinTournamentTeam(Player player) - { - if (_game == null) - return; - - if (!_tournamentTeam.containsKey(player.getName())) - return; - - GameTeam curPref = _game.GetTeamPreference(player); - if (curPref != null) - return; - - GameTeam curTeam = _game.GetTeam(player); - if (curTeam != null) - return; - - String teamName = _tournamentTeam.get(player.getName()); - - for (GameTeam team : _game.GetTeamList()) - { - if (team.GetName().equalsIgnoreCase(teamName)) - { - _gamePlayerManager.AddTeamPreference(_game, player, team); - break; - } - } - } - + public ArcadeRepository getArcadeRepository() { return _arcadeRepository; 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 ef78410a5..6239ca794 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 @@ -501,7 +501,7 @@ public abstract class Game implements Listener Manager.GetLobby().AddPlayerToScoreboards(player, team.GetName().toUpperCase()); //Save Tournament Team - Manager.setTournamentTeam(player, team); + Manager.GetGameTournamentManager().setTournamentTeam(player, team); } public GameTeam ChooseTeam(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java index 10d206029..9caf9430d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameServerConfig.java @@ -14,6 +14,8 @@ public class GameServerConfig //Flags public boolean Tournament = false; + public boolean TournamentPoints = false; + public boolean TeamRejoin = false; public boolean TeamAutoJoin = true; public boolean TeamForceBalance = true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java index f50c15413..d7de96197 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java @@ -16,6 +16,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilFirework; @@ -113,6 +114,18 @@ public class GameLootManager implements Listener { double chance = Math.min(0.5, 0.12 + (System.currentTimeMillis() - _startTime)/3600000d); + if (Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA)) + { + if (Manager.GetClients().Get(player).GetRank().Has(Rank.HERO)) + { + chance *= 1.5; + } + else + { + chance *= 1.25; + } + } + if (Math.random() > chance) return; 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 bb2bb1323..7c90206a7 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 @@ -485,21 +485,7 @@ public class GameManager implements Listener } } - @EventHandler - public void TeamTournamentAutoJoin(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - Game game = Manager.GetGame(); - if (game == null) return; - - if (game.GetState() != GameState.Recruit) - return; - - for (Player player : UtilServer.getPlayers()) - Manager.rejoinTournamentTeam(player); - } + public boolean PlayerAdd(Game game, Player player, GameTeam team) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTournamentManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTournamentManager.java new file mode 100644 index 000000000..c0571f64d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTournamentManager.java @@ -0,0 +1,210 @@ +package nautilus.game.arcade.managers; + +import java.util.ArrayList; +import java.util.HashMap; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerStateChangeEvent; +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 org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Scoreboard; + +public class GameTournamentManager implements Listener +{ + ArcadeManager Manager; + + private HashMap _tournamentTeam = new HashMap(); + + private HashMap _tournamentPoints = new HashMap(); + + public GameTournamentManager(ArcadeManager manager) + { + Manager = manager; + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + @EventHandler + public void TeamTournamentAutoJoin(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + Game game = Manager.GetGame(); + if (game == null) return; + + if (game.GetState() != GameState.Recruit) + return; + + for (Player player : UtilServer.getPlayers()) + rejoinTournamentTeam(player); + } + + public void setTournamentTeam(Player player, GameTeam team) + { + if (!Manager.IsTeamRejoin()) + return; + + _tournamentTeam.put(player.getName(), team.GetName()); + } + + public void rejoinTournamentTeam(Player player) + { + if (Manager.GetGame() == null) + return; + + if (!_tournamentTeam.containsKey(player.getName())) + return; + + GameTeam curPref = Manager.GetGame().GetTeamPreference(player); + if (curPref != null) + return; + + GameTeam curTeam = Manager.GetGame().GetTeam(player); + if (curTeam != null) + return; + + String teamName = _tournamentTeam.get(player.getName()); + + for (GameTeam team : Manager.GetGame().GetTeamList()) + { + if (team.GetName().equalsIgnoreCase(teamName)) + { + Manager.GetGamePlayerManager().AddTeamPreference(Manager.GetGame(), player, team); + break; + } + } + } + + @EventHandler + public void pointsReward(GameStateChangeEvent event) + { + if (!Manager.IsTournamentPoints()) + return; + + if (event.GetState() != GameState.End) + return; + + ArrayList places = event.GetGame().GetTeamList().get(0).GetPlacements(true); + + for (int i=0 ; i ranks = new ArrayList(); + + while (ranks.size() < _tournamentPoints.size()) + { + int bestPoints = 0; + String bestPlayer = null; + + for (String cur : _tournamentPoints.keySet()) + { + if (ranks.contains(cur)) + continue; + + int points = _tournamentPoints.get(cur); + + if (points == 0) + continue; + + if (bestPlayer == null || points < bestPoints) + { + bestPlayer = cur; + bestPoints = points; + } + } + + if (bestPlayer == null) + break; + + ranks.add(bestPlayer); + } + + Bukkit.broadcastMessage(C.cBlue + C.Strike + C.Bold + "--------------------------------------------"); + + for (int i=0 ; i Date: Wed, 24 Sep 2014 21:59:25 -0500 Subject: [PATCH 2/6] Fix Gem Booster display bug --- .../src/mineplex/core/cosmetic/ui/page/Menu.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java index 79e0c4722..1ce86888e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/Menu.java @@ -112,8 +112,11 @@ public class Menu extends ShopPageBase final GemBooster gemBoosterItem = new GemBooster(Shop.getBoosterEnabled(), Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster")); - - AddButton(6, new ShopItem( + + if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= gemBoosterItem.GetCost(CurrencyType.Coins) + || (Shop.getBoosterEnabled() && Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster") > 0)) + { + AddButton(6, new ShopItem( gemBoosterItem.GetDisplayMaterial(), gemBoosterItem.GetDisplayName(), gemBoosterItem.GetDescription(), @@ -144,15 +147,11 @@ public class Menu extends ShopPageBase purchaseGemBooster(gemBoosterItem, player); } } - ); - - if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= gemBoosterItem.GetCost(CurrencyType.Coins)) - { - + ); } else { - AddItem(15, new ShopItem( + AddItem(6, new ShopItem( gemBoosterItem.GetDisplayMaterial(), gemBoosterItem.GetDisplayName(), gemBoosterItem.GetDescription(), From f5c8b2b1ac85cc8cfa2e4e7efb0550e321a11b16 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 24 Sep 2014 22:31:09 -0500 Subject: [PATCH 3/6] Fix renaming pets for 1.8 clients --- .../src/mineplex/core/cosmetic/ui/page/PetPage.java | 2 +- .../src/mineplex/core/cosmetic/ui/page/PetTagPage.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 10d7b25e0..edeb31240 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -131,7 +131,7 @@ public class PetPage extends ShopPageBase PetTagPage petTagPage = new PetTagPage(Plugin, Shop, ClientManager, DonationManager, "Repairing", Player, pet, petPurchase); EntityPlayer entityPlayer = ((CraftPlayer)Player).getHandle(); int containerCounter = entityPlayer.nextContainerCounter(); - entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, 8, "Repairing", 9, true)); + entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, 8, "Repairing", 0, true)); entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory()); entityPlayer.activeContainer.windowId = containerCounter; entityPlayer.activeContainer.addSlotListener(entityPlayer); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java index 4baf499d2..c46db6c7b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetTagPage.java @@ -62,7 +62,10 @@ public class PetTagPage extends ShopPageBase public void SelectTag() { - if (ChatColor.stripColor(_tagName).length() > 16) + _tagName = ChatColor.stripColor(_tagName); + _tagName = _tagName.replaceAll("[^A-Za-z0-9]", ""); + + if (_tagName.length() > 16) { UtilPlayer.message(Player, F.main(Plugin.GetName(), ChatColor.RED + "Pet name cannot be longer than 16 characters.")); PlayDenySound(Player); From 79e808814ade4eb3f6ca9b46a76a2a30caecbbd0 Mon Sep 17 00:00:00 2001 From: Chiss Date: Thu, 25 Sep 2014 20:52:13 +1000 Subject: [PATCH 4/6] Minestrike cleans up incendiary at the end of rounds --- .../src/mineplex/core/blockrestore/BlockRestore.java | 8 ++++++++ .../game/arcade/game/games/minestrike/MineStrike.java | 1 + 2 files changed, 9 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java index 174e2769a..8641ac476 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestore.java @@ -94,6 +94,14 @@ public class BlockRestore extends MiniPlugin _blocks.remove(block).restore(); } + public void RestoreAll() + { + for (BlockRestoreData data : _blocks.values()) + data.restore(); + + _blocks.clear(); + } + public HashSet RestoreBlockAround(Material type, Location location, int radius) { HashSet restored = new HashSet(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index 437395bb8..87bc77503 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -1910,6 +1910,7 @@ public class MineStrike extends TeamGame //Incendiary _incendiary.clear(); + Manager.GetBlockRestore().RestoreAll(); //Restock Ammo for (Gun gun : _gunsEquipped.keySet()) From 895878ee409ad2726ce7eea0df9919894aa572f0 Mon Sep 17 00:00:00 2001 From: Chiss Date: Fri, 26 Sep 2014 09:33:12 +1000 Subject: [PATCH 5/6] Removing old items, fix for a larger problemo --- .../src/mineplex/hub/modules/WorldManager.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java index d4e42da29..331f172f0 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java @@ -31,6 +31,7 @@ import org.bukkit.entity.Chicken; import org.bukkit.entity.Cow; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Minecart; import org.bukkit.entity.Pig; @@ -202,6 +203,22 @@ public class WorldManager extends MiniPlugin event.setCancelled(true); } + + @EventHandler(priority = EventPriority.LOW) + public void ItemDespawn(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Entity ent : UtilWorld.getWorld("world").getEntities()) + { + if (!(ent instanceof Item)) + continue; + + if (ent.getTicksLived() > 600) + ent.remove(); + } + } @EventHandler public void UpdateWeather(UpdateEvent event) From 1bf5debc06f9bb6cdf951a632b55092433c018ab Mon Sep 17 00:00:00 2001 From: Peter Miller Date: Sat, 27 Sep 2014 00:45:52 -0400 Subject: [PATCH 6/6] Updating DDoSProtectionSwitcher switchServer() method to launch remote script for IP change instead of local. --- .../src/mineplex/ddos/DDoSProtectionSwitcher.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.DDoSProtectionSwitcher/src/mineplex/ddos/DDoSProtectionSwitcher.java b/Plugins/Mineplex.DDoSProtectionSwitcher/src/mineplex/ddos/DDoSProtectionSwitcher.java index dd9898f6f..9bcaaf2de 100644 --- a/Plugins/Mineplex.DDoSProtectionSwitcher/src/mineplex/ddos/DDoSProtectionSwitcher.java +++ b/Plugins/Mineplex.DDoSProtectionSwitcher/src/mineplex/ddos/DDoSProtectionSwitcher.java @@ -275,10 +275,13 @@ public class DDoSProtectionSwitcher private static void switchServer(final String privateIp, String currentIp, String newIp, String currentGateway, String newGateway) { - String cmd = "/home/mineplex/switchBungeeIp.sh"; + String cmd = "/usr/bin/ssh"; + String args = "-to StrictHostKeyChecking=no -o ServerAliveInterval=10 mineplex@" + privateIp + " -p 5191"; + String remoteCmd = "\"sh /home/mineplex/config/switchBungeeIpRemote.sh"; + String remoteCmdEnd = "\""; - ProcessRunner pr = new ProcessRunner(new String[] { "/bin/sh", cmd, privateIp, currentIp, newIp, - currentGateway, newGateway }); + ProcessRunner pr = new ProcessRunner(new String[] { cmd, args, remoteCmd, currentIp, newIp, + currentGateway, newGateway, remoteCmdEnd }); pr.start(new GenericRunnable() { public void run(Boolean error)