From 03731de7f831d0a2277605b5d24ae50ac0c6bc09 Mon Sep 17 00:00:00 2001 From: Chiss Date: Thu, 7 Nov 2013 10:18:36 +1100 Subject: [PATCH] Rank changes MAC no longer kicks lag/fly some H&S stuff :O --- .../src/mineplex/core/common/Rank.java | 24 +- .../src/mineplex/core/antihack/AntiHack.java | 9 +- .../mineplex/core/antihack/types/Idle.java | 7 +- .../core/disguise/DisguiseManager.java | 11 +- .../disguise/disguises/DisguiseBlock.java | 10 + .../mineplex/core/message/MessageManager.java | 10 + .../Mineplex.Hub/src/mineplex/hub/Hub.java | 4 +- .../src/mineplex/hub/HubManager.java | 6 +- .../src/mineplex/hub/party/Party.java | 2 +- .../src/nautilus/game/arcade/Arcade.java | 9 +- .../nautilus/game/arcade/ArcadeManager.java | 8 +- .../castlesiege/kits/KitHumanMarksman.java | 2 +- .../arcade/game/games/hideseek/HideSeek.java | 247 +++++++++++++++++- .../games/hideseek/kits/KitHiderAcrobat.java | 4 +- .../games/hideseek/kits/KitHiderShocker.java | 4 +- .../games/hideseek/kits/KitHiderSwapper.java | 4 +- .../games/hideseek/kits/KitSeekerArcher.java | 6 +- .../game/arcade/managers/GameChatManager.java | 6 +- .../arcade/managers/GameLobbyManager.java | 9 +- 19 files changed, 327 insertions(+), 55 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 eb6e85ad6..20b264c98 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -8,18 +8,18 @@ import org.bukkit.entity.Player; public enum Rank { - OWNER("Owner", ChatColor.DARK_RED), + OWNER("OP", ChatColor.DARK_RED), DEVELOPER("Dev", ChatColor.RED), ADMIN("Admin", ChatColor.RED), MODERATOR("Mod", ChatColor.GOLD), - HELPER("Helper", ChatColor.YELLOW), - MAPDEV("Mapper", ChatColor.GOLD), - YOUTUBE("YT", ChatColor.LIGHT_PURPLE), - HERO("Hero", ChatColor.LIGHT_PURPLE), + HELPER("Helper", ChatColor.GREEN), + MAPDEV("Mapper", ChatColor.BLUE), + YOUTUBE("Legend", ChatColor.LIGHT_PURPLE), + HERO("Hero", ChatColor.DARK_PURPLE), ULTRA("Ultra", ChatColor.AQUA), - ALL("All", ChatColor.GREEN); + ALL("All", ChatColor.YELLOW); - public ChatColor Color; + private ChatColor Color; public String Name; Rank(String name, ChatColor color) @@ -48,4 +48,14 @@ public enum Rank return false; } + + public String GetTag(boolean bold, boolean uppercase) + { + String name = Name; + if (uppercase) + name = Name.toUpperCase(); + + if (bold) return Color + C.Bold + name; + else return Color + name; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 97b246499..6cbad5bd0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.portal.Portal; import mineplex.core.punish.Category; import mineplex.core.punish.Punish; import mineplex.core.updater.UpdateType; @@ -33,6 +34,7 @@ public class AntiHack extends MiniPlugin public static AntiHack Instance; public Punish Punish; + public Portal Portal; //Record Offenses private HashMap>> _suspicion = new HashMap>>(); @@ -59,11 +61,12 @@ public class AntiHack extends MiniPlugin public ArrayList _detectors; - protected AntiHack(JavaPlugin plugin, Punish punish) + protected AntiHack(JavaPlugin plugin, Punish punish, Portal portal) { super("AntiHack", plugin); Punish = punish; + Portal = portal; //_repository = new AntiHackRepository(this, plugin.getConfig().getString("serverstatus.name")); //_repository.initialize(); @@ -75,9 +78,9 @@ public class AntiHack extends MiniPlugin _detectors.add(new Speed(this)); } - public static void Initialize(JavaPlugin plugin, Punish punish) + public static void Initialize(JavaPlugin plugin, Punish punish, Portal portal) { - Instance = new AntiHack(plugin, punish); + Instance = new AntiHack(plugin, punish, portal); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Idle.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Idle.java index aae7b5e7e..7f6489946 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Idle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Idle.java @@ -6,6 +6,7 @@ import mineplex.core.MiniPlugin; import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.Detector; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; @@ -55,7 +56,11 @@ public class Idle extends MiniPlugin implements Detector continue; //Host.addSuspicion(player, "Lag / Fly (Idle)"); - player.kickPlayer(C.cGold + "Mineplex " + C.cRed + "Anti-Cheat " + C.cWhite + "Kicked for Lag / Fly (Idle)"); + //player.kickPlayer(C.cGold + "Mineplex " + C.cRed + "Anti-Cheat " + C.cWhite + "Kicked for Lag / Fly (Idle)"); + + UtilPlayer.message(player, C.cRed + C.Bold + "Mineplex Anti-Cheat detected Lagging / Fly (Idle)"); + UtilPlayer.message(player, C.cRed + C.Bold + "You have been returned to Lobby."); + Host.Portal.SendPlayerToServer(player, "Lobby"); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index c197d321c..707bd8c2c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -106,6 +106,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable public void disguise(DisguiseBase disguise) { + if (!disguise.GetEntity().isAlive()) + return; + _spawnPacketMap.put(disguise.GetEntityId(), disguise); reApplyDisguise(disguise); @@ -377,7 +380,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable _movePacketMap.put(movePacket.a, velocityPacket); - packetList.forceAdd(velocityPacket); + //XXX packetList.forceAdd(velocityPacket); if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c > 20) { @@ -385,7 +388,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable { public void run() { - packetList.forceAdd(velocityPacket); + //XXX packetList.forceAdd(velocityPacket); } }); } @@ -424,7 +427,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable _movePacketMap.put(movePacket.a, velocityPacket); - packetList.forceAdd(velocityPacket); + //XXX packetList.forceAdd(velocityPacket); if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c > 20) { @@ -432,7 +435,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable { public void run() { - packetList.forceAdd(velocityPacket); + //XXX packetList.forceAdd(velocityPacket); } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java index 6316038a4..f8c6fb266 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java @@ -20,6 +20,16 @@ public class DisguiseBlock extends DisguiseBase _blockId = blockId; _blockData = blockData; } + + public int GetBlockId() + { + return _blockId; + } + + public byte GetBlockData() + { + return (byte)_blockData; + } @Override public Packet GetSpawnPacket() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index 39a5380bb..7e4a46346 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -135,6 +135,16 @@ public class MessageManager extends MiniClientPlugin UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly."); } + //Youtuber + if (_clientManager.Get(to).GetRank() == Rank.YOUTUBE) + { + if (!_clientManager.Get(from).GetRank().Has(from, Rank.MODERATOR, true)) + { + UtilPlayer.message(from, C.cPurple + "YouTubers cannot be private messaged."); + return; + } + } + //Log //Logger().logChat("Private Message", from, to.getName(), message); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index f78aca672..173998596 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -69,7 +69,8 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); Punish punish = new Punish(this, GetWebServerAddress()); - AntiHack.Initialize(this, punish); + Portal portal = new Portal(this); + AntiHack.Initialize(this, punish, portal); DonationManager donationManager = new DonationManager(this, GetWebServerAddress()); @@ -82,7 +83,6 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation //Main Modules PacketHandler packetHandler = new PacketHandler(this); - Portal portal = new Portal(this); PartyManager partyManager = new PartyManager(this, clientManager); HubManager hubManager = new HubManager(this, new BlockRestore(this), clientManager, donationManager, new ConditionManager(this), new DisguiseManager(this, packetHandler), new TaskManager(this, GetWebServerAddress()), portal, partyManager); new ServerManager(this, clientManager, donationManager, portal, partyManager, new ServerStatusManager(this, new LagMeter(this, clientManager)), hubManager, new StackerManager(hubManager)); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 209f15c89..26debd92f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -216,7 +216,7 @@ public class HubManager extends MiniClientPlugin for (Rank rank : Rank.values()) { if (rank != Rank.ALL) - board.registerNewTeam(rank.Name).setPrefix(rank.Color + C.Bold + rank.Name + ChatColor.RESET + " "); + board.registerNewTeam(rank.Name).setPrefix(rank.GetTag(true, false) + ChatColor.RESET + " "); else board.registerNewTeam(rank.Name).setPrefix(""); } @@ -290,10 +290,10 @@ public class HubManager extends MiniClientPlugin //Rank Prefix String rankStr = ""; if (rank != Rank.ALL) - rankStr = rank.Color + C.Bold + rank.Name.toUpperCase() + " "; + rankStr = rank.GetTag(true, true) + " "; if (ownsUltra && !rank.Has(Rank.ULTRA)) - rankStr = Rank.ULTRA.Color + C.Bold + Rank.ULTRA.Name.toUpperCase() + " "; + rankStr = Rank.ULTRA.GetTag(true, true) + " "; //Party Chat if (event.getMessage().charAt(0) == '@') diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/party/Party.java b/Plugins/Mineplex.Hub/src/mineplex/hub/party/Party.java index 7949e4b24..c3f199768 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/party/Party.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/party/Party.java @@ -49,7 +49,7 @@ public class Party for (Rank rank : Rank.values()) { if (rank != Rank.ALL) - _scoreboard.registerNewTeam(rank.Name).setPrefix(rank.Color + C.Bold + rank.Name + ChatColor.RESET + " "); + _scoreboard.registerNewTeam(rank.Name).setPrefix(rank.GetTag(true, false) + ChatColor.RESET + " "); else _scoreboard.registerNewTeam(rank.Name).setPrefix(""); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index d01d9e344..cf409dbf9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -14,7 +14,6 @@ import mineplex.core.antihack.AntiHack; import mineplex.core.antistack.AntiStack; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.command.CommandCenter; -import mineplex.core.common.Rank; import mineplex.core.common.util.FileUtil; import mineplex.core.common.util.UtilServer; import mineplex.core.creature.Creature; @@ -124,16 +123,16 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin _damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, GetCreature()), disguiseManager); + Portal portal = new Portal(this); + //Arcade Manager - _gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, disguiseManager, GetCreature(), GetBlood(), antistack, packetHandler, GetWebServerAddress()); + _gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, disguiseManager, GetCreature(), GetBlood(), antistack, portal, packetHandler, GetWebServerAddress()); //Unreferenced Modules - //new AntiStack(); Scheduler.Initialize(this); - //new Information(this); Punish punish = new Punish(this, GetWebServerAddress()); - AntiHack.Initialize(this, punish); + AntiHack.Initialize(this, punish, portal); new MemoryFix(this); 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 981b30158..e7b8c4f1b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -28,11 +28,9 @@ import org.bukkit.event.server.ServerListPingEvent; import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Class.IPvpClass; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; -import mineplex.minecraft.game.classcombat.itempack.ItemPackFactory; import mineplex.minecraft.game.classcombat.shop.ClassCombatCustomBuildShop; import mineplex.minecraft.game.classcombat.shop.ClassShopManager; import mineplex.minecraft.game.core.IRelation; -import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.DamageManager; @@ -49,9 +47,7 @@ import mineplex.core.common.util.*; import mineplex.core.creature.Creature; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; -import mineplex.core.movement.Movement; import mineplex.core.packethandler.PacketHandler; -import mineplex.core.energy.Energy; import mineplex.core.explosion.Explosion; import mineplex.core.portal.Portal; import mineplex.core.projectile.ProjectileManager; @@ -96,7 +92,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation //Games private Game _game; - public ArcadeManager(Arcade plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Blood blood, AntiStack antistack, PacketHandler packetHandler, String webAddress) + public ArcadeManager(Arcade plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Blood blood, AntiStack antistack, Portal portal, PacketHandler packetHandler, String webAddress) { super("Game Manager", plugin); @@ -140,7 +136,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _classCustomBuildShop = new ClassCombatCustomBuildShop(_classShopManager, clientManager, donationManager, webAddress); */ - _portal = new Portal(plugin); + _portal = portal; //Shop _arcadeShop = new ArcadeShop(this, clientManager, donationManager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java index ec22934d3..ed54acaf9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanMarksman.java @@ -25,7 +25,7 @@ public class KitHumanMarksman extends Kit new String[] { "Skilled human marksman, can fletch arrows." - }, + }, new Perk[] { new PerkBarrage(5, 250, true, false), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index 5b14712ed..3a5dd2cbc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -1,18 +1,35 @@ package nautilus.game.arcade.game.games.hideseek; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.MapUtil; 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.DisguiseBlock; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -20,6 +37,7 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.hideseek.kits.*; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.NullKit; public class HideSeek extends TeamGame { @@ -27,6 +45,12 @@ public class HideSeek extends TeamGame private GameTeam _seekers; private long _gameTime = 300000; + + private HashMap _disguises = new HashMap(); + private HashMap _disguiseBlock = new HashMap(); + private HashMap _disguiseMovement = new HashMap(); + + private ArrayList _allowedBlocks; public HideSeek(ArcadeManager manager) { @@ -37,7 +61,10 @@ public class HideSeek extends TeamGame new KitHiderAcrobat(manager), new KitHiderSwapper(manager), new KitHiderShocker(manager), + new NullKit(manager), new KitSeekerRadar(manager), + new KitSeekerArcher(manager), + new KitSeekerTNT(manager), }, new String[] @@ -48,8 +75,30 @@ public class HideSeek extends TeamGame }); this.DeathOut = false; + + _allowedBlocks = new ArrayList(); + _allowedBlocks.add(Material.TNT); + _allowedBlocks.add(Material.BOOKSHELF); + _allowedBlocks.add(Material.CHEST); + _allowedBlocks.add(Material.WORKBENCH); + _allowedBlocks.add(Material.FURNACE); + _allowedBlocks.add(Material.MELON_BLOCK); + _allowedBlocks.add(Material.CAULDRON); + _allowedBlocks.add(Material.BEACON); + _allowedBlocks.add(Material.FLOWER_POT); + _allowedBlocks.add(Material.ANVIL); + _allowedBlocks.add(Material.HAY_BLOCK); + _allowedBlocks.add(Material.CAKE); } - + + public Material GetItemEquivilent(Material mat) + { + if (mat == Material.CAULDRON) return Material.CAULDRON_ITEM; + if (mat == Material.FLOWER_POT) return Material.FLOWER_POT_ITEM; + + return mat; + } + @EventHandler public void CustomTeamGeneration(GameStateChangeEvent event) { @@ -63,6 +112,31 @@ public class HideSeek extends TeamGame _seekers = GetTeamList().get(1); _seekers.SetColor(ChatColor.RED); _seekers.SetName("Seekers"); + + RestrictKits(); + } + + + + @Override + public void RestrictKits() + { + for (Kit kit : GetKits()) + { + for (GameTeam team : GetTeamList()) + { + if (team.GetColor() == ChatColor.RED) + { + if (kit.GetName().contains("Hider")) + team.GetRestrictedKits().add(kit); + } + else + { + if (kit.GetName().contains("Seeker")) + team.GetRestrictedKits().add(kit); + } + } + } } /* @@ -72,7 +146,166 @@ public class HideSeek extends TeamGame return _hiders; } */ + + @EventHandler + public void InitialDisguise(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + for (Player player : _hiders.GetPlayers(true)) + SetDisguiseBlock(player, _allowedBlocks.get(UtilMath.r(_allowedBlocks.size()))); + } + + public void SetDisguiseBlock(Player player, Material type) + { + DisguiseBlock disguise = new DisguiseBlock(player, type.getId(), 0); + _disguises.put(player, disguise); + Manager.GetDisguise().disguise(disguise); + + //Inform + UtilPlayer.message(player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(type, (byte)0, false) + " Block") + "!")); + + //Give Item + player.getInventory().setItem(8, new ItemStack(GetItemEquivilent(type))); + } + + @EventHandler + public void SolidifyUpdate(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : _hiders.GetPlayers(true)) + { + DisguiseBase disguise = _disguises.get(player); + if (disguise == null || !(disguise instanceof DisguiseBlock)) + continue; + + DisguiseBlock blockDisguise = (DisguiseBlock)disguise; + + if (!_disguiseMovement.containsKey(player)) + _disguiseMovement.put(player, player.getLocation()); + + //Not a Block + if (!_disguiseBlock.containsKey(player)) + { + //Moved + if (!_disguiseMovement.get(player).getBlock().equals(player.getLocation().getBlock())) + { + player.setExp(0); + _disguiseMovement.put(player, player.getLocation()); + } + //Unmoved + else + { + player.setExp((float) Math.min(0.999f, player.getExp() + 0.025)); + + //Set Block + if (player.getExp() >= 0.999f) + { + Block block = player.getLocation().getBlock(); + + //Not Able + if (block.getType() != Material.AIR) + { + UtilPlayer.message(player, F.main("Game", "You cannot become a Solid Block here.")); + player.setExp(0f); + continue; + } + + //Set Block + _disguiseBlock.put(player, block); + + //Effect + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, blockDisguise.GetBlockId()); + + //Display + SolidifyVisual(player); + + //Invisible + Manager.GetCondition().Factory().Cloak("Disguised as Block", player, player, 60000, false, false); + + //Sound + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f); + } + } + } + //Is a Block + else + { + //Moved + if (!_disguiseBlock.get(player).equals(player.getLocation().getBlock())) + { + SolidifyRemove(player); + } + //Send Packets + else + { + SolidifyVisual(player); + } + } + } + } + + public void SolidifyRemove(Player player) + { + Block block = _disguiseBlock.remove(player); + + if (block == null) + return; + + MapUtil.QuickChangeBlockAt(block.getLocation(), 0, (byte)0); + + player.setExp(0f); + + Manager.GetCondition().EndCondition(player, null, "Disguised as Block"); + + //Inform + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f); + } + + public void SolidifyVisual(Player player) + { + if (!_disguises.containsKey(player) || !(_disguises.get(player) instanceof DisguiseBlock)) + { + SolidifyRemove(player); + return; + } + + DisguiseBlock block = (DisguiseBlock)_disguises.get(player); + + //Others + for (Player other : UtilServer.getPlayers()) + other.sendBlockChange(player.getLocation(), block.GetBlockId(), block.GetBlockData()); + + //Self + player.sendBlockChange(player.getLocation(), 36, (byte)0); + } + @EventHandler + public void BlockDamage(BlockDamageEvent event) + { + for (Player player : UtilServer.getPlayers()) + { + if (!_disguiseBlock.containsKey(player)) + continue; + + if (!_disguiseBlock.get(player).equals(event.getBlock())) + continue; + + //Damage Event + Manager.GetDamage().NewDamageEvent(player, event.getPlayer(), null, + DamageCause.CUSTOM, 5, true, true, false, + event.getPlayer().getName(), "Block Form Attack"); + + SolidifyRemove(player); + } + } + @EventHandler public void UpdateSeekers(UpdateEvent event) { @@ -101,13 +334,12 @@ public class HideSeek extends TeamGame public void SetSeeker(Player player, boolean forced) { SetPlayerTeam(player, _seekers); + + Manager.GetDisguise().undisguise(player); //Kit - Kit newKit = GetKits()[5]; //Normal - if (forced) newKit = GetKits()[4]; //Alpha - - SetKit(player, newKit, false); - newKit.ApplyKit(player); + SetKit(player, GetKits()[4], false); + GetKits()[4].ApplyKit(player); //Refresh for (Player other : UtilServer.getPlayers()) @@ -176,8 +408,7 @@ public class HideSeek extends TeamGame GetObjectiveSide().setDisplayName( ChatColor.WHITE + "§lTime: " + C.cGreen + "§l" + UtilTime.MakeStr(0)); - - //XXX End + SetState(GameState.End); AnnounceEnd(_hiders); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderAcrobat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderAcrobat.java index d40bec514..dbff7f03d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderAcrobat.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderAcrobat.java @@ -8,9 +8,11 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseBlock; import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -39,7 +41,7 @@ public class KitHiderAcrobat extends Kit @Override public void GiveItems(Player player) { - + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SLIME_BALL, (byte)0, 1,C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Change Form")); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java index eea7f0d73..7514f0378 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java @@ -8,9 +8,11 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseBlock; import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -38,7 +40,7 @@ public class KitHiderShocker extends Kit @Override public void GiveItems(Player player) { - + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SLIME_BALL, (byte)0, 1,C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Change Form")); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java index c545358ea..9351e28b2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderSwapper.java @@ -8,9 +8,11 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Slime; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseBlock; import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -39,7 +41,7 @@ public class KitHiderSwapper extends Kit @Override public void GiveItems(Player player) { - + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SLIME_BALL, (byte)0, 1,C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Change Form")); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerArcher.java index 1f5357393..81c9adb9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerArcher.java @@ -1,5 +1,5 @@ package nautilus.game.arcade.game.games.hideseek.kits; - + import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -21,10 +21,10 @@ public class KitSeekerArcher extends Kit { public KitSeekerArcher(ArcadeManager manager) { - super(manager, "Castle Marksman", KitAvailability.Green, + super(manager, "Archer Seeker", KitAvailability.Green, new String[] { - "Skilled human marksman, can fletch arrows." + "PEW" }, new Perk[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java index 8735b2b23..048005d4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java @@ -26,7 +26,7 @@ public class GameChatManager implements Listener Manager = manager; Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); - } + } @EventHandler public void MeCancel(PlayerCommandPreprocessEvent event) @@ -62,10 +62,10 @@ public class GameChatManager implements Listener //Rank Prefix String rankStr = ""; if (rank != Rank.ALL) - rankStr = rank.Color + C.Bold + rank.Name.toUpperCase() + " "; + rankStr = rank.GetTag(true, true) + " "; if (ownsUltra && !rank.Has(Rank.ULTRA)) - rankStr = Rank.ULTRA.Color + C.Bold + Rank.ULTRA.Name.toUpperCase() + " "; + rankStr = Rank.ULTRA.GetTag(true, true) + " "; if (Manager.GetGame() != null && Manager.GetGame().GetType() == GameType.UHC) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index cf2681f9a..1863ece2d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -76,9 +76,8 @@ public class GameLobbyManager implements IPacketRunnable, Listener private Location _kitText; private Location _teamText; - private Location _kitDisplay; - private Location _teamDisplay; + private Location _teamDisplay; private Location spawn; @@ -92,7 +91,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener private Color _fireworkColor; private int _advertiseStage = 0; - + //Scoreboard private NautHashMap _scoreboardMap = new NautHashMap(); private NautHashMap _gemMap = new NautHashMap(); @@ -167,7 +166,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener } else { - scoreboard.registerNewTeam(rank.Name).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.WHITE); + scoreboard.registerNewTeam(rank.Name).setPrefix(rank.GetTag(true, true) + ChatColor.RESET + " " + ChatColor.WHITE); } if (Manager.GetGame() != null && !Manager.GetGame().GetTeamList().isEmpty()) @@ -180,7 +179,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener } else { - scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor()); + scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.GetTag(true, true) + ChatColor.RESET + " " + team.GetColor()); } } }