From 633cbdabe279a9ec1a57d96d6585f58a6d3754df Mon Sep 17 00:00:00 2001 From: xGamingDudex Date: Thu, 20 Aug 2015 15:42:39 +0200 Subject: [PATCH 01/66] player.isOnGround() is controlled by packets from the player, meaning players can easily fake being on the ground resulting in infinite double jumps. player.getFallDisance() is also reset when isOnGround() returns true, meaning we'll need to manually check if the player is on the ground. Outlines two opposite corners of the entities bounding box, scann all blocks inside, check if any of them are solid and return respectively. --- .../mineplex/core/common/util/UtilEnt.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 8b489c952..1cc2d5416 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import net.minecraft.server.v1_7_R4.AxisAlignedBB; import net.minecraft.server.v1_7_R4.EntityBat; import net.minecraft.server.v1_7_R4.EntityCreature; import net.minecraft.server.v1_7_R4.EntityEnderDragon; @@ -26,7 +27,9 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.World; -import org.bukkit.block.BlockFace; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; import org.bukkit.entity.Creature; @@ -36,8 +39,6 @@ import org.bukkit.entity.Giant; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; public class UtilEnt { @@ -495,10 +496,14 @@ public class UtilEnt public static boolean isGrounded(Entity ent) { - if (ent instanceof CraftEntity) - return ((CraftEntity)ent).getHandle().onGround; - - return UtilBlock.solid(ent.getLocation().getBlock().getRelative(BlockFace.DOWN)); + AxisAlignedBB box = ((CraftEntity)ent).getHandle().boundingBox; + Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.1, box.c); + Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f); + + for(Block b : UtilBlock.getInBoundingBox(bottom_corner_1, bottom_corner_2)){ + if(UtilBlock.solid(b)) return true; + } + return false; } public static void PlayDamageSound(LivingEntity damagee) From b5b8bef39efabacbc9fd0418466a3131504b0f84 Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 19:58:51 -0700 Subject: [PATCH 02/66] evo fixes --- .../game/arcade/game/games/evolution/Evolution.java | 9 +++++++-- .../arcade/game/games/evolution/mobs/KitChicken.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index a136c20d1..ab6926ada 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -23,6 +23,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; +import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.CombatManager.AttackReason; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; @@ -146,8 +147,6 @@ public class Evolution extends SoloGame CreatureAllow = false; - DeathMessages = false; - InventoryClick = false; InventoryOpenBlock = false; @@ -785,4 +784,10 @@ public class Evolution extends SoloGame Scoreboard.Draw(); } + + @EventHandler + public void deathMsg(CombatDeathEvent event) + { + event.SetBroadcastType(DeathMessageType.Simple); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java index 63a8de47f..c2f477d71 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java @@ -40,7 +40,7 @@ public class KitChicken extends EvoKit new Perk[] { new PerkConstructor("Egg Pouch", 2.0, 3, Material.EGG, - "Egg Launcher Ammo", false), new PerkDoubleJumpEVO("Double Jump", 0.4, 0.9, false) + "Egg Launcher Ammo", false), new PerkDoubleJumpEVO("Double Jump", 0.6, 0.9, false) }, EntityType.CHICKEN); } From 8238a199d54a4aede9c8a133bb04f01ee2ed8d52 Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 20:06:39 -0700 Subject: [PATCH 03/66] gem stuff --- .../game/games/evolution/Evolution.java | 2 +- .../game/arcade/managers/GameGemManager.java | 41 +++++++++++++++++-- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index a6245c90a..e1e23d10b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -140,7 +140,7 @@ public class Evolution extends SoloGame GemAssistDeathRespawn = .5; CompassEnabled = true; - CompassGiveItem = false; + CompassGiveItem = false; AutomaticRespawn = false; DeathSpectateSecs = 4.0; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index 07bb93f7a..c9cdafe4a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -9,6 +9,7 @@ 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.common.util.UtilTime; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.ArcadeFormat; @@ -36,8 +37,9 @@ public class GameGemManager implements Listener { ArcadeManager Manager; - boolean DoubleGem = true; - + boolean DoubleGem = false; + boolean TimeReward = true; + public GameGemManager(ArcadeManager manager) { Manager = manager; @@ -184,8 +186,21 @@ public class GameGemManager implements Listener total += (int)(earned * (gemFinder * 0.25)); } } + + //Time Reward + if (TimeReward) + { + long timeOnline = 7380000; + + double hoursOnline = timeOnline/3600000d; + + if (hoursOnline > 5) + hoursOnline = 5; + + total += (int)(earned * (hoursOnline * 0.2)); + } - if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player)) + if (DoubleGem && game.GemDoubleEnabled) total += earned; Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), total); @@ -290,8 +305,26 @@ public class GameGemManager implements Listener } } + //Time Reward + if (TimeReward) + { + long timeOnline = 7380000; + + double hoursOnline = timeOnline/3600000d; + + if (hoursOnline > 5) + hoursOnline = 5; + + int extraGems = (int)(earnedGems * (hoursOnline * 0.2));; + + UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " + + F.elem("Online for " + UtilTime.MakeStr(timeOnline) )); + + totalGems += extraGems; + } + //Double Gem - if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player)) + if (DoubleGem && game.GemDoubleEnabled) { UtilPlayer.message(player, F.elem(C.cGreen + "+" + (earnedGems) + " Gems") + " for " + F.elem(C.cDGreen + "Double Gem Weekend")); From 88ca205474bf3df557ca5ad3d6e3591c12a94c5d Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 20:31:29 -0700 Subject: [PATCH 04/66] fixes --- .../game/games/evolution/Evolution.java | 8 +------ .../game/arcade/managers/GameGemManager.java | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index e1e23d10b..944202fec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -403,7 +403,7 @@ public class Evolution extends SoloGame } } - @EventHandler + @EventHandler(priority = EventPriority.MONITOR) public void onKill(CombatDeathEvent event) { event.SetBroadcastType(DeathMessageType.Simple); @@ -790,10 +790,4 @@ public class Evolution extends SoloGame Scoreboard.Draw(); } - - @EventHandler - public void deathMsg(CombatDeathEvent event) - { - event.SetBroadcastType(DeathMessageType.Simple); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index c9cdafe4a..16628a272 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -190,13 +190,13 @@ public class GameGemManager implements Listener //Time Reward if (TimeReward) { - long timeOnline = 7380000; + long timeOnline = 7980000; double hoursOnline = timeOnline/3600000d; if (hoursOnline > 5) - hoursOnline = 5; - + hoursOnline = 5; + total += (int)(earned * (hoursOnline * 0.2)); } @@ -308,19 +308,22 @@ public class GameGemManager implements Listener //Time Reward if (TimeReward) { - long timeOnline = 7380000; + long timeOnline = 7980000; double hoursOnline = timeOnline/3600000d; if (hoursOnline > 5) hoursOnline = 5; - int extraGems = (int)(earnedGems * (hoursOnline * 0.2));; + int extraGems = (int)(earnedGems * (hoursOnline * 0.2)); - UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " + - F.elem("Online for " + UtilTime.MakeStr(timeOnline) )); - - totalGems += extraGems; + if (extraGems > 0) + { + UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " + + F.elem("Online for " + UtilTime.MakeStr(timeOnline) + C.cGreen + " +" + (int)(hoursOnline * 20) + "%")); + + totalGems += extraGems; + } } //Double Gem From 11cc4a6cea1d90656833c68e0fe608876b6ab9cf Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 20:45:59 -0700 Subject: [PATCH 05/66] removed msg --- .../game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java index ad9232582..02435d894 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java @@ -151,9 +151,6 @@ public class PerkSiesmicSlamEVO extends Perk //Condition Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); - - //Inform - UtilPlayer.message(cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + ".")); } //Effect From 19b2ff5b583a8f8db310ae60764a003ea943885a Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 20:48:32 -0700 Subject: [PATCH 06/66] fixed scoreboard --- .../arcade/game/games/evolution/Evolution.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 468d57fd1..8dcc4019d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -776,19 +776,14 @@ public class Evolution extends SoloGame Scoreboard.WriteBlank(); - int index = 0; + Scoreboard.Write(C.cYellow + C.Bold + "First to " + _mobKits.size()); + + Scoreboard.WriteBlank(); + for (Player player : GetPlayers(true)) { - if (index > 11) - break; - - Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true); - index++; + Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true); } - - Scoreboard.WriteBlank(); - - Scoreboard.Write(C.cGold + C.Bold + "First to " + _mobKits.size()); Scoreboard.Draw(); } From 6f0309622c33eefbc500151d42130926ce20568f Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 28 Aug 2015 20:58:58 -0700 Subject: [PATCH 07/66] Removed AccountCache. Converted that to PlayerCache and store account id in there. --- .gitignore | 11 ++++++ Plugins/BuildFiles/common.xml | 12 +++++++ .../bungee/playerStats/PlayerStats.java | 16 ++++----- Plugins/Mineplex.Core/.classpath | 1 + .../mineplex/core/account/AccountCache.java | 33 ----------------- .../core/account/CoreClientManager.java | 36 +++++++++---------- .../core/donation/DonationManager.java | 3 +- .../core/inventory/InventoryManager.java | 3 +- .../src/mineplex/core/stats/StatsManager.java | 3 +- .../src/mineplex/core/task/TaskManager.java | 3 +- .../src/mineplex/game/clans/Clans.java | 4 ++- .../src/mineplex/playerCache/PlayerCache.java | 34 ++++++++++++++++-- .../src/mineplex/playerCache/PlayerInfo.java | 11 ++++++ Plugins/Mineplex.StaffServer/.classpath | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 11 ------ 15 files changed, 101 insertions(+), 82 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/account/AccountCache.java delete mode 100644 Plugins/Mineplex.StaffServer/.settings/org.eclipse.jdt.core.prefs diff --git a/.gitignore b/.gitignore index 626bd858f..c1fc8b034 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,14 @@ zBench zMyst zSotanna zSotanna2 +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.fdt +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.fdx +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.fnm +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.frq +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.nrm +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.prx +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.tii +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.tis +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/segments.gen +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/segments_1 +/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/write.lock diff --git a/Plugins/BuildFiles/common.xml b/Plugins/BuildFiles/common.xml index 5141a3cb9..3359861d8 100644 --- a/Plugins/BuildFiles/common.xml +++ b/Plugins/BuildFiles/common.xml @@ -86,6 +86,9 @@ + + + @@ -152,6 +155,9 @@ + + + @@ -198,6 +204,9 @@ + + + @@ -234,6 +243,9 @@ + + + diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java index c15651813..4547d4732 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java @@ -1,6 +1,5 @@ package mineplex.bungee.playerStats; -import java.util.HashMap; import java.util.HashSet; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -17,9 +16,8 @@ import net.md_5.bungee.event.EventHandler; public class PlayerStats implements Listener, Runnable { private Plugin _plugin; - private PlayerStatsRepository _repository; + private PlayerStatsRepository _repository; - private PlayerCache _playerCache = new PlayerCache(); private HashSet _retrievingPlayerInfo = new HashSet(); public PlayerStats(Plugin plugin) @@ -52,7 +50,7 @@ public class PlayerStats implements Listener, Runnable boolean addOrUpdatePlayer = false; - playerInfo = _playerCache.getPlayer(uuid); + playerInfo = PlayerCache.getInstance().getPlayer(uuid); if (playerInfo == null) { @@ -81,11 +79,11 @@ public class PlayerStats implements Listener, Runnable else playerInfo = updatedPlayerInfo; - _playerCache.addPlayer(playerInfo); + PlayerCache.getInstance().addPlayer(playerInfo); } playerInfo.setSessionId(_repository.updatePlayerStats(playerInfo.getId(), ipInfo.id)); - _playerCache.addPlayer(playerInfo); + PlayerCache.getInstance().addPlayer(playerInfo); } finally { @@ -106,13 +104,13 @@ public class PlayerStats implements Listener, Runnable PlayerInfo playerInfo = null; - playerInfo = _playerCache.getPlayer(uuid); + playerInfo = PlayerCache.getInstance().getPlayer(uuid); int timeout = 5; while (playerInfo == null && _retrievingPlayerInfo.contains(uuid) && timeout <= 5) { - playerInfo = _playerCache.getPlayer(uuid); + playerInfo = PlayerCache.getInstance().getPlayer(uuid); if (playerInfo != null) break; @@ -140,6 +138,6 @@ public class PlayerStats implements Listener, Runnable @Override public void run() { - _playerCache.clean(); + PlayerCache.getInstance().clean(); } } diff --git a/Plugins/Mineplex.Core/.classpath b/Plugins/Mineplex.Core/.classpath index 8171cd881..7dba3b7ca 100644 --- a/Plugins/Mineplex.Core/.classpath +++ b/Plugins/Mineplex.Core/.classpath @@ -14,5 +14,6 @@ + diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/AccountCache.java b/Plugins/Mineplex.Core/src/mineplex/core/account/AccountCache.java deleted file mode 100644 index e6ac95b35..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/AccountCache.java +++ /dev/null @@ -1,33 +0,0 @@ -package mineplex.core.account; - -import java.util.UUID; - -import mineplex.serverdata.data.Data; - -public class AccountCache implements Data -{ - private UUID _uuid; - private Integer _id; - - public AccountCache(UUID uuid, int id) - { - _uuid = uuid; - _id = id; - } - - public UUID getUUID() - { - return _uuid; - } - - public int getId() - { - return _id; - } - - @Override - public String getDataId() - { - return _uuid.toString(); - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index 48ea446a6..8bf3fddcf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -22,10 +22,8 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.timing.TimingManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.serverdata.Region; -import mineplex.serverdata.data.BungeeServer; -import mineplex.serverdata.redis.RedisDataRepository; -import mineplex.serverdata.servers.ServerManager; +import mineplex.playerCache.PlayerCache; +import mineplex.playerCache.PlayerInfo; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; @@ -48,7 +46,6 @@ public class CoreClientManager extends MiniPlugin private AccountRepository _repository; private NautHashMap _clientList; private HashSet _duplicateLoginGlitchPreventionList; - private RedisDataRepository _accountCacheRepository; private NautHashMap _loginProcessors = new NautHashMap(); private LinkedList _querylessLoginProcessors = new LinkedList(); @@ -66,9 +63,6 @@ public class CoreClientManager extends MiniPlugin _repository = new AccountRepository(plugin, webServer); _clientList = new NautHashMap(); _duplicateLoginGlitchPreventionList = new HashSet(); - - _accountCacheRepository = new RedisDataRepository(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), - Region.ALL, AccountCache.class, "accountCache"); } public AccountRepository getRepository() @@ -251,7 +245,15 @@ public class CoreClientManager extends MiniPlugin Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid)); if (client.getAccountId() > 0) - _accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()), 60 * 60 * 6); + { + PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid); + + if (playerInfo != null) + { + playerInfo.setAccountId(client.getAccountId()); + PlayerCache.getInstance().addPlayer(playerInfo); + } + } } catch (Exception exception) { @@ -326,13 +328,12 @@ public class CoreClientManager extends MiniPlugin if (client.getAccountId() > 0) { - try + PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid); + + if (playerInfo != null) { - _accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()), 60 * 60 * 6); - } - catch (Exception e) - { - e.printStackTrace(); + playerInfo.setAccountId(client.getAccountId()); + PlayerCache.getInstance().addPlayer(playerInfo); } } @@ -544,9 +545,4 @@ public class CoreClientManager extends MiniPlugin return client.GetRank().has(rank); } - - public int getCachedClientAccountId(UUID uuid) - { - return _accountCacheRepository.getElement(uuid.toString()).getId(); - } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index 71f7ea718..31a02818b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -24,6 +24,7 @@ import mineplex.core.donation.repository.token.DonorTokenWrapper; import mineplex.core.server.util.TransactionResponse; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.playerCache.PlayerCache; public class DonationManager extends MiniDbClientPlugin { @@ -279,7 +280,7 @@ public class DonationManager extends MiniDbClientPlugin { public void run() { - RewardCoins(null, caller, player.getName(), ClientManager.getCachedClientAccountId(player.getUniqueId()), total, false); + RewardCoins(null, caller, player.getName(), PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId(), total, false); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 8c87db300..8117ceeed 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -21,6 +21,7 @@ import mineplex.core.inventory.data.InventoryRepository; import mineplex.core.inventory.data.Item; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.playerCache.PlayerCache; public class InventoryManager extends MiniDbClientPlugin { @@ -180,7 +181,7 @@ public class InventoryManager extends MiniDbClientPlugin synchronized (_inventoryLock) { - final boolean success = _repository.incrementClientInventoryItem(ClientManager.getCachedClientAccountId(uuid), _items.get(item).Id, count); + final boolean success = _repository.incrementClientInventoryItem(PlayerCache.getInstance().getPlayer(uuid).getAccountId(), _items.get(item).Id, count); if (callback != null) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index 38051c268..addbfc4bd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.stats.command.GiveStatCommand; import mineplex.core.stats.command.TimeCommand; import mineplex.core.stats.event.StatChangeEvent; +import mineplex.playerCache.PlayerCache; public class StatsManager extends MiniDbClientPlugin { @@ -139,7 +140,7 @@ public class StatsManager extends MiniDbClientPlugin if (player.isOnline()) continue; - int uploadKey = ClientManager.getCachedClientAccountId(player.getUniqueId()); + int uploadKey = PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId(); uploadQueue.put(uploadKey, new NautHashMap()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java index 2ecce2580..83f495718 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/task/TaskManager.java @@ -14,6 +14,7 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.Callback; import mineplex.core.common.util.NautHashMap; import mineplex.core.task.repository.TaskRepository; +import mineplex.playerCache.PlayerCache; public class TaskManager extends MiniDbClientPlugin { @@ -68,7 +69,7 @@ public class TaskManager extends MiniDbClientPlugin synchronized (_taskLock) { - final boolean success = _repository.addAccountTask(ClientManager.getCachedClientAccountId(uuid), _tasks.get(task)); + final boolean success = _repository.addAccountTask(PlayerCache.getInstance().getPlayer(uuid).getAccountId(), _tasks.get(task)); if (callback != null) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index 553848414..ac3c3dc40 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -4,6 +4,7 @@ import org.bukkit.plugin.java.JavaPlugin; import net.minecraft.server.v1_7_R4.MinecraftServer; import mineplex.core.account.CoreClientManager; +import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.chat.Chat; @@ -23,6 +24,7 @@ import mineplex.core.punish.Punish; import mineplex.core.recharge.Recharge; import mineplex.core.serverConfig.ServerConfiguration; import mineplex.core.spawn.Spawn; +import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; import mineplex.core.teleport.Teleport; import mineplex.core.updater.FileUpdater; @@ -79,7 +81,7 @@ public class Clans extends JavaPlugin BlockRestore blockRestore = new BlockRestore(this); IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal); - Chat chat = new Chat(this, _clientManager, preferenceManager, serverStatusManager.getCurrentServerName()); + Chat chat = new Chat(this, _clientManager, preferenceManager, new AchievementManager(new StatsManager(this, _clientManager), _clientManager, _donationManager), serverStatusManager.getCurrentServerName()); new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat); new MemoryFix(this); diff --git a/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerCache.java b/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerCache.java index 15cffb719..cf320dbde 100644 --- a/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerCache.java +++ b/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerCache.java @@ -8,9 +8,19 @@ import mineplex.serverdata.servers.ServerManager; public class PlayerCache { + private static PlayerCache _instance = null; + private RedisDataRepository _repository; - public PlayerCache() + public static PlayerCache getInstance() + { + if (_instance == null) + _instance = new PlayerCache(); + + return _instance; + } + + private PlayerCache() { _repository = new RedisDataRepository( ServerManager.getMasterConnection(), @@ -22,12 +32,30 @@ public class PlayerCache public void addPlayer(PlayerInfo player) { - _repository.addElement(player, 60 * 60 * 6); // 6 Hours + try + { + _repository.addElement(player, 60 * 60 * 6); // 6 Hours + } + catch (Exception exception) + { + System.out.println("Error adding player info in PlayerCache : " + exception.getMessage()); + exception.printStackTrace(); + } } public PlayerInfo getPlayer(UUID uuid) { - return _repository.getElement(uuid.toString()); + try + { + return _repository.getElement(uuid.toString()); + } + catch (Exception exception) + { + System.out.println("Error retrieving player info in PlayerCache : " + exception.getMessage()); + exception.printStackTrace(); + } + + return null; } public void clean() diff --git a/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerInfo.java b/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerInfo.java index 700839ccb..636981ede 100644 --- a/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerInfo.java +++ b/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerInfo.java @@ -7,6 +7,7 @@ import mineplex.serverdata.data.Data; public class PlayerInfo implements Data { private int _id; + private int _accountId; private UUID _uuid; private String _name; private boolean _online; @@ -34,6 +35,11 @@ public class PlayerInfo implements Data return _id; } + public int getAccountId() + { + return _accountId; + } + public UUID getUUID() { return _uuid; @@ -83,4 +89,9 @@ public class PlayerInfo implements Data { _version = version; } + + public void setAccountId(int accountId) + { + _accountId = accountId; + } } diff --git a/Plugins/Mineplex.StaffServer/.classpath b/Plugins/Mineplex.StaffServer/.classpath index acc97657a..e03947a20 100644 --- a/Plugins/Mineplex.StaffServer/.classpath +++ b/Plugins/Mineplex.StaffServer/.classpath @@ -11,6 +11,6 @@ - + diff --git a/Plugins/Mineplex.StaffServer/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.StaffServer/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7341ab168..000000000 --- a/Plugins/Mineplex.StaffServer/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,11 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.7 From e47662f8551a320e657ff6deade32c8e504ce375 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 28 Aug 2015 21:44:00 -0700 Subject: [PATCH 08/66] Added LoginTime setting as RedisTime for use in calculating time on server. Optimized redis util for time calls to calculate time different and only pull redis time once. --- .../bungee/playerStats/PlayerStats.java | 3 +- .../src/mineplex/playerCache/PlayerInfo.java | 6 ++ .../src/mineplex/serverdata/Utility.java | 82 ++++++++----------- 3 files changed, 43 insertions(+), 48 deletions(-) diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java index 4547d4732..fcae65a57 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java @@ -78,11 +78,10 @@ public class PlayerStats implements Listener, Runnable } else playerInfo = updatedPlayerInfo; - - PlayerCache.getInstance().addPlayer(playerInfo); } playerInfo.setSessionId(_repository.updatePlayerStats(playerInfo.getId(), ipInfo.id)); + playerInfo.updateLoginTime(); PlayerCache.getInstance().addPlayer(playerInfo); } finally diff --git a/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerInfo.java b/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerInfo.java index 636981ede..3ab44b0d5 100644 --- a/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerInfo.java +++ b/Plugins/Mineplex.PlayerCache/src/mineplex/playerCache/PlayerInfo.java @@ -2,6 +2,7 @@ package mineplex.playerCache; import java.util.UUID; +import mineplex.serverdata.Utility; import mineplex.serverdata.data.Data; public class PlayerInfo implements Data @@ -94,4 +95,9 @@ public class PlayerInfo implements Data { _accountId = accountId; } + + public void updateLoginTime() + { + _loginTime = Utility.currentTimeMillis(); + } } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java index b71a39583..2a50ea3b9 100644 --- a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/Utility.java @@ -19,7 +19,9 @@ import com.google.gson.GsonBuilder; */ public class Utility { - + private static boolean _retrievedRedisTime = false; + private static long _millisTimeDifference; + // The Gson instance used to serialize/deserialize objects in JSON form. private static Gson _gson = new GsonBuilder().create(); public static Gson getGson() { return _gson; } @@ -74,29 +76,10 @@ public class Utility */ public static long currentTimeSeconds() { - long currentTime = 0; - JedisPool pool = getPool(false); - Jedis jedis = pool.getResource(); - - try - { - currentTime = Long.parseLong(jedis.time().get(0)); - } - catch (JedisConnectionException exception) - { - exception.printStackTrace(); - pool.returnBrokenResource(jedis); - jedis = null; - } - finally - { - if (pool != null) - { - pool.returnResource(jedis); - } - } - - return currentTime; + if (!_retrievedRedisTime) + setTimeDifference(); + + return (System.currentTimeMillis() + _millisTimeDifference) / 1000; } /** @@ -105,29 +88,10 @@ public class Utility */ public static long currentTimeMillis() { - long currentTime = 0; - JedisPool pool = getPool(false); - Jedis jedis = pool.getResource(); + if (!_retrievedRedisTime) + setTimeDifference(); - try - { - currentTime = Long.parseLong(jedis.time().get(0)); - } - catch (JedisConnectionException exception) - { - exception.printStackTrace(); - pool.returnBrokenResource(jedis); - jedis = null; - } - finally - { - if (pool != null) - { - pool.returnResource(jedis); - } - } - - return currentTime * 1000; + return System.currentTimeMillis() + _millisTimeDifference; } /** @@ -188,4 +152,30 @@ public class Utility return connData.getHost() + ":" + connData.getPort(); } + private static void setTimeDifference() + { + long currentTime = 0; + JedisPool pool = getPool(false); + Jedis jedis = pool.getResource(); + + try + { + currentTime = Long.parseLong(jedis.time().get(0)); + } + catch (JedisConnectionException exception) + { + exception.printStackTrace(); + pool.returnBrokenResource(jedis); + jedis = null; + } + finally + { + if (pool != null) + { + pool.returnResource(jedis); + } + } + + _millisTimeDifference = (currentTime * 1000) - System.currentTimeMillis(); + } } From c98a85c2ba3fe6a7bf9a4a545ffbba07cf83b766 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 28 Aug 2015 22:09:42 -0700 Subject: [PATCH 09/66] Added local storage of login time. Hooked in onlineTime bonus feature to real values. --- .../src/mineplex/core/account/CoreClient.java | 13 +++++++++++++ .../mineplex/core/account/CoreClientManager.java | 3 +-- .../game/arcade/managers/GameGemManager.java | 5 +++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java index df6717c6a..9d1c4c3b0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java @@ -1,12 +1,14 @@ package mineplex.core.account; import mineplex.core.common.Rank; +import mineplex.serverdata.Utility; import org.bukkit.entity.Player; public class CoreClient { private int _accountId = -1; + private long _networkSessionLoginTime; private String _name; private String _disguisedAs; private Player _player; @@ -18,6 +20,7 @@ public class CoreClient { _player = player; _name = player.getName(); + _networkSessionLoginTime = Utility.currentTimeMillis(); } public CoreClient(String name) @@ -65,6 +68,11 @@ public class CoreClient { _rank = rank; } + + public long getNetworkSessionLoginTime() + { + return _networkSessionLoginTime; + } public String getDisguisedAs() { @@ -95,4 +103,9 @@ public class CoreClient public void setDisguised(boolean disguised) { this._disguised = disguised; } + + public void setNetworkSessionLoginTime(long loginTime) + { + _networkSessionLoginTime = loginTime; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index 8bf3fddcf..fd4b324df 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -324,14 +324,13 @@ public class CoreClientManager extends MiniPlugin TimingManager.stop(client.GetPlayerName() + " LoadClient Total."); - System.out.println(client.GetPlayerName() + "'s account id = " + client.getAccountId()); - if (client.getAccountId() > 0) { PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid); if (playerInfo != null) { + client.setNetworkSessionLoginTime(playerInfo.getLoginTime()); playerInfo.setAccountId(client.getAccountId()); PlayerCache.getInstance().addPlayer(playerInfo); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index 16628a272..eb0edb352 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.serverdata.Utility; import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -190,7 +191,7 @@ public class GameGemManager implements Listener //Time Reward if (TimeReward) { - long timeOnline = 7980000; + long timeOnline = Utility.currentTimeMillis() - Manager.GetClients().Get(player).getNetworkSessionLoginTime(); double hoursOnline = timeOnline/3600000d; @@ -308,7 +309,7 @@ public class GameGemManager implements Listener //Time Reward if (TimeReward) { - long timeOnline = 7980000; + long timeOnline = Utility.currentTimeMillis() - Manager.GetClients().Get(player).getNetworkSessionLoginTime(); double hoursOnline = timeOnline/3600000d; From d4d0c4bed6459525dc26b1738738e4c590089dcf Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 28 Aug 2015 23:17:14 -0700 Subject: [PATCH 10/66] Updated Motd. --- .../src/mineplex/bungee/motd/MotdManager.java | 23 ++++--------------- .../.settings/org.eclipse.jdt.core.prefs | 1 + .../mineplex/core/gadget/GadgetManager.java | 2 +- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java index 8577a718e..75cf934cf 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -54,12 +54,13 @@ public class MotdManager implements Listener, Runnable Region.ALL, GlobalMotd.class, "globalMotd"); //String motdLine = "§f§l◄ §c§lMaintenance§f§l ►"; - String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►"; + //String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►"; + String motdLine = " §b§l◄§f§lNEW GAME§b§l► §f§l◄§b§lEVOLUTION§f§l► §b§l◄§f§lNEW GAME§b§l►"; //String motdLine = " §f§l◄ §a§lCarl the Creeper§f§l ▬ §c§l75% OFF SALE§f§l ►"; //String motdLine = " §d§lRank Sale §a§l40% Off"); //String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►"); - updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", motdLine); + updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", motdLine); System.out.println("Updated Bungee MOTD"); } } @@ -97,23 +98,7 @@ public class MotdManager implements Listener, Runnable public void updateMainMotd(String headline, String motdLine) { List motdLines = new ArrayList(); - String colorStripped = ChatColor.stripColor(motdLine); - - if (colorStripped.trim().length() > 45) - motdLine = motdLine.trim().substring(0, 45); - else - { - String trimmed = colorStripped.trim(); - int count = trimmed.length(); - int marker = 0; - - while ((45 - count) / 2 * 1.55 > marker) - { - motdLine = " " + motdLine; - marker++; - } - } - + motdLines.add(motdLine); _repository.addElement(new GlobalMotd("MainMotd", headline, motdLines)); diff --git a/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs index 7341ab168..d17b6724d 100644 --- a/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs +++ b/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,6 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index eb4143d04..4ebc822c1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -459,7 +459,7 @@ public class GadgetManager extends MiniPlugin { if (!event.getPlayer().isSneaking()) { - event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CAT_MEOW, 1f, 1f); + event.getPlayer().kickPlayer("Don't meow ever again."); } } } From d35b5940fc8bd549da0e85b6503fdc834b3e397b Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 23:30:21 -0700 Subject: [PATCH 11/66] fixed achievements --- .../Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 4ebc822c1..eb4143d04 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -459,7 +459,7 @@ public class GadgetManager extends MiniPlugin { if (!event.getPlayer().isSneaking()) { - event.getPlayer().kickPlayer("Don't meow ever again."); + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CAT_MEOW, 1f, 1f); } } } From f8729cbd66c42f9902e3a1ef9196ad111742bcc1 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 28 Aug 2015 23:47:27 -0700 Subject: [PATCH 12/66] Fixed Gadget. --- .../src/mineplex/core/gadget/GadgetManager.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index eb4143d04..d348571d3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -62,6 +62,7 @@ public class GadgetManager extends MiniPlugin private boolean _hideParticles = false; private int _activeItemSlot = 3; + private int _meows = 0; public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager, @@ -459,7 +460,14 @@ public class GadgetManager extends MiniPlugin { if (!event.getPlayer().isSneaking()) { + if (_meows > 3) + { + event.getPlayer().kickPlayer("You meow too much!"); + return; + } + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CAT_MEOW, 1f, 1f); + _meows++; } } } From 088068be80635233499fdbb42a927f8120b1ff59 Mon Sep 17 00:00:00 2001 From: Ty Sayers Date: Sat, 29 Aug 2015 14:51:17 -0700 Subject: [PATCH 13/66] Add 'Clans' to the ignored server groups for ServerMonitor to prevent interference with live Clans servers. --- .../src/mineplex/servermonitor/ServerMonitor.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java index 0cb7fa5b0..511f30d41 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java @@ -246,7 +246,7 @@ public class ServerMonitor for (MinecraftServer minecraftServer : _serverStatuses) { - if (minecraftServer.getGroup().equalsIgnoreCase("Testing")) + if (ignoreServer(minecraftServer.getGroup())) continue; onlineServers.add(minecraftServer.getName()); @@ -288,7 +288,7 @@ public class ServerMonitor for (ServerGroup serverGroup : _serverGroups) { - if (serverGroup.getName().equals("Testing")) + if (ignoreServer(serverGroup.getName())) continue; try @@ -388,7 +388,7 @@ public class ServerMonitor _deadServers.clear(); for (MinecraftServer deadServer : _repository.getDeadServers()) { - if (deadServer.getUptime() <= 10 || deadServer.getGroup().equalsIgnoreCase("Testing")) + if (deadServer.getUptime() <= 10 || ignoreServer(deadServer.getGroup())) continue; if (_count == 0 || deadServers.contains(deadServer.getName())) @@ -486,7 +486,7 @@ public class ServerMonitor if (joinableServers > maxUHC) serversToKill = maxUHC - joinableServers; } - else if (serverGroup.getName().equalsIgnoreCase("Testing")) + else if (ignoreServer(serverGroup.getName())) { return; } @@ -691,6 +691,11 @@ public class ServerMonitor _processes.add(pr); } + private static boolean ignoreServer(String serverGroupName) + { + return serverGroupName.equalsIgnoreCase("Testing") || serverGroupName.equalsIgnoreCase("Clans"); + } + private static void log(String message) { log(message, false); From 4e32bad8dd979595d4eaf4c77848f122b95b75c6 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Sat, 29 Aug 2015 14:54:57 -0700 Subject: [PATCH 14/66] Fixed bug with stats pulling as int. Fixed bug with Poll recording selections wrong. --- .../src/mineplex/core/bonuses/gui/buttons/PollButton.java | 2 +- .../Mineplex.Core/src/mineplex/core/stats/StatsRepository.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java index 8e7a5889e..dfb707a05 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PollButton.java @@ -197,7 +197,7 @@ public class PollButton extends SimpleGui implements GuiItem { { _create = true; - _pollManager.answerPoll(getPlayer(), _poll, num); + _pollManager.answerPoll(getPlayer(), _poll, num + 1); getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java index e1524436d..98543aad2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java @@ -165,7 +165,7 @@ public class StatsRepository extends RepositoryBase while (resultSet.next()) { - playerStats.addStat(resultSet.getString(1), resultSet.getInt(2)); + playerStats.addStat(resultSet.getString(1), resultSet.getLong(2)); } return playerStats; From b59511ece417396059e7617e7fb0f8e6b4b81d3c Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Sun, 30 Aug 2015 00:12:54 -0700 Subject: [PATCH 15/66] Added duplicate login kick for network. --- .../playerTracker/PlayerJoinHandler.java | 27 ++++++++++ .../bungee/playerTracker/PlayerTracker.java | 50 ++++++++++++++++++- .../commands/PlayerJoinCommand.java | 24 +++++++++ 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java create mode 100644 Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/PlayerJoinCommand.java diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java new file mode 100644 index 000000000..8e56dab88 --- /dev/null +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java @@ -0,0 +1,27 @@ +package mineplex.bungee.playerTracker; + +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.PlayerJoinCommand; +import mineplex.serverdata.commands.ServerCommand; + +public class PlayerJoinHandler implements CommandCallback +{ + private PlayerTracker _playerTracker; + + public PlayerJoinHandler(PlayerTracker playerTracker) + { + _playerTracker = playerTracker; + } + + @SuppressWarnings("deprecation") + @Override + public void run(ServerCommand command) + { + if (command instanceof PlayerJoinCommand) + { + PlayerJoinCommand joinCommand = (PlayerJoinCommand)command; + + _playerTracker.kickPlayerIfOnline(joinCommand.getUuid()); + } + } +} diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java index 1b8117d04..707dc3eb8 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java @@ -1,19 +1,25 @@ package mineplex.bungee.playerTracker; import java.io.File; +import java.util.HashSet; +import java.util.UUID; +import java.util.concurrent.TimeUnit; import mineplex.serverdata.Region; +import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.data.DataRepository; import mineplex.serverdata.data.PlayerStatus; import mineplex.serverdata.redis.RedisDataRepository; import mineplex.serverdata.servers.ServerManager; +import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PlayerDisconnectEvent; +import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.api.event.ServerConnectedEvent; import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.event.EventHandler; -public class PlayerTracker implements Listener +public class PlayerTracker implements Listener, Runnable { // Default period before status expiry (8 hours) private static final int DEFAULT_STATUS_TIMEOUT = 60 * 60 * 8; @@ -21,6 +27,8 @@ public class PlayerTracker implements Listener // Repository storing player status' across network. private DataRepository _repository; + private HashSet _onlineUUIDs = new HashSet(); + private Plugin _plugin; public PlayerTracker(Plugin plugin) @@ -28,11 +36,14 @@ public class PlayerTracker implements Listener _plugin = plugin; _plugin.getProxy().getPluginManager().registerListener(_plugin, this); + _plugin.getProxy().getScheduler().schedule(_plugin, this, 1L, 1L, TimeUnit.MINUTES); Region region = !new File("eu.dat").exists() ? Region.US : Region.EU; _repository = new RedisDataRepository(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), region, PlayerStatus.class, "playerStatus"); + ServerCommandManager.getInstance().registerCommandType("PlayerJoinCommand", mineplex.serverdata.commands.PlayerJoinCommand.class, new PlayerJoinHandler(this)); + System.out.println("Initialized PlayerTracker."); } @@ -59,5 +70,42 @@ public class PlayerTracker implements Listener _repository.removeElement(event.getPlayer().getName().toLowerCase()); } }); + + _onlineUUIDs.remove(event.getPlayer().getUniqueId()); + } + + @EventHandler + public void playerConnect(final PostLoginEvent event) + { + _onlineUUIDs.add(event.getPlayer().getUniqueId().toString()); + } + + @Override + public void run() + { + HashSet onlineUUIDs = new HashSet(); + + for (ProxiedPlayer player : _plugin.getProxy().getPlayers()) + { + onlineUUIDs.add(player.getUniqueId().toString()); + } + + _onlineUUIDs = onlineUUIDs; + } + + public boolean isPlayerOnline(String uuid) + { + return _onlineUUIDs.contains(uuid); + } + + public void kickPlayerIfOnline(String uuid) + { + if (_onlineUUIDs.contains(uuid)) + { + ProxiedPlayer player = _plugin.getProxy().getPlayer(UUID.fromString(uuid)); + + if (player != null) + player.disconnect("You have logged in from another location."); + } } } diff --git a/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/PlayerJoinCommand.java b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/PlayerJoinCommand.java new file mode 100644 index 000000000..b41ba4555 --- /dev/null +++ b/Plugins/Mineplex.ServerData/src/mineplex/serverdata/commands/PlayerJoinCommand.java @@ -0,0 +1,24 @@ +package mineplex.serverdata.commands; + +import java.util.UUID; + +public class PlayerJoinCommand extends ServerCommand +{ + private String _uuid; + + public PlayerJoinCommand(UUID uuid) + { + _uuid = uuid.toString(); + } + + @Override + public void run() + { + // Utilitizes a callback functionality to seperate dependencies + } + + public String getUuid() + { + return _uuid; + } +} From b0efe35531c20949407bed28c925530c15911ed7 Mon Sep 17 00:00:00 2001 From: Ty Sayers Date: Sun, 30 Aug 2015 13:14:01 -0700 Subject: [PATCH 16/66] Add restriction to ServerCommand that prevents players from directly connection to a Clans-X server, and instead insists that they join through a Clans hub. --- .../core/portal/Commands/ServerCommand.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java index 2162c3b85..b4ac74e62 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java @@ -43,7 +43,7 @@ public class ServerCommand extends CommandBase Plugin.doesServerExist(args[0], new Callback() { public void run(final Boolean serverExists) - { + { if (!serverExists) { UtilPlayer.message( @@ -84,6 +84,19 @@ public class ServerCommand extends CommandBase else deniedAccess = true; } + else if (servUp.contains("CLANS-")) + { + if (playerRank.has(Rank.MODERATOR)) + { + Plugin.sendPlayerToServer(player, args[0]); + } + else + { + UtilPlayer.message(player, + F.main(Plugin.getName(), C.cRed + "You must join clans through the hub! Join " + C.cGold + "ClansHub-1" + + C.cRed + "!")); + } + } else { Plugin.sendPlayerToServer(player, args[0]); From bb66d47e8ed3ae1fd51dd8d034dd3a8b2cc15ce5 Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Sun, 30 Aug 2015 15:47:49 -0700 Subject: [PATCH 17/66] meow --- .../mineplex/core/gadget/GadgetManager.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index d348571d3..22f60039c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -62,7 +62,6 @@ public class GadgetManager extends MiniPlugin private boolean _hideParticles = false; private int _activeItemSlot = 3; - private int _meows = 0; public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager, @@ -456,19 +455,16 @@ public class GadgetManager extends MiniPlugin @EventHandler public void chissMeow(PlayerToggleSneakEvent event) { - if (event.getPlayer().getName().equals("Chiss")) - { - if (!event.getPlayer().isSneaking()) - { - if (_meows > 3) - { - event.getPlayer().kickPlayer("You meow too much!"); - return; - } - - event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CAT_MEOW, 1f, 1f); - _meows++; - } - } + if (event.getPlayer().isSneaking()) + return; + + if (event.getPlayer().getName().equalsIgnoreCase("Chiss")) + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.CAT_MEOW, 1f, 1f); + + if (event.getPlayer().getName().equalsIgnoreCase("defek7")) + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.WOLF_BARK, 1f, 1f); + + if (event.getPlayer().getName().equalsIgnoreCase("sterling_")) + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.PIG_IDLE, 1f, 1f); } } From 740899c09e620ead0ef91705fc44a7d2e02710a9 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Mon, 31 Aug 2015 00:53:07 -0700 Subject: [PATCH 18/66] Added dummy CoreClient in the rare event a player joins and gets disconnected during the join event????Weird Fixes Lobby crashes. --- .../src/mineplex/core/account/CoreClientManager.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index fd4b324df..efb8646a9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -120,7 +120,15 @@ public class CoreClientManager extends MiniPlugin if(client.getDisguisedAs().equalsIgnoreCase(name)) return client; } - return _clientList.get(name); + CoreClient client = _clientList.get(name); + + if (client == null) + { + client = new CoreClient(name); + client.SetRank(Rank.ALL); + } + + return client; } } From 58ae09ebd4c9af901974d286468a38f792bb75ee Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 31 Aug 2015 11:32:18 +0200 Subject: [PATCH 19/66] saving Project for pulling. --- .../arcade/game/games/event/EventGame.java | 131 +++++++++++++++++- .../arcade/game/games/event/EventModule.java | 60 ++++---- 2 files changed, 159 insertions(+), 32 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 05d1c8508..681dd16c4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -1,9 +1,12 @@ package nautilus.game.arcade.game.games.event; +import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; @@ -11,7 +14,9 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseBat; import mineplex.core.disguise.disguises.DisguiseChicken; @@ -26,21 +31,28 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.visibility.VisibilityManager; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.event.kits.KitPlayer; +import nautilus.game.arcade.game.games.skywars.TeamSkywars.TeamColors; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.GameHostManager; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Effect; import org.bukkit.GameMode; +import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.BlockFace; +import org.bukkit.block.Sign; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockRedstoneEvent; +import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.EntityDeathEvent; @@ -65,6 +77,8 @@ public class EventGame extends Game private boolean _allowAllGadgets = false; private HashSet _gadgetWhitelist = new HashSet(); + + private HashMap _functionSigns; public EventGame(ArcadeManager manager) { @@ -110,9 +124,45 @@ public class EventGame extends Game this.GameTimeout = -1; _mps = manager.GetGameHostManager(); + _functionSigns = new HashMap<>(); this.CreatureAllow = true; } + + @EventHandler + public void registerSigns(GameStateChangeEvent event) + { + if(event.GetState() != GameState.Live) + return; + + for(Location loc : WorldData.GetDataLocs("RED")) + { + for(int i = -5; i < 5; i++) + { + Location temp = loc.clone().add(0, i, 0); + if(temp.getBlock().getType() == Material.SIGN_POST || temp.getBlock().getType() == Material.WALL_SIGN) + { + if(!_functionSigns.containsKey((Sign) temp.getBlock().getState())) + { + _functionSigns.put((Sign) temp.getBlock().getState(), System.currentTimeMillis()); + } + } + } + } + } + + @EventHandler + public void signPlace(SignChangeEvent event) + { + if(!IsLive()) + return; + + if(!Manager.GetGameHostManager().isAdmin(event.getPlayer(), true)) + return; + + if(event.getLine(0).startsWith("[") && event.getLine(0).endsWith("]")) + _functionSigns.put((Sign) event.getBlock().getState(), System.currentTimeMillis()); + } //Before GamePlayerManager puts onto Spec! @EventHandler(priority = EventPriority.LOW) @@ -464,4 +514,81 @@ public class EventGame extends Game return losers; } + @EventHandler + public void signCheck(BlockRedstoneEvent event) + { + if(event.getBlock().getType() != Material.SIGN_POST && event.getBlock().getType() != Material.WALL_SIGN) + return; + + useSign(((Sign) event.getBlock().getState()).getLines()); + } + + @EventHandler + public void signClock(UpdateEvent event) + { + if(event.getType() != UpdateType.SEC) + return; + + for(Sign sign : _functionSigns.keySet()) + { + if(sign.getBlock().getRelative(BlockFace.DOWN).getType() != Material.IRON_BLOCK) + continue; + + Sign cooldown = null; + + for(BlockFace face : BlockFace.values()) + { + if(face == BlockFace.UP) + continue; + + if(sign.getBlock().getRelative(BlockFace.DOWN).getRelative(face).getType() == Material.WALL_SIGN) + { + cooldown = (Sign) sign.getBlock().getRelative(BlockFace.DOWN).getRelative(face).getState(); + break; + } + } + + if(cooldown == null) + continue; + + if(!UtilTime.elapsed(_functionSigns.get(sign), Long.parseLong(cooldown.getLine(0)) * 1000)) + continue; + + _functionSigns.put(sign, System.currentTimeMillis()); + useSign(sign.getLines()); + } + } + + public void useSign(String[] args) + { + String command = args[0]; + String playerName = args[1]; + + command.replace("[", "").replaceAll("]", ""); + if(command.contentEquals("BC")) + { + String message = args[1]; + for(int i = 2; i <= 3; i++) + message += " " + args[i]; + + String colored = ChatColor.translateAlternateColorCodes('&', message); + this.Announce(F.main("Event", colored), true); + } + + + Player player = Bukkit.getPlayer(playerName); + if(player == null) + return; + + String[] vars = new String[args.length - 1]; + vars[0] = args[0]; + vars[1] = args[2]; + vars[2] = args[3]; + + if(command.contentEquals("MOB")) + { + Manager.GetEventModule().commandMob(player, vars); + } + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 537e6589c..90d0c4f29 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -54,7 +54,7 @@ import org.bukkit.potion.PotionEffectType; public class EventModule extends MiniPlugin { - public ArcadeManager Manager; + private ArcadeManager Manager; private NautHashMap _potionEffectsDuration = new NautHashMap<>(); private NautHashMap _potionEffectsMult = new NautHashMap<>(); @@ -110,7 +110,7 @@ public class EventModule extends MiniPlugin event.setCancelled(true); } - private void commandHelp(Player player) + public void commandHelp(Player player) { UtilPlayer.message(player, F.main("Event", "Displaying Commands;")); @@ -151,7 +151,7 @@ public class EventModule extends MiniPlugin UtilPlayer.message(player, F.value("/e effect clear", "")); } - private void commandHelpSettings(Player player) + public void commandHelpSettings(Player player) { UtilPlayer.message(player, F.main("Event", "Displaying Settings Commands;")); UtilPlayer.message(player, F.value("/e damage all", "Toggles All Damage")); @@ -181,7 +181,7 @@ public class EventModule extends MiniPlugin //Command Handler @EventHandler(priority = EventPriority.LOWEST) - private void commandHandler(PlayerCommandPreprocessEvent event) + public void commandHandler(PlayerCommandPreprocessEvent event) { if (!Manager.GetGame().InProgress()) return; @@ -366,7 +366,7 @@ public class EventModule extends MiniPlugin } } - private void listSettings(Player player) + public void listSettings(Player player) { UtilPlayer.message(player, F.value("Damage All", F.tf(Manager.GetGame().Damage))); UtilPlayer.message(player, F.value("Damage PvP", F.tf(Manager.GetGame().DamagePvP))); @@ -389,28 +389,28 @@ public class EventModule extends MiniPlugin UtilPlayer.message(player, F.value("Mob griefing", F.tf(_mobGriefing))); } - private void commandBlockBreakInCreative(Player player, String[] args) + public void commandBlockBreakInCreative(Player player, String[] args) { Manager.GetGame().BlockBreakCreative = !Manager.GetGame().BlockBreakCreative; UtilPlayer.message(player, F.main("Settings", "BlockBreakCreative: " + F.tf(Manager.GetGame().BlockBreakCreative))); } - private void commandBlockPlaceInCreative(Player player, String[] args) + public void commandBlockPlaceInCreative(Player player, String[] args) { Manager.GetGame().BlockPlaceCreative = !Manager.GetGame().BlockPlaceCreative; UtilPlayer.message(player, F.main("Settings", "BlockPlaceCreative: " + F.tf(Manager.GetGame().BlockPlaceCreative))); } - private void commandMobGriefing(Player player, String[] args) + public void commandMobGriefing(Player player, String[] args) { _mobGriefing = !_mobGriefing; UtilPlayer.message(player, F.main("Settings", "Mob Griefing: " + F.tf(_mobGriefing))); } - private void commandBlockPlace(Player player, String[] args, boolean whitelist, String command) + public void commandBlockPlace(Player player, String[] args, boolean whitelist, String command) { try { @@ -471,7 +471,7 @@ public class EventModule extends MiniPlugin commandHelpSettings(player); } - private void commandBlockBreak(Player player, String[] args, boolean whitelist, String command) + public void commandBlockBreak(Player player, String[] args, boolean whitelist, String command) { try { @@ -532,7 +532,7 @@ public class EventModule extends MiniPlugin commandHelpSettings(player); } - private void commandHealth(Player player, String[] args) + public void commandHealth(Player player, String[] args) { try { @@ -563,7 +563,7 @@ public class EventModule extends MiniPlugin commandHelpSettings(player); } - private void commandHunger(Player player, String[] args) + public void commandHunger(Player player, String[] args) { try { @@ -594,7 +594,7 @@ public class EventModule extends MiniPlugin commandHelpSettings(player); } - private void commandTime(Player player, String[] args) + public void commandTime(Player player, String[] args) { try { @@ -626,7 +626,7 @@ public class EventModule extends MiniPlugin } //Teleport Command (To, Here, All) - private void commandTeleport(Player player, String[] args) + public void commandTeleport(Player player, String[] args) { if (args.length >= 3 && args[1].equalsIgnoreCase("here")) { @@ -668,7 +668,7 @@ public class EventModule extends MiniPlugin } //Gadget Commands (Global & Individual) - private void commandGadget(Player player, String[] args) + public void commandGadget(Player player, String[] args) { if(!(Manager.GetGame() instanceof EventGame)) { UtilPlayer.message(player, F.main("Inventory", "You can only enable/disable gadgets in the Event game!")); @@ -780,7 +780,7 @@ public class EventModule extends MiniPlugin } //Silence - private void commandSilence(Player player, String[] args) + public void commandSilence(Player player, String[] args) { try { @@ -813,7 +813,7 @@ public class EventModule extends MiniPlugin } //Gamemode (Self and Others) - private void commandAdmin(Player player, String[] args) + public void commandAdmin(Player player, String[] args) { Player target = player; @@ -835,7 +835,7 @@ public class EventModule extends MiniPlugin } //Gamemode (Self and Others) - private void commandGamemode(Player player, String[] args) + public void commandGamemode(Player player, String[] args) { Player target = player; @@ -857,7 +857,7 @@ public class EventModule extends MiniPlugin } //Forcefield - private void commandForcefieldRadius(Player player, String[] args) + public void commandForcefieldRadius(Player player, String[] args) { if(!(Manager.GetGame() instanceof EventGame)) { @@ -889,7 +889,7 @@ public class EventModule extends MiniPlugin } //Give - private void commandGive(Player player, String[] args) + public void commandGive(Player player, String[] args) { String[] newArgs = new String[args.length-1]; @@ -900,7 +900,7 @@ public class EventModule extends MiniPlugin } //Spec - private void commandSpectators(Player player, String[] args) + public void commandSpectators(Player player, String[] args) { Manager.GetGame().JoinInProgress = !Manager.GetGame().JoinInProgress; @@ -908,7 +908,7 @@ public class EventModule extends MiniPlugin } //Deathout - private void commandDeathout(Player player, String[] args) + public void commandDeathout(Player player, String[] args) { Manager.GetGame().DeathOut = !Manager.GetGame().DeathOut; @@ -916,7 +916,7 @@ public class EventModule extends MiniPlugin } //QuitOut - private void commandQuitOut(Player player, String[] args) + public void commandQuitOut(Player player, String[] args) { Manager.GetGame().QuitOut = !Manager.GetGame().QuitOut; @@ -924,7 +924,7 @@ public class EventModule extends MiniPlugin } //Double Jump - private void commandDoubleJump(Player player, String[] args) + public void commandDoubleJump(Player player, String[] args) { if(!(Manager.GetGame() instanceof EventGame)) { @@ -942,7 +942,7 @@ public class EventModule extends MiniPlugin } //Scoreboard - private void commandScoreboard(Player player, String[] args) + public void commandScoreboard(Player player, String[] args) { if(!(Manager.GetGame() instanceof EventGame)) { @@ -1016,7 +1016,7 @@ public class EventModule extends MiniPlugin } //Whitelist - private void commandWhitelist(Player player, String[] args) + public void commandWhitelist(Player player, String[] args) { //On and Off if (args.length >= 2) @@ -1056,7 +1056,7 @@ public class EventModule extends MiniPlugin } //Mob - private void commandMob(Player caller, String[] args) + public void commandMob(Player caller, String[] args) { if (args.length == 1) { @@ -1444,7 +1444,7 @@ public class EventModule extends MiniPlugin } } - private void commandMobKill(Player caller, String[] args) + public void commandMobKill(Player caller, String[] args) { if (args.length < 3) { @@ -1490,7 +1490,7 @@ public class EventModule extends MiniPlugin UtilPlayer.message(caller, F.main("Creature", "Killed " + target + ". " + count + " Removed.")); } - private void commandKit(Player caller, String[] args) + public void commandKit(Player caller, String[] args) { if(!(Manager.GetGame() instanceof EventGame)) { @@ -1533,7 +1533,7 @@ public class EventModule extends MiniPlugin commandHelp(caller); } - private void commandEffect(Player caller, String[] args) + public void commandEffect(Player caller, String[] args) { //Clear if (args.length >= 3 && args[2].equalsIgnoreCase("clear")) From b63843930f4d5394ff5312c22931114c6c450faf Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Mon, 31 Aug 2015 15:08:42 -0400 Subject: [PATCH 20/66] Fixed bug https://trello.com/c/ZYS3Ddxw/134-hub-emerald-twirl-particles-are-called-green-ring-in-the-gui --- .../src/mineplex/core/gadget/gadgets/ParticleGreen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java index 9a370fad1..0489005a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java @@ -21,7 +21,7 @@ public class ParticleGreen extends ParticleGadget public ParticleGreen(GadgetManager manager) { - super(manager, "Green Ring", new String[] + super(manager, "Emerald Twirl", new String[] { C.cWhite + "With these sparkles, you", C.cWhite + "can now sparkle while you", From 32a257fa55ce97d9b9f98fceb70fc78a0dafb05f Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Mon, 31 Aug 2015 15:11:57 -0400 Subject: [PATCH 21/66] Fix bug https://trello.com/c/Jf7bht6V/138-general-tp-before-game-starts --- .../src/nautilus/game/arcade/managers/GameFlagManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 97ebf6af2..34c55e670 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -947,7 +947,7 @@ public class GameFlagManager implements Listener Game game = Manager.GetGame(); if (game == null) return; - if (!game.IsLive()) + if (!(game.IsLive() || game.GetState() == GameState.Prepare)) return; if (!game.TeleportsDisqualify) From 24fed013ae9920a84e6a899ea144ec9998169d9b Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Mon, 31 Aug 2015 15:39:04 -0400 Subject: [PATCH 22/66] Fixed previous ownership not being transferred --- .../src/mineplex/core/gadget/gadgets/ParticleGreen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java index 0489005a2..9a370fad1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleGreen.java @@ -21,7 +21,7 @@ public class ParticleGreen extends ParticleGadget public ParticleGreen(GadgetManager manager) { - super(manager, "Emerald Twirl", new String[] + super(manager, "Green Ring", new String[] { C.cWhite + "With these sparkles, you", C.cWhite + "can now sparkle while you", From 5322e9d018189c9ea1ac7315c27f1379086b39b2 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Mon, 31 Aug 2015 15:48:25 -0400 Subject: [PATCH 23/66] Marked the Bunny Morph to reflect its no longer available status --- .../src/mineplex/core/gadget/gadgets/MorphBunny.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBunny.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBunny.java index 7d84e2457..78e502bc5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBunny.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBunny.java @@ -59,8 +59,7 @@ public class MorphBunny extends MorphGadget " ", C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" , " ", - C.cPurple + "Special Limited Time Morph", - C.cPurple + "Purchase at www.mineplex.com/shop", + C.cPurple + "No longer available", }, -1, Material.MONSTER_EGG, (byte)98); From cbb0d4521cb4d12dafca9a4cae901bb3838e5182 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Mon, 31 Aug 2015 15:49:31 -0400 Subject: [PATCH 24/66] Made Legend cosmetics follow the same rules as all other premium rank cosmetics, as many staff were previously legend and lacked access to features they had paid for. --- .../src/mineplex/core/gadget/gadgets/MorphWither.java | 5 +---- Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java index da9d82ebd..7bd891dcb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java @@ -177,10 +177,7 @@ public class MorphWither extends MorphGadget @EventHandler public void legendOwner(PlayerJoinEvent event) { - if (Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.LEGEND || - Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.ADMIN || - Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.DEVELOPER || - Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.OWNER) + if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.LEGEND)) { Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index a95bcb150..0e70a0a22 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -146,7 +146,7 @@ public class PetManager extends MiniClientPlugin { Player p = event.getPlayer(); Rank rank = _clientManager.Get(p).GetRank(); - if (rank == Rank.LEGEND || rank == Rank.ADMIN || rank == Rank.DEVELOPER || rank == Rank.OWNER) + if (rank.has(Rank.LEGEND)) { _donationManager.Get(p.getName()).AddUnknownSalesPackagesOwned("Widder"); } From fe4586852c7537adb4fb5cf1ca7da3c460c4f2e9 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Mon, 31 Aug 2015 15:59:53 -0400 Subject: [PATCH 25/66] Made rank unlock lore colored based on rank required for item (QA Requested) --- .../src/mineplex/core/cosmetic/ui/page/PetPage.java | 2 +- .../src/mineplex/core/gadget/gadgets/MorphPig.java | 2 +- .../src/mineplex/core/gadget/gadgets/MorphWither.java | 2 +- .../src/mineplex/core/gadget/gadgets/ParticleLegend.java | 2 +- 4 files changed, 4 insertions(+), 4 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 47d45cfa3..c9a544b93 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 @@ -75,7 +75,7 @@ public class PetPage extends ShopPageBase if (pet.GetPetType() == EntityType.WITHER) { itemLore.add(C.cBlack); - itemLore.add(ChatColor.RESET + C.cYellow + "Unlocked with Legend Rank"); + itemLore.add(ChatColor.RESET + C.cGreen + "Unlocked with Legend Rank"); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java index f132e9e7a..44662f5a1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java @@ -38,7 +38,7 @@ public class MorphPig extends MorphGadget C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Oink", C.cYellow + "Collide" + C.cGray + " to use " + C.cGreen + "Pig Bounce", " ", - C.cPurple + "Unlocked with Ultra Rank", + C.cAqua + "Unlocked with Ultra Rank", }, -1, Material.PORK, (byte)0); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java index 7bd891dcb..d7e4ba8dc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java @@ -47,7 +47,7 @@ public class MorphWither extends MorphGadget " ", C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Wither Skull", " ", - C.cPurple + "Unlocked with Legend Rank", + C.cGreen + "Unlocked with Legend Rank", }, -1, Material.SKULL_ITEM, (byte)1); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java index 094c1ff39..7be1a9609 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleLegend.java @@ -22,7 +22,7 @@ public class ParticleLegend extends ParticleGadget C.cWhite + "These mystic particle attach to", C.cWhite + "only the most legendary of players!", " ", - C.cPurple + "Unlocked with Legend Rank", + C.cGreen + "Unlocked with Legend Rank", }, -2, Material.ENDER_PORTAL, (byte)0); From 8a94602aefc1e4ea3490da434f14205f99ba1d8e Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Mon, 31 Aug 2015 16:03:27 -0400 Subject: [PATCH 26/66] Fixed bug https://trello.com/c/KBhgw0zK/115-hg-mismatching-achievement-text --- .../src/mineplex/core/achievement/Achievement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index ab821003d..01925be94 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -56,7 +56,7 @@ public enum Achievement //Survival Games SURVIVAL_GAMES_WINS("Katniss Everdeen", 600, new String[]{"Survival Games.Wins"}, - new String[]{"Win 20 games of Survival Games"}, + new String[]{"Win 30 games of Survival Games"}, new int[]{30}, AchievementCategory.SURVIVAL_GAMES), From 890c9d59e1f6760610573440fdbff815c4dc1b70 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Thu, 3 Sep 2015 09:38:02 -0700 Subject: [PATCH 27/66] Fixed loading window bug. Added default rank for CoreClient in case of bugged login. --- .../Mineplex.Core/src/mineplex/core/account/CoreClient.java | 3 +++ .../src/mineplex/core/account/CoreClientManager.java | 3 +-- .../src/mineplex/core/gui/pages/LoadingWindow.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java index 9d1c4c3b0..156f18867 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java @@ -61,6 +61,9 @@ public class CoreClient public Rank GetRank() { + if (_rank == null) + _rank = Rank.ALL; + return _rank; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index efb8646a9..9fbd04fc0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -125,7 +125,6 @@ public class CoreClientManager extends MiniPlugin if (client == null) { client = new CoreClient(name); - client.SetRank(Rank.ALL); } return client; @@ -305,7 +304,7 @@ public class CoreClientManager extends MiniPlugin TimingManager.stop(client.GetPlayerName() + " GetClient."); token = gson.fromJson(response, ClientToken.class); - + client.SetRank(Rank.valueOf(token.Rank)); // _repository.updateMysqlRank(uuid.toString(), token.Rank, token.RankPerm, new Timestamp(Date.parse(token.RankExpire)).toString()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gui/pages/LoadingWindow.java b/Plugins/Mineplex.Core/src/mineplex/core/gui/pages/LoadingWindow.java index 6398b4e6b..3546d17cc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gui/pages/LoadingWindow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gui/pages/LoadingWindow.java @@ -151,7 +151,7 @@ public class LoadingWindow implements Runnable, Listener { { Player player = Bukkit.getPlayer(_playersUUID); - if (player == null || _inv == null ? !player.getOpenInventory().equals(_currentInventory) : (_inv != null && !player.getOpenInventory().getTopInventory().equals(_inv))) { + if (player == null || player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null || _inv == null ? !player.getOpenInventory().equals(_currentInventory) : (_inv != null && !player.getOpenInventory().getTopInventory().equals(_inv))) { end(); return; } From 921292a5c67fd70165f9527551f4f265d7c2f378 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Thu, 3 Sep 2015 09:38:26 -0700 Subject: [PATCH 28/66] Added timings capture and server log copy on server kill inside server monitor. --- .../mineplex/servermonitor/ServerMonitor.java | 154 +++++++++++++++--- 1 file changed, 133 insertions(+), 21 deletions(-) diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java index 511f30d41..ca9557402 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java @@ -16,6 +16,8 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Timer; +import java.util.TimerTask; import java.util.logging.FileHandler; import java.util.logging.Logger; @@ -42,10 +44,12 @@ public class ServerMonitor private static Map _serverGroupMap = null; private static List _dedicatedServers = null; private static HashSet _deadServers = new HashSet(); + private static HashSet _delayedKill = new HashSet(); private static HashSet _laggyServers = new HashSet(); private static SimpleDateFormat _dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); private static Logger _logger = Logger.getLogger("ServerMonitor"); + private static Timer _timer = new Timer(); private static int _totalPlayers = 0; private static Region _region; @@ -124,12 +128,15 @@ public class ServerMonitor for (MinecraftServer minecraftServer : _serverStatuses) { - if (minecraftServer.getMotd().contains("Finished") || (minecraftServer.getGroup().equalsIgnoreCase("UltraHardcore") && minecraftServer.getMotd().contains("Restarting") && minecraftServer.getPlayerCount() == 0)) + if (!ignoreServer(minecraftServer.getGroup())) { - killServer(minecraftServer.getName(), minecraftServer.getPublicAddress(), minecraftServer.getPlayerCount(), "[KILLED] [FINISHED] " + minecraftServer.getName() + ":" + minecraftServer.getPublicAddress(), true); - - handleUserServerGroup(_serverGroupMap.get(minecraftServer.getGroup())); - continue; + if (minecraftServer.getMotd().contains("Finished") || (minecraftServer.getGroup().equalsIgnoreCase("UltraHardcore") && minecraftServer.getMotd().contains("Restarting") && minecraftServer.getPlayerCount() == 0)) + { + killServer(minecraftServer.getName(), minecraftServer.getPublicAddress(), minecraftServer.getPlayerCount(), "[KILLED] [FINISHED] " + minecraftServer.getName() + ":" + minecraftServer.getPublicAddress(), true); + + handleUserServerGroup(_serverGroupMap.get(minecraftServer.getGroup())); + continue; + } } for (DedicatedServer server : _dedicatedServers) @@ -202,6 +209,9 @@ public class ServerMonitor for (ServerGroup groupStatus : _serverGroups) { + if (ignoreServer(groupStatus.getName())) + continue; + NautHashMap serverMap = new NautHashMap(); for (Iterator serverIterator = groupStatus.getServers().iterator(); serverIterator.hasNext();) @@ -226,17 +236,6 @@ public class ServerMonitor exception.printStackTrace(); } } - - /* - if (groupStatus.getHost() == null || groupStatus.getHost().isEmpty()) - { - if (groupStatus.getName().startsWith("0")) - { - int serverCount = groupStatus.getServers().size(); - log(groupStatus.getName() + " : " + groupStatus.getPlayerCount() + " players on " + serverCount + " servers " + String.format("%.2f", ((double)serverCount * (double)groupStatus.getRequiredCpu() / totalCPU)) + "% CPU," + String.format("%.2f", ((double)serverCount * (double)groupStatus.getRequiredRam() / totalRAM)) + "% RAM", false); - } - } - */ } HashSet onlineServers = new HashSet(); @@ -386,21 +385,35 @@ public class ServerMonitor deadServers.addAll(_deadServers); _deadServers.clear(); - for (MinecraftServer deadServer : _repository.getDeadServers()) + for (final MinecraftServer deadServer : _repository.getDeadServers()) { if (deadServer.getUptime() <= 10 || ignoreServer(deadServer.getGroup())) continue; if (_count == 0 || deadServers.contains(deadServer.getName())) { + copyServerLog(deadServer); killServer(deadServer.getName(), deadServer.getPublicAddress(), deadServer.getPlayerCount(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true); handleUserServerGroup(_serverGroupMap.get(deadServer.getGroup())); } - else - { - _deadServers.add(deadServer.getName()); - log("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress()); + else if (!_delayedKill.contains(deadServer.getName())) + { + startTimingReport(deadServer); + + _timer.schedule(new TimerTask() + { + public void run() + { + _deadServers.add(deadServer.getName()); + _delayedKill.remove(deadServer.getName()); + + stopTimingReport(deadServer); + log("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress()); + } + }, 20 * 1000); + + _delayedKill.add(deadServer.getName()); } } } @@ -653,6 +666,105 @@ public class ServerMonitor killServer(serverToKill.getName(), serverToKill.getPublicAddress(), serverToKill.getPlayerCount(), message, true); } + private static void startTimingReport(final MinecraftServer server) + { + if (_debug) + return; + + String cmd = "/home/mineplex/remoteStartTiming.sh"; + + ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, server.getPublicAddress(), server.getName() }); + pr.start(new GenericRunnable() + { + public void run(Boolean error) + { + if (error) + log("[TIMING START] Errored " + server.getName() + "(" + server.getPublicAddress() + ")"); + else + log("[TIMING START] Succeeded " + server.getName() + "(" + server.getPublicAddress() + ")"); + + } + }); + + try + { + pr.join(100); + } + catch (InterruptedException e1) + { + e1.printStackTrace(); + } + + if (!pr.isDone()) + _processes.add(pr); + } + + private static void stopTimingReport(final MinecraftServer server) + { + if (_debug) + return; + + String cmd = "/home/mineplex/remoteStopTiming.sh"; + + ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, server.getPublicAddress(), server.getName() }); + pr.start(new GenericRunnable() + { + public void run(Boolean error) + { + if (error) + log("[TIMING PASTE] Errored " + server.getName() + "(" + server.getPublicAddress() + ")"); + else + log("[TIMING PASTE] Succeeded " + server.getName() + "(" + server.getPublicAddress() + ")"); + + } + }); + + try + { + pr.join(100); + } + catch (InterruptedException e1) + { + e1.printStackTrace(); + } + + if (!pr.isDone()) + _processes.add(pr); + } + + private static void copyServerLog(final MinecraftServer server) + { + if (_debug) + return; + + String cmd = "/home/mineplex/easyRemoteCopyLog.sh"; + + ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, server.getPublicAddress(), server.getName() }); + pr.start(new GenericRunnable() + { + public void run(Boolean error) + { + if (error) + log("[COPY LOG] Errored " + server.getName() + "(" + server.getPublicAddress() + ")"); + else + log("[COPY LOG] Succeeded " + server.getName() + "(" + server.getPublicAddress() + ")"); + + } + }); + + try + { + pr.join(100); + } + catch (InterruptedException e1) + { + e1.printStackTrace(); + } + + if (!pr.isDone()) + _processes.add(pr); + } + private static void startServer(final DedicatedServer serverSpace, final ServerGroup serverGroup, final int serverNum, final boolean free) { if (_debug) From 106a7dab2e7b0ea2ec2d4a701dc3f3382a5e342f Mon Sep 17 00:00:00 2001 From: Cheese Date: Sat, 5 Sep 2015 09:48:06 +1000 Subject: [PATCH 29/66] removed ability for entities to change blcoks in hub --- .../src/mineplex/hub/modules/WorldManager.java | 8 ++++++++ Plugins/Mineplex.StaffServer/.classpath | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java index 5008cf505..8729a6e55 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.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Pig; import org.bukkit.entity.Player; +import org.bukkit.entity.Silverfish; import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.entity.Snowman; @@ -44,6 +45,7 @@ import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityTargetEvent; @@ -162,6 +164,12 @@ public class WorldManager extends MiniPlugin { event.setCancelled(true); } + + @EventHandler + public void BlockEntityChange(EntityChangeBlockEvent event) + { + event.setCancelled(true); + } @EventHandler(priority = EventPriority.LOWEST) public void Explosion(EntityExplodeEvent event) diff --git a/Plugins/Mineplex.StaffServer/.classpath b/Plugins/Mineplex.StaffServer/.classpath index e03947a20..acc97657a 100644 --- a/Plugins/Mineplex.StaffServer/.classpath +++ b/Plugins/Mineplex.StaffServer/.classpath @@ -11,6 +11,6 @@ - + From fc5ccd4a5ed0ff98f53c2505dd3383b7fd54a096 Mon Sep 17 00:00:00 2001 From: Cheese Date: Sat, 5 Sep 2015 10:04:54 +1000 Subject: [PATCH 30/66] fixed 'self scoring' in Soccer removed silverfish on wither pet despawn --- .../src/mineplex/core/pet/PetManager.java | 6 +++ .../mineplex/hub/modules/SoccerManager.java | 42 ++++++++++++------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index a95bcb150..0983baf8c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -228,8 +228,14 @@ public class PetManager extends MiniClientPlugin if (_activePetOwners.containsKey(player.getName())) { final Creature pet = _activePetOwners.get(player.getName()); + + //Wither Silverfish + if (pet.getPassenger() != null) + pet.getPassenger().remove(); + pet.remove(); + if (removeOwner) { _activePetOwners.remove(player.getName()); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java index ab3b37f02..1d55d9f03 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -83,8 +83,9 @@ public class SoccerManager extends MiniPlugin private Vector _ballVel; private long _ballDeadTime = -1; - private String _lastKicker = ""; - private Color _lastKick = null; + private String _lastRedKicker = ""; + private String _lastBlueKicker = ""; + private Color _lastKickColor = null; //Item Rebound protected Vector _vel; @@ -176,7 +177,7 @@ public class SoccerManager extends MiniPlugin if (_ball == null) return; - if (_lastKick == Color.AQUA) + if (_lastKickColor == Color.AQUA) { for (int i = 0 ; i < 3 ; i++) UtilParticle.PlayParticle(ParticleType.RED_DUST, _ball.getLocation().add(0.0, 0.5, 0.0), -1, 1, 1, 1, 0, @@ -213,13 +214,22 @@ public class SoccerManager extends MiniPlugin UtilAction.zeroVelocity(player); - _lastKick = getTeamColor(player); - if (_lastKick == null) - _lastKicker = player.getName(); - else if (_lastKick == Color.RED) - _lastKicker = C.cRed + player.getName(); - else if (_lastKick == Color.AQUA) - _lastKicker = C.cAqua + player.getName(); + _lastKickColor = getTeamColor(player); + if (_lastKickColor == Color.RED) + { + _lastRedKicker = C.cRed + player.getName(); + + if (_lastBlueKicker.length() == 0) + _lastBlueKicker = C.cRed + player.getName(); + } + + else if (_lastKickColor == Color.AQUA) + { + _lastBlueKicker = C.cAqua + player.getName(); + + if (_lastRedKicker.length() == 0) + _lastRedKicker = C.cRed + player.getName(); + } } } } @@ -239,14 +249,15 @@ public class SoccerManager extends MiniPlugin for (Player player : _active) UtilTextMiddle.display("Goal! (" + C.cRed + _redGoals + C.cWhite + " : " + C.cBlue + _blueGoals + C.cWhite + ")", - _lastKicker + C.cWhite + " scored for " + C.cAqua + "Blue Team", 0, 70, 20, player); + _lastBlueKicker + C.cWhite + " scored for " + C.cAqua + "Blue Team", 0, 70, 20, player); _ball.remove(); _ball = null; + + _lastRedKicker = ""; + _lastBlueKicker = ""; } - - return; } @@ -264,10 +275,13 @@ public class SoccerManager extends MiniPlugin for (Player player : _active) UtilTextMiddle.display("Goal! (" + C.cRed + _redGoals + C.cWhite + " : " + C.cBlue + _blueGoals + C.cWhite + ")", - _lastKicker + C.cWhite + " scored for " + C.cRed + "Red Team", 0, 70, 20, player); + _lastRedKicker + C.cWhite + " scored for " + C.cRed + "Red Team", 0, 70, 20, player); _ball.remove(); _ball = null; + + _lastRedKicker = ""; + _lastBlueKicker = ""; } return; From 0ac808ba43c88252c8751f7266d801c072ea0737 Mon Sep 17 00:00:00 2001 From: Cheese Date: Sat, 5 Sep 2015 10:30:11 +1000 Subject: [PATCH 31/66] stacker pref is now only for pvp stacking. --- .../core/preferences/ui/PreferencesPage.java | 2 +- .../src/mineplex/hub/HubManager.java | 2 +- .../mineplex/hub/modules/StackerManager.java | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java index 981f2c56b..8007a3aef 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/PreferencesPage.java @@ -243,7 +243,7 @@ public class PreferencesPage extends ShopPageBase return UtilTime.elapsed(_portalTime.get(player.getName()), 5000); } - public boolean CanBump(LivingEntity ent) + public boolean hasPlayerStackingEnabled(LivingEntity ent) { if (!(ent instanceof Player)) return true; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index ed43ae6d2..2f8a774d4 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -95,12 +95,6 @@ public class StackerManager extends MiniPlugin implements IThrown return; } - if (!Manager.CanBump(stacker)) - { - UtilPlayer.message(stacker, F.main("Stacker", "You are not playing stacker.")); - return; - } - if (stacker.getVehicle() != null || _tempStackShift.contains(stacker)) { UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack while stacked...")); @@ -123,9 +117,15 @@ public class StackerManager extends MiniPlugin implements IThrown if (stackee instanceof Player) { - if (!Manager.CanBump(((Player)stackee))) + if (!Manager.hasPlayerStackingEnabled(stacker)) { - UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker.")); + UtilPlayer.message(stacker, F.main("Stacker", "You have player stacking disabled.")); + return; + } + + if (!Manager.hasPlayerStackingEnabled(((Player)stackee))) + { + UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " has player stacking disabled.")); return; } @@ -242,7 +242,7 @@ public class StackerManager extends MiniPlugin implements IThrown if (target.getCustomName() != null || (target.getPassenger() != null && target.getPassenger() instanceof LivingEntity && ((LivingEntity)target.getPassenger()).getCustomName() != null)) return; - if (!Manager.CanBump(target)) + if (!Manager.hasPlayerStackingEnabled(target)) return; //Velocity From 2536d8a437e05716cf34343f5337d0c4911472c5 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Sat, 5 Sep 2015 01:40:56 -0700 Subject: [PATCH 32/66] Fixed out of range stats causing no stats to load. Issue fix to db for out of range stat on login. --- .../src/mineplex/core/stats/PlayerStats.java | 2 + .../src/mineplex/core/stats/StatsManager.java | 40 +++++++++++++----- .../mineplex/core/stats/StatsRepository.java | 42 +++++++++++++------ 3 files changed, 62 insertions(+), 22 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java index b5caa1745..9ceb59d83 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/PlayerStats.java @@ -10,6 +10,8 @@ public class PlayerStats public long addStat(String statName, long value) { + value = Math.max(0L, value); + if (!_statHash.containsKey(statName)) { _statHash.put(statName, 0L); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index addbfc4bd..7c8a2dd9b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -1,23 +1,16 @@ package mineplex.core.stats; -import java.lang.reflect.Field; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Iterator; -import net.minecraft.server.v1_7_R4.EntityHuman; -import net.minecraft.util.com.mojang.authlib.GameProfile; - -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniDbClientPlugin; -import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; -import mineplex.core.common.Rank; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilServer; import mineplex.core.stats.command.GiveStatCommand; @@ -60,6 +53,33 @@ public class StatsManager extends MiniDbClientPlugin } } + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event) + { + PlayerStats playerStats = Get(event.getPlayer()); + + final int accountId = getClientManager().getAccountId(event.getPlayer()); + + for (String statName : playerStats.getStatsNames()) + { + if (!_stats.containsKey(statName)) + continue; + + final int statId = _stats.get(statName); + + if (playerStats.getStat(statName) == -1) + { + runAsync(new Runnable() + { + public void run() + { + _repository.setStat(accountId, statId, 0); + } + }); + } + } + } + public void incrementStat(final Player player, final String statName, final long value) { if (value <= 0) @@ -73,7 +93,7 @@ public class StatsManager extends MiniDbClientPlugin // Verify stat is in our local cache, if not add it remotely. if (!_stats.containsKey(statName)) { - Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() + runAsync(new Runnable() { public void run() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java index 98543aad2..2b92728ff 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java @@ -26,9 +26,6 @@ import org.jooq.types.ULong; public class StatsRepository extends RepositoryBase { - private static String CREATE_STAT_TABLE = "CREATE TABLE IF NOT EXISTS stats (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX nameIndex (name));"; - private static String CREATE_STAT_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountStats (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, statId INT NOT NULL, value INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (statId) REFERENCES stats(id), UNIQUE INDEX accountStatIndex (accountId, statId));"; - private static String RETRIEVE_STATS = "SELECT id, name FROM stats;"; private static String INSERT_STAT = "INSERT INTO stats (name) VALUES (?);"; @@ -38,16 +35,10 @@ public class StatsRepository extends RepositoryBase } @Override - protected void initialize() - { - //executeUpdate(CREATE_STAT_TABLE); - //executeUpdate(CREATE_STAT_RELATION_TABLE); - } + protected void initialize() { } @Override - protected void update() - { - } + protected void update() { } public List retrieveStats() { @@ -165,9 +156,36 @@ public class StatsRepository extends RepositoryBase while (resultSet.next()) { - playerStats.addStat(resultSet.getString(1), resultSet.getLong(2)); + try + { + playerStats.addStat(resultSet.getString(1), resultSet.getLong(2)); + } + catch (Exception ex) + { + ex.printStackTrace(); + playerStats.addStat(resultSet.getString(1), -1); + } } return playerStats; } + + public void setStat(int accountId, int statId, long value) + { + try + { + DSLContext context = DSL.using(getConnectionPool(), SQLDialect.MYSQL); + + context + .update(Tables.accountStat) + .set(Tables.accountStat.value, ULong.valueOf(value)) + .where(Tables.accountStat.accountId.eq(accountId)) + .and(Tables.accountStat.statId.eq(statId)) + .execute(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } } From 4ad95b54cf08aadb56f66480bd61a373019c0576 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Sat, 5 Sep 2015 01:53:37 -0700 Subject: [PATCH 33/66] Updated ServerMonitor status reporting for network. --- .../StatusHistoryRepository.java | 85 ++++++------------- 1 file changed, 24 insertions(+), 61 deletions(-) diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java index e2f94098c..a85d42848 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/StatusHistoryRepository.java @@ -3,16 +3,19 @@ package mineplex.servermonitor; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; +import java.util.Iterator; import java.util.List; import mineplex.serverdata.Region; +import mineplex.serverdata.data.BungeeServer; +import mineplex.serverdata.data.DataRepository; import mineplex.serverdata.data.DedicatedServer; import mineplex.serverdata.data.ServerGroup; -import mineplex.servermonitor.data.BungeeStatusData; +import mineplex.serverdata.redis.RedisDataRepository; +import mineplex.serverdata.servers.ServerManager; public class StatusHistoryRepository { @@ -24,8 +27,6 @@ public class StatusHistoryRepository private static String CREATE_DEDICATED_TABLE = "CREATE TABLE IF NOT EXISTS DedicatedServerStats (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(100), address VARCHAR(25), updated LONG, cpu TINYINT, ram MEDIUMINT, usedCpuPercent DOUBLE(4,2), usedRamPercent DOUBLE(4,2), US BOOLEAN NOT NULL DEFAULT '1', PRIMARY KEY (id));"; private static String CREATE_BUNGEE_TABLE = "CREATE TABLE IF NOT EXISTS BungeeStats (id INT NOT NULL AUTO_INCREMENT, address VARCHAR(25), updated LONG, players INT, maxPlayers INT, alive BOOLEAN NOT NULL, online BOOLEAN NOT NULL, US BOOLEAN NOT NULL DEFAULT '1', PRIMARY KEY (id));"; private static String CREATE_NETWORKSTATS_TABLE = "CREATE TABLE IF NOT EXISTS NetworkStats (id INT NOT NULL AUTO_INCREMENT, updated LONG, players INT, totalNetworkCpuUsage DOUBLE(4,2), totalNetworkRamUsage DOUBLE(4,2), totalCpu MEDIUMINT, totalRam MEDIUMINT, US BOOLEAN NOT NULL DEFAULT '1', PRIMARY KEY (id));"; - - private static String RETRIEVE_BUNGEE_STATUSES = "SELECT bungeeStatus.address, bungeeStatus.players, bungeeStatus.maxPlayers, bungeeStatus.US, onlineStatus.online, now(), bungeeStatus.updated FROM BungeeServers AS bungeeStatus INNER JOIN bungeeOnlineStatus AS onlineStatus ON onlineStatus.address = bungeeStatus.address"; private static String INSERT_SERVERGROUP_STATS = "INSERT INTO ServerGroupStats (serverGroup, updated, players, maxPlayers, totalNetworkCpuUsage, totalNetworkRamUsage, totalCpu, totalRam, US) VALUES (?, now(), ?, ?, ?, ?, ?, ?, ?);"; private static String INSERT_DEDICATEDSERVER_STATS = "INSERT INTO DedicatedServerStats (serverName, address, updated, cpu, ram, usedCpuPercent, usedRamPercent, US) VALUES (?, ?, now(), ?, ?, ?, ?, ?);"; @@ -33,7 +34,8 @@ public class StatusHistoryRepository private static String INSERT_NETWORK_STATS = "INSERT INTO NetworkStats (updated, players, totalNetworkCpuUsage, totalNetworkRamUsage, totalCpu, totalRam, US) VALUES (now(), ?, ?, ?, ?, ?, ?);"; private static Connection _connection; - private static Connection _bungeeconnection; + + private static DataRepository _repository; public StatusHistoryRepository() { @@ -65,6 +67,9 @@ public class StatusHistoryRepository preparedStatement = _connection.prepareStatement(CREATE_NETWORKSTATS_TABLE); preparedStatement.execute(); preparedStatement.close(); + + _repository = new RedisDataRepository(ServerManager.getConnection(true, ServerManager.SERVER_STATUS_LABEL), ServerManager.getConnection(false, ServerManager.SERVER_STATUS_LABEL), + Region.ALL, BungeeServer.class, "bungeeServers"); } catch (Exception exception) { @@ -185,58 +190,16 @@ public class StatusHistoryRepository public void saveNetworkStats(double usedCpuPercent, double usedRamPercent, double availableCPU, double availableRAM, Region region) { - /* int totalPlayers = 0; - List bungeeStatuses = new ArrayList(); - PreparedStatement retrieveStatement = null; + List bungeeServers = new ArrayList(_repository.getElements()); - try + for (Iterator bungeeIterator = bungeeServers.iterator(); bungeeIterator.hasNext();) { - if (_bungeeconnection == null || _bungeeconnection.isClosed()) - _bungeeconnection = DriverManager.getConnection(_bungeeConnectionString, _userName, _password); + BungeeServer server = bungeeIterator.next(); - retrieveStatement = _bungeeconnection.prepareStatement(RETRIEVE_BUNGEE_STATUSES); - ResultSet resultSet = retrieveStatement.executeQuery(); - - while (resultSet.next()) - { - BungeeStatusData bungeeData = new BungeeStatusData(); - bungeeData.Address = resultSet.getString(1); - bungeeData.Players = resultSet.getInt(2); - bungeeData.MaxPlayers = resultSet.getInt(3); - bungeeData.US = resultSet.getBoolean(4); - bungeeData.Online = resultSet.getBoolean(5); - - long now = resultSet.getLong(6); - long updated = resultSet.getLong(7); - - bungeeData.Alive = (now - updated) <= 15; - - if (bungeeData.Alive && bungeeData.US == (region == Region.US)) - totalPlayers += bungeeData.Players; - - if (bungeeData.US == (region == Region.US)) - bungeeStatuses.add(bungeeData); - } - } - catch (Exception exception) - { - exception.printStackTrace(); - } - finally - { - if (retrieveStatement != null) - { - try - { - retrieveStatement.close(); - } - catch (SQLException e) - { - e.printStackTrace(); - } - } + if (server.getPublicAddress().equalsIgnoreCase("127.0.0.1") || server.getPublicAddress().equalsIgnoreCase("0.0.0.0")) + bungeeIterator.remove(); } PreparedStatement preparedStatement = null; @@ -248,15 +211,16 @@ public class StatusHistoryRepository preparedStatement = _connection.prepareStatement(INSERT_BUNGEE_STATS); - for (BungeeStatusData bungeeStatusData : bungeeStatuses) + for (BungeeServer bungeeStatusData : bungeeServers) { - preparedStatement.setString(1, bungeeStatusData.Address); - preparedStatement.setInt(2, bungeeStatusData.Players); - preparedStatement.setInt(3, bungeeStatusData.MaxPlayers); - preparedStatement.setBoolean(4, bungeeStatusData.Alive); - preparedStatement.setBoolean(5, bungeeStatusData.Online); - preparedStatement.setBoolean(6, bungeeStatusData.US); - preparedStatement.addBatch(); + totalPlayers += bungeeStatusData.getPlayerCount(); + preparedStatement.setString(1, bungeeStatusData.getPublicAddress()); + preparedStatement.setInt(2, bungeeStatusData.getPlayerCount()); + preparedStatement.setInt(3, bungeeStatusData.getPlayerCount()); + preparedStatement.setBoolean(4, true); + preparedStatement.setBoolean(5, true); + preparedStatement.setBoolean(6, bungeeStatusData.getRegion() == Region.US); + preparedStatement.addBatch(); } preparedStatement.executeBatch(); @@ -315,6 +279,5 @@ public class StatusHistoryRepository } } } - */ } } From 5712af8ddcaeac6c5c5090b7ce7c445418c754ac Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 5 Sep 2015 20:38:51 +0200 Subject: [PATCH 34/66] Adding Redstone function signs for events. --- .../arcade/game/games/event/EventGame.java | 316 ++++++++++++++++-- .../arcade/game/games/event/EventModule.java | 40 ++- 2 files changed, 327 insertions(+), 29 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 681dd16c4..6f74a2da3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import mineplex.core.common.util.F; @@ -23,6 +24,7 @@ import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.gadget.event.GadgetActivateEvent; +import mineplex.core.give.Give; import mineplex.core.mount.event.MountActivateEvent; import mineplex.core.recharge.Recharge; import mineplex.core.shop.item.SalesPackageBase; @@ -34,7 +36,6 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.event.kits.KitPlayer; -import nautilus.game.arcade.game.games.skywars.TeamSkywars.TeamColors; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.GameHostManager; @@ -51,6 +52,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.CreatureSpawnEvent; @@ -79,6 +81,7 @@ public class EventGame extends Game private HashSet _gadgetWhitelist = new HashSet(); private HashMap _functionSigns; + private ArrayList _powerdedSigns; public EventGame(ArcadeManager manager) { @@ -125,6 +128,7 @@ public class EventGame extends Game _mps = manager.GetGameHostManager(); _functionSigns = new HashMap<>(); + _powerdedSigns = new ArrayList<>(); this.CreatureAllow = true; } @@ -514,25 +518,23 @@ public class EventGame extends Game return losers; } - @EventHandler + /*@EventHandler public void signCheck(BlockRedstoneEvent event) { if(event.getBlock().getType() != Material.SIGN_POST && event.getBlock().getType() != Material.WALL_SIGN) - return; + return; useSign(((Sign) event.getBlock().getState()).getLines()); - } + }*/ @EventHandler public void signClock(UpdateEvent event) { - if(event.getType() != UpdateType.SEC) + if(event.getType() != UpdateType.TICK) return; for(Sign sign : _functionSigns.keySet()) { - if(sign.getBlock().getRelative(BlockFace.DOWN).getType() != Material.IRON_BLOCK) - continue; Sign cooldown = null; @@ -542,42 +544,243 @@ public class EventGame extends Game continue; if(sign.getBlock().getRelative(BlockFace.DOWN).getRelative(face).getType() == Material.WALL_SIGN) - { + { cooldown = (Sign) sign.getBlock().getRelative(BlockFace.DOWN).getRelative(face).getState(); break; } } if(cooldown == null) + { + if(!sign.getBlock().isBlockPowered()) + { + _powerdedSigns.remove(sign); + continue; + } + + if(_powerdedSigns.contains(sign)) + continue; + + useSign(sign, ((Sign) sign.getBlock().getState()).getLines()); + + if(sign.getBlock().isBlockPowered()) + { + if(!_powerdedSigns.contains(sign)) + { + _powerdedSigns.add(sign); + } + } + continue; + } + + if(!sign.getBlock().isBlockPowered() && !UtilTime.elapsed(_functionSigns.get(sign), Long.parseLong(cooldown.getLine(0)) * 1000)) continue; - if(!UtilTime.elapsed(_functionSigns.get(sign), Long.parseLong(cooldown.getLine(0)) * 1000)) + if(!sign.getBlock().isBlockPowered()) + { + _powerdedSigns.remove(sign); + } + + if(_powerdedSigns.contains(sign)) continue; _functionSigns.put(sign, System.currentTimeMillis()); - useSign(sign.getLines()); + useSign(sign, ((Sign) sign.getBlock().getState()).getLines()); + + if(sign.getBlock().isBlockPowered()) + { + if(!_powerdedSigns.contains(sign)) + { + _powerdedSigns.add(sign); + } + } } } - public void useSign(String[] args) + public void useSign(final Sign sign, String[] args) { String command = args[0]; String playerName = args[1]; - command.replace("[", "").replaceAll("]", ""); - if(command.contentEquals("BC")) + HashMap> varMap = new HashMap<>(); + + int i = 0; + for(String varArgs : args) + { + ArrayList players = new ArrayList<>(); + if(Bukkit.getPlayer(playerName) != null) + players.add(Bukkit.getPlayer(playerName)); + + if(playerName.contentEquals("@p")) + { + for(Player player : GetPlayers(true)) + { + boolean found = true; + for(Player otherPlayer : GetPlayers(true)) + { + if(UtilMath.offset(sign.getLocation(), player.getLocation()) >= UtilMath.offset(sign.getLocation(), otherPlayer.getLocation())) + { + found = false; + break; + } + } + if(found = true) + { + players.add(player); + break; + } + } + } + if(playerName.contains("@a")) + { + int radius = 0; + if(playerName.contains("r=")) + { + try + { + radius = Integer.parseInt(playerName.split("=")[1]); + } + catch (Exception e) {} + } + for(Player player : GetPlayers(true)) + { + if(UtilMath.offset(sign.getLocation(), player.getLocation()) <= radius || radius <= 0) + players.add(player); + } + } + + varMap.put(i, players); + i++; + } + + if(command.contentEquals("[BC]")) { String message = args[1]; - for(int i = 2; i <= 3; i++) - message += " " + args[i]; + for(int e = 2; e <= 3; e++) + message += " " + args[e]; String colored = ChatColor.translateAlternateColorCodes('&', message); this.Announce(F.main("Event", colored), true); } + if(command.contentEquals("[TELEPORT]")) + { + for(Player player : varMap.get(1)) + { + if(Bukkit.getPlayer(args[2]) != null) + { + player.teleport(Bukkit.getPlayer(args[2])); + } + else + { + String[] coords = args[2].split(" "); + int x = Integer.parseInt(coords[0]); + int y = Integer.parseInt(coords[1]); + int z = Integer.parseInt(coords[2]); + player.teleport(new Location(sign.getWorld(), x, y, z)); + } + } + } + + if(command.contentEquals("[MESSAGE]")) + { + String message = args[2]; + message += " " + args[3]; + + String colored = ChatColor.translateAlternateColorCodes('&', message); + + for(Player player : varMap.get(1)) + { + UtilPlayer.message(player, F.main("Event", colored)); + } + } + + if(command.contentEquals("[SETBLOCK]")) + { + Material mat = Material.getMaterial(args[1]); + String[] coords = args[2].split(" "); + int x = Integer.parseInt(coords[0]); + int y = Integer.parseInt(coords[1]); + int z = Integer.parseInt(coords[2]); + sign.getWorld().getBlockAt(new Location(sign.getWorld(), x, y, z)).setType(mat); + } + + if(command.contentEquals("[TESTFOR]")) + { + boolean redstone = false; + Material mat = Material.getMaterial(args[1]); + if(args[2].contains("r=")) + { + int radius = 0; + try + { + radius = Integer.parseInt(args[2].split("=")[1]); + if(radius >= 30) + radius = 30; + + for(int x = -radius + sign.getLocation().getBlockX(); x < radius + sign.getLocation().getBlockX(); x++) + { + for(int y = -radius + sign.getLocation().getBlockY(); y < radius + sign.getLocation().getBlockY(); y++) + { + for(int z = -radius + sign.getLocation().getBlockZ(); z < radius + sign.getLocation().getBlockZ(); z++) + { + if(sign.getWorld().getBlockAt(new Location(sign.getWorld(), x, y, z)).getType() == mat) + { + redstone = true; + } + } + } + } + } + catch (Exception e) {} + } + else + { + String[] coords = args[2].split(" "); + int x = Integer.parseInt(coords[0]); + int y = Integer.parseInt(coords[1]); + int z = Integer.parseInt(coords[2]); + if(sign.getWorld().getBlockAt(new Location(sign.getWorld(), x, y, z)).getType() == mat) + { + redstone = true; + } + } + if(redstone) + { + for(final BlockFace face : BlockFace.values()) + { + if(face != BlockFace.UP + && face != BlockFace.NORTH_WEST + && face != BlockFace.NORTH_EAST + && face != BlockFace.SOUTH_EAST + && face != BlockFace.SOUTH_WEST) + { + continue; + } + + if(sign.getBlock().getRelative(face).getType() != Material.AIR) + continue; + + if(sign.getBlock().getRelative(face).isBlockPowered()) + continue; + + sign.getBlock().getRelative(face).setType(Material.REDSTONE_BLOCK); + + Manager.runSyncLater(new Runnable() + { - Player player = Bukkit.getPlayer(playerName); - if(player == null) + @Override + public void run() + { + sign.getBlock().getRelative(face).setType(Material.AIR); + } + + }, 3L); + } + } + } + + if(varMap.get(1).isEmpty()) return; String[] vars = new String[args.length - 1]; @@ -585,9 +788,84 @@ public class EventGame extends Game vars[1] = args[2]; vars[2] = args[3]; - if(command.contentEquals("MOB")) + String tempArgs = ""; + for(String str : vars) { - Manager.GetEventModule().commandMob(player, vars); + for(String string : str.split(" ")) + { + tempArgs += string + " "; + } + } + String[] commandArgs = tempArgs.split(" "); + + if(command.contentEquals("[MOB]")) + { + for(Player player : varMap.get(1)) + Manager.GetEventModule().commandMob(player, commandArgs); + } + if(command.contentEquals("[SCORE]")) + { + for(Player player : varMap.get(1)) + Manager.GetEventModule().commandScoreboard(player, vars); + } + if(command.contentEquals("[GIVE]")) + { + try + { + for(Player player : varMap.get(1)) + { + String[] newArgs = new String[commandArgs.length-1]; + + for (int e=0 ; e signIter = _functionSigns.keySet().iterator(); + while(signIter.hasNext()) + { + Sign sign = signIter.next(); + if(sign.getLocation().getBlockX() == event.getBlock().getLocation().getBlockX() + && sign.getLocation().getBlockY() == event.getBlock().getLocation().getBlockY() + && sign.getLocation().getBlockZ() == event.getBlock().getLocation().getBlockZ()) + { + signIter.remove(); + } + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 90d0c4f29..8880db1e7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -257,7 +257,7 @@ public class EventModule extends MiniPlugin } else if (args[0].equalsIgnoreCase("effect")) { - commandEffect(event.getPlayer(), args); + commandEffect(event.getPlayer(), args, null); } else if (args[0].equalsIgnoreCase("kit")) { @@ -987,7 +987,7 @@ public class EventModule extends MiniPlugin lineText += " "; } - ((EventGame) Manager.GetGame()).getSideText()[line] = lineText; + ((EventGame) Manager.GetGame()).getSideText()[line] = ChatColor.translateAlternateColorCodes('&', lineText); UtilPlayer.message(player, F.main("Scoreboard", "Set Line " + F.elem(line+"") + " to " + F.elem(lineText) + ".")); @@ -1533,7 +1533,7 @@ public class EventModule extends MiniPlugin commandHelp(caller); } - public void commandEffect(Player caller, String[] args) + public void commandEffect(Player caller, String[] args, ArrayList players) { //Clear if (args.length >= 3 && args[2].equalsIgnoreCase("clear")) @@ -1551,9 +1551,19 @@ public class EventModule extends MiniPlugin } else { - targets = UtilPlayer.matchOnline(caller, args[1], true); - if (targets.isEmpty()) - return; + if(players == null) + { + targets = UtilPlayer.matchOnline(caller, args[1], true); + if (targets.isEmpty()) + return; + } + else + { + targets = new LinkedList<>(); + for(Player player : players) + targets.add(player); + + } } for (Player player : targets) @@ -1647,10 +1657,20 @@ public class EventModule extends MiniPlugin _potionEffectsMult.put(type, mult); } else - { - targets = UtilPlayer.matchOnline(caller, args[1], true); - if (targets.isEmpty()) - return; + { + if(players == null) + { + targets = UtilPlayer.matchOnline(caller, args[1], true); + if (targets.isEmpty()) + return; + } + else + { + targets = new LinkedList<>(); + for(Player player : players) + targets.add(player); + + } } //Apply From 4240026024b8dbe1e4e0ca15df1f6b74403aa398 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 6 Sep 2015 18:55:00 +0200 Subject: [PATCH 35/66] Adding Areas and a few more commands like /e kick and /e tempgadget to the event game. --- .../arcade/game/games/event/EventGame.java | 178 ++++++++++++++++++ .../arcade/game/games/event/EventModule.java | 120 +++++++++++- 2 files changed, 293 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 6f74a2da3..2a979c53a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -31,11 +31,13 @@ import mineplex.core.shop.item.SalesPackageBase; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.visibility.VisibilityManager; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.event.kits.KitPlayer; +import nautilus.game.arcade.game.games.sheep.kits.KitBrute; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.managers.GameHostManager; @@ -57,8 +59,10 @@ import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.inventory.ItemStack; @@ -82,6 +86,8 @@ public class EventGame extends Game private HashMap _functionSigns; private ArrayList _powerdedSigns; + + private HashMap _customAreas; public EventGame(ArcadeManager manager) { @@ -131,6 +137,8 @@ public class EventGame extends Game _powerdedSigns = new ArrayList<>(); this.CreatureAllow = true; + + _customAreas = new HashMap<>(); } @EventHandler @@ -155,6 +163,35 @@ public class EventGame extends Game } } + @EventHandler + public void registerAreas(GameStateChangeEvent event) + { + if(event.GetState() != GameState.Live) + return; + + for(String name : WorldData.GetAllCustomLocs().keySet()) + { + try + { + EventArea area = new EventArea(Integer.parseInt(name.split(" ")[0])); + Location tempA = WorldData.GetAllCustomLocs().get(name).get(0); + Location tempB = WorldData.GetAllCustomLocs().get(name).get(1); + area.CornerA = new Location(tempA.getWorld(), Math.min(tempA.getX(), tempB.getX()), Math.min(tempA.getY(), tempB.getY()), Math.min(tempA.getZ(), tempB.getZ())); + area.CornerB = new Location(tempA.getWorld(), Math.max(tempA.getX(), tempB.getX()), Math.max(tempA.getY(), tempB.getY()), Math.max(tempA.getZ(), tempB.getZ())); + area.DamageAll = name.contains("ALL"); + area.DamagePvP = name.contains("PVP"); + area.DamagePvE = name.contains("PVE"); + area.DamageEvP = name.contains("EVP"); + area.Usable = true; + _customAreas.put(Integer.parseInt(name.split(" ")[0]), area); + } + catch (Exception e) + { + System.out.println("Error while parsing area locs"); + } + } + } + @EventHandler public void signPlace(SignChangeEvent event) { @@ -869,4 +906,145 @@ public class EventGame extends Game } } + @EventHandler(ignoreCancelled=true) + public void areaDamage(CustomDamageEvent event) + { + for(EventArea area : _customAreas.values()) + { + if(area.CornerA == null || area.CornerB == null) + continue; + + if(area.Usable == false) + continue; + + if(event.GetDamageeEntity().getLocation().getX() < area.CornerA.getX() || event.GetDamageeEntity().getLocation().getX() > area.CornerB.getX()) + continue; + + if(event.GetDamageeEntity().getLocation().getY() < area.CornerA.getY() || event.GetDamageeEntity().getLocation().getY() > area.CornerB.getY()) + continue; + + if(event.GetDamageeEntity().getLocation().getZ() < area.CornerA.getZ() || event.GetDamageeEntity().getLocation().getZ() > area.CornerB.getZ()) + continue; + + if(!area.DamageAll) + { + event.SetCancelled("Event Area"); + } + if(event.GetCause() == DamageCause.ENTITY_ATTACK && event.GetDamagerPlayer(true) == null) + { + if(!area.DamageEvP) + { + event.SetCancelled("Event Area"); + } + } + if(!(event.GetDamageeEntity() instanceof Player)) + { + if(!area.DamagePvE) + { + event.SetCancelled("Event Area"); + } + } + if((event.GetDamageeEntity() instanceof Player) && (event.GetDamagerEntity(true) instanceof Player)) + { + if(!area.DamagePvP) + { + event.SetCancelled("Event Area"); + } + } + } + } + + public void editArea(Player player, String[] args) + { + try + { + if(_customAreas.containsKey(Integer.parseInt(args[1]))) + { + if(args[2].equalsIgnoreCase("Del")) + { + _customAreas.remove(Integer.parseInt(args[1])); + UtilPlayer.message(player, F.main("Event", "Region deleted")); + } + if(args[2].equalsIgnoreCase("ALL")) + { + _customAreas.get(Integer.parseInt(args[1])).DamageAll = !_customAreas.get(Integer.parseInt(args[1])).DamageAll; + UtilPlayer.message(player, F.main("Event", "Damage all for Region " + args[1] + ": " + F.tf(_customAreas.get(Integer.parseInt(args[1])).DamageAll))); + } + if(args[2].equalsIgnoreCase("PVP")) + { + _customAreas.get(Integer.parseInt(args[1])).DamagePvP = !_customAreas.get(Integer.parseInt(args[1])).DamagePvP; + UtilPlayer.message(player, F.main("Event", "Damage PvP for Region " + args[1] + ": " + F.tf(_customAreas.get(Integer.parseInt(args[1])).DamagePvP))); + } + if(args[2].equalsIgnoreCase("PVE")) + { + _customAreas.get(Integer.parseInt(args[1])).DamagePvE = !_customAreas.get(Integer.parseInt(args[1])).DamagePvE; + UtilPlayer.message(player, F.main("Event", "Damage PvE for Region " + args[1] + ": " + F.tf(_customAreas.get(Integer.parseInt(args[1])).DamagePvE))); + } + if(args[2].equalsIgnoreCase("EVP")) + { + _customAreas.get(Integer.parseInt(args[1])).DamageEvP = !_customAreas.get(Integer.parseInt(args[1])).DamageEvP; + UtilPlayer.message(player, F.main("Event", "Damage EvP for Region " + args[1] + ": " + F.tf(_customAreas.get(Integer.parseInt(args[1])).DamageEvP))); + } + } + else + { + UtilPlayer.message(player, F.main("Event", "No Area Found")); + } + if(args[2].equalsIgnoreCase("Add")) + { + if(!_customAreas.containsKey(Integer.parseInt(args[1]))) + _customAreas.put(Integer.parseInt(args[1]), new EventArea(Integer.parseInt(args[1]))); + + EventArea area = _customAreas.get(Integer.parseInt(args[1])); + + if(args[3].equalsIgnoreCase("A")) + { + area.CornerA = player.getLocation(); + UtilPlayer.message(player, F.main("Event", "Corner A set!")); + } + if(args[3].equalsIgnoreCase("B")) + { + area.CornerB = player.getLocation(); + UtilPlayer.message(player, F.main("Event", "Corner B set!")); + } + if(area.CornerA != null && area.CornerB != null) + { + Location tempA = area.CornerA.clone(); + Location tempB = area.CornerB.clone(); + area.CornerA = new Location(tempA.getWorld(), Math.min(tempA.getX(), tempB.getX()), Math.min(tempA.getY(), tempB.getY()), Math.min(tempA.getZ(), tempB.getZ())); + area.CornerB = new Location(tempA.getWorld(), Math.max(tempA.getX(), tempB.getX()), Math.max(tempA.getY(), tempB.getY()), Math.max(tempA.getZ(), tempB.getZ())); + area.Usable = true; + UtilPlayer.message(player, F.main("Event", "Region is Usable")); + } + } + } + catch (Exception e) + { + UtilPlayer.message(player, F.main("Event", "Error while executing command")); + } + } + + public class EventArea + { + + public int ID; + + public Location CornerA; + public Location CornerB; + + public boolean DamageAll; + public boolean DamagePvP; + public boolean DamagePvE; + public boolean DamageEvP; + + public boolean Usable; + + public EventArea(Integer id) + { + ID = id; + Usable = false; + } + + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 8880db1e7..e7bb773de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -26,9 +26,12 @@ import nautilus.game.arcade.ArcadeManager; import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.Effect; import org.bukkit.GameMode; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.OfflinePlayer; +import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; import org.bukkit.entity.Ageable; @@ -36,16 +39,17 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.entity.Slime; import org.bukkit.entity.Villager; +import org.bukkit.entity.Villager.Profession; import org.bukkit.entity.Wolf; import org.bukkit.entity.Zombie; -import org.bukkit.entity.Skeleton.SkeletonType; -import org.bukkit.entity.Villager.Profession; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; @@ -59,12 +63,17 @@ public class EventModule extends MiniPlugin private NautHashMap _potionEffectsDuration = new NautHashMap<>(); private NautHashMap _potionEffectsMult = new NautHashMap<>(); - private boolean _mobGriefing = true; + private boolean _mobGriefing; + + private ArrayList _stacker; + private boolean _allowStacker; public EventModule(ArcadeManager manager, JavaPlugin plugin) { super("EventModule", plugin); Manager = manager; + _mobGriefing = true; + _stacker = new ArrayList<>(); } @EventHandler @@ -356,14 +365,50 @@ public class EventModule extends MiniPlugin { commandBlockPlaceInCreative(event.getPlayer(), args); } - else if(args[0].equalsIgnoreCase("blockbreakcreative")) + else if(args[0].equalsIgnoreCase("stacker")) { - commandBlockBreakInCreative(event.getPlayer(), args); + commandStacker(event.getPlayer(), args); + } + else if(args[0].equalsIgnoreCase("area")) + { + if(!(Manager.GetGame() instanceof EventGame)) { + UtilPlayer.message(event.getPlayer(), F.main("Settings", "You can only edit areas in the Event game!")); + return; + } + + ((EventGame) Manager.GetGame()).editArea(event.getPlayer(), args); } else if(args[0].equalsIgnoreCase("mobgriefing")) { commandMobGriefing(event.getPlayer(), args); } + else if(args[0].equalsIgnoreCase("kick")) + { + if(Bukkit.getPlayer(args[1]) == null) + { + UtilPlayer.message(event.getPlayer(), "No matches for: " + C.cYellow + args[1]); + return; + } + Bukkit.getPlayer(args[1]).kickPlayer("You where kicked from the event, probably you didn't stick to the Event Rules."); + UtilPlayer.message(event.getPlayer(), F.main("Event", "You kicked " + C.cYellow + Bukkit.getPlayer(args[1]).getName())); + } + else if(args[0].equalsIgnoreCase("tempgadget")) + { + String gadget = args[1]; + for(int e = 2; e < args.length; e++) + gadget+= " " + args[e]; + + try + { + for(Player target : UtilServer.getPlayers()) + Manager.GetDonation().Get(target).AddUnknownSalesPackagesOwned(gadget); + } + catch (Exception e) + { + UtilPlayer.message(event.getPlayer(), F.main("Event", "Gadget is not vallid")); + } + UtilPlayer.message(event.getPlayer(), F.main("Event", "You gave the gadget " + F.item(gadget) + " to all Players!")); + } } public void listSettings(Player player) @@ -396,6 +441,33 @@ public class EventModule extends MiniPlugin UtilPlayer.message(player, F.main("Settings", "BlockBreakCreative: " + F.tf(Manager.GetGame().BlockBreakCreative))); } + public void commandStacker(Player player, String[] args) + { + if(args.length == 1) + { + _allowStacker = !_allowStacker; + UtilPlayer.message(player, F.main("Settings", "Stacker all: " + F.tf(_allowStacker))); + } + else + { + for(Player target : UtilPlayer.matchOnline(player, args[1], true)) + { + if(_stacker.contains(target)) + { + _stacker.remove(target); + UtilPlayer.message(target, F.main("Settings", "Stacker: " + F.tf(false))); + UtilPlayer.message(player, F.main("Settings", "Stacker " + target.getName() + ": " + F.tf(false))); + } + else + { + _stacker.add(target); + UtilPlayer.message(target, F.main("Settings", "Stacker: " + F.tf(true))); + UtilPlayer.message(player, F.main("Settings", "Stacker " + target.getName() + ": " + F.tf(true))); + } + } + } + } + public void commandBlockPlaceInCreative(Player player, String[] args) { Manager.GetGame().BlockPlaceCreative = !Manager.GetGame().BlockPlaceCreative; @@ -1706,4 +1778,42 @@ public class EventModule extends MiniPlugin } } + @EventHandler + public void StackPlayer(PlayerInteractEntityEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!(event.getRightClicked() instanceof Player)) + return; + + if (event.getRightClicked().getVehicle() != null) + return; + + Player player = event.getPlayer(); + Player other = (Player)event.getRightClicked(); + + if(!_allowStacker && !_stacker.contains(player)) + return; + + if (Manager.isSpectator(event.getPlayer())) + return; + + if (!Manager.GetGame().IsAlive(event.getPlayer())) + return; + + //Effect + event.getRightClicked().getWorld().playEffect(event.getRightClicked().getLocation(), Effect.STEP_SOUND, 35); + + //Stack + player.setPassenger(other); + + //Audio + player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f); + + //Inform + UtilPlayer.message(other, F.main("Event", F.elem(Manager.GetGame().GetTeam(player).GetColor() + player.getName()) + " picked you up.")); + UtilPlayer.message(player, F.main("Event", "You picked up " + F.elem(Manager.GetGame().GetTeam(other).GetColor() + other.getName()) + ".")); + } + } From a4cc70c3f031850f448908b81cebce996719410d Mon Sep 17 00:00:00 2001 From: Cheese Date: Thu, 10 Sep 2015 13:17:11 +1000 Subject: [PATCH 36/66] new small youtuber rank --- .../src/mineplex/core/common/Rank.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index 8eba27eb1..ede01d37b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -8,6 +8,7 @@ import mineplex.core.common.util.UtilPlayer; public enum Rank { + //Staff LT("LT", ChatColor.DARK_RED), OWNER("Owner", ChatColor.DARK_RED), DEVELOPER("Dev", ChatColor.RED), @@ -21,11 +22,13 @@ public enum Rank MEDIA("Media", ChatColor.BLUE), EVENT("Event", ChatColor.WHITE), - - //Staff ^^ - + + //MEdia YOUTUBE("YouTube", ChatColor.RED), + YOUTUBE_SMALL("YouTube", ChatColor.DARK_PURPLE), TWITCH("Twitch", ChatColor.DARK_PURPLE), + + //Player LEGEND("Legend", ChatColor.GREEN, true), HERO("Hero", ChatColor.LIGHT_PURPLE, true), ULTRA("Ultra", ChatColor.AQUA, true), From b56813deefbfef323b39328c8dd53c259409fdaa Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 12 Sep 2015 04:33:10 +0200 Subject: [PATCH 37/66] Improving /e commands (/e kick, /e area, etc) --- .../arcade/game/games/event/EventGame.java | 50 +++++-- .../arcade/game/games/event/EventModule.java | 132 ++++++++++++++++-- 2 files changed, 165 insertions(+), 17 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 2a979c53a..a96234726 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -13,6 +13,7 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; @@ -62,6 +63,7 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; @@ -851,13 +853,7 @@ public class EventGame extends Game { for(Player player : varMap.get(1)) { - String[] newArgs = new String[commandArgs.length-1]; - - for (int e=0 ; e area.CornerB.getX()) continue; @@ -929,12 +936,14 @@ public class EventGame extends Game if(!area.DamageAll) { event.SetCancelled("Event Area"); + continue; } if(event.GetCause() == DamageCause.ENTITY_ATTACK && event.GetDamagerPlayer(true) == null) { if(!area.DamageEvP) { event.SetCancelled("Event Area"); + continue; } } if(!(event.GetDamageeEntity() instanceof Player)) @@ -942,6 +951,7 @@ public class EventGame extends Game if(!area.DamagePvE) { event.SetCancelled("Event Area"); + continue; } } if((event.GetDamageeEntity() instanceof Player) && (event.GetDamagerEntity(true) instanceof Player)) @@ -949,8 +959,17 @@ public class EventGame extends Game if(!area.DamagePvP) { event.SetCancelled("Event Area"); + continue; } } + if(!Manager.GetGame().DamagePvP) + { + Manager.GetGame().Damage = true; + Manager.GetGame().DamagePvP = true; + Bukkit.getPluginManager().callEvent(event); + Manager.GetGame().DamagePvP = false; + Manager.GetGame().Damage = false; + } } } @@ -1024,6 +1043,21 @@ public class EventGame extends Game } } + @EventHandler + public void preventChestDrop(PlayerDropItemEvent event) + { + if(event.getItemDrop() == null) + return; + + if(event.getItemDrop().getItemStack().getType() != Material.CHEST) + return; + + if(!event.getItemDrop().getItemStack().hasItemMeta()) + return; + + event.setCancelled(true); + } + public class EventArea { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index e7bb773de..82315cc58 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -12,16 +12,22 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilSystem; import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.creature.event.CreatureKillEntitiesEvent; +import mineplex.core.event.StackerEvent; +import mineplex.core.gadget.gadgets.MorphBlock; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.give.Give; import mineplex.core.mount.Mount; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import org.bukkit.Bukkit; @@ -50,6 +56,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; @@ -65,7 +72,10 @@ public class EventModule extends MiniPlugin private boolean _mobGriefing; + private HashSet _tempStackShift = new HashSet(); + private ArrayList _stacker; + private ArrayList _damage; private boolean _allowStacker; public EventModule(ArcadeManager manager, JavaPlugin plugin) @@ -74,6 +84,7 @@ public class EventModule extends MiniPlugin Manager = manager; _mobGriefing = true; _stacker = new ArrayList<>(); + _damage = new ArrayList<>(); } @EventHandler @@ -369,6 +380,29 @@ public class EventModule extends MiniPlugin { commandStacker(event.getPlayer(), args); } + else if(args[0].equalsIgnoreCase("playerdamage")) + { + if(args[1] == null) + { + UtilPlayer.message(event.getPlayer(), F.main("Event", "Insufficient arguments!")); + return; + } + + if(Bukkit.getPlayer(args[1]) == null) + { + UtilPlayer.message(event.getPlayer(), F.main("Event", "This Player is not online!")); + return; + } + + if(_damage.contains(Bukkit.getPlayer(args[1]))) + _damage.remove(Bukkit.getPlayer(args[1])); + else + _damage.add(Bukkit.getPlayer(args[1])); + } + else if(args[0].equalsIgnoreCase("bc")) + { + commandBC(event.getPlayer(), args); + } else if(args[0].equalsIgnoreCase("area")) { if(!(Manager.GetGame() instanceof EventGame)) { @@ -389,8 +423,9 @@ public class EventModule extends MiniPlugin UtilPlayer.message(event.getPlayer(), "No matches for: " + C.cYellow + args[1]); return; } - Bukkit.getPlayer(args[1]).kickPlayer("You where kicked from the event, probably you didn't stick to the Event Rules."); - UtilPlayer.message(event.getPlayer(), F.main("Event", "You kicked " + C.cYellow + Bukkit.getPlayer(args[1]).getName())); + //Bukkit.getPlayer(args[1]).kickPlayer("You where kicked from the event, probably you didn't stick to the Event Rules."); + Manager.GetGameHostManager().getBlacklist().add(Bukkit.getPlayer(args[1]).getName()); + UtilPlayer.message(event.getPlayer(), F.main("Event", "You removed " + C.cYellow + Bukkit.getPlayer(args[1]).getName())); } else if(args[0].equalsIgnoreCase("tempgadget")) { @@ -1562,6 +1597,16 @@ public class EventModule extends MiniPlugin UtilPlayer.message(caller, F.main("Creature", "Killed " + target + ". " + count + " Removed.")); } + public void commandBC(Player caller, String[] args) + { + String message = args[1]; + for(int e = 2; e <= 3; e++) + message += " " + args[e]; + + String colored = ChatColor.translateAlternateColorCodes('&', message); + Manager.GetGame().Announce(F.main("Event", colored), true); + } + public void commandKit(Player caller, String[] args) { @@ -1773,25 +1818,25 @@ public class EventModule extends MiniPlugin { for(PotionEffectType effect : _potionEffectsDuration.keySet()) { + if(_potionEffectsDuration.get(effect) < 0) + continue; + player.addPotionEffect(new PotionEffect(effect, (int) (((_potionEffectsDuration.get(effect) - System.currentTimeMillis()) / 1000) * 20), _potionEffectsMult.get(effect))); } } } @EventHandler - public void StackPlayer(PlayerInteractEntityEvent event) + public void StackEntity(PlayerInteractEntityEvent event) { if (!Manager.GetGame().IsLive()) return; - if (!(event.getRightClicked() instanceof Player)) - return; - if (event.getRightClicked().getVehicle() != null) return; Player player = event.getPlayer(); - Player other = (Player)event.getRightClicked(); + Entity other = event.getRightClicked(); if(!_allowStacker && !_stacker.contains(player)) return; @@ -1802,6 +1847,17 @@ public class EventModule extends MiniPlugin if (!Manager.GetGame().IsAlive(event.getPlayer())) return; + if (Manager.getCosmeticManager().getGadgetManager().getActive(player, GadgetType.Morph) instanceof MorphBlock) + { + UtilPlayer.message(player, F.main("Stacker", "You cannot stack while using the Block Morph.")); + return; + } + + StackerEvent stackerEvent = new StackerEvent(player); + Bukkit.getServer().getPluginManager().callEvent(stackerEvent); + if (stackerEvent.isCancelled()) + return; + //Effect event.getRightClicked().getWorld().playEffect(event.getRightClicked().getLocation(), Effect.STEP_SOUND, 35); @@ -1812,8 +1868,66 @@ public class EventModule extends MiniPlugin player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f); //Inform - UtilPlayer.message(other, F.main("Event", F.elem(Manager.GetGame().GetTeam(player).GetColor() + player.getName()) + " picked you up.")); - UtilPlayer.message(player, F.main("Event", "You picked up " + F.elem(Manager.GetGame().GetTeam(other).GetColor() + other.getName()) + ".")); + if ((event.getRightClicked() instanceof Player)) + { + UtilPlayer.message(other, F.main("Event", F.elem(Manager.GetGame().GetTeam(player).GetColor() + player.getName()) + " picked you up.")); + UtilPlayer.message(player, F.main("Event", "You picked up " + F.elem(Manager.GetGame().GetTeam(((Player) other)).GetColor() + ((Player) other).getName()) + ".")); + } } + + @EventHandler + public void ThrowEntity(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.L)) + return; + Player thrower = event.getPlayer(); + + if (thrower.getVehicle() != null) + return; + + Entity throwee = thrower.getPassenger(); + if (throwee == null) + return; + + StackerEvent stackerEvent = new StackerEvent(thrower); + Bukkit.getServer().getPluginManager().callEvent(stackerEvent); + if (stackerEvent.isCancelled()) + return; + + thrower.eject(); + + Entity throweeStack = throwee.getPassenger(); + if (throweeStack != null) + { + throwee.eject(); + throweeStack.leaveVehicle(); + + final Entity fThrower = thrower; + final Entity fThroweeStack = throweeStack; + + _tempStackShift.add(throweeStack); + + getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() + { + public void run() + { + fThrower.setPassenger(fThroweeStack); + _tempStackShift.remove(fThroweeStack); + } + }, 2); + } + } + + @EventHandler(ignoreCancelled=true) + public void playerDamage(CustomDamageEvent event) + { + + } + + public ArrayList getDamagePlayers() + { + return _damage; + } + } From 4184fe20cfa328c0a2115bc8292cb53e70af6796 Mon Sep 17 00:00:00 2001 From: Cheese Date: Sat, 12 Sep 2015 14:09:04 +1000 Subject: [PATCH 38/66] minor fixes --- .../src/mineplex/core/common/Rank.java | 2 +- .../core/notifier/NotificationManager.java | 22 +++++++++---------- .../src/mineplex/hub/HubManager.java | 2 +- .../hub/modules/ForcefieldManager.java | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index ede01d37b..d7952ab3f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -23,7 +23,7 @@ public enum Rank EVENT("Event", ChatColor.WHITE), - //MEdia + //Media YOUTUBE("YouTube", ChatColor.RED), YOUTUBE_SMALL("YouTube", ChatColor.DARK_PURPLE), TWITCH("Twitch", ChatColor.DARK_PURPLE), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java index 60420cf11..d5097e318 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/notifier/NotificationManager.java @@ -22,12 +22,12 @@ public class NotificationManager extends MiniPlugin private CoreClientManager _clientManager; private String _summerLine = - C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + - C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + - C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + - C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + - C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + - C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█" + C.cGold + "█" + C.cYellow + "█"; + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█" + C.cBlack + "█" + C.cYellow + "█"; public NotificationManager(JavaPlugin plugin, CoreClientManager client) { @@ -45,8 +45,8 @@ public class NotificationManager extends MiniPlugin // if (event.getType() == UpdateType.MIN_08) // hugeSale(); -// if (event.getType() == UpdateType.MIN_16) -// sale(); + if (event.getType() == UpdateType.MIN_16) + sale(); } private void sale() @@ -60,15 +60,15 @@ public class NotificationManager extends MiniPlugin if (rank == Rank.ALL) { - UtilPlayer.message(player, C.cWhite + "Summer Sale! " + " Purchase " + C.cAqua + C.Bold + "Ultra RANK" + C.cWhite + " for $15"); + UtilPlayer.message(player, C.cWhite + "50% Off Sale! " + " Purchase " + C.cAqua + C.Bold + "Ultra Rank" + C.cWhite + " for $15"); } else if (rank == Rank.ULTRA) { - UtilPlayer.message(player, C.cWhite + "Summer Sale! " + " Upgrade to " + C.cPurple + C.Bold + "HERO RANK" + C.cWhite + " for $15!"); + UtilPlayer.message(player, C.cWhite + "50% Off Sale! " + " Upgrade to " + C.cPurple + C.Bold + "Hero Rank" + C.cWhite + " for $15!"); } else if (rank == Rank.HERO) { - UtilPlayer.message(player, C.cWhite + "Summer Sale! " + "Upgrade to " + C.cGreen + C.Bold + "LEGEND RANK" + C.cWhite + " for $15!"); + UtilPlayer.message(player, C.cWhite + "50% Off Sale! " + "Upgrade to " + C.cGreen + C.Bold + "Legend Rank" + C.cWhite + " for $15!"); } UtilPlayer.message(player, C.cWhite + " Visit " + F.link("www.mineplex.com/shop") + " for 50% Off Ranks!"); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 490f0bf99..3186c0011 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -906,7 +906,7 @@ public class HubManager extends MiniClientPlugin @EventHandler public void ignoreVelocity(PlayerVelocityEvent event) { - if (_clientManager.Get(event.getPlayer()).GetRank().has(Rank.MODERATOR) && _preferences.Get(event.getPlayer()).IgnoreVelocity) + if (_clientManager.Get(event.getPlayer()).GetRank().has(Rank.TWITCH) && _preferences.Get(event.getPlayer()).IgnoreVelocity) { event.setCancelled(true); } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java index ca48a3484..c52990ac1 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java @@ -42,7 +42,7 @@ public class ForcefieldManager extends MiniPlugin for (Player player : UtilServer.getPlayers()) { - if (Manager.getPreferences().Get(player).HubForcefield && (Manager.GetClients().Get(player).GetRank().has(Rank.ADMIN) || Manager.GetClients().Get(player).GetRank() == Rank.JNR_DEV)) + if (Manager.getPreferences().Get(player).HubForcefield && (Manager.GetClients().Get(player).GetRank().has(Rank.ADMIN) || Manager.GetClients().Get(player).GetRank() == Rank.JNR_DEV || Manager.GetClients().Get(player).GetRank() == Rank.YOUTUBE || Manager.GetClients().Get(player).GetRank() == Rank.TWITCH)) { for (Player other : UtilServer.getPlayers()) { From 5c0ada3df63a137e316ed27253295d90dde739bc Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 12 Sep 2015 06:39:40 +0200 Subject: [PATCH 39/66] Implementing RequiredRank file and command. --- .../nautilus/game/arcade/ArcadeManager.java | 69 +++++++++++++++++++ .../arcade/command/RequiredRankCommand.java | 53 ++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/RequiredRankCommand.java 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 30871a8e7..272921dcf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -111,6 +111,7 @@ import nautilus.game.arcade.addons.TeamArmorAddon; import nautilus.game.arcade.addons.compass.CompassAddon; import nautilus.game.arcade.command.DisguiseCommand; import nautilus.game.arcade.command.GameCommand; +import nautilus.game.arcade.command.RequiredRankCommand; import nautilus.game.arcade.command.WriteCommand; import nautilus.game.arcade.command.KitUnlockCommand; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -210,6 +211,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation //Youtuber Kits private HashSet _youtube = new HashSet(); + + //Server Property + private Rank _requiredRank; public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, @@ -414,6 +418,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation }); getPacketHandler().addPacketHandler(_resourcePacketHandler); + + checkRequiredRank(); } @Override @@ -423,6 +429,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation addCommand(new WriteCommand(this)); addCommand(new KitUnlockCommand(this)); addCommand(new DisguiseCommand(this)); + addCommand(new RequiredRankCommand(this)); } public GameServerConfig GetServerConfig() @@ -785,6 +792,34 @@ public class ArcadeManager extends MiniPlugin implements IRelation { if (Bukkit.getServer().hasWhitelist()) { + if(_requiredRank != null) + { + if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), _requiredRank, false)) + { + event.allow(); + event.setResult(PlayerLoginEvent.Result.ALLOWED); + + if (_serverConfig.Tournament && _clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.MODERATOR, false)) + { + event.getPlayer().setOp(true); + } + } + else + { + for (OfflinePlayer player : Bukkit.getWhitelistedPlayers()) + { + if (player.getName().equalsIgnoreCase(event.getPlayer().getName())) + { + event.allow(); + event.setResult(PlayerLoginEvent.Result.ALLOWED); + return; + } + } + + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Required Rank for this server: " + _requiredRank.getColor() + _requiredRank.Name); + return; + } + } if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.MODERATOR, false)) { event.allow(); @@ -1490,4 +1525,38 @@ public class ArcadeManager extends MiniPlugin implements IRelation } } } + + public void checkRequiredRank() + { + _requiredRank = null; + + for(File file : new File(".").listFiles()) + { + if(!file.getName().startsWith("RequiredRank")) + continue; + + try + { + _requiredRank = Rank.valueOf(file.getName().split("=")[1]); + System.out.println("set required rank to " + _requiredRank.Name); + } + catch (IllegalArgumentException e) + { + System.out.println("==============================="); + System.out.println("Wrong required rank definition."); + System.out.println("[" + file.getName().split("=")[1] + "] Does not exist!"); + System.out.println("==============================="); + } + } + } + + public Rank getRequiredRank() + { + return _requiredRank; + } + + public void setRequiredRank(Rank rank) + { + _requiredRank = rank; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/RequiredRankCommand.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/RequiredRankCommand.java new file mode 100644 index 000000000..fbb89b22d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/command/RequiredRankCommand.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.command; + +import org.bukkit.entity.Player; + +import nautilus.game.arcade.ArcadeManager; +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; + +public class RequiredRankCommand extends CommandBase +{ + + private ArcadeManager _manager; + + public RequiredRankCommand(ArcadeManager plugin) + { + super(plugin, Rank.DEVELOPER, new Rank[]{Rank.JNR_DEV}, "Requiredrank"); + _manager = plugin; + } + + @Override + public void Execute(Player caller, String[] args) + { + if(!_manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) + { + UtilPlayer.message(caller, F.main("Command", "This is not a test server..")); + return; + } + if(args.length == 0) + { + UtilPlayer.message(caller, F.main("Command", "Invalid rank input.")); + return; + } + if(args[0].equalsIgnoreCase("Reset")) + { + _manager.setRequiredRank(null); + UtilPlayer.message(caller, F.main("Command", "You reset the required rank to null.")); + return; + } + try + { + Rank rank = Rank.valueOf(args[0]); + _manager.setRequiredRank(rank); + UtilPlayer.message(caller, F.main("Command", "You set the required rank to: " + rank.getColor() + rank.Name)); + } + catch (IllegalArgumentException e) + { + UtilPlayer.message(caller, F.main("Command", "Invalid rank input.")); + } + } + +} From 119dc8ab52658cafda1ad9dd8040ad96fe382e26 Mon Sep 17 00:00:00 2001 From: Cheese Date: Sat, 12 Sep 2015 15:01:18 +1000 Subject: [PATCH 40/66] changed name of method --- .../src/nautilus/game/arcade/ArcadeManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 272921dcf..036793db1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -419,7 +419,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation getPacketHandler().addPacketHandler(_resourcePacketHandler); - checkRequiredRank(); + loadRequiredRank(); } @Override @@ -1526,7 +1526,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation } } - public void checkRequiredRank() + public void loadRequiredRank() { _requiredRank = null; From 2380b9041da2afeec32771f5dab0c7a9f48059d8 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 11 Sep 2015 22:50:53 -0700 Subject: [PATCH 41/66] Added automatic timings report in the event of lag. Added more exception handling around LoadingWindow --- .../core/gui/pages/LoadingWindow.java | 54 ++++++++++++++----- .../src/mineplex/core/monitor/LagMeter.java | 21 ++++++++ 2 files changed, 61 insertions(+), 14 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gui/pages/LoadingWindow.java b/Plugins/Mineplex.Core/src/mineplex/core/gui/pages/LoadingWindow.java index 3546d17cc..b14d00d41 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gui/pages/LoadingWindow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gui/pages/LoadingWindow.java @@ -151,21 +151,47 @@ public class LoadingWindow implements Runnable, Listener { { Player player = Bukkit.getPlayer(_playersUUID); - if (player == null || player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null || _inv == null ? !player.getOpenInventory().equals(_currentInventory) : (_inv != null && !player.getOpenInventory().getTopInventory().equals(_inv))) { - end(); - return; - } - if (_inv == null) { - _inv = Bukkit.createInventory(null, _size, _title); + try + { + if (player == null || player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null || _inv == null ? !player.getOpenInventory().equals(_currentInventory) : (!player.getOpenInventory().getTopInventory().equals(_inv))) + { + end(); + return; + } - setBackGround(); - setLoadingBarItems(); - UtilPlayer.swapToInventory(player, _inv); - Bukkit.getPluginManager().registerEvents(this, _plugin); - } else - setLoadingBarItems(); - - _ticker++; + if (_inv == null) + { + _inv = Bukkit.createInventory(null, _size, _title); + + setBackGround(); + setLoadingBarItems(); + UtilPlayer.swapToInventory(player, _inv); + Bukkit.getPluginManager().registerEvents(this, _plugin); + } + else + setLoadingBarItems(); + } + catch (Exception exception) + { + try + { + System.out.println("player ? " + (player == null)); + System.out.println("player.getOpenInventory() ? " + (player.getOpenInventory() == null)); + System.out.println("player.getOpenInventory().getTopInventory() ? " + (player.getOpenInventory().getTopInventory() == null)); + System.out.println("_inv ? " + (_inv == null)); + exception.printStackTrace(); + } + catch (Exception exception2) + { + exception.printStackTrace(); + } + + end(); + } + finally + { + _ticker++; + } } public void end() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java index 0460b145a..448b55a6f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java @@ -9,7 +9,9 @@ import mineplex.core.common.util.F; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -28,6 +30,10 @@ public class LagMeter extends MiniPlugin private long _lastTick = 0; + private boolean _timingsRunning; + private boolean _timingsPasted; + private long _timingsStarted; + private HashSet _monitoring = new HashSet(); public LagMeter(JavaPlugin plugin, CoreClientManager clientManager) @@ -87,6 +93,21 @@ public class LagMeter extends MiniPlugin _lastRun = now; _count++; + + if (_timingsRunning) + { + if (_ticksPerSecond > 15 || System.currentTimeMillis() - _timingsStarted > 60000) + { + getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings paste"); + _timingsRunning = false; + } + } + else if (_ticksPerSecond < 10) + { + _timingsRunning = true; + _timingsStarted = System.currentTimeMillis(); + getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings on"); + } } public double getTicksPerSecond() From c9971bb11791073c578cd00b152d4d761a17f811 Mon Sep 17 00:00:00 2001 From: Cheese Date: Sat, 12 Sep 2015 16:45:22 +1000 Subject: [PATCH 42/66] fixed duplicate rank name --- Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index d7952ab3f..8cab61a15 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -25,7 +25,7 @@ public enum Rank //Media YOUTUBE("YouTube", ChatColor.RED), - YOUTUBE_SMALL("YouTube", ChatColor.DARK_PURPLE), + YOUTUBE_SMALL("MooTube", ChatColor.DARK_PURPLE), TWITCH("Twitch", ChatColor.DARK_PURPLE), //Player From 1417d31b733890ace017187033899f17995d2787 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 11 Sep 2015 23:57:26 -0700 Subject: [PATCH 43/66] Added 60s delay to timings enable check. --- .../src/mineplex/core/monitor/LagMeter.java | 30 +++++++++++-------- Plugins/Mineplex.StaffServer/.classpath | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java index 448b55a6f..9b7f921a5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/monitor/LagMeter.java @@ -27,6 +27,7 @@ public class LagMeter extends MiniPlugin private double _ticksPerSecond; private double _ticksPerSecondAverage; private long _lastAverage; + private long _start; private long _lastTick = 0; @@ -43,6 +44,8 @@ public class LagMeter extends MiniPlugin _clientManager = clientManager; _lastRun = System.currentTimeMillis(); _lastAverage = System.currentTimeMillis(); + + _start = System.currentTimeMillis(); } @EventHandler @@ -94,19 +97,22 @@ public class LagMeter extends MiniPlugin _count++; - if (_timingsRunning) + if (System.currentTimeMillis() - _start > 60000) { - if (_ticksPerSecond > 15 || System.currentTimeMillis() - _timingsStarted > 60000) - { - getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings paste"); - _timingsRunning = false; - } - } - else if (_ticksPerSecond < 10) - { - _timingsRunning = true; - _timingsStarted = System.currentTimeMillis(); - getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings on"); + if (_timingsRunning) + { + if (_ticksPerSecond > 15 || System.currentTimeMillis() - _timingsStarted > 60000) + { + getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings paste"); + _timingsRunning = false; + } + } + else if (_ticksPerSecond < 10) + { + _timingsRunning = true; + _timingsStarted = System.currentTimeMillis(); + getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings on"); + } } } diff --git a/Plugins/Mineplex.StaffServer/.classpath b/Plugins/Mineplex.StaffServer/.classpath index acc97657a..e03947a20 100644 --- a/Plugins/Mineplex.StaffServer/.classpath +++ b/Plugins/Mineplex.StaffServer/.classpath @@ -11,6 +11,6 @@ - + From fcec6253cdf635c48cbb81edf5b7c2b6efc7fcb2 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 12 Sep 2015 23:56:38 +0200 Subject: [PATCH 44/66] fixing @p on signs, adding potioneffects and gadgets to areas. --- .../arcade/game/games/event/EventGame.java | 164 ++++++++++++++++-- .../arcade/game/games/event/EventModule.java | 10 +- 2 files changed, 152 insertions(+), 22 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index a96234726..18c492865 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -25,7 +25,10 @@ import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.gadget.event.GadgetActivateEvent; +import mineplex.core.gadget.types.Gadget; +import mineplex.core.gadget.types.GadgetType; import mineplex.core.give.Give; +import mineplex.core.mount.Mount; import mineplex.core.mount.event.MountActivateEvent; import mineplex.core.recharge.Recharge; import mineplex.core.shop.item.SalesPackageBase; @@ -68,6 +71,8 @@ import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; public class EventGame extends Game { @@ -130,6 +135,7 @@ public class EventGame extends Game this.InventoryClick = true; this.InventoryOpenBlock = true; this.InventoryOpenChest = true; + //Dont timeout this.GameTimeout = -1; @@ -647,23 +653,27 @@ public class EventGame extends Game for(String varArgs : args) { ArrayList players = new ArrayList<>(); - if(Bukkit.getPlayer(playerName) != null) - players.add(Bukkit.getPlayer(playerName)); + if(Bukkit.getPlayer(varArgs) != null) + players.add(Bukkit.getPlayer(varArgs)); - if(playerName.contentEquals("@p")) + if(varArgs.contentEquals("@p")) { for(Player player : GetPlayers(true)) { - boolean found = true; + boolean found; + found = true; for(Player otherPlayer : GetPlayers(true)) { + if(player == otherPlayer) + continue; + if(UtilMath.offset(sign.getLocation(), player.getLocation()) >= UtilMath.offset(sign.getLocation(), otherPlayer.getLocation())) { found = false; break; } } - if(found = true) + if(found) { players.add(player); break; @@ -736,7 +746,7 @@ public class EventGame extends Game if(command.contentEquals("[SETBLOCK]")) { - Material mat = Material.getMaterial(args[1]); + Material mat = Material.getMaterial(Integer.parseInt(args[1])); String[] coords = args[2].split(" "); int x = Integer.parseInt(coords[0]); int y = Integer.parseInt(coords[1]); @@ -747,7 +757,7 @@ public class EventGame extends Game if(command.contentEquals("[TESTFOR]")) { boolean redstone = false; - Material mat = Material.getMaterial(args[1]); + Material mat = Material.getMaterial(Integer.parseInt(args[1])); if(args[2].contains("r=")) { int radius = 0; @@ -853,7 +863,7 @@ public class EventGame extends Game { for(Player player : varMap.get(1)) { - player.getInventory().addItem(new ItemStack(Material.getMaterial(args[2]), Integer.parseInt(args[3]))); + player.getInventory().addItem(new ItemStack(Material.getMaterial(Integer.parseInt(args[2])), Integer.parseInt(args[3]))); } } catch (Exception e) @@ -902,6 +912,68 @@ public class EventGame extends Game } } + public boolean isInArea(EventArea area, Entity entity) + { + if(entity.getLocation().getX() < area.CornerA.getX() || entity.getLocation().getX() > area.CornerB.getX()) + return false; + + if(entity.getLocation().getY() < area.CornerA.getY() || entity.getLocation().getY() > area.CornerB.getY()) + return false; + + if(entity.getLocation().getZ() < area.CornerA.getZ() || entity.getLocation().getZ() > area.CornerB.getZ()) + return false; + + return true; + } + + @EventHandler + public void activateGadget(GadgetActivateEvent event) + { + for(EventArea area : _customAreas.values()) + { + if(area.CornerA == null || area.CornerB == null) + continue; + + if(area.Usable == false) + continue; + + if(!isInArea(area, event.getPlayer())) + continue; + + if(!area.GadgetsEnabled.contains(event.getGadget())) + { + event.setCancelled(true); + } + } + } + + @EventHandler + public void areaPotionEffect(UpdateEvent event) + { + if(event.getType() != UpdateType.SEC) + return; + + for(EventArea area : _customAreas.values()) + { + for(Player player : GetPlayers(true)) + { + if(area.CornerA == null || area.CornerB == null) + continue; + + if(area.Usable == false) + continue; + + if(!isInArea(area, player)) + continue; + + for(PotionEffectType type : area.PotionEffects.keySet()) + { + player.addPotionEffect(new PotionEffect(type, 30, area.PotionEffects.get(type)), true); + } + } + } + } + @EventHandler(ignoreCancelled=true) public void areaDamage(CustomDamageEvent event) { @@ -917,20 +989,16 @@ public class EventGame extends Game { if(!Manager.GetGame().DamagePvP) { + Manager.GetGame().Damage = true; Manager.GetGame().DamagePvP = true; Bukkit.getPluginManager().callEvent(event); Manager.GetGame().DamagePvP = false; + Manager.GetGame().Damage = false; } return; } - if(event.GetDamageeEntity().getLocation().getX() < area.CornerA.getX() || event.GetDamageeEntity().getLocation().getX() > area.CornerB.getX()) - continue; - - if(event.GetDamageeEntity().getLocation().getY() < area.CornerA.getY() || event.GetDamageeEntity().getLocation().getY() > area.CornerB.getY()) - continue; - - if(event.GetDamageeEntity().getLocation().getZ() < area.CornerA.getZ() || event.GetDamageeEntity().getLocation().getZ() > area.CornerB.getZ()) + if(!isInArea(area, event.GetDamageeEntity())) continue; if(!area.DamageAll) @@ -1004,6 +1072,67 @@ public class EventGame extends Game _customAreas.get(Integer.parseInt(args[1])).DamageEvP = !_customAreas.get(Integer.parseInt(args[1])).DamageEvP; UtilPlayer.message(player, F.main("Event", "Damage EvP for Region " + args[1] + ": " + F.tf(_customAreas.get(Integer.parseInt(args[1])).DamageEvP))); } + if(args[2].equalsIgnoreCase("Effect")) + { + PotionEffectType type = PotionEffectType.getByName(args[3]); + if (type == null) + { + UtilPlayer.message(player, F.main("Effect", "Invalid Effect Type: " + args[2])); + UtilPlayer.message(player, F.value("Valid Types", "http://minecraft.gamepedia.com/Status_effect")); + return; + } + int strenght = 0; + try + { + strenght = Integer.parseInt(args[4]); + } + catch (Exception e) {} + _customAreas.get(Integer.parseInt(args[1])).PotionEffects.put(type, strenght); + UtilPlayer.message(player, F.main("Event", "Potion Effect added for Region " + args[1])); + } + if(args[2].equalsIgnoreCase("Gadget")) + { + //Gadgets + for (GadgetType type : GadgetType.values()) + { + for (Gadget gadget : Manager.getCosmeticManager().getGadgetManager().getGadgets(type)) + { + if (gadget.GetName().replaceAll(" ", "").equalsIgnoreCase(args[3])) + { + if (_customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.remove(gadget)) + { + Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget for area " + args[1], F.ed(false)))); + } + else + { + Manager.GetGame().Announce(F.main("Inventory", F.value(gadget.GetName() + " Gadget for area " + args[1], F.ed(true)))); + _customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.add(gadget); + } + + return; + } + } + } + + //Mounts + for (Mount mount : Manager.getCosmeticManager().getMountManager().getMounts()) + { + if (mount.GetName().replaceAll(" ", "").equalsIgnoreCase(args[3])) + { + if (_customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.remove(mount)) + { + Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget for area " + args[1], F.ed(false)))); + } + else + { + Manager.GetGame().Announce(F.main("Inventory", F.value(mount.GetName() + " Gadget for area " + args[1], F.ed(true)))); + _customAreas.get(Integer.parseInt(args[1])).GadgetsEnabled.add(mount); + } + + return; + } + } + } } else { @@ -1073,10 +1202,15 @@ public class EventGame extends Game public boolean Usable; + public HashMap PotionEffects; + public HashSet GadgetsEnabled; + public EventArea(Integer id) { ID = id; Usable = false; + PotionEffects = new HashMap<>(); + GadgetsEnabled = new HashSet(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 82315cc58..9e980a32f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -29,6 +29,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.PlayerDeathOutEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -57,6 +58,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; @@ -1600,7 +1602,7 @@ public class EventModule extends MiniPlugin public void commandBC(Player caller, String[] args) { String message = args[1]; - for(int e = 2; e <= 3; e++) + for(int e = 2; e < args.length; e++) message += " " + args[e]; String colored = ChatColor.translateAlternateColorCodes('&', message); @@ -1919,12 +1921,6 @@ public class EventModule extends MiniPlugin } } - @EventHandler(ignoreCancelled=true) - public void playerDamage(CustomDamageEvent event) - { - - } - public ArrayList getDamagePlayers() { return _damage; From 112f94a8421c61b2c73375975dab8ea971bed0ef Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 13 Sep 2015 00:00:47 +0200 Subject: [PATCH 45/66] forgot to add command to remove potion effects. --- .../src/nautilus/game/arcade/game/games/event/EventGame.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 18c492865..555511b96 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -1075,6 +1075,11 @@ public class EventGame extends Game if(args[2].equalsIgnoreCase("Effect")) { PotionEffectType type = PotionEffectType.getByName(args[3]); + if(_customAreas.get(Integer.parseInt(args[1])).PotionEffects.containsKey(type)) + { + _customAreas.get(Integer.parseInt(args[1])).PotionEffects.remove(type); + UtilPlayer.message(player, F.main("Event", "Removed potion effect from area")); + } if (type == null) { UtilPlayer.message(player, F.main("Effect", "Invalid Effect Type: " + args[2])); From 53d5c2fd0e9e5ae172d10e182cf33442a64cbb7e Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 13 Sep 2015 00:30:55 +0200 Subject: [PATCH 46/66] adding area info command. --- .../arcade/game/games/event/EventGame.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 555511b96..d48f616d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -74,6 +74,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import com.sun.xml.internal.ws.resources.UtilMessages; + public class EventGame extends Game { private GameHostManager _mps; @@ -1041,8 +1043,34 @@ public class EventGame extends Game } } + public void listAreaSettings(Player player) + { + for(EventArea area : _customAreas.values()) + { + UtilPlayer.message(player, F.main("Event", "============================")); + UtilPlayer.message(player, F.main("Event", "Settings for area " + area.ID)); + UtilPlayer.message(player, F.oo("Damage All", area.DamageAll) + ", " + + F.oo("Damage PvP", area.DamagePvP) + ", " + + F.oo("Damage PvE", area.DamagePvE) + + ", " + F.oo("Damage EvP", area.DamageEvP)); + + UtilPlayer.message(player, F.main("Event", "Potion Effects for area " + area.ID)); + for(PotionEffectType type : area.PotionEffects.keySet()) + UtilPlayer.message(player, F.oo(type.getName(), true) + " level: " + area.PotionEffects.get(type)); + + for(SalesPackageBase gadget : area.GadgetsEnabled) + UtilPlayer.message(player, F.oo(gadget.GetName(), true)); + } + } + public void editArea(Player player, String[] args) { + + if(args[1].equalsIgnoreCase("Info")) + { + listAreaSettings(player); + return; + } try { if(_customAreas.containsKey(Integer.parseInt(args[1]))) From a46cb2c2749d634026e9134a7476466d4186f897 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 13 Sep 2015 00:35:22 +0200 Subject: [PATCH 47/66] last fix in the listAreaInfo method. --- .../src/nautilus/game/arcade/game/games/event/EventGame.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index d48f616d4..0957549dd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -1058,6 +1058,7 @@ public class EventGame extends Game for(PotionEffectType type : area.PotionEffects.keySet()) UtilPlayer.message(player, F.oo(type.getName(), true) + " level: " + area.PotionEffects.get(type)); + UtilPlayer.message(player, F.main("Event", "Gadgets for area " + area.ID)); for(SalesPackageBase gadget : area.GadgetsEnabled) UtilPlayer.message(player, F.oo(gadget.GetName(), true)); } From 7ca6f581082eea9e1c50bb2bd6ef609cf49246b0 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 13 Sep 2015 10:25:44 +0200 Subject: [PATCH 48/66] Adding Gem signs. --- .../arcade/game/games/event/EventGame.java | 48 +++++++++++++++++++ .../arcade/game/games/event/EventModule.java | 6 +++ 2 files changed, 54 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 0957549dd..20caa6877 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -7,6 +7,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; @@ -58,6 +59,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.block.SignChangeEvent; @@ -68,6 +70,7 @@ import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.inventory.ItemStack; @@ -1221,6 +1224,51 @@ public class EventGame extends Game event.setCancelled(true); } + @EventHandler + public void gemSign(final PlayerInteractEvent event) + { + if(event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if(!(event.getClickedBlock() instanceof Sign)) + return; + + Sign sign = (Sign) event.getClickedBlock().getState(); + if(!sign.getLine(0).contentEquals("[GEM]")) + return; + + final Material mat = Material.getMaterial(Integer.parseInt(sign.getLine(1))); + Integer price = Integer.parseInt(sign.getLine(2)); + if(price > 500) + price = 500; + + if(price <= 0) + { + UtilPlayer.message(event.getPlayer(), F.main("Event", "You got an item for free.")); + event.getPlayer().getInventory().addItem(new ItemStack(mat)); + return; + } + + if(Manager.GetDonation().Get(event.getPlayer()).GetGems() < price) + { + UtilPlayer.message(event.getPlayer(), F.main("Event", "You dont have enough Gems.")); + return; + } + + final int gems = price; + Manager.GetDonation().RewardGems(new Callback() + { + public void run(Boolean completed) + { + if (completed) + { + UtilPlayer.message(event.getPlayer(), F.main("Event", "You bought an item for " + gems + " Gems.")); + event.getPlayer().getInventory().addItem(new ItemStack(mat)); + } + } + }, "Gem Sign", event.getPlayer().getName(), event.getPlayer().getUniqueId(), -price); + } + public class EventArea { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 9e980a32f..9dc6de524 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -159,6 +159,12 @@ public class EventModule extends MiniPlugin UtilPlayer.message(player, F.value("/e give [e:#,e:#...]", "Give Item")); UtilPlayer.message(player, F.value("/e doublejump", "Toggles Double Jump")); + UtilPlayer.message(player, F.value("/e bc", "Broadcast a message with colorcodes")); + UtilPlayer.message(player, F.value("/e tempgadget", "Activates gadget for all player")); + UtilPlayer.message(player, F.value("/e playerdamage", "Toggles damage fpr player")); + UtilPlayer.message(player, F.value("/e stacker [Player]", "toggles stacker global or for Players")); + UtilPlayer.message(player, F.value("/e kick", "Remove a player from the event")); + UtilPlayer.message(player, F.value("/e area PVP|ALL|PVE|EVP|Gadget|Effect / add", "Create and edit areas")); UtilPlayer.message(player, F.value("/e scoreboard [Text]", "Sets Scoreboard Text")); From 362d99a819f053f9907320b910133b14dd42ea20 Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 15 Sep 2015 07:10:39 +0200 Subject: [PATCH 49/66] Fixing up Gem signs, Effects etc. --- .../game/arcade/game/games/event/EventGame.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java index 20caa6877..31e1a164a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventGame.java @@ -883,13 +883,12 @@ public class EventGame extends Game } if(command.contentEquals("[EFFECT]")) { - try + //Manager.GetEventModule().commandEffect(Manager.GetGameHostManager().getHost(), commandArgs, varMap.get(1)); + for(Player player : varMap.get(1)) { - Manager.GetEventModule().commandEffect(Manager.GetGameHostManager().getHost(), commandArgs, varMap.get(1)); - } catch (Exception e) - { - + player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(args[2]), Integer.parseInt(args[3].split(" ")[0]), Integer.parseInt(args[3].split(" ")[1]))); } + } if(command.contentEquals("[KIT]")) { @@ -973,7 +972,7 @@ public class EventGame extends Game for(PotionEffectType type : area.PotionEffects.keySet()) { - player.addPotionEffect(new PotionEffect(type, 30, area.PotionEffects.get(type)), true); + player.addPotionEffect(new PotionEffect(type, 60, area.PotionEffects.get(type)), true); } } } @@ -1111,6 +1110,7 @@ public class EventGame extends Game { _customAreas.get(Integer.parseInt(args[1])).PotionEffects.remove(type); UtilPlayer.message(player, F.main("Event", "Removed potion effect from area")); + return; } if (type == null) { @@ -1230,11 +1230,11 @@ public class EventGame extends Game if(event.getAction() != Action.RIGHT_CLICK_BLOCK) return; - if(!(event.getClickedBlock() instanceof Sign)) + if(event.getClickedBlock().getType() != Material.SIGN && event.getClickedBlock().getType() != Material.WALL_SIGN && event.getClickedBlock().getType() != Material.SIGN_POST) return; Sign sign = (Sign) event.getClickedBlock().getState(); - if(!sign.getLine(0).contentEquals("[GEM]")) + if(!sign.getLine(0).contentEquals("(GEM)")) return; final Material mat = Material.getMaterial(Integer.parseInt(sign.getLine(1))); From 5e8fc771649fd3e9513f3aa10b15022860b3b679 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 17 Sep 2015 04:34:45 +1200 Subject: [PATCH 50/66] Add pages to spectator and in-progress server menu --- .../mineplex/core/shop/page/ShopPageBase.java | 2 +- .../core/shop/page/ShopPageInventory.java | 123 ++++++++++++++++ .../mineplex/hub/server/ui/ServerNpcPage.java | 114 +++++++++++---- .../arcade/addons/compass/CompassAddon.java | 2 +- .../nautilus/game/arcade/game/GameTeam.java | 11 ++ .../gui/spectatorMenu/page/SpectatorPage.java | 137 +++++++++++++----- 6 files changed, 325 insertions(+), 64 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageInventory.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java index 4f46b6f0f..67f346fd0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java @@ -138,7 +138,7 @@ public abstract class ShopPageBase= 0) { if (event.getInventory().getTitle() == inventory.getInventoryName() && (inventory.getSize() <= event.getSlot() || inventory.getItem(event.getSlot()) != null)) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageInventory.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageInventory.java new file mode 100644 index 000000000..0546c0de6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageInventory.java @@ -0,0 +1,123 @@ +package mineplex.core.shop.page; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.shop.ShopBase; +import mineplex.core.shop.item.IButton; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; + +public abstract class ShopPageInventory> extends + ShopPageBase +{ + private int _page; + + public ShopPageInventory(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, + String name, Player player) + { + super(plugin, shop, clientManager, donationManager, name, player, 54); + } + + public PluginType getPlugin() + { + return (PluginType) super.getPlugin(); + } + + public ShopPageInventory(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, + String name, Player player, int slots) + { + super(plugin, shop, clientManager, donationManager, name, player, slots); + } + + protected abstract IButton[] getButtons(); + + protected abstract ItemStack[] getItems(); + + protected abstract void buildItems(); + + @Override + protected final void buildPage() + { + clearPage(); + buildItems(); + + IButton[] buttons = getButtons(); + ItemStack[] items = getItems(); + + int maxLen = Math.max(items.length, buttons.length); + boolean pages = maxLen > getSize(); + + _page = Math.max(0, Math.min(_page, pages ? (int) Math.ceil(maxLen / (double) (getSize() - 9)) - 1 : 0)); + + int start = pages ? _page * (getSize() - 9) : 0; + + for (int slot = 0; slot < (pages ? getSize() - 9 : getSize()); slot++) + { + IButton button = null; + ItemStack item = null; + + if (slot + start < buttons.length) + { + button = buttons[slot + start]; + } + + if (slot + start < items.length) + { + item = items[slot + start]; + } + + if (button != null) + { + super.addButton(slot, item, button); + } + else + { + setItem(slot, item); + } + } + + if (pages) + { + for (int slot = 0; slot < 9; slot++) + { + int realSlot = getSize() - (9 - slot); + + if ((slot == 0 && _page > 0) || (slot == 8 && maxLen > (_page + 1) * (getSize() - 9))) + { + final int nextPage = slot == 0 ? _page - 1 : _page + 1; + + ItemBuilder builder = new ItemBuilder(Material.SIGN); + builder.setTitle(slot == 0 ? "Previous Page" : "Next Page"); + builder.setAmount(nextPage + 1); + + super.addButton(realSlot, builder.build(), new IButton() + { + + @Override + public void onClick(Player player, ClickType clickType) + { + setPage(nextPage); + } + }); + } + else if (slot == 4) + { + ItemStack item = new ItemBuilder(Material.PAPER).setTitle("Page " + (_page + 1)).setAmount(_page + 1).build(); + + setItem(realSlot, item); + } + } + } + } + + public void setPage(int newPage) + { + _page = newPage; + buildPage(); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java index c2c1bf9e4..34b527fa9 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -1,6 +1,7 @@ package mineplex.hub.server.ui; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -8,25 +9,26 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; import mineplex.core.account.CoreClientManager; -import mineplex.core.achievement.AchievementCategory; import mineplex.core.common.Rank; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; import mineplex.core.donation.DonationManager; import mineplex.core.game.GameDisplay; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; -import mineplex.core.shop.page.ShopPageBase; +import mineplex.core.shop.page.ShopPageInventory; import mineplex.hub.server.ServerInfo; import mineplex.hub.server.ServerManager; import mineplex.hub.server.ServerSorter; import mineplex.hub.server.ui.button.JoinServerButton; -public class ServerNpcPage extends ShopPageBase implements IServerPage +public class ServerNpcPage extends ShopPageInventory implements IServerPage { // Shop Item Messages private static final String MESSAGE_BETA_GET_ULTRA = ChatColor.RESET + C.Line + "Get Ultra to join Tournament servers!"; @@ -40,6 +42,9 @@ public class ServerNpcPage extends ShopPageBase im private String _serverGroupName; private boolean _onMainPage = true; + private IButton[] _buttons; + private ItemStack[] _items; + public ServerNpcPage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String serverGroupName) { super(plugin, shop, clientManager, donationManager, name, player, 54); @@ -50,12 +55,14 @@ public class ServerNpcPage extends ShopPageBase im } @Override - protected void buildPage() + protected void buildItems() { + _items = new ItemStack[0]; + _buttons = new IButton[0]; + List serverList = new ArrayList(getPlugin().getServerList(_serverGroupName)); - + int slotsNeeded = 1; - if (serverList.size() > 0) { @@ -81,6 +88,7 @@ public class ServerNpcPage extends ShopPageBase im getPlugin().selectServer(player, _serverGroupName); } }); + buildAvailableServerPage(serverList, slotsNeeded); } else @@ -109,7 +117,7 @@ public class ServerNpcPage extends ShopPageBase im ChatColor.RESET + C.cGreen + "www.mineplex.com/shop" }, seconds, false, false); - addItem(22, item); + addItemStack(22, item); } private ShopItem buildShopItem(ServerInfo serverInfo, int slotsNeeded) @@ -220,7 +228,7 @@ public class ServerNpcPage extends ShopPageBase im ChatColor.RESET + "Visit " + C.cGreen + "www.mineplex.com/shop" + C.cWhite + "!" }, 1, false, false); - addItem(22, item); + addItemStack(22, item); return; } @@ -243,9 +251,6 @@ public class ServerNpcPage extends ShopPageBase im } else { - if (slot >= 54) - continue; - addButton(slot, getPrivateItem(serverInfo), new JoinServerButton(this, serverInfo)); slot++; } @@ -273,7 +278,7 @@ public class ServerNpcPage extends ShopPageBase im greenCount++; if (serverInfo.MOTD.contains("Open in")) - setItem(slot, shopItem); + addItemStack(slot, shopItem); else { addButton(slot, shopItem, new JoinServerButton(this, serverInfo)); @@ -303,11 +308,39 @@ public class ServerNpcPage extends ShopPageBase im { for (int i = greenCount + greenStartSlot; i < greenStartSlot + serversToShow; i++) { - setItem(i, null); + addItemStack(i, null); } } } + public void addItemStack(int slot, ItemStack item) + { + if (_items.length <= slot) + { + if (item == null || item.getType() == Material.AIR) + { + return; + } + + _items = Arrays.copyOf(_items, slot + 1); + _buttons = Arrays.copyOf(_buttons, slot + 1); + } + + _items[slot] = item; + } + + protected void addButton(int slot, ItemStack item, IButton button) + { + if (_items.length <= slot) + { + _items = Arrays.copyOf(_items, slot + 1); + _buttons = Arrays.copyOf(_buttons, slot + 1); + } + + _items[slot] = item; + _buttons[slot] = button; + } + private ShopItem getPrivateItem(ServerInfo serverInfo) { String hostName = serverInfo.Name.substring(0, serverInfo.Name.indexOf('-')); @@ -371,36 +404,47 @@ public class ServerNpcPage extends ShopPageBase im private void buildInProgressServerPage(List serverList, int slotsNeeded) { int slot = 9; + + ArrayList inProgress = new ArrayList(); for (ServerInfo serverInfo : serverList) { - if (isInProgress(serverInfo) && slot < getSize()) + if (isInProgress(serverInfo)) { - ShopItem shopItem = buildShopItem(serverInfo, slotsNeeded); - - addButton(slot, shopItem, new JoinServerButton(this, serverInfo)); - - slot++; + inProgress.add(serverInfo); } } - addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() + for (ServerInfo serverInfo : inProgress) + { + if (inProgress.size() > 45 && slot > 9 && slot % 45 == 0) + { + addBackBed(slot + 4); + slot += 9; + } + + ShopItem shopItem = buildShopItem(serverInfo, slotsNeeded); + + addButton(slot, shopItem, new JoinServerButton(this, serverInfo)); + + slot++; + } + + addBackBed(4); + } + + private void addBackBed(int slot) + { + addButton(slot, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] + {}, 1, false), new IButton() { @Override public void onClick(Player player, ClickType clickType) { - clear(); _onMainPage = true; + buildPage(); } }); - - while (slot < getSize()) - { - if (getItem(slot) != null) - setItem(slot, null); - - slot++; - } } public void Update() @@ -422,4 +466,16 @@ public class ServerNpcPage extends ShopPageBase im getPlugin().selectServer(player, serverInfo); } + + @Override + protected IButton[] getButtons() + { + return _buttons; + } + + @Override + protected ItemStack[] getItems() + { + return _items; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java index 5383b0be6..488295caf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java @@ -206,7 +206,7 @@ public class CompassAddon extends MiniPlugin { // Teleport to nearest player when you left click compass - if (!Recharge.Instance.use(player, "Spectate", 5000, true, false)) + if (!Recharge.Instance.use(player, "Spectate", 3000, true, false)) { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index a4adccbd5..cc3956390 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -73,6 +73,7 @@ public class GameTeam //Records order players go out in protected ArrayList _places = new ArrayList(); + private long _teamCreatedTime = System.currentTimeMillis(); // Used just for SpectatorPage so that teams remain ordered public GameTeam(Game host, String name, ChatColor color, ArrayList spawns, boolean tags) { @@ -90,6 +91,11 @@ public class GameTeam this(host, name, color, spawns, false); } + public long getCreatedTime() + { + return _teamCreatedTime; + } + public String GetName() { return _name; @@ -300,6 +306,11 @@ public class GameTeam _displayName = name; } + public String getDisplayName() + { + return _displayName; + } + public byte GetColorData() { if (GetColor() == ChatColor.WHITE) return (byte)0; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java index ebe10c41a..7f75b4533 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java @@ -4,8 +4,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.List; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -18,8 +20,9 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilColor; import mineplex.core.common.util.UtilMath; import mineplex.core.donation.DonationManager; +import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.ShopItem; -import mineplex.core.shop.page.ShopPageBase; +import mineplex.core.shop.page.ShopPageInventory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.addons.compass.CompassAddon; import nautilus.game.arcade.game.GameTeam; @@ -30,35 +33,46 @@ import nautilus.game.arcade.gui.spectatorMenu.button.SpectatorButton; * Created by shaun on 14-09-24. */ -public class SpectatorPage extends ShopPageBase +public class SpectatorPage extends + ShopPageInventory { private ArcadeManager _arcadeManager; + private IButton[] _buttons; + private ItemStack[] _items; - public SpectatorPage(CompassAddon plugin, ArcadeManager arcadeManager, SpectatorShop shop, CoreClientManager clientManager, + public SpectatorPage(CompassAddon plugin, ArcadeManager arcadeManager, + SpectatorShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player) { - super(plugin, shop, clientManager, donationManager, "Spectator Menu", player); + super(plugin, shop, clientManager, donationManager, "Spectator Menu", + player); + _arcadeManager = arcadeManager; buildPage(); } @Override - protected void buildPage() + protected void buildItems() { - int playerCount = _arcadeManager.GetGame().GetPlayers(true).size(); + _buttons = new IButton[54]; + _items = new ItemStack[54]; + List teamList = _arcadeManager.GetGame().GetTeamList(); - if (teamList.size() == 1 && playerCount < 28) - buildSingleTeam(teamList.get(0), playerCount); - else - buildMultipleTeams(teamList, playerCount); + int playerCount = _arcadeManager.GetGame().GetPlayers(true).size(); + if (teamList.size() == 1 && playerCount < 28) + { + buildSingleTeam(teamList.get(0), playerCount); + } + else + { + buildMultipleTeams(teamList, playerCount); + } } private void buildSingleTeam(GameTeam team, int playerCount) { - setItem(13, getTeamItem(team, playerCount)); - ArrayList players = team.GetPlayers(true); Collections.sort(players, new Comparator() @@ -72,6 +86,11 @@ public class SpectatorPage extends ShopPageBase }); + _buttons = new IButton[19 + players.size()]; + _items = new ItemStack[_buttons.length]; + + _items[13] = getTeamItem(team, playerCount); + int slot = 19; for (Player other : players) @@ -79,41 +98,70 @@ public class SpectatorPage extends ShopPageBase addPlayerItem(slot, team, other); if ((slot + 2) % 9 == 0) + { + _buttons = Arrays.copyOf(_buttons, _buttons.length + 3); + _items = Arrays.copyOf(_items, _items.length + 3); + slot += 3; + } else + { slot++; + } } } private void buildMultipleTeams(List teamList, int playerCount) { + _buttons = new IButton[0]; + _items = new ItemStack[0]; + int currentRow = 0; + Collections.sort(teamList, new Comparator() + { + + @Override + public int compare(GameTeam o1, GameTeam o2) + { + int returns = o1.getDisplayName().compareToIgnoreCase( + o2.getDisplayName()); + + if (returns == 0) + { + return Long.compare(o1.getCreatedTime(), + o2.getCreatedTime()); + } + + return returns; + } + + }); + for (GameTeam team : teamList) { ArrayList teamPlayers = team.GetPlayers(true); - int rowsNeeded = (int) Math.ceil(teamPlayers.size() / 8.0); Collections.sort(teamPlayers, new Comparator() { - @Override public int compare(Player o1, Player o2) { return o1.getName().compareToIgnoreCase(o2.getName()); } - }); + int rowsNeeded = (int) Math.ceil(teamPlayers.size() / 8.0); + + _buttons = Arrays.copyOf(_buttons, _buttons.length + + (rowsNeeded * 9)); + _items = Arrays.copyOf(_items, _items.length + (rowsNeeded * 9)); + for (int row = 0; row < rowsNeeded; row++) { int woolSlot = (row * 9) + (currentRow * 9); - // TODO Need to handle too many players in a better way - if (woolSlot >= getSize()) - continue; - - setItem(woolSlot, getTeamItem(team, teamPlayers.size())); + _items[woolSlot] = getTeamItem(team, teamPlayers.size()); int playerIndex = row * 8; for (int i = 0; i < 8 && playerIndex < teamPlayers.size(); i++, playerIndex++) @@ -121,36 +169,43 @@ public class SpectatorPage extends ShopPageBase Player other = teamPlayers.get(playerIndex); int slot = woolSlot + 1 + i; - // TODO Need to handle too many players in a better way - if (slot >= getSize()) - continue; - addPlayerItem(slot, team, other); } } - // Add a line in between teams if the player count is low enough and there are less than 4 teams + // Add a line in between teams if the player count is low enough and + // there are less than 4 teams if (rowsNeeded == 1 && teamList.size() < 4 && playerCount <= 26) + { currentRow += 2; + } else + { currentRow += rowsNeeded; + } } } private void addPlayerItem(int slot, GameTeam team, Player other) { ItemStack playerItem = getPlayerItem(team, other); - ShopItem shopItem = new ShopItem(playerItem, other.getName(), other.getName(), 1, false, false); - addButton(slot, shopItem, new SpectatorButton(_arcadeManager, getPlayer(), other)); + + ShopItem shopItem = new ShopItem(playerItem, other.getName(), + other.getName(), 1, false, false); + + _items[slot] = shopItem; + _buttons[slot] = new SpectatorButton(_arcadeManager, getPlayer(), other); } private ItemStack getTeamItem(GameTeam team, int playerCount) { - ItemStack item = new ItemStack(Material.WOOL, 1, (short) 0, UtilColor.chatColorToWoolData(team.GetColor())); + ItemStack item = new ItemStack(Material.WOOL, 1, (short) 0, + UtilColor.chatColorToWoolData(team.GetColor())); ItemMeta meta = item.getItemMeta(); meta.setDisplayName(team.GetFormattedName()); - meta.setLore(Arrays.asList(" ", ChatColor.RESET + C.cYellow + "Players Alive: " + C.cWhite + playerCount)); + meta.setLore(Arrays.asList(" ", ChatColor.RESET + C.cYellow + + "Players Alive: " + C.cWhite + playerCount)); item.setItemMeta(meta); return item; @@ -161,13 +216,17 @@ public class SpectatorPage extends ShopPageBase ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3); double distance = UtilMath.offset(getPlayer(), other); - double heightDifference = other.getLocation().getY() - getPlayer().getLocation().getY(); + double heightDifference = other.getLocation().getY() + - getPlayer().getLocation().getY(); ArrayList lore = new ArrayList(); lore.add(" "); - lore.add(ChatColor.RESET + C.cYellow + "Kit: " + C.cWhite + _arcadeManager.GetGame().GetKit(other).GetName()); - lore.add(ChatColor.RESET + C.cYellow + "Distance: " + C.cWhite + UtilMath.trim(1, distance)); - lore.add(ChatColor.RESET + C.cYellow + "Height Difference: " + C.cWhite + UtilMath.trim(1, heightDifference)); + lore.add(ChatColor.RESET + C.cYellow + "Kit: " + C.cWhite + + _arcadeManager.GetGame().GetKit(other).GetName()); + lore.add(ChatColor.RESET + C.cYellow + "Distance: " + C.cWhite + + UtilMath.trim(1, distance)); + lore.add(ChatColor.RESET + C.cYellow + "Height Difference: " + C.cWhite + + UtilMath.trim(1, heightDifference)); lore.add(" "); lore.add(ChatColor.RESET + C.Line + "Click to Spectate"); SkullMeta skullMeta = ((SkullMeta) item.getItemMeta()); @@ -179,4 +238,16 @@ public class SpectatorPage extends ShopPageBase return item; } + @Override + protected IButton[] getButtons() + { + return _buttons; + } + + @Override + protected ItemStack[] getItems() + { + return _items; + } + } \ No newline at end of file From 901dad2f8a46126ee6691cf6d45cb5d793c8c311 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 17 Sep 2015 22:31:18 -0400 Subject: [PATCH 51/66] Add vote3 to bonusmanager --- .../Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 85f878294..1276e2f00 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -156,6 +156,7 @@ public class BonusManager extends MiniClientPlugin implements I _voteList = new ArrayList(); _voteList.add("http://vote1.mineplex.com"); _voteList.add("http://vote2.mineplex.com"); + _voteList.add("http://vote3.mineplex.com"); _coinQueue = new LinkedList(); _gemQueue = new LinkedList(); @@ -185,6 +186,7 @@ public class BonusManager extends MiniClientPlugin implements I _voteList = new ArrayList(); _voteList.add("http://vote1.mineplex.com"); _voteList.add("http://vote2.mineplex.com"); + _voteList.add("http://vote3.mineplex.com"); _canVote = true; _coinQueue = new LinkedList(); From cf618abd4ec47fd984b4212a93b025d68de35696 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 22 Sep 2015 01:38:45 -0400 Subject: [PATCH 52/66] BotSpam Module --- Plugins/.idea/artifacts/Mineplex_Hub_jar.xml | 1 + Plugins/.idea/compiler.xml | 1 + Plugins/Mineplex.Core/Mineplex.Core.iml | 1 + .../src/mineplex/core/TablistFix.java | 3 +- .../mineplex/core/botspam/BotSpamManager.java | 162 ++++++++++++++++++ .../src/mineplex/core/botspam/SpamText.java | 47 +++++ .../botspam/command/BotSpamAddCommand.java | 64 +++++++ .../core/botspam/command/BotSpamCommand.java | 31 ++++ .../command/BotSpamDisableCommand.java | 71 ++++++++ .../botspam/command/BotSpamEnableCommand.java | 71 ++++++++ .../botspam/command/BotSpamListCommand.java | 40 +++++ .../botspam/repository/BotSpamRepository.java | 85 +++++++++ .../src/mineplex/core/punish/Punish.java | 34 ++-- .../Mineplex.Hub/src/mineplex/hub/Hub.java | 2 +- .../src/mineplex/hub/HubManager.java | 5 +- 15 files changed, 602 insertions(+), 16 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/botspam/BotSpamManager.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/botspam/SpamText.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamAddCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamDisableCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamEnableCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/botspam/command/BotSpamListCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/botspam/repository/BotSpamRepository.java diff --git a/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml b/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml index 150c21bc3..370ba8bd7 100644 --- a/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml +++ b/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml @@ -20,6 +20,7 @@ + \ No newline at end of file diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml index bd35e0f52..37717d4dc 100644 --- a/Plugins/.idea/compiler.xml +++ b/Plugins/.idea/compiler.xml @@ -4,6 +4,7 @@